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 Nano_System
{
    public partial class frmRepFactorKharid : Form
    {
        public frmRepFactorKharid()
        {
            InitializeComponent();
        }

        private void UDF_Cmb_ShowFactorID()
        {
            LSC_NanoProjDataContext db = new LSC_NanoProjDataContext();
            var Query = from Row in db.xtblCmbKharids
                        select new
                        {
                            Row.FactoreKaridID,
                            Row.Expr2

                        };

            Cmb_FactorID.ValueMember = "FactoreKaridID";
            Cmb_FactorID.DisplayMember = "Expr2";
            Cmb_FactorID.DataSource = Query;
        
        }

        private void frmRepFactorKharid_Load(object sender, EventArgs e)
        {
            UDF_Cmb_ShowFactorID();
        }

        private void Btn_Show_Click(object sender, EventArgs e)
        {
            LSC_NanoProjDataContext db = new LSC_NanoProjDataContext();
            var Query = from Row in db.W_FactoreKharids
                        where Row.FactoreKaridID == int.Parse(Cmb_FactorID.SelectedValue.ToString())
                        select new
                        {
                            Row.FactoreKaridID,
                            Row.DtOfSodoor,
                            Row.Expr1,
                            Row.Title,
                            Row.Quantity1,
                            Row.PurchPrice,
                            Row.TotalPRICE
                        };

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

            W_FactoreKharidBindingSource.DataSource = Query;
            reportViewer1.RefreshReport();
        }
    }
}
