private void frmSelReceipeDefinitions_Load(object sender, EventArgs e) { formloaded = false; parms = new DyeQueryParameters(); using (var context = new TTI2Entities()) { var ExistingGreige = context.TLADM_Griege.OrderBy(x => x.TLGreige_Description).ToList(); foreach (var record in ExistingGreige) { cmboQualities.Items.Add(new DyeHouse.CheckComboBoxItem(record.TLGreige_Id, record.TLGreige_Description, false)); } var ExistDefinitions = context.TLDYE_RecipeDefinition.ToList(); foreach (var record in ExistDefinitions) { cmboReceipeDefintions.Items.Add(new DyeHouse.CheckComboBoxItem(record.TLDYE_DefinePk, record.TLDYE_DefineDescription, false)); } var ExistWeight = context.TLADM_Colours.OrderBy(x => x.Col_Display).ToList(); foreach (var Record in ExistWeight) { cmboColours.Items.Add(new DyeHouse.CheckComboBoxItem(Record.Col_Id, Record.Col_Display, false)); } //-------------------------------------------------------- // wire up the check state changed event //-------------------------------------------------------------------------------------------------------- this.cmboColours.CheckStateChanged += new System.EventHandler(this.cmboColours_CheckStateChanged); this.cmboQualities.CheckStateChanged += new System.EventHandler(this.cmboQualities_CheckStateChanged); this.cmboReceipeDefintions.CheckStateChanged += new System.EventHandler(this.cmboReceipeDefintions_CheckStateChanged); } formloaded = true; }
private void frmViewDyeOrder_Load(object sender, EventArgs e) { FormLoaded = false; DyeParameters = new DyeQueryParameters(); using (var context = new TTI2Entities()) { var Customers = context.TLADM_CustomerFile.OrderBy(x => x.Cust_Description).ToList(); foreach (var Customer in Customers) { comboCustomers.Items.Add(new DyeHouse.CheckComboBoxItem(Customer.Cust_Pk, Customer.Cust_Description, false)); } var Qualitys = context.TLADM_Griege.OrderBy(x => x.TLGreige_Description).ToList(); foreach (var Quality in Qualitys) { comboQuality.Items.Add(new DyeHouse.CheckComboBoxItem(Quality.TLGreige_Id, Quality.TLGreige_Description, false)); } var Colours = context.TLADM_Colours.OrderBy(x => x.Col_Display).ToList(); foreach (var Colour in Colours) { comboColour.Items.Add(new DyeHouse.CheckComboBoxItem(Colour.Col_Id, Colour.Col_Display, false)); } var Styles = context.TLADM_Styles.OrderBy(x => x.Sty_Description).ToList(); foreach (var Style in Styles) { comboStyles.Items.Add(new DyeHouse.CheckComboBoxItem(Style.Sty_Id, Style.Sty_Description, false)); } } FormLoaded = true; }
public IQueryable <TLKNI_GreigeCommissionTransctions> CommissionTransactions(DyeQueryParameters parameters) { var Transactions = _context.TLKNI_GreigeCommissionTransctions.Where(x => x.GreigeCom_Transdate >= parameters.FromDate && x.GreigeCom_Transdate <= parameters.ToDate).OrderBy(x => x.GreigeCom_GrnNo).AsQueryable(); if (parameters.Customers.Count > 0) { var CustomerPredicate = PredicateBuilder.False <TLKNI_GreigeCommissionTransctions>(); foreach (var Customer in parameters.Customers) { var temp = Customer; CustomerPredicate = CustomerPredicate.Or(s => s.GreigeCom_Customer_FK == temp.Cust_Pk); } Transactions = Transactions.AsExpandable().Where(CustomerPredicate); } if (parameters.FabricQualities.Count > 0) { var QualityPredicate = PredicateBuilder.False <TLKNI_GreigeCommissionTransctions>(); foreach (var Quality in parameters.FabricQualities) { var temp = Quality; QualityPredicate = QualityPredicate.Or(s => s.GreigeCom_ProductType_FK == Quality.GQ_Pk); } Transactions = Transactions.AsExpandable().Where(QualityPredicate); } return(Transactions); }
private void cmboProductCodes_SelectedIndexChanged(object sender, EventArgs e) { ComboBox oCmbo = sender as ComboBox; if (oCmbo != null && formloaded) { var selected = (TLDYE_RecipeDefinition)cmboProductCodes.SelectedItem; if (selected != null) { dataGridView1.Rows.Clear(); txtProductCode.Text = selected.TLDYE_DefineCode; //cmboGreigeQuality.SelectedValue = selected.TLDYE_DefineGreigeQual_Fk; if (selected.TLDYE_ColorChart_FK != null) { cmboColours.SelectedValue = selected.TLDYE_ColorChart_FK; } txtProgramLoad.Text = selected.TLDYE_ProgramLoad.ToString(); txtProgramVolume.Text = selected.TLDYE_LiquidLoad.ToString(); lNew = false; using (var context = new TTI2Entities()) { var ExistingData = context.TLDYE_DefinitionDetails.Where(x => x.TLDYED_Receipe_FK == selected.TLDYE_DefinePk).ToList(); foreach (var row in ExistingData) { var index = dataGridView1.Rows.Add(); dataGridView1.Rows[index].Cells[0].Value = row.TLDYED_PK; dataGridView1.Rows[index].Cells[1].Value = row.TLDYED_Cosumables_FK; dataGridView1.Rows[index].Cells[2].Value = row.TLDYED_LiqCalc; dataGridView1.Rows[index].Cells[3].Value = row.TLDYED_MELFC; dataGridView1.Rows[index].Cells[4].Value = row.TLDYED_LiqRatio; MandRows = core.PopulateArray(MandatoryRows.Length, true); fieldEntered.Add(new DATA(index, MandRows)); } this.cmboGreigeQuality.Items.Clear(); QueryParms = new DyeQueryParameters(); var GreigeQualities = context.TLADM_GreigeQuality.OrderBy(x => x.GQ_Description).ToList(); foreach (var Quality in GreigeQualities) { var Existing = context.TLDYE_ReceipeGreigeQual.Where(x => x.TLGQ_GreigeQuality_FK == Quality.GQ_Pk && x.TLGQ_ReceipeDef_FK == selected.TLDYE_DefinePk).FirstOrDefault(); if (Existing != null) { cmboGreigeQuality.Items.Add(new DyeHouse.CheckComboBoxItem(Quality.GQ_Pk, Quality.GQ_Description, true)); QueryParms.FabricQualities.Add(repo.LoadFabricQuality(Quality.GQ_Pk)); } else { cmboGreigeQuality.Items.Add(new DyeHouse.CheckComboBoxItem(Quality.GQ_Pk, Quality.GQ_Description, false)); } } } } } }
public IQueryable <TLDYE_DyeOrder> SelectActiveDyeOrders(DyeQueryParameters parameters) { var DO = _context.TLDYE_DyeOrder.Where(x => !x.TLDYO_Closed).AsQueryable(); if (parameters.Customers.Count > 0) { var CustomerPredicate = PredicateBuilder.False <TLDYE_DyeOrder>(); foreach (var Customer in parameters.Customers) { var temp = Customer; CustomerPredicate = CustomerPredicate.Or(s => s.TLDYO_Customer_FK == temp.Cust_Pk); } DO = DO.AsExpandable().Where(CustomerPredicate); } if (parameters.Colours.Count > 0) { var ColourPredicate = PredicateBuilder.False <TLDYE_DyeOrder>(); foreach (var colour in parameters.Colours) { var temp = colour; ColourPredicate = ColourPredicate.Or(s => s.TLDYO_Colour_FK == temp.Col_Id); } DO = DO.AsExpandable().Where(ColourPredicate); } if (parameters.Styles.Count > 0) { var StylePredicate = PredicateBuilder.False <TLDYE_DyeOrder>(); foreach (var Style in parameters.Styles) { var temp = Style; StylePredicate = StylePredicate.Or(s => s.TLDYO_Style_FK == temp.Sty_Id); } DO = DO.AsExpandable().Where(StylePredicate); } if (parameters.Qualities.Count > 0) { var QualityPredicate = PredicateBuilder.False <TLDYE_DyeOrder>(); foreach (var Quality in parameters.Qualities) { var temp = Quality; QualityPredicate = QualityPredicate.Or(s => s.TLDYO_Greige_FK == temp.TLGreige_Id); } DO = DO.AsExpandable().Where(QualityPredicate); } return(DO); }
public IQueryable <TLDYE_DyeBatch> SelectDyeBatches(DyeQueryParameters parameters) { var DB = _context.TLDYE_DyeBatch.Where(x => !x.DYEB_Transfered).AsQueryable(); if (parameters.DyeBatches.Count > 0) { var BatchesPredicate = PredicateBuilder.False <TLDYE_DyeBatch>(); foreach (var DyeBatch in parameters.DyeBatches) { var temp = DyeBatch; BatchesPredicate = BatchesPredicate.Or(s => s.DYEB_Pk == temp.DYEB_Pk); } DB = DB.AsExpandable().Where(BatchesPredicate); } if (parameters.Customers.Count > 0) { var CustomerPredicate = PredicateBuilder.False <TLDYE_DyeBatch>(); foreach (var Customer in parameters.Customers) { var temp = Customer; CustomerPredicate = CustomerPredicate.Or(s => s.DYEB_Customer_FK == temp.Cust_Pk); } DB = DB.AsExpandable().Where(CustomerPredicate); } if (parameters.Qualities.Count != 0) { var QualitiesPredicate = PredicateBuilder.False <TLDYE_DyeBatch>(); foreach (var Qual in parameters.Qualities) { QualitiesPredicate = QualitiesPredicate.Or(s => s.DYEB_Greige_FK == Qual.TLGreige_Id); } DB.AsExpandable().Where(QualitiesPredicate); } if (parameters.Colours.Count > 0) { var ColourPredicate = PredicateBuilder.False <TLDYE_DyeBatch>(); foreach (var colour in parameters.Colours) { var temp = colour; ColourPredicate = ColourPredicate.Or(s => s.DYEB_Colour_FK == temp.Col_Id); } DB = DB.AsExpandable().Where(ColourPredicate); } return(DB); }
public IQueryable <TLDYE_DyeBatchDetails> SelectDyeBatchDetails(DyeQueryParameters parameters) { var DBDetails = _context.TLDYE_DyeBatchDetails.AsQueryable(); if (parameters.DyeBatchDetails.Count > 0) { var DyeBatchDetPredicate = PredicateBuilder.False <TLDYE_DyeBatchDetails>(); foreach (var BatchDetail in parameters.DyeBatchDetails) { var Temp = BatchDetail; DyeBatchDetPredicate = DyeBatchDetPredicate.Or(s => s.DYEBD_DyeBatch_FK == Temp.DYEBD_DyeBatch_FK); } } return(DBDetails); }
void SetUp() { formloaded = false; txtProductCode.Text = string.Empty; QueryParms = new DyeQueryParameters(); rbStandard.Checked = true; lNew = true; using (var context = new TTI2Entities()) { cmboColours.DataSource = context.TLADM_Colours.OrderBy(x => x.Col_Display).ToList(); cmboColours.DisplayMember = "Col_Display"; cmboColours.ValueMember = "Col_Id"; cmboColours.SelectedValue = -1; cmboProductCodes.DataSource = context.TLDYE_RecipeDefinition.Where(x => x.TLDYE_StandardReceipe).OrderBy(x => x.TLDYE_DefineCode).ToList(); cmboProductCodes.DisplayMember = "TLDYE_DefineDescription"; cmboProductCodes.ValueMember = "TLDYE_DefinePK"; cmboProductCodes.SelectedValue = -1; var GreigeQualitys = context.TLADM_GreigeQuality.OrderBy(x => x.GQ_Description).ToList(); foreach (var Quality in GreigeQualitys) { cmboGreigeQuality.Items.Add(new DyeHouse.CheckComboBoxItem(Quality.GQ_Pk, Quality.GQ_Description, false)); } oCmboA.DataSource = context.TLADM_ConsumablesDC.OrderBy(x => x.ConsDC_Description).ToList(); oCmboA.DisplayMember = "ConsDC_Description"; oCmboA.ValueMember = "ConsDC_Pk"; } txtProgramLoad.KeyPress += core.txtWin_KeyPress; txtProgramLoad.KeyDown += core.txtWin_KeyDownJI; txtProgramLoad.Text = "0"; txtProgramVolume.KeyPress += core.txtWin_KeyPress; txtProgramVolume.KeyDown += core.txtWin_KeyDownJI; txtProgramVolume.Text = "0"; MandSelected = core.PopulateArray(MandatoryFields.Length, false); formloaded = true; }
public IQueryable <TLADM_Colours> PPSColour(DyeQueryParameters parameters) { var SOH = _context.TLADM_Colours.AsQueryable(); if (parameters.Colours.Count > 0) { var ReceipePredicate = PredicateBuilder.False <TLADM_Colours>(); foreach (var Quality in parameters.Colours) { var temp = Quality; ReceipePredicate = ReceipePredicate.Or(s => s.Col_Id == temp.Col_Id); } SOH = SOH.AsExpandable().Where(ReceipePredicate); } return(SOH); }
public IQueryable <TLADM_ConsumablesDC> SelectConsumables(DyeQueryParameters parameters) { var Consumables = _context.TLADM_ConsumablesDC.Where(x => !(bool)x.ConsDC_Discontinued).AsQueryable(); if (parameters.Consummables.Count > 0) { var ConsumablesPredicate = PredicateBuilder.False <TLADM_ConsumablesDC>(); foreach (var Consumable in parameters.Consummables) { var temp = Consumable; ConsumablesPredicate = ConsumablesPredicate.Or(s => s.ConsDC_Pk == temp.ConsDC_Pk); } Consumables = Consumables.AsExpandable().Where(ConsumablesPredicate); } return(Consumables); }
public IQueryable <TLDYE_DyeBatch> SelectViewDyeBatches(DyeQueryParameters parameters) { var DB = _context.TLDYE_DyeBatch.Where(x => x.DYEB_BatchDate >= parameters.FromDate && x.DYEB_BatchDate <= parameters.ToDate && !x.DYEB_Closed && !x.DYEB_CommissinCust).AsQueryable(); if (parameters.FabricQualities.Count > 0) { var QualityPredicate = PredicateBuilder.False <TLDYE_DyeBatch>(); foreach (var Quality in parameters.FabricQualities) { var temp = Quality; QualityPredicate = QualityPredicate.Or(s => s.DYEB_Pk == temp.GQ_Pk); } DB = DB.AsExpandable().Where(QualityPredicate); } if (parameters.Customers.Count > 0) { var CustomerPredicate = PredicateBuilder.False <TLDYE_DyeBatch>(); foreach (var Customer in parameters.Customers) { var temp = Customer; CustomerPredicate = CustomerPredicate.Or(s => s.DYEB_Customer_FK == temp.Cust_Pk); } DB = DB.AsExpandable().Where(CustomerPredicate); } if (parameters.Colours.Count > 0) { var ColourPredicate = PredicateBuilder.False <TLDYE_DyeBatch>(); foreach (var colour in parameters.Colours) { var temp = colour; ColourPredicate = ColourPredicate.Or(s => s.DYEB_Colour_FK == temp.Col_Id); } DB = DB.AsExpandable().Where(ColourPredicate); } return(DB); }
public IQueryable <TLDYE_RecipeDefinition> SOHQuery(DyeQueryParameters parameters) { var SOH = _context.TLDYE_RecipeDefinition.Where(x => x.TLDYE_ColorChart_FK != null).AsQueryable(); if (parameters.Colours.Count > 0) { var ReceipePredicate = PredicateBuilder.False <TLDYE_RecipeDefinition>(); foreach (var Colour in parameters.Colours) { var temp = Colour; ReceipePredicate = ReceipePredicate.Or(s => s.TLDYE_ColorChart_FK == temp.Col_Id); } SOH = SOH.AsExpandable().Where(ReceipePredicate); } if (parameters.RecDefinitions.Count > 0) { var RecDefPredicate = PredicateBuilder.False <TLDYE_RecipeDefinition>(); foreach (var Definition in parameters.RecDefinitions) { var temp = Definition; RecDefPredicate = RecDefPredicate.Or(s => s.TLDYE_DefinePk == temp.TLDYE_DefinePk); } SOH = SOH.AsExpandable().Where(RecDefPredicate); } if (parameters.Qualities.Count > 0) { var QualPredicate = PredicateBuilder.False <TLDYE_RecipeDefinition>(); foreach (var Quality in parameters.Qualities) { var temp = Quality; // QualPredicate = QualPredicate.Or(s => s.TLDYE_DefineGreigeQual_Fk == temp.TLGreige_Id); } SOH = SOH.AsExpandable().Where(QualPredicate); } return(SOH); }
private void btnSubmit_Click(object sender, EventArgs e) { Button oBtn = sender as Button; if (oBtn != null) { DyeHouse.DyeRepository repo = new DyeRepository(); DyeHouse.DyeQueryParameters QueryParms = new DyeQueryParameters(); QueryParms.FromDate = Convert.ToDateTime(dtpFromDate.Value.ToShortDateString()); QueryParms.ToDate = Convert.ToDateTime(dtpToDate.Value.ToShortDateString()); QueryParms.ToDate = QueryParms.ToDate.AddHours(23); frmDyeViewReport vRep = new frmDyeViewReport(44, QueryParms); int h = Screen.PrimaryScreen.WorkingArea.Height; int w = Screen.PrimaryScreen.WorkingArea.Width; vRep.ClientSize = new Size(w, h); vRep.ShowDialog(this); } }
private void frmViewCommissionReceipts_Load(object sender, EventArgs e) { FormLoaded = false; DyeParameters = new DyeQueryParameters(); using (var context = new TTI2Entities()) { var Customers = context.TLADM_CustomerFile.Where(x => x.Cust_CommissionCust).OrderBy(x => x.Cust_Description).ToList(); foreach (var Customer in Customers) { comboCustomers.Items.Add(new DyeHouse.CheckComboBoxItem(Customer.Cust_Pk, Customer.Cust_Description, false)); } var Qualitys = context.TLADM_Griege.OrderBy(x => x.TLGreige_Description).ToList(); foreach (var Quality in Qualitys) { comboQuality.Items.Add(new DyeHouse.CheckComboBoxItem(Quality.TLGreige_Id, Quality.TLGreige_Description, false)); } } FormLoaded = true; }
private void frmProductionPlanDC_Load(object sender, EventArgs e) { formloaded = false; repo = new DyeRepository(); QueryParms = new DyeQueryParameters(); using (var context = new TTI2Entities()) { var Entries = context.TLDYE_DyeBatch.Where(x => !x.DYEB_Allocated && !x.DYEB_Closed).OrderBy(x => x.DYEB_BatchNo).ToList(); foreach (var Entry in Entries) { cmboDyeBatches.Items.Add(new DyeHouse.CheckComboBoxItem(Entry.DYEB_Pk, Entry.DYEB_BatchNo, false)); } cmboDyeBatches.ValueMember = "DYEB_PK"; cmboDyeBatches.DisplayMember = "DYEB_BatchNo"; } formloaded = true; }
private void frmTransferToDyeHouse_Load(object sender, EventArgs e) { formloaded = false; QueryParms = new DyeQueryParameters(); using (var context = new TTI2Entities()) { var Batches = context.TLDYE_DyeBatch.Where(x => !x.DYEB_Transfered).ToList(); foreach (var Batch in Batches) { cmboBatches.Items.Add(new DyeHouse.CheckComboBoxItem(Batch.DYEB_Pk, Batch.DYEB_BatchNo, false)); } var Colours = context.TLADM_Colours.OrderBy(x => x.Col_Display).ToList(); foreach (var Colour in Colours) { cmboColour.Items.Add(new DyeHouse.CheckComboBoxItem(Colour.Col_Id, Colour.Col_Display, false)); } var FabricWeights = context.TLADM_FabricWeight.OrderBy(x => x.FWW_Id).ToList(); foreach (var FabricWeight in FabricWeights) { cmboFabricWeight.Items.Add(new DyeHouse.CheckComboBoxItem(FabricWeight.FWW_Id, FabricWeight.FWW_Description, false)); } var FabricWidths = context.TLADM_FabWidth.OrderBy(x => x.FW_Id).ToList(); foreach (var FabricWidth in FabricWidths) { cmboFabricWidth.Items.Add(new DyeHouse.CheckComboBoxItem(FabricWidth.FW_Id, FabricWidth.FW_Description, false)); } var FabricQualities = context.TLADM_GreigeQuality.OrderBy(x => x.GQ_Description).ToList(); foreach (var FabricQuality in FabricQualities) { cmboFabricQuality.Items.Add(new DyeHouse.CheckComboBoxItem(FabricQuality.GQ_Pk, FabricQuality.GQ_Description, false)); } } formloaded = true; }
private void frmShadeAfterDyeing_Load(object sender, EventArgs e) { repOps = new DyeReportOptions(); QueryParms = new DyeQueryParameters(); formloaded = false; using (var context = new TTI2Entities()) { var DyeQDCodes = context.TLADM_DyeQDCodes.OrderBy(x => x.QDF_Code).ToList(); foreach (var DyeCode in DyeQDCodes) { cmboCause.Items.Add(new DyeHouse.CheckComboBoxItem(DyeCode.QDF_Pk, DyeCode.QDF_Description, false)); } var Remedies = context.TLADM_DyeRemendyCodes.OrderBy(x => x.QRC_Code).ToList(); foreach (var Remedy in Remedies) { cmboRemedy.Items.Add(new DyeHouse.CheckComboBoxItem(Remedy.QRC_Pk, Remedy.QRC_Description, false)); } var Colours = context.TLADM_Colours.OrderBy(x => x.Col_Display).ToList(); foreach (var Colour in Colours) { cmboColour.Items.Add(new DyeHouse.CheckComboBoxItem(Colour.Col_Id, Colour.Col_Display, false)); } var Dept = context.TLADM_Departments.Where(x => x.Dep_ShortCode.Contains("DYE")).FirstOrDefault(); if (Dept != null) { var MachineDefinitions = context.TLADM_MachineDefinitions.Where(x => x.MD_Department_FK == Dept.Dep_Id).OrderBy(x => x.MD_Description).ToList(); foreach (var MachineDefinition in MachineDefinitions) { cmboDyeMachine.Items.Add(new DyeHouse.CheckComboBoxItem(MachineDefinition.MD_Pk, MachineDefinition.MD_AlternateDesc, false)); } var Operators = context.TLADM_MachineOperators.Where(x => x.MachOp_Department_FK == Dept.Dep_Id && !x.MachOp_Discontinued).ToList(); foreach (var Operator in Operators) { cmboDyeOperator.Items.Add(new DyeHouse.CheckComboBoxItem(Operator.MachOp_Pk, Operator.MachOp_Description, false)); } } var Qualities = context.TLADM_Griege.OrderBy(x => x.TLGreige_Description).ToList(); foreach (var Quality in Qualities) { cmboQuality.Items.Add(new DyeHouse.CheckComboBoxItem(Quality.TLGreige_Id, Quality.TLGreige_Description, false)); } } var reportOptions = new BindingList <KeyValuePair <string, string> >(); reportOptions.Add(new KeyValuePair <string, string>("1", "Quality")); reportOptions.Add(new KeyValuePair <string, string>("2", "Dye Machine")); reportOptions.Add(new KeyValuePair <string, string>("3", "Dye Operator")); reportOptions.Add(new KeyValuePair <string, string>("4", "Colour")); if (_Stage == 3) { reportOptions.Add(new KeyValuePair <string, string>("5", "Remedy")); reportOptions.Add(new KeyValuePair <string, string>("6", "Fault")); reportOptions.Add(new KeyValuePair <string, string>("7", "Result")); } cmboReportOptions.DataSource = reportOptions; cmboReportOptions.ValueMember = "Key"; cmboReportOptions.DisplayMember = "Value"; cmboReportOptions.SelectedIndex = -1; formloaded = true; }