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

        private void UDF_Cmb_ShowFactorID()
        {
            LSC_NanoProjDataContext db = new LSC_NanoProjDataContext();
            var Query = from Row in db.xtblCmbForooshes
                        select new
                        {
                            Row.FactoreForooshID,
                            Row.info

                        };

            Cmb_FactorID.ValueMember = "FactoreForooshID";
            Cmb_FactorID.DisplayMember = "info";
            Cmb_FactorID.DataSource = Query;

        }

        private void frmRepFactorForoosh_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_FactoreForooshes
                        where Row.FactoreForooshID == int.Parse(Cmb_FactorID.SelectedValue.ToString())
                        select new
                        {
                            Row.FactoreForooshID,
                            Row.DtOfSodoor,
                            Row.Expr1,
                            Row.Title,
                            Row.Quantity1,
                            Row.salePrice,
                            Row.TotalPRICE,
                            Row.BefitLoss
                        };

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

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