private void bwInsert_DoWork(object sender, DoWorkEventArgs e) { rawMaterial.ETD = dtDefault; rawMaterial.IsETDUpdate = true; foreach (var upperRawMaterialView in upperComponentRawMaterialViewToDeleteList) { int upperComponentID = upperRawMaterialView.UpperComponents.UpperComponentID; UpperComponentRawMaterialController.Delete(productNo, upperComponentID); } if (upperComponentRawMaterialViewToInsertList.Count > 0) { rawMaterial.ETD = upperComponentRawMaterialViewToInsertList.Max(m => m.ETDReal); } foreach (var upperRawMaterialView in upperComponentRawMaterialViewToInsertList) { int upperComponentID = upperRawMaterialView.UpperComponents.UpperComponentID; DateTime etd = TimeHelper.Convert(upperRawMaterialView.ETD); if (etd != dtDefault && etd != dtNothing) { UpperComponentRawMaterialModel model = new UpperComponentRawMaterialModel() { ProductNo = productNo, UpperComponentID = upperComponentID, ETD = etd, }; UpperComponentRawMaterialController.Insert(model); if (model.ETD > rawMaterial.ETD) { rawMaterial.ETD = model.ETD.Date; } } } }
private void dgOutsoleMaterial_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) { OutsoleRawMaterialViewModel outsoleRawMaterialView = e.Row.Item as OutsoleRawMaterialViewModel; if (outsoleRawMaterialView == null) { return; } int columnIndex = e.Column.DisplayIndex; if (colDatetimeList.Contains(columnIndex)) { TextBox txtElement = (TextBox)e.EditingElement as TextBox; DateTime etd = TimeHelper.Convert(txtElement.Text); if (String.IsNullOrEmpty(txtElement.Text) == false && etd == dtNothing) { txtElement.Foreground = Brushes.Red; txtElement.Text = "!"; txtElement.SelectAll(); } else { outsoleRawMaterialView.ETDReal = etd; } } }
private void btnSave_Click(object sender, RoutedEventArgs e) { if (MessageBox.Show("Confirm Save?", this.Title, MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.No) { return; } dt = ((DataView)dgInsockMaterial.ItemsSource).ToTable(); for (int r = 0; r <= dt.Rows.Count - 1; r = r + 2) { DataRow dr = dt.Rows[r]; DataRow dr1 = dt.Rows[r + 1]; InsockSuppliersModel insockSupplier = (InsockSuppliersModel)dr["Supplier"]; if (insockSupplier != null) { int insockSupplierId = insockSupplier.InsockSupplierId; string actualDate = dr["ActualDate"] as String; DateTime dtActualDate = TimeHelper.Convert(actualDate); if (String.IsNullOrEmpty(actualDate) == false && dtActualDate != dtNothing) { InsockRawMaterialModel insockRawMaterial = new InsockRawMaterialModel { ProductNo = productNo, InsockSupplierId = insockSupplierId, ActualDate = dtActualDate, }; insockRawMaterialToInsertList.Add(insockRawMaterial); } for (int i = 0; i <= sizeRunList.Count - 1; i++) { string sizeNo = sizeRunList[i].SizeNo; int quantity = (Int32)dr[String.Format("Column{0}", i)]; int quantityReject = (Int32)dr1[String.Format("Column{0}", i)]; if (quantity >= 0 && quantityReject >= 0) { InsockMaterialModel model = new InsockMaterialModel { ProductNo = productNo, InsockSupplierId = insockSupplierId, SizeNo = sizeNo, Quantity = quantity, QuantityReject = quantityReject, }; insockMaterialToInsertList.Add(model); } } } } if (threadInsert.IsBusy == false) { this.Cursor = Cursors.Wait; btnSave.IsEnabled = false; threadInsert.RunWorkerAsync(); } }
public static bool Insert_2(OutsoleMasterModel model) { DateTime dtDefault = new DateTime(2000, 01, 01); var @ProductNo = new SqlParameter("@ProductNo", model.ProductNo); var @Sequence = new SqlParameter("@Sequence", model.Sequence); var @OutsoleLine = new SqlParameter("@OutsoleLine", model.OutsoleLine); var @OutsoleStartDate = new SqlParameter("@OutsoleStartDate", model.OutsoleStartDate); var @OutsoleFinishDate = new SqlParameter("@OutsoleFinishDate", model.OutsoleFinishDate); var @OutsoleQuota = new SqlParameter("@OutsoleQuota", model.OutsoleQuota); var @OutsoleActualStartDate = new SqlParameter("@OutsoleActualStartDate", model.OutsoleActualStartDate); var @OutsoleActualFinishDate = new SqlParameter("@OutsoleActualFinishDate", model.OutsoleActualFinishDate); DateTime outsoleActualStartDateAutoDt = TimeHelper.Convert(model.OutsoleActualStartDateAuto); DateTime outsoleActualFinishDateAutoDt = TimeHelper.Convert(model.OutsoleActualFinishDateAuto); string outsoleActualStartDateAutoString = ""; if (outsoleActualStartDateAutoDt != dtDefault) { outsoleActualStartDateAutoString = String.Format("{0:MM/dd/yyyy}", outsoleActualStartDateAutoDt); } string outsoleActualFinishDateAutoString = ""; if (outsoleActualFinishDateAutoDt != dtDefault) { outsoleActualFinishDateAutoString = String.Format("{0:MM/dd/yyyy}", outsoleActualFinishDateAutoDt); } var @OutsoleActualStartDateAuto = new SqlParameter("@OutsoleActualStartDateAuto", outsoleActualStartDateAutoString); var @OutsoleActualFinishDateAuto = new SqlParameter("@OutsoleActualFinishDateAuto", outsoleActualFinishDateAutoString); var @OutsoleBalance = new SqlParameter("@OutsoleBalance", model.OutsoleBalance); var @IsSequenceUpdate = new SqlParameter("@IsSequenceUpdate", model.IsSequenceUpdate); var @IsOutsoleLineUpdate = new SqlParameter("@IsOutsoleLineUpdate", model.IsOutsoleLineUpdate); var @IsOutsoleStartDateUpdate = new SqlParameter("@IsOutsoleStartDateUpdate", model.IsOutsoleStartDateUpdate); var @IsOutsoleFinishDateUpdate = new SqlParameter("@IsOutsoleFinishDateUpdate", model.IsOutsoleFinishDateUpdate); var @IsOutsoleQuotaUpdate = new SqlParameter("@IsOutsoleQuotaUpdate", model.IsOutsoleQuotaUpdate); var @IsOutsoleActualStartDateUpdate = new SqlParameter("@IsOutsoleActualStartDateUpdate", model.IsOutsoleActualStartDateUpdate); var @IsOutsoleActualFinishDateUpdate = new SqlParameter("@IsOutsoleActualFinishDateUpdate", model.IsOutsoleActualFinishDateUpdate); var @IsOutsoleActualStartDateAutoUpdate = new SqlParameter("@IsOutsoleActualStartDateAutoUpdate", model.IsOutsoleActualStartDateAutoUpdate); var @IsOutsoleActualFinishDateAutoUpdate = new SqlParameter("@IsOutsoleActualFinishDateAutoUpdate", model.IsOutsoleActualFinishDateAutoUpdate); var @IsOutsoleBalanceUpdate = new SqlParameter("@IsOutsoleBalanceUpdate", model.IsOutsoleBalanceUpdate); SaovietMasterScheduleEntities db = new SaovietMasterScheduleEntities(); if (db.ExecuteStoreCommand(@"EXEC spm_InsertOutsoleMaster_3 @ProductNo, @Sequence, @OutsoleLine, @OutsoleStartDate, @OutsoleFinishDate, @OutsoleQuota, @OutsoleActualStartDate, @OutsoleActualFinishDate, @OutsoleActualStartDateAuto, @OutsoleActualFinishDateAuto, @OutsoleBalance, @IsSequenceUpdate, @IsOutsoleLineUpdate, @IsOutsoleStartDateUpdate, @IsOutsoleFinishDateUpdate, @IsOutsoleQuotaUpdate, @IsOutsoleActualStartDateUpdate, @IsOutsoleActualFinishDateUpdate, @IsOutsoleActualStartDateAutoUpdate, @IsOutsoleActualFinishDateAutoUpdate, @IsOutsoleBalanceUpdate", @ProductNo, @Sequence, @OutsoleLine, @OutsoleStartDate, @OutsoleFinishDate, @OutsoleQuota, @OutsoleActualStartDate, @OutsoleActualFinishDate, @OutsoleActualStartDateAuto, @OutsoleActualFinishDateAuto, @OutsoleBalance, @IsSequenceUpdate, @IsOutsoleLineUpdate, @IsOutsoleStartDateUpdate, @IsOutsoleFinishDateUpdate, @IsOutsoleQuotaUpdate, @IsOutsoleActualStartDateUpdate, @IsOutsoleActualFinishDateUpdate, @IsOutsoleActualStartDateAutoUpdate, @IsOutsoleActualFinishDateAutoUpdate, @IsOutsoleBalanceUpdate) > 0) { return(true); } return(false); }
public static bool Insert_2(SockliningMasterModel model) { DateTime dtDefault = new DateTime(2000, 01, 01); var @ProductNo = new SqlParameter("@ProductNo", model.ProductNo); var @Sequence = new SqlParameter("@Sequence", model.Sequence); var @SockliningLine = new SqlParameter("@SockliningLine", model.SockliningLine); var @SockliningStartDate = new SqlParameter("@SockliningStartDate", model.SockliningStartDate); var @SockliningFinishDate = new SqlParameter("@SockliningFinishDate", model.SockliningFinishDate); var @SockliningQuota = new SqlParameter("@SockliningQuota", model.SockliningQuota); DateTime sockliningActualStartDateDt = TimeHelper.Convert(model.SockliningActualStartDate); DateTime sockliningActualFinishDateDt = TimeHelper.Convert(model.SockliningActualFinishDate); string sockliningActualStartDateString = ""; if (sockliningActualStartDateDt != dtDefault) { sockliningActualStartDateString = String.Format("{0:MM/dd/yyyy}", sockliningActualStartDateDt); } string sockliningActualFinishDateString = ""; if (sockliningActualFinishDateDt != dtDefault) { sockliningActualFinishDateString = String.Format("{0:MM/dd/yyyy}", sockliningActualFinishDateDt); } var @SockliningActualStartDate = new SqlParameter("@SockliningActualStartDate", sockliningActualStartDateString); var @SockliningActualFinishDate = new SqlParameter("@SockliningActualFinishDate", sockliningActualFinishDateString); var @InsoleBalance = new SqlParameter("@InsoleBalance", model.InsoleBalance); var @InsockBalance = new SqlParameter("@InsockBalance", model.InsockBalance); var @IsSequenceUpdate = new SqlParameter("@IsSequenceUpdate", model.IsSequenceUpdate); var @IsSockliningLineUpdate = new SqlParameter("@IsSockliningLineUpdate", model.IsSockliningLineUpdate); var @IsSockliningStartDateUpdate = new SqlParameter("@IsSockliningStartDateUpdate", model.IsSockliningStartDateUpdate); var @IsSockliningFinishDateUpdate = new SqlParameter("@IsSockliningFinishDateUpdate", model.IsSockliningFinishDateUpdate); var @IsSockliningQuotaUpdate = new SqlParameter("@IsSockliningQuotaUpdate", model.IsSockliningQuotaUpdate); var @IsSockliningActualStartDateUpdate = new SqlParameter("@IsSockliningActualStartDateUpdate", model.IsSockliningActualStartDateUpdate); var @IsSockliningActualFinishDateUpdate = new SqlParameter("@IsSockliningActualFinishDateUpdate", model.IsSockliningActualFinishDateUpdate); var @IsInsoleBalanceUpdate = new SqlParameter("@IsInsoleBalanceUpdate", model.IsInsoleBalanceUpdate); var @IsInsockBalanceUpdate = new SqlParameter("@IsInsockBalanceUpdate", model.IsInsockBalanceUpdate); using (var db = new SaovietMasterScheduleEntities()) { if (db.ExecuteStoreCommand("EXEC spm_InsertSockliningMaster_3 @ProductNo, @Sequence, @SockliningLine, @SockliningStartDate, @SockliningFinishDate, @SockliningQuota, @SockliningActualStartDate, @SockliningActualFinishDate, @InsoleBalance, @InsockBalance, @IsSequenceUpdate, @IsSockliningLineUpdate, @IsSockliningStartDateUpdate, @IsSockliningFinishDateUpdate, @IsSockliningQuotaUpdate, @IsSockliningActualStartDateUpdate, @IsSockliningActualFinishDateUpdate, @IsInsoleBalanceUpdate, @IsInsockBalanceUpdate ", @ProductNo, @Sequence, @SockliningLine, @SockliningStartDate, @SockliningFinishDate, @SockliningQuota, @SockliningActualStartDate, @SockliningActualFinishDate, @InsoleBalance, @InsockBalance, @IsSequenceUpdate, @IsSockliningLineUpdate, @IsSockliningStartDateUpdate, @IsSockliningFinishDateUpdate, @IsSockliningQuotaUpdate, @IsSockliningActualStartDateUpdate, @IsSockliningActualFinishDateUpdate, @IsInsoleBalanceUpdate, @IsInsockBalanceUpdate) > 0) { return(true); } return(false); } }
public static bool Insert_2(AssemblyMasterModel model) { DateTime dtDefault = new DateTime(2000, 01, 01); var @ProductNo = new SqlParameter("@ProductNo", model.ProductNo); var @Sequence = new SqlParameter("@Sequence", model.Sequence); var @AssemblyLine = new SqlParameter("@AssemblyLine", model.AssemblyLine); var @AssemblyStartDate = new SqlParameter("@AssemblyStartDate", model.AssemblyStartDate); var @AssemblyFinishDate = new SqlParameter("@AssemblyFinishDate", model.AssemblyFinishDate); var @AssemblyQuota = new SqlParameter("@AssemblyQuota", model.AssemblyQuota); DateTime assemblyActualStartDateDt = TimeHelper.Convert(model.AssemblyActualStartDate); DateTime assemblyActualFinishDateDt = TimeHelper.Convert(model.AssemblyActualFinishDate); string assemblyActualStartDateString = ""; if (assemblyActualStartDateDt != dtDefault) { assemblyActualStartDateString = String.Format("{0:MM/dd/yyyy}", assemblyActualStartDateDt); } string assemblyActualFinishDateString = ""; if (assemblyActualFinishDateDt != dtDefault) { assemblyActualFinishDateString = String.Format("{0:MM/dd/yyyy}", assemblyActualFinishDateDt); } var @AssemblyActualStartDate = new SqlParameter("@AssemblyActualStartDate", assemblyActualStartDateString); var @AssemblyActualFinishDate = new SqlParameter("@AssemblyActualFinishDate", assemblyActualFinishDateString); var @AssemblyBalance = new SqlParameter("@AssemblyBalance", model.AssemblyBalance); var @IsSequenceUpdate = new SqlParameter("@IsSequenceUpdate", model.IsSequenceUpdate); var @IsAssemblyLineUpdate = new SqlParameter("@IsAssemblyLineUpdate", model.IsAssemblyLineUpdate); var @IsAssemblyStartDateUpdate = new SqlParameter("@IsAssemblyStartDateUpdate", model.IsAssemblyStartDateUpdate); var @IsAssemblyFinishDateUpdate = new SqlParameter("@IsAssemblyFinishDateUpdate", model.IsAssemblyFinishDateUpdate); var @IsAssemblyQuotaUpdate = new SqlParameter("@IsAssemblyQuotaUpdate", model.IsAssemblyQuotaUpdate); var @IsAssemblyActualStartDateUpdate = new SqlParameter("@IsAssemblyActualStartDateUpdate", model.IsAssemblyActualStartDateUpdate); var @IsAssemblyActualFinishDateUpdate = new SqlParameter("@IsAssemblyActualFinishDateUpdate", model.IsAssemblyActualFinishDateUpdate); var @IsAssemblyBalanceUpdate = new SqlParameter("@IsAssemblyBalanceUpdate", model.IsAssemblyBalanceUpdate); SaovietMasterScheduleEntities db = new SaovietMasterScheduleEntities(); if (db.ExecuteStoreCommand("EXEC spm_InsertAssemblyMaster_3 @ProductNo, @Sequence, @AssemblyLine, @AssemblyStartDate, @AssemblyFinishDate, @AssemblyQuota, @AssemblyActualStartDate, @AssemblyActualFinishDate, @AssemblyBalance, @IsSequenceUpdate, @IsAssemblyLineUpdate, @IsAssemblyStartDateUpdate, @IsAssemblyFinishDateUpdate, @IsAssemblyQuotaUpdate, @IsAssemblyActualStartDateUpdate, @IsAssemblyActualFinishDateUpdate, @IsAssemblyBalanceUpdate", @ProductNo, @Sequence, @AssemblyLine, @AssemblyStartDate, @AssemblyFinishDate, @AssemblyQuota, @AssemblyActualStartDate, @AssemblyActualFinishDate, @AssemblyBalance, @IsSequenceUpdate, @IsAssemblyLineUpdate, @IsAssemblyStartDateUpdate, @IsAssemblyFinishDateUpdate, @IsAssemblyQuotaUpdate, @IsAssemblyActualStartDateUpdate, @IsAssemblyActualFinishDateUpdate, @IsAssemblyBalanceUpdate) > 0) { return(true); } return(false); }
private void bwInsert_DoWork(object sender, DoWorkEventArgs e) { rawMaterial.ETD = dtDefault; rawMaterial.IsETDUpdate = true; foreach (var insockRawMaterial in insockRawMaterialViewToDeleteList) { int insockSupplierId = insockRawMaterial.InsockSupplier.InsockSupplierId; InsockRawMaterialController.Delete(productNo, insockSupplierId); } if (insockRawMaterialViewToInsertList.Count > 0) { rawMaterial.ETD = insockRawMaterialViewToInsertList.Max(m => m.ETDReal); } foreach (var insockRawMaterial in insockRawMaterialViewToInsertList) { int insockSupplierId = insockRawMaterial.InsockSupplier.InsockSupplierId; DateTime etd = TimeHelper.Convert(insockRawMaterial.ETD); if (etd != dtDefault && etd != dtNothing) { var insertModel = new InsockRawMaterialModel() { ProductNo = productNo, InsockSupplierId = insockSupplierId, ETD = etd }; InsockRawMaterialController.Insert(insertModel); if (insertModel.ETD > rawMaterial.ETD) { rawMaterial.ETD = insertModel.ETD; } } } }
private void bwInsert_DoWork(object sender, DoWorkEventArgs e) { rawMaterial.ETD = dtDefault; rawMaterial.IsETDUpdate = true; foreach (OutsoleRawMaterialViewModel outsoleRawMaterialView in outsoleRawMaterialViewToDeleteList) { int outsoleSupplierId = outsoleRawMaterialView.Supplier.OutsoleSupplierId; OutsoleRawMaterialController.Delete(productNo, outsoleSupplierId); } if (outsoleRawMaterialViewToInsertList.Count > 0) { rawMaterial.ETD = outsoleRawMaterialViewToInsertList.Max(o => o.ETDReal); } foreach (OutsoleRawMaterialViewModel outsoleRawMaterialView in outsoleRawMaterialViewToInsertList) { int outsoleSupplierId = outsoleRawMaterialView.Supplier.OutsoleSupplierId; DateTime etd = TimeHelper.Convert(outsoleRawMaterialView.ETD); if (etd != dtDefault && etd != dtNothing) { OutsoleRawMaterialModel model = new OutsoleRawMaterialModel { ProductNo = productNo, OutsoleSupplierId = outsoleSupplierId, ETD = etd, }; OutsoleRawMaterialController.Insert(model); if (model.ETD > rawMaterial.ETD) { rawMaterial.ETD = model.ETD.Date; } } } }
public void CheckConversion() { Assert.AreEqual(500.0, TimeHelper.Convert(TimeSpan.FromMilliseconds(500), TimeUnit.Milliseconds)); Assert.AreEqual(500, TimeHelper.GetFromNanoSeconds(500000000, TimeUnit.Milliseconds)); }
private void threadLoad_DoWork(object sender, DoWorkEventArgs e) { object[] args = e.Argument as object[]; string sectionId = args[2] as string; if ((sectionId == sewing || sectionId == cuta || sectionId == cutb) && sewingMasterList.Count <= 0) { sewingMasterList = SewingMasterController.Select(); } if (sectionId == assembly || sectionId == cuta || sectionId == cutb && assemblyMasterList.Count <= 0) { assemblyMasterList = AssemblyMasterController.Select(); } if (sectionId == outsole && outsoleMasterList.Count <= 0) { outsoleMasterList = OutsoleMasterController.Select(); } if (sectionId == socklining && sockliningMasterList.Count <= 0) { sockliningMasterList = SockliningMasterController.Select(); } var lineList = new List <string>(); Regex regex = new Regex(@"\D"); var regexNotString = new Regex("[^a-zA-Z]"); dt = new LeadTimeReportDataSet().Tables["LeadTimeTable"]; #region SEWING if (currentSection == sewing) { //var sewingLineList = sewingMasterList // .Where(w => w.SewingLine.Contains("sewing")) // .Select(s => new { line = s.SewingLine, sort = Int32.Parse(regex.Replace(s.SewingLine, "0")) }) // .OrderBy(o => o.sort) // .ThenBy(t => t.line) // .Distinct() // .ToList(); lineList = sewingMasterList.Where(w => w.SewingLine.Contains("sew")).Select(s => s.SewingLine).Distinct().ToList(); var lineCustomList = lineList.Select(s => new { Line = s, LineNumber = regex.IsMatch(s) ? regex.Replace(s, "") : s }).ToList(); if (lineCustomList.Count() > 0) { lineCustomList = lineCustomList//.OrderBy(o => regexNotString.IsMatch(o.Line) ? regexNotString.Replace(o.Line, "") : o.Line) .OrderBy(o => String.IsNullOrEmpty(o.LineNumber) ? 100 : Int64.Parse(o.LineNumber)) .ThenBy(th => th.Line).ToList(); } foreach (var line in lineCustomList) { int qtyXDay = 0; int qtyQuota = 0; var productNoList = sewingMasterList.Where(w => w.SewingLine == line.Line).Select(s => s.ProductNo).ToList(); foreach (string productNo in productNoList) { var sewingModel = sewingMasterList.FirstOrDefault(f => f.ProductNo == productNo && TimeHelper.Convert(f.SewingActualFinishDateAuto) >= dateFrom && TimeHelper.Convert(f.SewingActualFinishDateAuto) < dateTo); if (sewingModel != null) { DateTime sewingActualStartDate = TimeHelper.Convert(sewingModel.SewingActualStartDateAuto); DateTime sewingActualFinishDate = TimeHelper.Convert(sewingModel.SewingActualFinishDateAuto); if (sewingActualStartDate != dtDefault && sewingActualStartDate != dtNothing && sewingActualFinishDate != dtDefault && sewingActualFinishDate != dtNothing) { qtyXDay += CalculateDateRange(sewingActualStartDate, sewingActualFinishDate) * sewingModel.SewingQuota; qtyQuota += sewingModel.SewingQuota; } } } CreateData(qtyXDay, qtyQuota, line.Line); } Dispatcher.Invoke(new Action(() => { ExportReport(); })); } #endregion #region ASSEMBLY if (currentSection == assembly) { var assyLineList = assemblyMasterList .Where(w => w.AssemblyLine.Contains("assy")) .Select(s => new { line = s.AssemblyLine, sort = Int32.Parse(regex.Replace(s.AssemblyLine, "")) }) .OrderBy(o => o.sort) .ThenBy(t => t.line) .Distinct() .ToList(); lineList = assyLineList.Select(s => s.line).ToList(); foreach (string line in lineList) { int qtyXDay = 0; int qtyQuota = 0; var assemblyMasterListPerLine = assemblyMasterList.Where(w => w.AssemblyLine == line).ToList(); var productNoList = assemblyMasterList.Where(w => w.AssemblyLine == line).Select(s => s.ProductNo).ToList(); foreach (string productNo in productNoList) { var assemblyModel = assemblyMasterList.Where(w => w.ProductNo == productNo && TimeHelper.Convert(w.AssemblyActualFinishDate) >= dateFrom && TimeHelper.Convert(w.AssemblyActualFinishDate) < dateTo) .FirstOrDefault(); if (assemblyModel != null) { DateTime assemblyActualStartDate = TimeHelper.Convert(assemblyModel.AssemblyActualStartDate); DateTime assemblyActualFinishDate = TimeHelper.Convert(assemblyModel.AssemblyActualFinishDate); if (assemblyActualStartDate != dtDefault && assemblyActualStartDate != dtNothing && assemblyActualFinishDate != dtDefault && assemblyActualFinishDate != dtNothing) { qtyXDay += CalculateDateRange(assemblyActualStartDate, assemblyActualFinishDate) * assemblyModel.AssemblyQuota; qtyQuota += assemblyModel.AssemblyQuota; } } } CreateData(qtyXDay, qtyQuota, line); } Dispatcher.Invoke(new Action(() => { ExportReport(); })); } #endregion #region OUTSOLE if (currentSection == outsole) { var outSoleLineList = outsoleMasterList .Where(w => w.OutsoleLine.Contains("stockfit")) .Select(s => new { line = s.OutsoleLine, sort = Int32.Parse(regex.Replace(s.OutsoleLine, "")) }) .OrderBy(o => o.sort) .ThenBy(t => t.line) .Distinct() .ToList(); lineList = outSoleLineList.Select(s => s.line).ToList(); foreach (string line in lineList) { int qtyXDay = 0; int qtyQuota = 0; var productNoList = outsoleMasterList.Where(w => w.OutsoleLine == line).Select(s => s.ProductNo).ToList(); foreach (string productNo in productNoList) { var outsoleModel = outsoleMasterList .Where(w => w.ProductNo == productNo && TimeHelper.Convert(w.OutsoleActualFinishDateAuto) >= dateFrom && TimeHelper.Convert(w.OutsoleActualFinishDateAuto) < dateTo) .FirstOrDefault(); if (outsoleModel != null) { DateTime outsoleModelActualStartDate = TimeHelper.Convert(outsoleModel.OutsoleActualStartDateAuto); DateTime outsoleModelActualFinishDate = TimeHelper.Convert(outsoleModel.OutsoleActualFinishDateAuto); if (outsoleModelActualStartDate != dtDefault && outsoleModelActualStartDate != dtNothing && outsoleModelActualFinishDate != dtDefault && outsoleModelActualFinishDate != dtNothing) { qtyXDay += CalculateDateRange(outsoleModelActualStartDate, outsoleModelActualFinishDate) * outsoleModel.OutsoleQuota; qtyQuota += outsoleModel.OutsoleQuota; } } } CreateData(qtyXDay, qtyQuota, line); } Dispatcher.Invoke(new Action(() => { ExportReport(); })); } #endregion #region SOCKLINING if (currentSection == socklining) { var sockliningLineList = sockliningMasterList .Where(w => w.SockliningLine.Contains("insock cell")) .Select(s => new { line = s.SockliningLine, sort = Int32.Parse(regex.Replace(s.SockliningLine, "")) }) .OrderBy(o => o.sort) .ThenBy(t => t.line) .Distinct() .ToList(); lineList = sockliningLineList.Select(s => s.line).ToList(); foreach (string line in lineList) { int qtyXDay = 0; int qtyQuota = 0; var productNoList = sockliningMasterList.Where(w => w.SockliningLine == line).Select(s => s.ProductNo).ToList(); foreach (string productNo in productNoList) { var sockliningModel = sockliningMasterList .Where(w => w.ProductNo == productNo && TimeHelper.Convert(w.SockliningActualFinishDate) >= dateFrom && TimeHelper.Convert(w.SockliningActualFinishDate) < dateTo) .FirstOrDefault(); if (sockliningModel != null) { DateTime sockliningModelActualStartDate = TimeHelper.Convert(sockliningModel.SockliningActualStartDate); DateTime sockliningModelActualFinishDate = TimeHelper.Convert(sockliningModel.SockliningActualFinishDate); if (sockliningModelActualStartDate != dtDefault && sockliningModelActualStartDate != dtNothing && sockliningModelActualFinishDate != dtDefault && sockliningModelActualFinishDate != dtNothing) { qtyXDay += CalculateDateRange(sockliningModelActualStartDate, sockliningModelActualFinishDate) * sockliningModel.SockliningQuota; qtyQuota += sockliningModel.SockliningQuota; } } } CreateData(qtyXDay, qtyQuota, line); } Dispatcher.Invoke(new Action(() => { ExportReport(); })); } #endregion #region CUTA if (currentSection == cuta) { var cutALineList = sewingMasterList .Where(w => w.SewingLine.Contains("sewing")) .Select(s => new { line = s.SewingLine, sort = Int32.Parse(regex.Replace(s.SewingLine, "")) }) .OrderBy(o => o.sort) .ThenBy(t => t.line) .Distinct() .ToList(); lineList = cutALineList.Select(s => s.line).ToList(); foreach (string line in lineList) { var productNoList = sewingMasterList.Where(w => w.SewingLine == line).Select(s => s.ProductNo).ToList(); int qtyXDay = 0; int qtyQuota = 0; foreach (var productNo in productNoList) { var sewingModel = sewingMasterList.Where(w => w.ProductNo == productNo).FirstOrDefault(); var assyModel = assemblyMasterList .Where(w => w.ProductNo == productNo && TimeHelper.Convert(w.AssemblyActualFinishDate) >= dateFrom && TimeHelper.Convert(w.AssemblyActualFinishDate) < dateTo) .FirstOrDefault(); if (sewingModel != null && assyModel != null) { DateTime cutAActualStartDate = TimeHelper.Convert(sewingModel.CutAActualStartDate); DateTime sewingActualFinishDate = TimeHelper.Convert(sewingModel.SewingActualFinishDate); DateTime assyActualStartDate = TimeHelper.Convert(assyModel.AssemblyActualStartDate); DateTime assyActualFinishDate = TimeHelper.Convert(assyModel.AssemblyActualFinishDate); int timeRange = 0; if (cutAActualStartDate != dtNothing && cutAActualStartDate != dtDefault && assyActualFinishDate != dtNothing && assyActualFinishDate != dtDefault) { if (assyActualStartDate != dtDefault && assyActualStartDate != dtNothing && sewingActualFinishDate != dtDefault && sewingActualFinishDate != dtNothing && assyActualStartDate > sewingActualFinishDate) { //timeRange = TimeHelper.CalculateDate(sewingActualFinishDate, assyActualStartDate); timeRange = (Int32)((assyActualStartDate - sewingActualFinishDate).TotalDays); qtyXDay += (CalculateDateRange(cutAActualStartDate, assyActualFinishDate) - timeRange) * sewingModel.CutAQuota; qtyQuota += sewingModel.CutAQuota; } else { qtyXDay += CalculateDateRange(cutAActualStartDate, assyActualFinishDate) * sewingModel.CutAQuota; qtyQuota += sewingModel.CutAQuota; } } } } CreateData(qtyXDay, qtyQuota, line); } Dispatcher.Invoke(new Action(() => { ExportReport(); })); } #endregion #region CUTB if (currentSection == cutb) { var cutBLineList = sewingMasterList .Where(w => w.SewingLine.Contains("sewing")) .Select(s => new { line = s.SewingLine, sort = Int32.Parse(regex.Replace(s.SewingLine, "")) }) .OrderBy(o => o.sort) .ThenBy(t => t.line) .Distinct() .ToList(); lineList = cutBLineList.Select(s => s.line).ToList(); foreach (string line in lineList) { var productNoList = sewingMasterList.Where(w => w.SewingLine == line).Select(s => s.ProductNo).ToList(); int qtyXDay = 0; int qtyQuota = 0; foreach (var productNo in productNoList) { var sewingModel = sewingMasterList.Where(w => w.ProductNo == productNo).FirstOrDefault(); var assyModel = assemblyMasterList .Where(w => w.ProductNo == productNo && TimeHelper.Convert(w.AssemblyActualFinishDate) >= dateFrom && TimeHelper.Convert(w.AssemblyActualFinishDate) < dateTo) .FirstOrDefault(); if (sewingModel != null && assyModel != null) { DateTime cutBActualStartDate = TimeHelper.Convert(sewingModel.CutBActualStartDate); DateTime sewingActualFinishDate = TimeHelper.Convert(sewingModel.SewingActualFinishDateAuto); DateTime assyActualStartDate = TimeHelper.Convert(assyModel.AssemblyActualStartDate); DateTime assyActualFinishDate = TimeHelper.Convert(assyModel.AssemblyActualFinishDate); int timeRange = 0; if (cutBActualStartDate != dtNothing && cutBActualStartDate != dtDefault && assyActualFinishDate != dtNothing && assyActualFinishDate != dtDefault) { if (assyActualStartDate != dtDefault && assyActualStartDate != dtNothing && sewingActualFinishDate != dtDefault && sewingActualFinishDate != dtNothing && assyActualStartDate > sewingActualFinishDate) { //timeRange = TimeHelper.CalculateDate(sewingActualFinishDate, assyActualStartDate); timeRange = (Int32)((assyActualStartDate - sewingActualFinishDate).TotalDays); qtyXDay += (CalculateDateRange(cutBActualStartDate, assyActualFinishDate) - timeRange) * sewingModel.CutAQuota; qtyQuota += sewingModel.CutAQuota; } else { qtyXDay += CalculateDateRange(cutBActualStartDate, assyActualFinishDate) * sewingModel.CutAQuota; qtyQuota += sewingModel.CutAQuota; } } } } CreateData(qtyXDay, qtyQuota, line); } Dispatcher.Invoke(new Action(() => { ExportReport(); })); } #endregion #region None //#region ARTICLE //if (currentSection == article) //{ // var articleNoList = ordersList.Select(s => new { article = s.ArticleNo.Contains("-") ? s.ArticleNo.Split('-')[0] : s.ArticleNo }).OrderBy(o => o.article).Distinct().Select(s => s.article).ToList(); // foreach (var articleNo in articleNoList) // { // int qtyXDay = 0; // int qtyQuota = 0; // var productNoList = ordersList.Where(w => w.ArticleNo.Contains(articleNo)).Select(s => s.ProductNo).ToList(); // foreach (var productNo in productNoList) // { // var sewingModel = sewingMasterList.Where(w => w.ProductNo == productNo).FirstOrDefault(); // var assyModel = assemblyMasterList // .Where(w => w.ProductNo == productNo // && TimeHelper.ConvertOldData(w.AssemblyActualFinishDate) >= dateFrom // && TimeHelper.ConvertOldData(w.AssemblyActualFinishDate) < dateTo) // .FirstOrDefault(); // if (sewingModel != null && assyModel != null) // { // DateTime cutAActualStartDate = TimeHelper.ConvertOldData(sewingModel.CutAActualStartDate); // DateTime sewingActualFinishDate = TimeHelper.ConvertOldData(sewingModel.SewingActualFinishDate); // DateTime assyActualStartDate = TimeHelper.ConvertOldData(assyModel.AssemblyActualStartDate); // DateTime assyActualFinishDate = TimeHelper.ConvertOldData(assyModel.AssemblyActualFinishDate); // int timeRange = 0; // if (cutAActualStartDate != dtNothing && cutAActualStartDate != dtDefault && assyActualFinishDate != dtNothing && assyActualFinishDate != dtDefault) // { // if (assyActualStartDate != dtDefault && assyActualStartDate != dtNothing && sewingActualFinishDate != dtDefault && sewingActualFinishDate != dtNothing && assyActualStartDate > sewingActualFinishDate) // { // timeRange = TimeHelper.CalculateDate(sewingActualFinishDate, assyActualStartDate); // qtyXDay += (CalculateDateRange(cutAActualStartDate, assyActualFinishDate) - timeRange) * sewingModel.CutAQuota; // qtyQuota += sewingModel.CutAQuota; // } // else // { // qtyXDay += CalculateDateRange(cutAActualStartDate, assyActualFinishDate) * sewingModel.CutAQuota; // qtyQuota += sewingModel.CutAQuota; // } // } // } // } // if (qtyXDay > 0) // { // CreateData(qtyXDay, qtyQuota, "", articleNo); // } // } // ExportReport(); //} //#endregion //#region PM //if (currentSection == pm) //{ // var pmNoList = ordersList.Select(s => s.PatternNo).Distinct().ToList(); // foreach (var pmNo in pmNoList) // { // int qtyXDay = 0; // int qtyQuota = 0; // var productNoList = ordersList.Where(w => w.PatternNo == pmNo).Select(s => s.ProductNo).ToList(); // foreach (var productNo in productNoList) // { // var sewingModel = sewingMasterList.Where(w => w.ProductNo == productNo).FirstOrDefault(); // var assyModel = assemblyMasterList // .Where(w => w.ProductNo == productNo // && TimeHelper.ConvertOldData(w.AssemblyActualFinishDate) >= dateFrom // && TimeHelper.ConvertOldData(w.AssemblyActualFinishDate) < dateTo) // .FirstOrDefault(); // if (sewingModel != null && assyModel != null) // { // DateTime cutAActualStartDate = TimeHelper.ConvertOldData(sewingModel.CutAActualStartDate); // DateTime sewingActualFinishDate = TimeHelper.ConvertOldData(sewingModel.SewingActualFinishDate); // DateTime assyActualStartDate = TimeHelper.ConvertOldData(assyModel.AssemblyActualStartDate); // DateTime assyActualFinishDate = TimeHelper.ConvertOldData(assyModel.AssemblyActualFinishDate); // int timeRange = 0; // if (cutAActualStartDate != dtNothing && cutAActualStartDate != dtDefault && assyActualFinishDate != dtNothing && assyActualFinishDate != dtDefault) // { // if (assyActualStartDate != dtDefault && assyActualStartDate != dtNothing && sewingActualFinishDate != dtDefault && sewingActualFinishDate != dtNothing && assyActualStartDate > sewingActualFinishDate) // { // timeRange = TimeHelper.CalculateDate(sewingActualFinishDate, assyActualStartDate); // qtyXDay += (CalculateDateRange(cutAActualStartDate, assyActualFinishDate) - timeRange) * sewingModel.CutAQuota; // qtyQuota += sewingModel.CutAQuota; // } // else // { // qtyXDay += CalculateDateRange(cutAActualStartDate, assyActualFinishDate) * sewingModel.CutAQuota; // qtyQuota += sewingModel.CutAQuota; // } // } // } // } // if (qtyXDay > 0) // { // CreateData(qtyXDay, qtyQuota, "", pmNo); // } // } // ExportReport(); //} //#endregion #endregion }
/// <summary> /// Checks that the actual duration is greater (strictly) than a comparand. /// </summary> /// <param name="fluentAssertion">The fluent assertion to be extended.</param> /// <param name="providedDuration">The duration to compare to.</param> /// <param name="unit">The unit in which the duration is expressed.</param> /// <returns>A chainable assertion.</returns> /// <exception cref="FluentAssertionException">The actual value is not greater than the provided comparand.</exception> public static IChainableFluentAssertion <IFluentAssertion <TimeSpan> > IsGreaterThan(this IFluentAssertion <TimeSpan> fluentAssertion, double providedDuration, TimeUnit unit) { var assertionRunner = fluentAssertion as IFluentAssertionRunner <TimeSpan>; var runnableAssertion = fluentAssertion as IRunnableAssertion <TimeSpan>; TimeSpan comparand = TimeHelper.ToTimeSpan(providedDuration, unit); return(assertionRunner.ExecuteAssertion( () => { if (runnableAssertion.Value <= comparand) { throw new FluentAssertionException(string.Format("\nThe actual value of:\n\t[{0} {2}]\nis not greater than:\n\t[{1} {2}]\nas expected.", TimeHelper.Convert(runnableAssertion.Value, unit), TimeHelper.Convert(comparand, unit), unit)); } }, string.Format("\nThe actual value of:\n\t[{0} {2}]\nis greater than:\n\t[{1} {2}]\nwhich is unexpected.", TimeHelper.Convert(runnableAssertion.Value, unit), TimeHelper.Convert(comparand, unit), unit))); }
/// <summary> /// Checks that the actual duration is less (strictly) than a comparand. /// </summary> /// <param name="fluentAssertion">The fluent assertion to be extended.</param> /// <param name="comparand">The value to compare to.</param> /// <returns>A chainable assertion.</returns> /// <exception cref="FluentAssertionException">The actual value is not less than the provided comparand.</exception> public static IChainableFluentAssertion <IFluentAssertion <TimeSpan> > IsLessThan(this IFluentAssertion <TimeSpan> fluentAssertion, TimeSpan comparand) { var assertionRunner = fluentAssertion as IFluentAssertionRunner <TimeSpan>; var runnableAssertion = fluentAssertion as IRunnableAssertion <TimeSpan>; TimeUnit unit = TimeHelper.DiscoverUnit(comparand); return(assertionRunner.ExecuteAssertion( () => { if (runnableAssertion.Value >= comparand) { throw new FluentAssertionException(string.Format("\nThe actual value of:\n\t[{0} {2}]\nis not less than:\n\t[{1} {2}]\nas expected.", TimeHelper.Convert(runnableAssertion.Value, unit), TimeHelper.Convert(comparand, unit), unit)); } }, string.Format("\nThe actual value of:\n\t[{0} {2}]\nis less than:\n\t[{1} {2}]\nwhich is unexpected.", TimeHelper.Convert(runnableAssertion.Value, unit), TimeHelper.Convert(comparand, unit), unit))); }
private void bwSearch_DoWork(object sender, DoWorkEventArgs e) { if (modePerStyle == "PM") { reportTitle = pm; orderList = OrdersController.Select().Where(w => w.PatternNo == pm).ToList(); } if (modePerStyle == "Article") { reportTitle = "Article: " + articleNo; orderList = OrdersController.Select().Where(w => w.ArticleNo.Contains(articleNo)).ToList(); } sewingMasterList = SewingMasterController.Select(); sockliningMasterList = SockliningMasterController.Select(); outsoleMasterList = OutsoleMasterController.Select(); assemblyMasterList = AssemblyMasterController.Select(); DataTable dt = new LeadTimePerStyleDataSet().Tables["LeadTimePerStyleTable"]; List <string> productNoList = orderList.Select(s => s.ProductNo).Distinct().ToList(); double timeAverage = 0; foreach (string phase in phaseList) { int qtyXDay = 0, qtyQuota = 0; timeAverage = 0; // Sewing if (phase == phaseList[0]) { foreach (string productNo in productNoList) { var sewingModel = sewingMasterList.Where(w => w.ProductNo == productNo && TimeHelper.Convert(w.SewingActualStartDateAuto) != dtNothing && TimeHelper.Convert(w.SewingActualStartDateAuto) != dtDefault && TimeHelper.Convert(w.SewingActualFinishDateAuto) != dtNothing && TimeHelper.Convert(w.SewingActualFinishDateAuto) != dtDefault).FirstOrDefault(); if (sewingModel != null) { DateTime sewingActualStartDate = TimeHelper.Convert(sewingModel.SewingActualStartDateAuto); DateTime sewingActualFinishDate = TimeHelper.Convert(sewingModel.SewingActualFinishDateAuto); qtyXDay += CalculateDateRange(sewingActualStartDate, sewingActualFinishDate) * sewingModel.SewingQuota; qtyQuota += sewingModel.SewingQuota; } } timeAverage = (double)qtyXDay / (double)qtyQuota; } // Socklining if (phase == phaseList[1]) { timeAverage = 0; foreach (string productNo in productNoList) { var sockliningModel = sockliningMasterList.Where(w => w.ProductNo == productNo && TimeHelper.Convert(w.SockliningActualStartDate) != dtNothing && TimeHelper.Convert(w.SockliningActualStartDate) != dtDefault && TimeHelper.Convert(w.SockliningActualFinishDate) != dtNothing && TimeHelper.Convert(w.SockliningActualFinishDate) != dtDefault).FirstOrDefault(); if (sockliningModel != null) { DateTime sockliningActualStartDate = TimeHelper.Convert(sockliningModel.SockliningActualStartDate); DateTime sockliningActualFinishDate = TimeHelper.Convert(sockliningModel.SockliningActualFinishDate); qtyXDay += CalculateDateRange(sockliningActualStartDate, sockliningActualFinishDate) * sockliningModel.SockliningQuota; qtyQuota += sockliningModel.SockliningQuota; } } timeAverage = (double)qtyXDay / (double)qtyQuota; } // Outsole if (phase == phaseList[2]) { timeAverage = 0; foreach (string productNo in productNoList) { var outsoleModel = outsoleMasterList.Where(w => w.ProductNo == productNo && TimeHelper.Convert(w.OutsoleActualStartDateAuto) != dtNothing && TimeHelper.Convert(w.OutsoleActualStartDateAuto) != dtDefault && TimeHelper.Convert(w.OutsoleActualFinishDateAuto) != dtNothing && TimeHelper.Convert(w.OutsoleActualFinishDateAuto) != dtDefault).FirstOrDefault(); if (outsoleModel != null) { DateTime outsoleActualStartDate = TimeHelper.Convert(outsoleModel.OutsoleActualStartDateAuto); DateTime outsoleActualFinishDate = TimeHelper.Convert(outsoleModel.OutsoleActualFinishDateAuto); qtyXDay += CalculateDateRange(outsoleActualStartDate, outsoleActualFinishDate) * outsoleModel.OutsoleQuota; qtyQuota += outsoleModel.OutsoleQuota; } } timeAverage = (double)qtyXDay / (double)qtyQuota; } // Assembly if (phase == phaseList[3]) { timeAverage = 0; foreach (string productNo in productNoList) { var assemblyModel = assemblyMasterList.Where(w => w.ProductNo == productNo && TimeHelper.Convert(w.AssemblyActualStartDate) != dtNothing && TimeHelper.Convert(w.AssemblyActualStartDate) != dtDefault && TimeHelper.Convert(w.AssemblyActualFinishDate) != dtNothing && TimeHelper.Convert(w.AssemblyActualFinishDate) != dtDefault).FirstOrDefault(); if (assemblyModel != null) { DateTime assemblyActualStartDate = TimeHelper.Convert(assemblyModel.AssemblyActualStartDate); DateTime assemblyActualFinishDate = TimeHelper.Convert(assemblyModel.AssemblyActualFinishDate); qtyXDay += CalculateDateRange(assemblyActualStartDate, assemblyActualFinishDate) * assemblyModel.AssemblyQuota; qtyQuota += assemblyModel.AssemblyQuota; } } timeAverage = (double)qtyXDay / (double)qtyQuota; } // Cut A To Box if (phase == phaseList[4]) { timeAverage = 0; foreach (string productNo in productNoList) { var sewingModel = sewingMasterList.Where(w => w.ProductNo == productNo && TimeHelper.Convert(w.CutAActualStartDate) != dtNothing && TimeHelper.Convert(w.CutAActualStartDate) != dtDefault).FirstOrDefault(); var assemblyModel = assemblyMasterList.Where(w => w.ProductNo == productNo && TimeHelper.Convert(w.AssemblyActualFinishDate) != dtNothing && TimeHelper.Convert(w.AssemblyActualFinishDate) != dtDefault).FirstOrDefault(); if (sewingModel != null && assemblyModel != null) { DateTime cutAActualStartDate = TimeHelper.Convert(sewingModel.CutAActualStartDate); DateTime sewingActualFinishDate = TimeHelper.Convert(sewingModel.SewingActualFinishDateAuto); DateTime assyActualStartDate = TimeHelper.Convert(assemblyModel.AssemblyActualStartDate); DateTime assyActualFinishDate = TimeHelper.Convert(assemblyModel.AssemblyActualFinishDate); int timeRange = 0; if (assyActualStartDate != dtDefault && assyActualStartDate != dtNothing && sewingActualFinishDate != dtDefault && sewingActualFinishDate != dtNothing && assyActualStartDate > sewingActualFinishDate) { //timeRange = TimeHelper.CalculateDate(sewingActualFinishDate, assyActualStartDate); timeRange = (Int32)((assyActualStartDate - sewingActualFinishDate).TotalDays); qtyXDay += (CalculateDateRange(cutAActualStartDate, assyActualFinishDate) - timeRange) * sewingModel.CutAQuota; qtyQuota += sewingModel.CutAQuota; } else { qtyXDay += CalculateDateRange(cutAActualStartDate, assyActualFinishDate) * sewingModel.CutAQuota; qtyQuota += sewingModel.CutAQuota; } } } timeAverage = (double)qtyXDay / (double)qtyQuota; } // Cut B To Box if (phase == phaseList[4]) { timeAverage = 0; foreach (string productNo in productNoList) { var sewingModel = sewingMasterList.Where(w => w.ProductNo == productNo && TimeHelper.Convert(w.CutBActualStartDate) != dtNothing && TimeHelper.Convert(w.CutBActualStartDate) != dtDefault).FirstOrDefault(); var assemblyModel = assemblyMasterList.Where(w => w.ProductNo == productNo && TimeHelper.Convert(w.AssemblyActualFinishDate) != dtNothing && TimeHelper.Convert(w.AssemblyActualFinishDate) != dtDefault).FirstOrDefault(); if (sewingModel != null && assemblyModel != null) { DateTime cutBActualStartDate = TimeHelper.Convert(sewingModel.CutBActualStartDate); DateTime sewingActualFinishDate = TimeHelper.Convert(sewingModel.SewingActualFinishDateAuto); DateTime assyActualStartDate = TimeHelper.Convert(assemblyModel.AssemblyActualStartDate); DateTime assyActualFinishDate = TimeHelper.Convert(assemblyModel.AssemblyActualFinishDate); int timeRange = 0; if (assyActualStartDate != dtDefault && assyActualStartDate != dtNothing && sewingActualFinishDate != dtDefault && sewingActualFinishDate != dtNothing && assyActualStartDate > sewingActualFinishDate) { //timeRange = TimeHelper.CalculateDate(sewingActualFinishDate, assyActualStartDate); timeRange = (Int32)((assyActualStartDate - sewingActualFinishDate).TotalDays); qtyXDay += (CalculateDateRange(cutBActualStartDate, assyActualFinishDate) - timeRange) * sewingModel.CutAQuota; qtyQuota += sewingModel.CutAQuota; } else { qtyXDay += CalculateDateRange(cutBActualStartDate, assyActualFinishDate) * sewingModel.CutAQuota; qtyQuota += sewingModel.CutAQuota; } } } timeAverage = (double)qtyXDay / (double)qtyQuota; } string timeAverageString = ""; if (timeAverage > 0) { timeAverageString = string.Format("{0:0.00}", timeAverage); } DataRow dr = dt.NewRow(); dr["Phase"] = phase; dr["TimeAverage"] = timeAverageString; dt.Rows.Add(dr); } e.Result = dt; }
public void ConvertWorks() { Check.That(TimeHelper.Convert(TimeSpan.FromMilliseconds(500), TimeUnit.Milliseconds)).IsEqualTo(500.0); }
public static bool Insert_2(SewingMasterModel model, AccountModel account) { DateTime dtDefault = new DateTime(2000, 01, 01); var @ProductNo = new SqlParameter("@ProductNo", model.ProductNo); var @Sequence = new SqlParameter("@Sequence", model.Sequence); var @SewingLine = new SqlParameter("@SewingLine", model.SewingLine); var @SewingStartDate = new SqlParameter("@SewingStartDate", model.SewingStartDate); var @SewingFinishDate = new SqlParameter("@SewingFinishDate", model.SewingFinishDate); var @SewingQuota = new SqlParameter("@SewingQuota", model.SewingQuota); var @SewingPrep = new SqlParameter("@SewingPrep", model.SewingPrep); var @SewingActualStartDate = new SqlParameter("@SewingActualStartDate", model.SewingActualStartDate); var @SewingActualFinishDate = new SqlParameter("@SewingActualFinishDate", model.SewingActualFinishDate); DateTime sewingActualStartDateAutoDt = TimeHelper.Convert(model.SewingActualStartDateAuto); DateTime sewingActualFinishDateAutoDt = TimeHelper.Convert(model.SewingActualFinishDateAuto); string sewingActualStartDateAutoString = ""; if (sewingActualStartDateAutoDt != dtDefault) { sewingActualStartDateAutoString = String.Format("{0:MM/dd/yyyy}", sewingActualStartDateAutoDt); } string sewingActualFinishDateAutoString = ""; if (sewingActualFinishDateAutoDt != dtDefault) { sewingActualFinishDateAutoString = String.Format("{0:MM/dd/yyyy}", sewingActualFinishDateAutoDt); } var @SewingActualStartDateAuto = new SqlParameter("@SewingActualStartDateAuto", sewingActualStartDateAutoString); var @SewingActualFinishDateAuto = new SqlParameter("@SewingActualFinishDateAuto", sewingActualFinishDateAutoString); //var @SewingBalance = new SqlParameter("@SewingBalance", model.SewingBalance); var sewingBalanceInsert = model.SewingBalance; if (model.SewingBalance_Date != dtDefault) { sewingBalanceInsert = model.SewingBalance_Date.ToShortDateString(); } var @SewingBalance = new SqlParameter("@SewingBalance", sewingBalanceInsert); var @CutAStartDate = new SqlParameter("@CutAStartDate", model.CutAStartDate); var @CutAFinishDate = new SqlParameter("@CutAFinishDate", model.CutAFinishDate); var @CutAQuota = new SqlParameter("@CutAQuota", model.CutAQuota); var @CutAActualStartDate = new SqlParameter("@CutAActualStartDate", model.CutAActualStartDate); var @CutAActualFinishDate = new SqlParameter("@CutAActualFinishDate", model.CutAActualFinishDate); var cutABalanceInsert = model.CutABalance; if (model.CutABalance_Date != dtDefault) { cutABalanceInsert = model.CutABalance_Date.ToShortDateString(); } var @CutABalance = new SqlParameter("@CutABalance", cutABalanceInsert); var @PrintingBalance = new SqlParameter("@PrintingBalance", model.PrintingBalance); var @H_FBalance = new SqlParameter("@H_FBalance", model.H_FBalance); var @EmbroideryBalance = new SqlParameter("@EmbroideryBalance", model.EmbroideryBalance); var @CutBActualStartDate = new SqlParameter("@CutBActualStartDate", model.CutBActualStartDate); var @CutBBalance = new SqlParameter("@CutBBalance", model.CutBBalance); var @AutoCut = new SqlParameter("@AutoCut", model.AutoCut); var @LaserCut = new SqlParameter("@LaserCut", model.LaserCut); var @HuasenCut = new SqlParameter("@HuasenCut", model.HuasenCut); var @CutBStartDate = new SqlParameter("@CutBStartDate", model.CutBStartDate); var @AtomCutA = new SqlParameter("@AtomCutA", model.AtomCutA); var @AtomCutB = new SqlParameter("@AtomCutB", model.AtomCutB); var @LaserCutA = new SqlParameter("@LaserCutA", model.LaserCutA); var @LaserCutB = new SqlParameter("@LaserCutB", model.LaserCutB); var @HuasenCutA = new SqlParameter("@HuasenCutA", model.HuasenCutA); var @HuasenCutB = new SqlParameter("@HuasenCutB", model.HuasenCutB); var @ComelzCutA = new SqlParameter("@ComelzCutA", model.ComelzCutA); var @ComelzCutB = new SqlParameter("@ComelzCutB", model.ComelzCutB); var @IsSequenceUpdate = new SqlParameter("@IsSequenceUpdate", model.IsSequenceUpdate); var @IsSewingLineUpdate = new SqlParameter("@IsSewingLineUpdate", model.IsSewingLineUpdate); var @IsSewingStartDateUpdate = new SqlParameter("@IsSewingStartDateUpdate", model.IsSewingStartDateUpdate); var @IsSewingFinishDateUpdate = new SqlParameter("@IsSewingFinishDateUpdate", model.IsSewingFinishDateUpdate); var @IsSewingQuotaUpdate = new SqlParameter("@IsSewingQuotaUpdate", model.IsSewingQuotaUpdate); var @IsSewingPrepUpdate = new SqlParameter("@IsSewingPrepUpdate", model.IsSewingPrepUpdate); var @IsSewingActualStartDateUpdate = new SqlParameter("@IsSewingActualStartDateUpdate", model.IsSewingActualStartDateUpdate); var @IsSewingActualFinishDateUpdate = new SqlParameter("@IsSewingActualFinishDateUpdate", model.IsSewingActualFinishDateUpdate); var @IsSewingActualStartDateAutoUpdate = new SqlParameter("@IsSewingActualStartDateAutoUpdate", model.IsSewingActualStartDateAutoUpdate); var @IsSewingActualFinishDateAutoUpdate = new SqlParameter("@IsSewingActualFinishDateAutoUpdate", model.IsSewingActualFinishDateAutoUpdate); var @IsSewingBalanceUpdate = new SqlParameter("@IsSewingBalanceUpdate", model.IsSewingBalanceUpdate); var @IsCutAStartDateUpdate = new SqlParameter("@IsCutAStartDateUpdate", model.IsCutAStartDateUpdate); var @IsCutAFinishDateUpdate = new SqlParameter("@IsCutAFinishDateUpdate", model.IsCutAFinishDateUpdate); var @IsCutAQuotaUpdate = new SqlParameter("@IsCutAQuotaUpdate", model.IsCutAQuotaUpdate); var @IsCutAActualStartDateUpdate = new SqlParameter("@IsCutAActualStartDateUpdate", model.IsCutAActualStartDateUpdate); var @IsCutAActualFinishDateUpdate = new SqlParameter("@IsCutAActualFinishDateUpdate", model.IsCutAActualFinishDateUpdate); var @IsCutABalanceUpdate = new SqlParameter("@IsCutABalanceUpdate", model.IsCutABalanceUpdate); var @IsPrintingBalanceUpdate = new SqlParameter("@IsPrintingBalanceUpdate", model.IsPrintingBalanceUpdate); var @IsH_FBalanceUpdate = new SqlParameter("@IsH_FBalanceUpdate", model.IsH_FBalanceUpdate); var @IsEmbroideryBalanceUpdate = new SqlParameter("@IsEmbroideryBalanceUpdate", model.IsEmbroideryBalanceUpdate); var @IsCutBActualStartDateUpdate = new SqlParameter("@IsCutBActualStartDateUpdate", model.IsCutBActualStartDateUpdate); var @IsCutBBalanceUpdate = new SqlParameter("@IsCutBBalanceUpdate", model.IsCutBBalanceUpdate); var @IsAutoCutUpdate = new SqlParameter("@IsAutoCutUpdate", model.IsAutoCutUpdate); var @IsLaserCutUpdate = new SqlParameter("@IsLaserCutUpdate", model.IsLaserCutUpdate); var @IsHuasenCutUpdate = new SqlParameter("@IsHuasenCutUpdate", model.IsHuasenCutUpdate); var @IsCutBStartDateUpdate = new SqlParameter("@IsCutBStartDateUpdate", model.IsUpdateCutBStartDate); var @IsAtomCutAUpdate = new SqlParameter("@IsAtomCutAUpdate", model.IsUpdateAtomCutA); var @IsAtomCutBUpdate = new SqlParameter("@IsAtomCutBUpdate", model.IsUpdateAtomCutB); var @IsLaserCutAUpdate = new SqlParameter("@IsLaserCutAUpdate", model.IsUpdateLaserCutA); var @IsLaserCutBUpdate = new SqlParameter("@IsLaserCutBUpdate", model.IsUpdateLaserCutB); var @IsHuasenCutAUpdate = new SqlParameter("@IsHuasenCutAUpdate", model.IsUpdateHuasenCutA); var @IsHuasenCutBUpdate = new SqlParameter("@IsHuasenCutBUpdate", model.IsUpdateHuasenCutB); var @IsComelzCutAUpdate = new SqlParameter("@IsComelzCutAUpdate", model.IsUpdateComelzCutA); var @IsComelzCutBUpdate = new SqlParameter("@IsComelzCutBUpdate", model.IsUpdateComelzCutB); var @Reviser = new SqlParameter("@Reviser", account.FullName); var @SewingActualStartDate_Date = new SqlParameter("@SewingActualStartDate_Date", model.SewingActualStartDate_Date); var @SewingActualFinishDate_Date = new SqlParameter("@SewingActualFinishDate_Date", model.SewingActualFinishDate_Date); var @CutAActualStartDate_Date = new SqlParameter("@CutAActualStartDate_Date", model.CutAActualStartDate_Date); var @CutAActualFinishDate_Date = new SqlParameter("@CutAActualFinishDate_Date", model.CutAActualFinishDate_Date); using (var db = new SaovietMasterScheduleEntities()) { db.CommandTimeout = 120; if (db.ExecuteStoreCommand(@"EXEC spm_InsertSewingMaster_10 @ProductNo, @Sequence, @SewingLine, @SewingStartDate, @SewingFinishDate, @SewingQuota, @SewingPrep, @SewingActualStartDate, @SewingActualFinishDate, @SewingActualStartDateAuto, @SewingActualFinishDateAuto, @SewingBalance, @CutAStartDate, @CutAFinishDate, @CutAQuota, @CutAActualStartDate, @CutAActualFinishDate, @CutABalance, @PrintingBalance, @H_FBalance, @EmbroideryBalance, @CutBActualStartDate, @CutBBalance, @AutoCut, @LaserCut, @HuasenCut, @CutBStartDate, @AtomCutA, @AtomCutB, @LaserCutA, @LaserCutB, @HuasenCutA, @HuasenCutB, @ComelzCutA, @ComelzCutB, @IsSequenceUpdate, @IsSewingLineUpdate, @IsSewingStartDateUpdate, @IsSewingFinishDateUpdate, @IsSewingQuotaUpdate, @IsSewingPrepUpdate, @IsSewingActualStartDateUpdate, @IsSewingActualFinishDateUpdate, @IsSewingActualStartDateAutoUpdate, @IsSewingActualFinishDateAutoUpdate, @IsSewingBalanceUpdate, @IsCutAStartDateUpdate, @IsCutAFinishDateUpdate, @IsCutAQuotaUpdate, @IsCutAActualStartDateUpdate, @IsCutAActualFinishDateUpdate, @IsCutABalanceUpdate, @IsPrintingBalanceUpdate, @IsH_FBalanceUpdate, @IsEmbroideryBalanceUpdate, @IsCutBActualStartDateUpdate, @IsCutBBalanceUpdate, @IsAutoCutUpdate, @IsLaserCutUpdate, @IsHuasenCutUpdate, @IsCutBStartDateUpdate, @IsAtomCutAUpdate, @IsAtomCutBUpdate, @IsLaserCutAUpdate, @IsLaserCutBUpdate, @IsHuasenCutAUpdate, @IsHuasenCutBUpdate, @IsComelzCutAUpdate, @IsComelzCutBUpdate, @Reviser, @SewingActualStartDate_Date, @SewingActualFinishDate_Date, @CutAActualStartDate_Date, @CutAActualFinishDate_Date", @ProductNo, @Sequence, @SewingLine, @SewingStartDate, @SewingFinishDate, @SewingQuota, @SewingPrep, @SewingActualStartDate, @SewingActualFinishDate, @SewingActualStartDateAuto, @SewingActualFinishDateAuto, @SewingBalance, @CutAStartDate, @CutAFinishDate, @CutAQuota, @CutAActualStartDate, @CutAActualFinishDate, @CutABalance, @PrintingBalance, @H_FBalance, @EmbroideryBalance, @CutBActualStartDate, @CutBBalance, @AutoCut, @LaserCut, @HuasenCut, @CutBStartDate, @AtomCutA, @AtomCutB, @LaserCutA, @LaserCutB, @HuasenCutA, @HuasenCutB, @ComelzCutA, @ComelzCutB, @IsSequenceUpdate, @IsSewingLineUpdate, @IsSewingStartDateUpdate, @IsSewingFinishDateUpdate, @IsSewingQuotaUpdate, @IsSewingPrepUpdate, @IsSewingActualStartDateUpdate, @IsSewingActualFinishDateUpdate, @IsSewingActualStartDateAutoUpdate, @IsSewingActualFinishDateAutoUpdate, @IsSewingBalanceUpdate, @IsCutAStartDateUpdate, @IsCutAFinishDateUpdate, @IsCutAQuotaUpdate, @IsCutAActualStartDateUpdate, @IsCutAActualFinishDateUpdate, @IsCutABalanceUpdate, @IsPrintingBalanceUpdate, @IsH_FBalanceUpdate, @IsEmbroideryBalanceUpdate, @IsCutBActualStartDateUpdate, @IsCutBBalanceUpdate, @IsAutoCutUpdate, @IsLaserCutUpdate, @IsHuasenCutUpdate, @IsCutBStartDateUpdate, @IsAtomCutAUpdate, @IsAtomCutBUpdate, @IsLaserCutAUpdate, @IsLaserCutBUpdate, @IsHuasenCutAUpdate, @IsHuasenCutBUpdate, @IsComelzCutAUpdate, @IsComelzCutBUpdate, @Reviser, @SewingActualStartDate_Date, @SewingActualFinishDate_Date, @CutAActualStartDate_Date, @CutAActualFinishDate_Date) > 0) { return(true); } return(false); } }
public static bool Insert_2(OutsoleMasterModel model, AccountModel account) { DateTime dtDefault = new DateTime(2000, 01, 01); var @ProductNo = new SqlParameter("@ProductNo", model.ProductNo != null ? model.ProductNo : ""); var @Sequence = new SqlParameter("@Sequence", model.Sequence); var @OutsoleLine = new SqlParameter("@OutsoleLine", model.OutsoleLine != null ? model.OutsoleLine : ""); var @OutsoleStartDate = new SqlParameter("@OutsoleStartDate", model.OutsoleStartDate != null ? model.OutsoleStartDate : dtDefault); var @OutsoleFinishDate = new SqlParameter("@OutsoleFinishDate", model.OutsoleFinishDate != null ? model.OutsoleFinishDate : dtDefault); var @OutsoleQuota = new SqlParameter("@OutsoleQuota", model.OutsoleQuota); var @OutsoleActualStartDate = new SqlParameter("@OutsoleActualStartDate", model.OutsoleActualStartDate != null ? model.OutsoleActualStartDate : ""); var @OutsoleActualFinishDate = new SqlParameter("@OutsoleActualFinishDate", model.OutsoleActualFinishDate != null ? model.OutsoleActualFinishDate : ""); var @Remarks = new SqlParameter("@Remarks", model.Remarks != null ? model.Remarks : ""); DateTime outsoleActualStartDateAutoDt = TimeHelper.Convert(model.OutsoleActualStartDateAuto); DateTime outsoleActualFinishDateAutoDt = TimeHelper.Convert(model.OutsoleActualFinishDateAuto); string outsoleActualStartDateAutoString = ""; if (outsoleActualStartDateAutoDt != dtDefault) { outsoleActualStartDateAutoString = String.Format("{0:MM/dd/yyyy}", outsoleActualStartDateAutoDt); } string outsoleActualFinishDateAutoString = ""; if (outsoleActualFinishDateAutoDt != dtDefault) { outsoleActualFinishDateAutoString = String.Format("{0:MM/dd/yyyy}", outsoleActualFinishDateAutoDt); } var @OutsoleActualStartDateAuto = new SqlParameter("@OutsoleActualStartDateAuto", outsoleActualStartDateAutoString); var @OutsoleActualFinishDateAuto = new SqlParameter("@OutsoleActualFinishDateAuto", outsoleActualFinishDateAutoString); var outsoleBalanceInsert = model.OutsoleBalance; if (model.OutsoleBalance_Date != dtDefault) { outsoleBalanceInsert = String.Format("{0:MM/dd/yyyy}", model.OutsoleBalance_Date); } var @OutsoleBalance = new SqlParameter("@OutsoleBalance", outsoleBalanceInsert); var @IsSequenceUpdate = new SqlParameter("@IsSequenceUpdate", model.IsSequenceUpdate); var @IsOutsoleLineUpdate = new SqlParameter("@IsOutsoleLineUpdate", model.IsOutsoleLineUpdate); var @IsOutsoleStartDateUpdate = new SqlParameter("@IsOutsoleStartDateUpdate", model.IsOutsoleStartDateUpdate); var @IsOutsoleFinishDateUpdate = new SqlParameter("@IsOutsoleFinishDateUpdate", model.IsOutsoleFinishDateUpdate); var @IsOutsoleQuotaUpdate = new SqlParameter("@IsOutsoleQuotaUpdate", model.IsOutsoleQuotaUpdate); var @IsOutsoleActualStartDateUpdate = new SqlParameter("@IsOutsoleActualStartDateUpdate", model.IsOutsoleActualStartDateUpdate); var @IsOutsoleActualFinishDateUpdate = new SqlParameter("@IsOutsoleActualFinishDateUpdate", model.IsOutsoleActualFinishDateUpdate); var @IsOutsoleActualStartDateAutoUpdate = new SqlParameter("@IsOutsoleActualStartDateAutoUpdate", model.IsOutsoleActualStartDateAutoUpdate); var @IsOutsoleActualFinishDateAutoUpdate = new SqlParameter("@IsOutsoleActualFinishDateAutoUpdate", model.IsOutsoleActualFinishDateAutoUpdate); var @IsOutsoleBalanceUpdate = new SqlParameter("@IsOutsoleBalanceUpdate", model.IsOutsoleBalanceUpdate); var @IsRemarksUpdate = new SqlParameter("@IsRemarksUpdate", model.IsRemarksUpdate); var @OutsoleActualStartDate_Date = new SqlParameter("@OutsoleActualStartDate_Date", model.OutsoleActualStartDate_Date); var @OutsoleActualFinishDate_Date = new SqlParameter("@OutsoleActualFinishDate_Date", model.OutsoleActualFinishDate_Date); var @Reviser = new SqlParameter("@Reviser", account.FullName); SaovietMasterScheduleEntities db = new SaovietMasterScheduleEntities(); if (db.ExecuteStoreCommand(@"EXEC spm_InsertOutsoleMaster_8 @ProductNo, @Sequence, @OutsoleLine, @OutsoleStartDate, @OutsoleFinishDate, @OutsoleQuota, @OutsoleActualStartDate, @OutsoleActualFinishDate, @OutsoleActualStartDateAuto, @OutsoleActualFinishDateAuto, @OutsoleBalance, @Remarks, @IsSequenceUpdate, @IsOutsoleLineUpdate, @IsOutsoleStartDateUpdate, @IsOutsoleFinishDateUpdate, @IsOutsoleQuotaUpdate, @IsOutsoleActualStartDateUpdate, @IsOutsoleActualFinishDateUpdate, @IsOutsoleActualStartDateAutoUpdate, @IsOutsoleActualFinishDateAutoUpdate, @IsOutsoleBalanceUpdate, @IsRemarksUpdate, @OutsoleActualStartDate_Date, @OutsoleActualFinishDate_Date, @Reviser", @ProductNo, @Sequence, @OutsoleLine, @OutsoleStartDate, @OutsoleFinishDate, @OutsoleQuota, @OutsoleActualStartDate, @OutsoleActualFinishDate, @OutsoleActualStartDateAuto, @OutsoleActualFinishDateAuto, @OutsoleBalance, @Remarks, @IsSequenceUpdate, @IsOutsoleLineUpdate, @IsOutsoleStartDateUpdate, @IsOutsoleFinishDateUpdate, @IsOutsoleQuotaUpdate, @IsOutsoleActualStartDateUpdate, @IsOutsoleActualFinishDateUpdate, @IsOutsoleActualStartDateAutoUpdate, @IsOutsoleActualFinishDateAutoUpdate, @IsOutsoleBalanceUpdate, @IsRemarksUpdate, @OutsoleActualStartDate_Date, @OutsoleActualFinishDate_Date, @Reviser) > 0) { return(true); } return(false); }
public static bool Insert_2(SewingMasterModel model) { DateTime dtDefault = new DateTime(2000, 01, 01); var @ProductNo = new SqlParameter("@ProductNo", model.ProductNo); var @Sequence = new SqlParameter("@Sequence", model.Sequence); var @SewingLine = new SqlParameter("@SewingLine", model.SewingLine); var @SewingStartDate = new SqlParameter("@SewingStartDate", model.SewingStartDate); var @SewingFinishDate = new SqlParameter("@SewingFinishDate", model.SewingFinishDate); var @SewingQuota = new SqlParameter("@SewingQuota", model.SewingQuota); var @SewingPrep = new SqlParameter("@SewingPrep", model.SewingPrep); var @SewingActualStartDate = new SqlParameter("@SewingActualStartDate", model.SewingActualStartDate); var @SewingActualFinishDate = new SqlParameter("@SewingActualFinishDate", model.SewingActualFinishDate); DateTime sewingActualStartDateAutoDt = TimeHelper.Convert(model.SewingActualStartDateAuto); DateTime sewingActualFinishDateAutoDt = TimeHelper.Convert(model.SewingActualFinishDateAuto); string sewingActualStartDateAutoString = ""; if (sewingActualStartDateAutoDt != dtDefault) { sewingActualStartDateAutoString = String.Format("{0:MM/dd/yyyy}", sewingActualStartDateAutoDt); } string sewingActualFinishDateAutoString = ""; if (sewingActualFinishDateAutoDt != dtDefault) { sewingActualFinishDateAutoString = String.Format("{0:MM/dd/yyyy}", sewingActualFinishDateAutoDt); } var @SewingActualStartDateAuto = new SqlParameter("@SewingActualStartDateAuto", sewingActualStartDateAutoString); var @SewingActualFinishDateAuto = new SqlParameter("@SewingActualFinishDateAuto", sewingActualFinishDateAutoString); var @SewingBalance = new SqlParameter("@SewingBalance", model.SewingBalance); var @CutAStartDate = new SqlParameter("@CutAStartDate", model.CutAStartDate); var @CutAFinishDate = new SqlParameter("@CutAFinishDate", model.CutAFinishDate); var @CutAQuota = new SqlParameter("@CutAQuota", model.CutAQuota); DateTime cutAActualStartDateDt = TimeHelper.Convert(model.CutAActualStartDate); DateTime cutAActualFinishDateDt = TimeHelper.Convert(model.CutAActualFinishDate); string cutAActualStartDateString = ""; if (cutAActualStartDateDt != dtDefault) { cutAActualStartDateString = String.Format("{0:MM/dd/yyyy}", cutAActualStartDateDt); } string cutAActualFinishDateString = ""; if (cutAActualFinishDateDt != dtDefault) { cutAActualFinishDateString = String.Format("{0:MM/dd/yyyy}", cutAActualFinishDateDt); } var @CutAActualStartDate = new SqlParameter("@CutAActualStartDate", cutAActualStartDateString); var @CutAActualFinishDate = new SqlParameter("@CutAActualFinishDate", cutAActualFinishDateString); var @CutABalance = new SqlParameter("@CutABalance", model.CutABalance); var @PrintingBalance = new SqlParameter("@PrintingBalance", model.PrintingBalance); var @H_FBalance = new SqlParameter("@H_FBalance", model.H_FBalance); var @EmbroideryBalance = new SqlParameter("@EmbroideryBalance", model.EmbroideryBalance); DateTime cutBActualStartDateDt = TimeHelper.Convert(model.CutBActualStartDate); string cutBActualStartDateString = ""; if (cutBActualStartDateDt != dtDefault) { cutBActualStartDateString = String.Format("{0:MM/dd/yyyy}", cutBActualStartDateDt); } var @CutBActualStartDate = new SqlParameter("@CutBActualStartDate", cutBActualStartDateString); var @CutBBalance = new SqlParameter("@CutBBalance", model.CutBBalance); var @AutoCut = new SqlParameter("@AutoCut", model.AutoCut); var @LaserCut = new SqlParameter("@LaserCut", model.LaserCut); var @HuasenCut = new SqlParameter("@HuasenCut", model.HuasenCut); var @IsSequenceUpdate = new SqlParameter("@IsSequenceUpdate", model.IsSequenceUpdate); var @IsSewingLineUpdate = new SqlParameter("@IsSewingLineUpdate", model.IsSewingLineUpdate); var @IsSewingStartDateUpdate = new SqlParameter("@IsSewingStartDateUpdate", model.IsSewingStartDateUpdate); var @IsSewingFinishDateUpdate = new SqlParameter("@IsSewingFinishDateUpdate", model.IsSewingFinishDateUpdate); var @IsSewingQuotaUpdate = new SqlParameter("@IsSewingQuotaUpdate", model.IsSewingQuotaUpdate); var @IsSewingPrepUpdate = new SqlParameter("@IsSewingPrepUpdate", model.IsSewingPrepUpdate); var @IsSewingActualStartDateUpdate = new SqlParameter("@IsSewingActualStartDateUpdate", model.IsSewingActualStartDateUpdate); var @IsSewingActualFinishDateUpdate = new SqlParameter("@IsSewingActualFinishDateUpdate", model.IsSewingActualFinishDateUpdate); var @IsSewingActualStartDateAutoUpdate = new SqlParameter("@IsSewingActualStartDateAutoUpdate", model.IsSewingActualStartDateAutoUpdate); var @IsSewingActualFinishDateAutoUpdate = new SqlParameter("@IsSewingActualFinishDateAutoUpdate", model.IsSewingActualFinishDateAutoUpdate); var @IsSewingBalanceUpdate = new SqlParameter("@IsSewingBalanceUpdate", model.IsSewingBalanceUpdate); var @IsCutAStartDateUpdate = new SqlParameter("@IsCutAStartDateUpdate", model.IsCutAStartDateUpdate); var @IsCutAFinishDateUpdate = new SqlParameter("@IsCutAFinishDateUpdate", model.IsCutAFinishDateUpdate); var @IsCutAQuotaUpdate = new SqlParameter("@IsCutAQuotaUpdate", model.IsCutAQuotaUpdate); var @IsCutAActualStartDateUpdate = new SqlParameter("@IsCutAActualStartDateUpdate", model.IsCutAActualStartDateUpdate); var @IsCutAActualFinishDateUpdate = new SqlParameter("@IsCutAActualFinishDateUpdate", model.IsCutAActualFinishDateUpdate); var @IsCutABalanceUpdate = new SqlParameter("@IsCutABalanceUpdate", model.IsCutABalanceUpdate); var @IsPrintingBalanceUpdate = new SqlParameter("@IsPrintingBalanceUpdate", model.IsPrintingBalanceUpdate); var @IsH_FBalanceUpdate = new SqlParameter("@IsH_FBalanceUpdate", model.IsH_FBalanceUpdate); var @IsEmbroideryBalanceUpdate = new SqlParameter("@IsEmbroideryBalanceUpdate", model.IsEmbroideryBalanceUpdate); var @IsCutBActualStartDateUpdate = new SqlParameter("@IsCutBActualStartDateUpdate", model.IsCutBActualStartDateUpdate); var @IsCutBBalanceUpdate = new SqlParameter("@IsCutBBalanceUpdate", model.IsCutBBalanceUpdate); var @IsAutoCutUpdate = new SqlParameter("@IsAutoCutUpdate", model.IsAutoCutUpdate); var @IsLaserCutUpdate = new SqlParameter("@IsLaserCutUpdate", model.IsLaserCutUpdate); var @IsHuasenCutUpdate = new SqlParameter("@IsHuasenCutUpdate", model.IsHuasenCutUpdate); SaovietMasterScheduleEntities db = new SaovietMasterScheduleEntities(); if (db.ExecuteStoreCommand("EXEC spm_InsertSewingMaster_5 @ProductNo, @Sequence, @SewingLine, @SewingStartDate, @SewingFinishDate, @SewingQuota, @SewingPrep, @SewingActualStartDate, @SewingActualFinishDate, @SewingActualStartDateAuto, @SewingActualFinishDateAuto, @SewingBalance, @CutAStartDate, @CutAFinishDate, @CutAQuota, @CutAActualStartDate, @CutAActualFinishDate, @CutABalance, @PrintingBalance, @H_FBalance, @EmbroideryBalance, @CutBActualStartDate, @CutBBalance, @AutoCut, @LaserCut, @HuasenCut, @IsSequenceUpdate, @IsSewingLineUpdate, @IsSewingStartDateUpdate, @IsSewingFinishDateUpdate, @IsSewingQuotaUpdate, @IsSewingPrepUpdate, @IsSewingActualStartDateUpdate, @IsSewingActualFinishDateUpdate, @IsSewingActualStartDateAutoUpdate, @IsSewingActualFinishDateAutoUpdate, @IsSewingBalanceUpdate, @IsCutAStartDateUpdate, @IsCutAFinishDateUpdate, @IsCutAQuotaUpdate, @IsCutAActualStartDateUpdate, @IsCutAActualFinishDateUpdate, @IsCutABalanceUpdate, @IsPrintingBalanceUpdate, @IsH_FBalanceUpdate, @IsEmbroideryBalanceUpdate, @IsCutBActualStartDateUpdate, @IsCutBBalanceUpdate, @IsAutoCutUpdate, @IsLaserCutUpdate, @IsHuasenCutUpdate", @ProductNo, @Sequence, @SewingLine, @SewingStartDate, @SewingFinishDate, @SewingQuota, @SewingPrep, @SewingActualStartDate, @SewingActualFinishDate, @SewingActualStartDateAuto, @SewingActualFinishDateAuto, @SewingBalance, @CutAStartDate, @CutAFinishDate, @CutAQuota, @CutAActualStartDate, @CutAActualFinishDate, @CutABalance, @PrintingBalance, @H_FBalance, @EmbroideryBalance, @CutBActualStartDate, @CutBBalance, @AutoCut, @LaserCut, @HuasenCut, @IsSequenceUpdate, @IsSewingLineUpdate, @IsSewingStartDateUpdate, @IsSewingFinishDateUpdate, @IsSewingQuotaUpdate, @IsSewingPrepUpdate, @IsSewingActualStartDateUpdate, @IsSewingActualFinishDateUpdate, @IsSewingActualStartDateAutoUpdate, @IsSewingActualFinishDateAutoUpdate, @IsSewingBalanceUpdate, @IsCutAStartDateUpdate, @IsCutAFinishDateUpdate, @IsCutAQuotaUpdate, @IsCutAActualStartDateUpdate, @IsCutAActualFinishDateUpdate, @IsCutABalanceUpdate, @IsPrintingBalanceUpdate, @IsH_FBalanceUpdate, @IsEmbroideryBalanceUpdate, @IsCutBActualStartDateUpdate, @IsCutBBalanceUpdate, @IsAutoCutUpdate, @IsLaserCutUpdate, @IsHuasenCutUpdate) > 0) { return(true); } return(false); }
/// <summary> /// Checks that the actual duration is greater (strictly) than a comparand. /// </summary> /// <param name="check">The fluent check to be extended.</param> /// <param name="comparand">The value to compare to.</param> /// <returns>A check link.</returns> /// <exception cref="FluentCheckException">The actual value is not greater than the provided comparand.</exception> public static ICheckLink <ICheck <TimeSpan> > IsGreaterThan(this ICheck <TimeSpan> check, TimeSpan comparand) { var unit = TimeHelper.DiscoverUnit(comparand); return(check.IsGreaterThan(TimeHelper.Convert(comparand, unit), unit)); }