void SetUp(bool xSel) { IList <TLKNI_GreigeProduction> Existing = new List <TLKNI_GreigeProduction>(); formloaded = false; CheckFired = false; dataGridView2.Rows.Clear(); using (var context = new TTI2Entities()) { var LNU = context.TLADM_LastNumberUsed.Find(3); if (LNU != null) { txtNumber.Text = "DA" + LNU.col6.ToString().PadLeft(6, '0'); } if (xSel) { var Query = from T1 in context.TLDYE_DyeBatch join T2 in context.TLDYE_DyeBatchDetails on T1.DYEB_Pk equals T2.DYEBD_DyeBatch_FK where !T1.DYEB_Closed && !T1.DYEB_CommissinCust && T1.DYEB_Allocated && T1.DYEB_Transfered && !T2.DYEBO_Rejected && !T2.DYEBO_CutSheet && !T2.DYEBO_WriteOff select new { T1.DYEB_Pk, T1.DYEB_BatchNo, T1.DYEB_DyeOrder_FK, T1.DYEB_Colour_FK, T1.DYEB_Allocated, T1.DYEB_Transfered }; var QueryGroup = Query.OrderBy(x => x.DYEB_BatchNo).GroupBy(x => x.DYEB_BatchNo); foreach (var BatchGroup in QueryGroup) { TLDYE_DyeBatch DB = new TLDYE_DyeBatch(); DB.DYEB_Pk = BatchGroup.FirstOrDefault().DYEB_Pk; DB.DYEB_DyeOrder_FK = BatchGroup.FirstOrDefault().DYEB_DyeOrder_FK; DB.DYEB_BatchNo = BatchGroup.FirstOrDefault().DYEB_BatchNo; DB.DYEB_Colour_FK = BatchGroup.FirstOrDefault().DYEB_Colour_FK; DB.DYEB_Allocated = BatchGroup.FirstOrDefault().DYEB_Allocated; DB.DYEB_Transfered = BatchGroup.FirstOrDefault().DYEB_Transfered; cmboDyeBatches.Items.Add(DB); cmboDyeBatches.ValueMember = "DYEB_Pk"; cmboDyeBatches.DisplayMember = "DYEB_BatchNo"; } cmboDyeBatches.SelectedValue = -1; } } MandSelected = core.PopulateArray(MandatoryFields.Length, false); formloaded = true; }
private void frmFabricReversal_Load(object sender, EventArgs e) { FormLoaded = false; dataGridView1.Rows.Clear(); using (var context = new TTI2Entities()) { var LNU = context.TLADM_LastNumberUsed.Find(3); if (LNU != null) { txtGrnNumber.Text = "RFREV" + LNU.col7.ToString().PadLeft(6, '0'); } var Query = from T1 in context.TLDYE_DyeBatch join T2 in context.TLDYE_DyeBatchDetails on T1.DYEB_Pk equals T2.DYEBD_DyeBatch_FK where T2.DYEBO_Rejected select new { T1.DYEB_Pk, T1.DYEB_BatchNo, T1.DYEB_DyeOrder_FK, T1.DYEB_Colour_FK }; var QueryGroup = Query.OrderBy(x => x.DYEB_BatchNo).GroupBy(x => x.DYEB_BatchNo); foreach (var BatchGroup in QueryGroup) { TLDYE_DyeBatch DB = new TLDYE_DyeBatch(); DB.DYEB_Pk = BatchGroup.FirstOrDefault().DYEB_Pk; DB.DYEB_DyeOrder_FK = BatchGroup.FirstOrDefault().DYEB_DyeOrder_FK; DB.DYEB_BatchNo = BatchGroup.FirstOrDefault().DYEB_BatchNo; DB.DYEB_Colour_FK = BatchGroup.FirstOrDefault().DYEB_Colour_FK; cmboBatchNumber.Items.Add(DB); } cmboBatchNumber.ValueMember = "DYEB_Pk"; cmboBatchNumber.DisplayMember = "DYEB_BatchNo"; cmboBatchNumber.SelectedValue = -1; txtBatchFabricKg.Text = "0.0"; txtBatchGreigeKg.Text = "0.0"; txtColour.Text = string.Empty; txtCustomerDetails.Text = string.Empty; txtDyeOrder.Text = string.Empty; } FormLoaded = true; }
void SetUp() { formloaded = false; dataGridView1.Rows.Clear(); dataGridView1.AllowUserToAddRows = false; dataGridView1.AutoGenerateColumns = false; using (var context = new TTI2Entities()) { var LNU = context.TLADM_LastNumberUsed.Find(3); if (LNU != null) { txtGrnNumber.Text = "RF" + LNU.col7.ToString().PadLeft(6, '0'); } var Query = (from T1 in context.TLDYE_DyeBatch join T2 in context.TLDYE_DyeBatchDetails on T1.DYEB_Pk equals T2.DYEBD_DyeBatch_FK join T3 in context.TLKNI_GreigeProduction on T2.DYEBD_GreigeProduction_FK equals T3.GreigeP_Pk where !T2.DYEBO_Sold && !T2.DYEBO_Rejected && !T2.DYEBO_CutSheet && !T2.DYEBO_QAApproved && T1.DYEB_OutProcess && T1.DYEB_Allocated && !T1.DYEB_CommissinCust && T3.GreigeP_Dye select T1).OrderBy(x => x.DYEB_BatchNo).GroupBy(x => x.DYEB_BatchNo); foreach (var BatchGroup in Query) { TLDYE_DyeBatch DB = new TLDYE_DyeBatch(); DB.DYEB_Pk = BatchGroup.FirstOrDefault().DYEB_Pk; DB.DYEB_BatchNo = BatchGroup.FirstOrDefault().DYEB_BatchNo; DB.DYEB_DyeOrder_FK = BatchGroup.FirstOrDefault().DYEB_DyeOrder_FK; DB.DYEB_Colour_FK = BatchGroup.FirstOrDefault().DYEB_Colour_FK; cmboBatchNumber.Items.Add(DB); } cmboBatchNumber.ValueMember = "DYEB_Pk"; cmboBatchNumber.DisplayMember = "DYEB_BatchNo"; } txtBatchFabricKg.Text = "0.0"; txtBatchGreigeKg.Text = "0.0"; txtColour.Text = string.Empty; txtCustomerDetails.Text = string.Empty; txtDyeOrder.Text = string.Empty; formloaded = true; }
void Setup() { formloaded = false; dataGridView1.Rows.Clear(); using (var context = new TTI2Entities()) { var Query = from T1 in context.TLDYE_DyeBatch join T2 in context.TLDYE_DyeBatchDetails on T1.DYEB_Pk equals T2.DYEBD_DyeBatch_FK where !T2.DYEBO_QAApproved && !T1.DYEB_OnHold select new { T1.DYEB_Pk, T1.DYEB_BatchNo, T1.DYEB_DyeOrder_FK, T1.DYEB_Colour_FK }; var QueryGroup = Query.OrderBy(x => x.DYEB_BatchNo).GroupBy(x => x.DYEB_BatchNo); foreach (var BatchGroup in QueryGroup) { TLDYE_DyeBatch DB = new TLDYE_DyeBatch(); DB.DYEB_Pk = BatchGroup.FirstOrDefault().DYEB_Pk; DB.DYEB_DyeOrder_FK = BatchGroup.FirstOrDefault().DYEB_DyeOrder_FK; DB.DYEB_BatchNo = BatchGroup.FirstOrDefault().DYEB_BatchNo; DB.DYEB_Colour_FK = BatchGroup.FirstOrDefault().DYEB_Colour_FK; cmboBatchNumber.Items.Add(DB); } cmboBatchNumber.ValueMember = "DYEB_Pk"; cmboBatchNumber.DisplayMember = "DYEB_BatchNo"; cmboBatchNumber.SelectedValue = -1; } txtBatchFabricKg.Text = "0.0"; txtBatchGreigeKg.Text = "0.0"; txtColour.Text = string.Empty; txtCustomerDetails.Text = string.Empty; txtDyeOrder.Text = string.Empty; formloaded = true; }