using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace RadioLogy
{
    public partial class frmReportPicture : Form
    {
        public frmReportPicture()
        {
            InitializeComponent();
        }

        private void UDF_CmbFill()
        {
            LSC_RadioLogyDataContext db = new LSC_RadioLogyDataContext();
            var Query = from Row in db.xtblPictureRadioLogies
                        orderby Row.RadPicID descending
                        select new
                        {
                            Row.RadPicID ,
                            Row.Information 
                        };
            Cmb_Info.DisplayMember = "Information";
            Cmb_Info.ValueMember = "RadPicID";
            Cmb_Info.DataSource = Query;
        }

        private void frmReportPicture_Load(object sender, EventArgs e)
        {
            LSC_RadioLogyDataContext db = new LSC_RadioLogyDataContext();
            var Query = from Row in db.xtblPictureRadioLogies 
                        orderby Row.RadPicID descending
                        select new
                        {
                            Row.RadPicID ,
                            Row.Information ,
                            Row.DateOfActPicSH ,
                            Row.RadPicDescription ,
                            Row.RadiologOperator 
                        };
            xtblPictureRadioLogyBindingSource.DataSource = Query;
            this.reportViewer1.RefreshReport();
            reportViewer1.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout );
            reportViewer1.ZoomMode = Microsoft.Reporting.WinForms.ZoomMode.Percent;
            reportViewer1.ZoomPercent = 25;
            UDF_CmbFill();
        }

        private void Btn_ShowInfo_Click(object sender, EventArgs e)
        {
            Decimal Dec_RadPic = Decimal.Parse(Cmb_Info.SelectedValue.ToString());
            LSC_RadioLogyDataContext db = new LSC_RadioLogyDataContext();
            var Query = from Row in db.xtblPictureRadioLogies
                        orderby Row.RadPicID descending
                        where Row.RadPicID == Dec_RadPic 
                        select new
                        {
                            Row.RadPicID,
                            Row.Information,
                            Row.DateOfActPicSH,
                            Row.RadPicDescription,
                            Row.RadiologOperator
                        };
            xtblPictureRadioLogyBindingSource.DataSource = Query;
            this.reportViewer1.RefreshReport();
            reportViewer1.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout);
            reportViewer1.ZoomMode = Microsoft.Reporting.WinForms.ZoomMode.Percent;
            reportViewer1.ZoomPercent = 25;
            UDF_CmbFill();
        }

        private void Btn_ShoeAll_Click(object sender, EventArgs e)
        {
            LSC_RadioLogyDataContext db = new LSC_RadioLogyDataContext();
            var Query = from Row in db.xtblPictureRadioLogies
                        orderby Row.RadPicID descending
                        select new
                        {
                            Row.RadPicID,
                            Row.Information,
                            Row.DateOfActPicSH,
                            Row.RadPicDescription,
                            Row.RadiologOperator
                        };
            xtblPictureRadioLogyBindingSource.DataSource = Query;
            this.reportViewer1.RefreshReport();
            reportViewer1.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout);
            reportViewer1.ZoomMode = Microsoft.Reporting.WinForms.ZoomMode.Percent;
            reportViewer1.ZoomPercent = 25;
            UDF_CmbFill();
        }
    }
}
