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 frmReportBimar : Form
    {
        public frmReportBimar()
        {
            InitializeComponent();
        }
        private void UDF_CmbFill()
        {
            LSC_RadioLogyDataContext db = new LSC_RadioLogyDataContext();
            var Query = from Row in db.xtblBimarInfos 
                        select new
                        {
                            Row.BimarID,
                            Row.Expr1 
                           
                        };
            Cmb_InfoBimar.DisplayMember = "Expr1";
            Cmb_InfoBimar.ValueMember = "BimarID";
            Cmb_InfoBimar.DataSource = Query;
        }

        private void frmReportBimar_Load(object sender, EventArgs e)
        {
            LSC_RadioLogyDataContext db = new LSC_RadioLogyDataContext();
            var Query = from Row in db.tblBimars
                        orderby Row.BimarID descending
                        select new
                        {
                            Row.BimarID,
                            Row.BimarName,
                            Row.BimarFamily,
                            Row.DateOzviatSH,
                            Row.BimarTell,
                            Row.BimarMobail,
                            Row.BimarAddress,
                            Row.BimarIsActive
                        };
            
            tblBimarBindingSource.DataSource = Query;

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

            this.reportViewer1.RefreshReport();
            UDF_CmbFill();


        }

        private void button1_Click(object sender, EventArgs e)
        {
            Decimal Dec_BimarID = Decimal.Parse(Cmb_InfoBimar.SelectedValue.ToString());
            LSC_RadioLogyDataContext db = new LSC_RadioLogyDataContext();
            var Query = from Row in db.tblBimars
                        orderby Row.BimarID descending
                        where Row.BimarID == Dec_BimarID
                        select new
                        {
                            Row.BimarID,
                            Row.BimarName,
                            Row.BimarFamily,
                            Row.DateOzviatSH,
                            Row.BimarTell,
                            Row.BimarMobail,
                            Row.BimarAddress,
                            Row.BimarIsActive
                        };

            tblBimarBindingSource.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_ShowAll_Click(object sender, EventArgs e)
        {
            LSC_RadioLogyDataContext db = new LSC_RadioLogyDataContext();
            var Query = from Row in db.tblBimars
                        orderby Row.BimarID descending
                        select new
                        {
                            Row.BimarID,
                            Row.BimarName,
                            Row.BimarFamily,
                            Row.DateOzviatSH,
                            Row.BimarTell,
                            Row.BimarMobail,
                            Row.BimarAddress,
                            Row.BimarIsActive
                        };

            tblBimarBindingSource.DataSource = Query;

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

            this.reportViewer1.RefreshReport();
        }
    }
}
