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 TaxiTelphoni
{
    public partial class frmRepDaramadAja : Form
    {
        public frmRepDaramadAja()
        {
            InitializeComponent();
        }
        private void UDF_ShowDaramadByDate()
        {
            LSC_TaxiTelfoniDataContext db = new LSC_TaxiTelfoniDataContext();

            var Query1 = from Row in db.xtblDaramadAjanses
                         where Row.TasviehBit == true
                         select new
                        {
                            Row.ServDate1,
                            Row.DarsadeAjanse
                        };
            try
            {
                Int64 int_StartDate = Convert.ToInt64(MTxt_StartDate.Text.Trim().Replace("/", ""));
                Int64 int_EndDate = Convert.ToInt64(MTxt_EndDate.Text.Trim().Replace("/", ""));
                var Query2 = from Row in Query1
                             where ((Convert.ToInt64(Row.ServDate1.Trim().Replace("/", "")) >= int_StartDate) && (Convert.ToInt64(Row.ServDate1.Trim().Replace("/", "")) <= int_EndDate))
                             select new
                             {

                                 Row.ServDate1,
                                 Row.DarsadeAjanse

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

                xtblDaramadAjanseBindingSource.DataSource = Query2;
                reportViewer1.RefreshReport();
            }
            catch
            {
                MessageBox.Show("تاریخ ها را وارد کنید");
            }
        }
        private void Btn_Show_Click(object sender, EventArgs e)
        {
            UDF_ShowDaramadByDate();
        }
    }
}
