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 frmReportPaziresh : Form
    {
        public frmReportPaziresh()
        {
            InitializeComponent();
        }

        private void frmReportPaziresh_Load(object sender, EventArgs e)
        {
            LSC_RadioLogyDataContext db = new LSC_RadioLogyDataContext();
            var Query = from Row in db.xtblPazireshReports
                        orderby Row.PazireshID descending
                        select new
                        {
                            Row.PazireshID,
                            Row.Expr1,
                            Row.PazireshDateSh,
                            Row.BimaryDescription ,
                            Row.BimehDescription,
                            Row.ServiceTypeDescription ,
                            Row.HaggeVisit 
                        };
            xtblPazireshReportBindingSource.DataSource = Query;

            reportViewer1.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout);
            reportViewer1.ZoomMode = Microsoft.Reporting.WinForms.ZoomMode.Percent;
            reportViewer1.ZoomPercent = 25;

            this.reportViewer1.RefreshReport();
            
        }

        private void Btn_ShowDate_Click(object sender, EventArgs e)
        {
             
           

            int int_StartDate = int.Parse(Msk_Txt_StartDate.Text.Replace("/", ""));
            int int_EndDate = int.Parse(Msk_Txt_EndDate.Text.Replace("/" ,""));
           
            LSC_RadioLogyDataContext db = new LSC_RadioLogyDataContext();

            var Query1 = from Row in db.xtblPazireshReports
                        orderby Row.PazireshID descending
                        select new
                        {
                            Row.PazireshID,
                            Row.Expr1,
                            Row.PazireshDateSh,
                            Row.BimaryDescription,
                            Row.BimehDescription,
                            Row.ServiceTypeDescription,
                            Row.HaggeVisit
                        };
           

            var Query = from Row1 in Query1.AsEnumerable()
                        orderby Row1.PazireshID descending
                        where ((int.Parse(Row1.PazireshDateSh.Replace("/", "")) >= int_StartDate) && (int.Parse(Row1.PazireshDateSh.Replace("/", "")) <= int_EndDate))
                        select new
                        {
                            Row1.PazireshID,
                            Row1.Expr1,
                            Row1.PazireshDateSh,
                            Row1.BimaryDescription,
                            Row1.BimehDescription,
                            Row1.ServiceTypeDescription,
                            Row1.HaggeVisit
                            
                        };
            

            xtblPazireshReportBindingSource.DataSource = Query;

            reportViewer1.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout);
            reportViewer1.ZoomMode = Microsoft.Reporting.WinForms.ZoomMode.Percent;
            reportViewer1.ZoomPercent = 25;

            this.reportViewer1.RefreshReport();
            
        }

        private void button1_Click(object sender, EventArgs e)
        {
            LSC_RadioLogyDataContext db = new LSC_RadioLogyDataContext();
            var Query = from Row in db.xtblPazireshReports
                        orderby Row.PazireshID descending
                        select new
                        {
                            Row.PazireshID,
                            Row.Expr1,
                            Row.PazireshDateSh,
                            Row.BimaryDescription,
                            Row.BimehDescription,
                            Row.ServiceTypeDescription,
                            Row.HaggeVisit
                        };
            xtblPazireshReportBindingSource.DataSource = Query;

            reportViewer1.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout);
            reportViewer1.ZoomMode = Microsoft.Reporting.WinForms.ZoomMode.Percent;
            reportViewer1.ZoomPercent = 25;

            this.reportViewer1.RefreshReport();
            
        }
    }
}
