public IQueryable <TLSPN_QAMeasurements> QAMeasurementQuery(SpinningQueryParameters parameters) { IQueryable <TLSPN_QAMeasurements> QAItems = null; QAItems = _context.TLSPN_QAMeasurements.Where(x => x.YarnQA_Date >= parameters.FromDate && x.YarnQA_Date <= parameters.ToDate && x.YarnQA_MeasureNo == parameters.MeasurementOpt).AsQueryable(); if (parameters.MeasurementOpt == 3) { if (!parameters.OutSideTolerance) { QAItems = QAItems.Where(x => x.YarnQA_12H00 > parameters.LowerTolerance && x.YarnQA_12H00 <= parameters.UpperTolerance).AsQueryable(); } else { QAItems = QAItems.Where(x => x.YarnQA_12H00 < parameters.LowerTolerance || x.YarnQA_12H00 >= parameters.UpperTolerance).AsQueryable(); } } if (parameters.Machines.Count > 0) { var MeasurementPredicate = PredicateBuilder.False <TLSPN_QAMeasurements>(); foreach (var Machine in parameters.Machines) { var temp = Machine; MeasurementPredicate = MeasurementPredicate.Or(s => s.YarnQA_MachineNo_FK == temp.MD_Pk); } QAItems = QAItems.AsExpandable().Where(MeasurementPredicate); } return(QAItems); }
public IQueryable <TLSPN_YarnOrder> YarnOrderQuery(SpinningQueryParameters parameters) { var yarnOrders = _context.TLSPN_YarnOrder.Where(x => !(bool)x.Yarno_Closed && x.YarnO_Date >= parameters.FromDate && x.YarnO_Date <= parameters.ToDate).AsQueryable(); if (parameters.YarnOrders.Count > 0) { var yarnOrderPredicate = PredicateBuilder.False <TLSPN_YarnOrder>(); foreach (var yarnOrder in parameters.YarnOrders) { var temp = yarnOrder; yarnOrderPredicate = yarnOrderPredicate.Or(s => s.YarnO_Pk == temp.YarnO_Pk); } yarnOrders = yarnOrders.AsExpandable().Where(yarnOrderPredicate); } if (parameters.YarnTypes.Count > 0) { var yarnTypePredicate = PredicateBuilder.False <TLSPN_YarnOrder>(); foreach (var yarnType in parameters.YarnTypes) { var temp = yarnType; yarnTypePredicate = yarnTypePredicate.Or(s => s.Yarno_YarnType_FK == temp.YA_Id); } yarnOrders = yarnOrders.AsExpandable().Where(yarnTypePredicate); } return(yarnOrders); }
private void frmQAReportSelection_Load(object sender, EventArgs e) { formloaded = false; QueryParms = new SpinningQueryParameters(); txtBottomTolerance.Text = "4410"; txtTopTolerance.Text = "4590"; core = new Util(); txtBottomTolerance.KeyPress += core.txtWin_KeyPress; txtBottomTolerance.KeyDown += core.txtWin_KeyDownJI; txtTopTolerance.KeyPress += core.txtWin_KeyPress; txtTopTolerance.KeyDown += core.txtWin_KeyDownJI; rbOutsideTNo.Checked = true; using (var context = new TTI2Entities()) { var deptdetails = context.TLADM_Departments.Where(x => x.Dep_ShortCode == "SPIN").FirstOrDefault(); if (deptdetails != null) { var Machines = context.TLADM_MachineDefinitions.Where(x => x.MD_Department_FK == deptdetails.Dep_Id).OrderBy(x => x.MD_Description).ToList(); foreach (var Machine in Machines) { cmboRSBMachines.Items.Add(new Spinning.CheckComboBoxItem(Machine.MD_Pk, Machine.MD_MachineCode, false)); } cmboRSBMachines.SelectedValue = 0; } } formloaded = true; }