private void threadInsert_DoWork(object sender, DoWorkEventArgs e) { ProductionMemoModel model = e.Argument as ProductionMemoModel; string memoId = ProductionMemoController.Insert(model); e.Result = memoId; }
private void threadSearchByProductionNumber_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { this.Cursor = null; btnSearchbyProductionNumber.IsEnabled = true; if (e.Error != null) { MessageBox.Show(e.Error.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } productionMemoList = e.Result as List <ProductionMemoModel>; List <ProductionMemoModel> productionMemoViewList = new List <ProductionMemoModel>(); foreach (ProductionMemoModel productionMemo in productionMemoList) { ProductionMemoModel productionMemoView = new ProductionMemoModel { MemoId = productionMemo.MemoId, }; productionMemoView.SectionId = ""; SectionModel section = sectionList.Where(s => s.SectionId == productionMemo.SectionId).FirstOrDefault(); if (section != null) { productionMemoView.SectionId = section.Name; } productionMemoViewList.Add(productionMemoView); } dgProductionMemo.ItemsSource = productionMemoViewList; }
private void threadSearch_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { this.Cursor = null; btnSearch.IsEnabled = true; if (e.Error != null) { MessageBox.Show(e.Error.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } ProductionMemoModel productionMemo = e.Result as ProductionMemoModel; if (productionMemo != null) { lblMemoId.Text = productionMemo.MemoId; SectionModel section = sectionList.Where(s => s.SectionId == productionMemo.SectionId).FirstOrDefault(); if (section != null) { cboSection.SelectedItem = section; } string[] productNumberArray = productionMemo.ProductionNumbers.Split(';'); foreach (string productNumber in productNumberArray) { if (string.IsNullOrEmpty(productNumber) == false) { productionNumbers.Add(new ProductionNumberModel() { Value = productNumber }); } } if (productionMemo.Picture != null) { imgPicture.Source = ConvertJPGHelper.GetBitmapImageFromJPG(productionMemo.Picture); } if (productionMemo.Picture1 != null) { imgPicture1.Source = ConvertJPGHelper.GetBitmapImageFromJPG(productionMemo.Picture1); } if (productionMemo.Picture2 != null) { imgPicture2.Source = ConvertJPGHelper.GetBitmapImageFromJPG(productionMemo.Picture2); } if (productionMemo.Picture3 != null) { imgPicture3.Source = ConvertJPGHelper.GetBitmapImageFromJPG(productionMemo.Picture3); } if (productionMemo.Picture4 != null) { imgPicture4.Source = ConvertJPGHelper.GetBitmapImageFromJPG(productionMemo.Picture4); } } else { MessageBox.Show("Not Found!", "Search", MessageBoxButton.OK, MessageBoxImage.Error); } }
public static string Insert(ProductionMemoModel model) { var @SectionId = new SqlParameter("@SectionId", model.SectionId); var @ProductionNumbers = new SqlParameter("@ProductionNumbers", model.ProductionNumbers); var @Picture = new SqlParameter("@Picture", SqlDbType.Image); @Picture.Value = DBNull.Value; if (model.Picture != null) { @Picture.Value = model.Picture; } var @Picture1 = new SqlParameter("@Picture1", SqlDbType.Image); @Picture1.Value = DBNull.Value; if (model.Picture1 != null) { @Picture1.Value = model.Picture1; } var @Picture2 = new SqlParameter("@Picture2", SqlDbType.Image); @Picture2.Value = DBNull.Value; if (model.Picture2 != null) { @Picture2.Value = model.Picture2; } var @Picture3 = new SqlParameter("@Picture3", SqlDbType.Image); @Picture3.Value = DBNull.Value; if (model.Picture3 != null) { @Picture3.Value = model.Picture3; } var @Picture4 = new SqlParameter("@Picture4", SqlDbType.Image); @Picture4.Value = DBNull.Value; if (model.Picture4 != null) { @Picture4.Value = model.Picture4; } string memoId = db.ExecuteStoreQuery <string>("spm_InsertProductionMemo_1 @SectionId, @ProductionNumbers, @Picture, @Picture1, @Picture2, @Picture3, @Picture4", @SectionId, @ProductionNumbers, @Picture, @Picture1, @Picture2, @Picture3, @Picture4).FirstOrDefault(); return(memoId); }
public static bool Update(ProductionMemoModel model) { var @MemoId = new SqlParameter("@MemoId", model.MemoId); var @ProductionNumbers = new SqlParameter("@ProductionNumbers", model.ProductionNumbers); var @Picture = new SqlParameter("@Picture", SqlDbType.Image); @Picture.Value = DBNull.Value; if (model.Picture != null) { @Picture.Value = model.Picture; } var @Picture1 = new SqlParameter("@Picture1", SqlDbType.Image); @Picture1.Value = DBNull.Value; if (model.Picture1 != null) { @Picture1.Value = model.Picture1; } var @Picture2 = new SqlParameter("@Picture2", SqlDbType.Image); @Picture2.Value = DBNull.Value; if (model.Picture2 != null) { @Picture2.Value = model.Picture2; } var @Picture3 = new SqlParameter("@Picture3", SqlDbType.Image); @Picture3.Value = DBNull.Value; if (model.Picture3 != null) { @Picture3.Value = model.Picture3; } var @Picture4 = new SqlParameter("@Picture4", SqlDbType.Image); @Picture4.Value = DBNull.Value; if (model.Picture4 != null) { @Picture4.Value = model.Picture4; } return(db.ExecuteStoreCommand("spm_UpdateProductionMemo_1 @MemoId, @ProductionNumbers, @Picture, @Picture1, @Picture2, @Picture3, @Picture4", @MemoId, @ProductionNumbers, @Picture, @Picture1, @Picture2, @Picture3, @Picture4) > 0); }
private void bwLoad_DoWork(object sender, DoWorkEventArgs e) { try { orderList = OrdersController.Select(); rawMaterialList = RawMaterialController.Select(); sewingMasterList = SewingMasterController.Select(); productionMemoList = ProductionMemoController.Select(); offDayList = OffDayController.Select(); privateDefine = PrivateDefineController.GetDefine(); } catch (Exception ex) { Dispatcher.Invoke(new Action(() => { MessageBox.Show(ex.Message, this.Title, MessageBoxButton.OK, MessageBoxImage.Error); })); return; } _SEW_VS_OTHERS_CUT_A = privateDefine.SewingVsOthersCutTypeA; _SEW_VS_OTHERS_CUT_B = privateDefine.SewingVsOthersCutTypeB; //sewingMasterList.RemoveAll(s => DateTimeHelper.Create(s.SewingBalance) != dtDefault && DateTimeHelper.Create(s.SewingBalance) != dtNothing); sewingMasterList = sewingMasterList.OrderBy(s => s.Sequence).ToList(); int[] materialIdUpperArray = { 1, 2, 3, 4, 10 }; int[] materialIdSewingArray = { 5, 7 }; int[] materialIdOutsoleArray = { 6 }; foreach (SewingMasterModel sewingMaster in sewingMasterList) { CutprepMasterExportViewModel cutprepMasterExportView = new CutprepMasterExportViewModel(); cutprepMasterExportView.Sequence = sewingMaster.Sequence; cutprepMasterExportView.ProductNo = sewingMaster.ProductNo; OrdersModel order = orderList.FirstOrDefault(f => f.ProductNo == sewingMaster.ProductNo); string memoId = ""; if (order != null) { cutprepMasterExportView.Country = order.Country; cutprepMasterExportView.ShoeName = order.ShoeName; cutprepMasterExportView.ArticleNo = order.ArticleNo; cutprepMasterExportView.PatternNo = order.PatternNo; cutprepMasterExportView.Quantity = order.Quantity; cutprepMasterExportView.ETD = order.ETD; List <ProductionMemoModel> productionMemoByProductionNumberList = productionMemoList.Where(p => p.ProductionNumbers.Contains(order.ProductNo) == true).ToList(); for (int p = 0; p <= productionMemoByProductionNumberList.Count - 1; p++) { ProductionMemoModel productionMemo = productionMemoByProductionNumberList[p]; memoId += productionMemo.MemoId; if (p < productionMemoByProductionNumberList.Count - 1) { memoId += "\n"; } } cutprepMasterExportView.MemoId = memoId; } MaterialArrivalViewModel materialArrivalUpper = MaterialArrival(order.ProductNo, materialIdUpperArray); cutprepMasterExportView.IsUpperMatsArrivalOk = false; if (materialArrivalUpper != null) { cutprepMasterExportView.UpperMatsArrival = String.Format(new CultureInfo("en-US"), "{0:dd-MMM}", materialArrivalUpper.Date); cutprepMasterExportView.IsUpperMatsArrivalOk = materialArrivalUpper.IsMaterialArrivalOk; } cutprepMasterExportView.SewingLine = sewingMaster.SewingLine; cutprepMasterExportView.SewingStartDate = sewingMaster.SewingStartDate; cutprepMasterExportView.SewingQuota = sewingMaster.SewingQuota; cutprepMasterExportView.SewingBalance = sewingMaster.SewingBalance; cutprepMasterExportView.CutAStartDate = sewingMaster.CutAStartDate; cutprepMasterExportView.CutAFinishDate = sewingMaster.CutAFinishDate; cutprepMasterExportView.CutAQuota = sewingMaster.CutAQuota; cutprepMasterExportView.AutoCut = sewingMaster.AutoCut; cutprepMasterExportView.LaserCut = sewingMaster.LaserCut; cutprepMasterExportView.HuasenCut = sewingMaster.HuasenCut; cutprepMasterExportView.CutABalance = sewingMaster.CutABalance; cutprepMasterExportView.PrintingBalance = sewingMaster.PrintingBalance; cutprepMasterExportView.H_FBalance = sewingMaster.H_FBalance; cutprepMasterExportView.EmbroideryBalance = sewingMaster.EmbroideryBalance; cutprepMasterExportView.CutBBalance = sewingMaster.CutBBalance; // Cut type A before sewing 18days var cutTypeABeforeSewing = sewingMaster.SewingStartDate.AddDays(-_SEW_VS_OTHERS_CUT_A); var dtCheckOffDateCutTypeAList = CheckOffDay(cutTypeABeforeSewing, sewingMaster.SewingStartDate); // Cut type B before sewing 10days var cutTypeBBeforeSewing = sewingMaster.SewingStartDate.AddDays(-_SEW_VS_OTHERS_CUT_B); var dtCheckOffDateCutTypeBList = CheckOffDay(cutTypeBBeforeSewing, sewingMaster.SewingStartDate); var firstDateCheckOffCutTypeA = String.Format("{0:M/d}", dtCheckOffDateCutTypeAList.FirstOrDefault()); var firstDateCheckOffCutTypeB = String.Format("{0:M/d}", dtCheckOffDateCutTypeBList.FirstOrDefault()); if (!String.IsNullOrEmpty(sewingMaster.CutBStartDate)) { cutprepMasterExportView.CutBStartDate = sewingMaster.CutBStartDate; } else if (sewingMaster.SewingStartDate != dtDefault) { cutprepMasterExportView.CutBStartDate = firstDateCheckOffCutTypeB; } else { cutprepMasterExportView.CutBStartDate = ""; } if (!String.IsNullOrEmpty(sewingMaster.AtomCutA)) { cutprepMasterExportView.AtomCutA = sewingMaster.AtomCutA; } else if (sewingMaster.SewingStartDate != dtDefault) { cutprepMasterExportView.AtomCutA = firstDateCheckOffCutTypeA; } else { cutprepMasterExportView.AtomCutA = ""; } if (!String.IsNullOrEmpty(sewingMaster.AtomCutB)) { cutprepMasterExportView.AtomCutB = sewingMaster.AtomCutB; } else if (sewingMaster.SewingStartDate != dtDefault) { cutprepMasterExportView.AtomCutB = firstDateCheckOffCutTypeB; } else { cutprepMasterExportView.AtomCutB = ""; } if (!String.IsNullOrEmpty(sewingMaster.LaserCutA)) { cutprepMasterExportView.LaserCutA = sewingMaster.LaserCutA; } else if (sewingMaster.SewingStartDate != dtDefault) { cutprepMasterExportView.LaserCutA = firstDateCheckOffCutTypeA; } else { cutprepMasterExportView.LaserCutA = ""; } if (!String.IsNullOrEmpty(sewingMaster.LaserCutB)) { cutprepMasterExportView.LaserCutB = sewingMaster.LaserCutB; } else if (sewingMaster.SewingStartDate != dtDefault) { cutprepMasterExportView.LaserCutB = firstDateCheckOffCutTypeB; } else { cutprepMasterExportView.LaserCutB = ""; } if (!String.IsNullOrEmpty(sewingMaster.HuasenCutA)) { cutprepMasterExportView.HuasenCutA = sewingMaster.HuasenCutA; } else if (sewingMaster.SewingStartDate != dtDefault) { cutprepMasterExportView.HuasenCutA = firstDateCheckOffCutTypeA; } else { cutprepMasterExportView.HuasenCutA = ""; } if (!String.IsNullOrEmpty(sewingMaster.HuasenCutB)) { cutprepMasterExportView.HuasenCutB = sewingMaster.HuasenCutB; } else if (sewingMaster.SewingStartDate != dtDefault) { cutprepMasterExportView.HuasenCutB = firstDateCheckOffCutTypeB; } else { cutprepMasterExportView.HuasenCutB = ""; } if (!String.IsNullOrEmpty(sewingMaster.ComelzCutA)) { cutprepMasterExportView.ComelzCutA = sewingMaster.ComelzCutA; } else if (sewingMaster.SewingStartDate != dtDefault) { cutprepMasterExportView.ComelzCutA = firstDateCheckOffCutTypeA; } else { cutprepMasterExportView.ComelzCutA = ""; } if (!String.IsNullOrEmpty(sewingMaster.ComelzCutB)) { cutprepMasterExportView.ComelzCutB = sewingMaster.ComelzCutB; } else if (sewingMaster.SewingStartDate != dtDefault) { cutprepMasterExportView.ComelzCutB = firstDateCheckOffCutTypeB; } else { cutprepMasterExportView.ComelzCutB = ""; } cutprepMasterExportViewList.Add(cutprepMasterExportView); } }
private void bwLoad_DoWork(object sender, DoWorkEventArgs e) { orderList = OrdersController.Select(); rawMaterialList = RawMaterialController.Select(); sewingMasterList = SewingMasterController.Select(); outsoleMasterList = OutsoleMasterController.Select(); sockliningMasterList = SockliningMasterController.Select(); assemblyMasterList = AssemblyMasterController.Select(); productionMemoList = ProductionMemoController.Select(); outsoleRawMaterialList = OutsoleRawMaterialController.Select(); rawMaterialViewModelNewList = RawMaterialController.Select_1(); //sewingMasterList.RemoveAll(s => DateTimeHelper.Create(s.SewingBalance) != dtDefault && DateTimeHelper.Create(s.SewingBalance) != dtNothing); assemblyMasterList = assemblyMasterList.OrderBy(s => s.Sequence).ToList(); int[] materialIdUpperArray = { 1, 2, 3, 4, 10 }; int[] materialIdSewingArray = { 5, 7 }; int[] materialIdOutsoleArray = { 6 }; int[] materialIdAssemblyArray = { 8, 9 }; int[] materialIdCartonArray = { 11 }; foreach (AssemblyMasterModel assemblyMaster in assemblyMasterList) { AssemblyMasterExportViewModel assemblyMasterExportView = new AssemblyMasterExportViewModel(); assemblyMasterExportView.Sequence = assemblyMaster.Sequence; assemblyMasterExportView.ProductNo = assemblyMaster.ProductNo; OrdersModel order = orderList.Where(o => o.ProductNo == assemblyMaster.ProductNo).FirstOrDefault(); string memoId = ""; if (order != null) { assemblyMasterExportView.Country = order.Country; assemblyMasterExportView.ShoeName = order.ShoeName; assemblyMasterExportView.ArticleNo = order.ArticleNo; assemblyMasterExportView.LastCode = order.LastCode; assemblyMasterExportView.Quantity = order.Quantity; assemblyMasterExportView.ETD = order.ETD; List <ProductionMemoModel> productionMemoByProductionNumberList = productionMemoList.Where(p => p.ProductionNumbers.Contains(order.ProductNo) == true).ToList(); for (int p = 0; p <= productionMemoByProductionNumberList.Count - 1; p++) { ProductionMemoModel productionMemo = productionMemoByProductionNumberList[p]; memoId += productionMemo.MemoId; if (p < productionMemoByProductionNumberList.Count - 1) { memoId += "\n"; } } assemblyMasterExportView.MemoId = memoId; } //MaterialArrivalViewModel materialArrivalOutsole = MaterialArrival(order.ProductNo, materialIdOutsoleArray); //assemblyMasterExportView.IsOutsoleMatsArrivalOk = false; //if (materialArrivalOutsole != null) //{ // assemblyMasterExportView.OutsoleMatsArrival = String.Format(new CultureInfo("en-US"), "{0:dd-MMM}", materialArrivalOutsole.Date); // assemblyMasterExportView.IsOutsoleMatsArrivalOk = materialArrivalOutsole.IsMaterialArrivalOk; //} //// follow OutsoleRawMaterial //var osRawMaterial = outsoleRawMaterialList.Where(w => w.ProductNo == order.ProductNo).ToList(); //var actualDateList = osRawMaterial.Select(s => s.ActualDate).ToList(); //assemblyMasterExportView.IsOutsoleMatsArrivalOk = false; //if (actualDateList.Count() > 0 && actualDateList.Contains(dtDefault) == false) //{ // assemblyMasterExportView.OutsoleMatsArrival = String.Format(new CultureInfo("en-US"), "{0:dd-MMM}", actualDateList.Max()); // assemblyMasterExportView.IsOutsoleMatsArrivalOk = true; //} //else //{ // var etdDateList = osRawMaterial.Select(s => s.ETD).ToList(); // if (etdDateList.Count() > 0) // { // assemblyMasterExportView.OutsoleMatsArrival = String.Format(new CultureInfo("en-US"), "{0:dd-MMM}", etdDateList.Max()); // } //} assemblyMasterExportView.IsOutsoleMatsArrivalOk = false; var rawMaterialViewModelNew = rawMaterialViewModelNewList.FirstOrDefault(f => f.ProductNo == order.ProductNo); if (String.IsNullOrEmpty(rawMaterialViewModelNew.OUTSOLE_Remarks) && !String.IsNullOrEmpty(rawMaterialViewModelNew.OUTSOLE_ActualDate)) { assemblyMasterExportView.OutsoleMatsArrival = rawMaterialViewModelNew.OUTSOLE_ActualDate; assemblyMasterExportView.IsOutsoleMatsArrivalOk = true; } else { assemblyMasterExportView.OutsoleMatsArrival = rawMaterialViewModelNew.OUTSOLE_ETD; } MaterialArrivalViewModel materialArrivalAssembly = MaterialArrival(order.ProductNo, materialIdAssemblyArray); assemblyMasterExportView.IsAssemblyMatsArrivalOk = false; if (materialArrivalAssembly != null) { assemblyMasterExportView.AssemblyMatsArrival = String.Format(new CultureInfo("en-US"), "{0:dd-MMM}", materialArrivalAssembly.Date); assemblyMasterExportView.IsAssemblyMatsArrivalOk = materialArrivalAssembly.IsMaterialArrivalOk; } MaterialArrivalViewModel materialArrivalCarton = MaterialArrival(order.ProductNo, materialIdCartonArray); if (materialArrivalCarton != null) { assemblyMasterExportView.CartonMatsArrival = String.Format(new CultureInfo("en-US"), "{0:dd-MMM}", materialArrivalCarton.Date); } assemblyMasterExportView.AssemblyLine = assemblyMaster.AssemblyLine; assemblyMasterExportView.AssemblyStartDate = assemblyMaster.AssemblyStartDate; assemblyMasterExportView.AssemblyFinishDate = assemblyMaster.AssemblyFinishDate; assemblyMasterExportView.AssemblyQuota = assemblyMaster.AssemblyQuota; assemblyMasterExportView.AssemblyBalance = assemblyMaster.AssemblyBalance; SewingMasterModel sewingMaster = sewingMasterList.Where(o => o.ProductNo == assemblyMaster.ProductNo).FirstOrDefault(); if (sewingMaster != null) { assemblyMasterExportView.SewingStartDate = sewingMaster.SewingStartDate; assemblyMasterExportView.SewingFinishDate = sewingMaster.SewingFinishDate; assemblyMasterExportView.SewingBalance = sewingMaster.SewingBalance; } else { assemblyMasterExportView.SewingStartDate = dtDefault; assemblyMasterExportView.SewingFinishDate = dtDefault; assemblyMasterExportView.SewingBalance = ""; } OutsoleMasterModel outsoleMaster = outsoleMasterList.Where(o => o.ProductNo == assemblyMaster.ProductNo).FirstOrDefault(); if (outsoleMaster != null) { assemblyMasterExportView.OutsoleBalance = outsoleMaster.OutsoleBalance; } else { assemblyMasterExportView.OutsoleBalance = ""; } SockliningMasterModel sockliningMaster = sockliningMasterList.Where(o => o.ProductNo == assemblyMaster.ProductNo).FirstOrDefault(); if (sockliningMaster != null) { assemblyMasterExportView.InsoleBalance = sockliningMaster.InsoleBalance; assemblyMasterExportView.InsockBalance = sockliningMaster.InsockBalance; } else { assemblyMasterExportView.InsoleBalance = ""; assemblyMasterExportView.InsockBalance = ""; } assemblyMasterExportViewList.Add(assemblyMasterExportView); } }
private void bwLoad_DoWork(object sender, DoWorkEventArgs e) { orderList = OrdersController.Select(); rawMaterialList = RawMaterialController.Select(); sewingMasterList = SewingMasterController.Select(); outsoleMasterList = OutsoleMasterController.Select(); productionMemoList = ProductionMemoController.Select(); outsoleRawMaterialList = OutsoleRawMaterialController.Select(); rawMaterialViewModelNewList = RawMaterialController.Select_1(); //sewingMasterList.RemoveAll(s => DateTimeHelper.Create(s.SewingBalance) != dtDefault && DateTimeHelper.Create(s.SewingBalance) != dtNothing); sewingMasterList = sewingMasterList.OrderBy(s => s.Sequence).ToList(); int[] materialIdUpperArray = { 1, 2, 3, 4, 10 }; int[] materialIdSewingArray = { 5, 7 }; int[] materialIdOutsoleArray = { 6 }; foreach (SewingMasterModel sewingMaster in sewingMasterList) { SewingMasterExportViewModel sewingMasterExportView = new SewingMasterExportViewModel(); sewingMasterExportView.Sequence = sewingMaster.Sequence; sewingMasterExportView.ProductNo = sewingMaster.ProductNo; OrdersModel order = orderList.Where(o => o.ProductNo == sewingMaster.ProductNo).FirstOrDefault(); string memoId = ""; if (order != null) { sewingMasterExportView.Country = order.Country; sewingMasterExportView.ShoeName = order.ShoeName; sewingMasterExportView.ArticleNo = order.ArticleNo; sewingMasterExportView.PatternNo = order.PatternNo; sewingMasterExportView.Quantity = order.Quantity; sewingMasterExportView.ETD = order.ETD; List <ProductionMemoModel> productionMemoByProductionNumberList = productionMemoList.Where(p => p.ProductionNumbers.Contains(order.ProductNo) == true).ToList(); for (int p = 0; p <= productionMemoByProductionNumberList.Count - 1; p++) { ProductionMemoModel productionMemo = productionMemoByProductionNumberList[p]; memoId += productionMemo.MemoId; if (p < productionMemoByProductionNumberList.Count - 1) { memoId += "\n"; } } sewingMasterExportView.MemoId = memoId; } MaterialArrivalViewModel materialArrivalUpper = MaterialArrival(order.ProductNo, materialIdUpperArray); sewingMasterExportView.IsUpperMatsArrivalOk = false; if (materialArrivalUpper != null) { sewingMasterExportView.UpperMatsArrival = String.Format(new CultureInfo("en-US"), "{0:dd-MMM}", materialArrivalUpper.Date); sewingMasterExportView.IsUpperMatsArrivalOk = materialArrivalUpper.IsMaterialArrivalOk; } MaterialArrivalViewModel materialArrivalSewing = MaterialArrival(order.ProductNo, materialIdSewingArray); sewingMasterExportView.IsSewingMatsArrivalOk = false; if (materialArrivalSewing != null) { sewingMasterExportView.SewingMatsArrival = String.Format(new CultureInfo("en-US"), "{0:dd-MMM}", materialArrivalSewing.Date); sewingMasterExportView.IsSewingMatsArrivalOk = materialArrivalSewing.IsMaterialArrivalOk; } //MaterialArrivalViewModel materialArrivalOutsole = MaterialArrival(order.ProductNo, materialIdOutsoleArray); //sewingMasterExportView.IsOSMatsArrivalOk = false; //if (materialArrivalOutsole != null) //{ // sewingMasterExportView.OSMatsArrival = String.Format(new CultureInfo("en-US"), "{0:dd-MMM}", materialArrivalOutsole.Date); // sewingMasterExportView.IsOSMatsArrivalOk = materialArrivalOutsole.IsMaterialArrivalOk; //} // For Outsole Material //var osRawMaterial = outsoleRawMaterialList.Where(w => w.ProductNo == order.ProductNo).ToList(); //var actualDateList = osRawMaterial.Select(s => s.ActualDate).ToList(); //sewingMasterExportView.IsOSMatsArrivalOk = false; //if (actualDateList.Count() > 0 && actualDateList.Contains(dtDefault) == false) //{ // sewingMasterExportView.OSMatsArrival = String.Format(new CultureInfo("en-US"), "{0:dd-MMM}", actualDateList.Max()); // sewingMasterExportView.IsOSMatsArrivalOk = true; //} //else //{ // var etdDateList = osRawMaterial.Select(s => s.ETD).ToList(); // if (etdDateList.Count() > 0) // { // sewingMasterExportView.OSMatsArrival = String.Format(new CultureInfo("en-US"), "{0:dd-MMM}", etdDateList.Max()); // } //} var rawMaterialViewModelNew = rawMaterialViewModelNewList.FirstOrDefault(f => f.ProductNo == order.ProductNo); sewingMasterExportView.IsOSMatsArrivalOk = false; if (String.IsNullOrEmpty(rawMaterialViewModelNew.OUTSOLE_Remarks) && !String.IsNullOrEmpty(rawMaterialViewModelNew.OUTSOLE_ActualDate)) { sewingMasterExportView.OSMatsArrival = rawMaterialViewModelNew.OUTSOLE_ActualDate; sewingMasterExportView.IsOSMatsArrivalOk = true; } else { sewingMasterExportView.OSMatsArrival = rawMaterialViewModelNew.OUTSOLE_ETD; } sewingMasterExportView.SewingLine = sewingMaster.SewingLine; sewingMasterExportView.CutAStartDate = sewingMaster.CutAStartDate; sewingMasterExportView.SewingStartDate = sewingMaster.SewingStartDate; sewingMasterExportView.SewingFinishDate = sewingMaster.SewingFinishDate; sewingMasterExportView.SewingQuota = sewingMaster.SewingQuota; sewingMasterExportView.SewingBalance = sewingMaster.SewingBalance; sewingMasterExportView.CutABalance = sewingMaster.CutABalance; sewingMasterExportView.CutBBalance = sewingMaster.CutBBalance; OutsoleMasterModel outsoleMaster = outsoleMasterList.Where(o => o.ProductNo == sewingMaster.ProductNo).FirstOrDefault(); if (outsoleMaster != null) { sewingMasterExportView.OSBalance = outsoleMaster.OutsoleBalance; } else { sewingMasterExportView.OSBalance = ""; } sewingMasterExportViewList.Add(sewingMasterExportView); } }
private void bwLoad_DoWork(object sender, DoWorkEventArgs e) { orderList = OrdersController.Select(); rawMaterialList = RawMaterialController.Select(); sewingMasterList = SewingMasterController.Select(); outsoleMasterList = OutsoleMasterController.Select(); outsoleReleaseMaterialList = OutsoleReleaseMaterialController.SelectByOutsoleMaster(); productionMemoList = ProductionMemoController.Select(); //sewingMasterList.RemoveAll(s => DateTimeHelper.Create(s.SewingBalance) != dtDefault && DateTimeHelper.Create(s.SewingBalance) != dtNothing); outsoleMasterList = outsoleMasterList.OrderBy(s => s.Sequence).ToList(); int[] materialIdUpperArray = { 1, 2, 3, 4, 10 }; int[] materialIdSewingArray = { 5, 7 }; int[] materialIdOutsoleArray = { 6 }; foreach (OutsoleMasterModel outsoleMaster in outsoleMasterList) { OutsoleMasterExportViewModel outsoleMasterExportView = new OutsoleMasterExportViewModel(); outsoleMasterExportView.Sequence = outsoleMaster.Sequence; outsoleMasterExportView.ProductNo = outsoleMaster.ProductNo; OrdersModel order = orderList.Where(o => o.ProductNo == outsoleMaster.ProductNo).FirstOrDefault(); string memoId = ""; if (order != null) { outsoleMasterExportView.Country = order.Country; outsoleMasterExportView.ShoeName = order.ShoeName; outsoleMasterExportView.ArticleNo = order.ArticleNo; outsoleMasterExportView.OutsoleCode = order.OutsoleCode; outsoleMasterExportView.Quantity = order.Quantity; outsoleMasterExportView.ETD = order.ETD; List <ProductionMemoModel> productionMemoByProductionNumberList = productionMemoList.Where(p => p.ProductionNumbers.Contains(order.ProductNo) == true).ToList(); for (int p = 0; p <= productionMemoByProductionNumberList.Count - 1; p++) { ProductionMemoModel productionMemo = productionMemoByProductionNumberList[p]; memoId += productionMemo.MemoId; if (p < productionMemoByProductionNumberList.Count - 1) { memoId += "\n"; } } outsoleMasterExportView.MemoId = memoId; } MaterialArrivalViewModel materialArrivalOutsole = MaterialArrival(order.ProductNo, materialIdOutsoleArray); outsoleMasterExportView.IsOutsoleMatsArrivalOk = false; if (materialArrivalOutsole != null) { outsoleMasterExportView.OutsoleMatsArrival = String.Format(new CultureInfo("en-US"), "{0:dd-MMM}", materialArrivalOutsole.Date); outsoleMasterExportView.IsOutsoleMatsArrivalOk = materialArrivalOutsole.IsMaterialArrivalOk; } outsoleMasterExportView.OutsoleLine = outsoleMaster.OutsoleLine; outsoleMasterExportView.OutsoleStartDate = outsoleMaster.OutsoleStartDate; outsoleMasterExportView.OutsoleFinishDate = outsoleMaster.OutsoleFinishDate; outsoleMasterExportView.OutsoleQuota = outsoleMaster.OutsoleQuota; outsoleMasterExportView.OutsoleBalance = outsoleMaster.OutsoleBalance; RawMaterialModel outsoleRawMaterial = rawMaterialList.Where(r => r.ProductNo == outsoleMaster.ProductNo && materialIdOutsoleArray.Contains(r.MaterialTypeId)).FirstOrDefault(); if (outsoleRawMaterial != null) { outsoleMasterExportView.OutsoleWHBalance = outsoleRawMaterial.Remarks; } else { outsoleMasterExportView.OutsoleWHBalance = ""; } SewingMasterModel sewingMaster = sewingMasterList.Where(o => o.ProductNo == outsoleMaster.ProductNo).FirstOrDefault(); if (sewingMaster != null) { outsoleMasterExportView.SewingStartDate = sewingMaster.SewingStartDate; outsoleMasterExportView.SewingFinishDate = sewingMaster.SewingFinishDate; outsoleMasterExportView.SewingQuota = sewingMaster.SewingQuota; outsoleMasterExportView.SewingBalance = sewingMaster.SewingBalance; } else { outsoleMasterExportView.SewingStartDate = dtDefault; outsoleMasterExportView.SewingFinishDate = dtDefault; outsoleMasterExportView.SewingQuota = 0; outsoleMasterExportView.SewingBalance = ""; } List <OutsoleReleaseMaterialModel> outsoleReleaseMaterialList_D1 = outsoleReleaseMaterialList.Where(o => o.ProductNo == outsoleMaster.ProductNo).ToList(); int qtyReleased = outsoleReleaseMaterialList_D1.Sum(o => o.Quantity); outsoleMasterExportView.ReleasedQuantity = qtyReleased.ToString(); if (qtyReleased <= 0) { outsoleMasterExportView.ReleasedQuantity = ""; } if (qtyReleased >= outsoleMasterExportView.Quantity && outsoleReleaseMaterialList_D1.Count > 0) { DateTime releasedDate = outsoleReleaseMaterialList_D1.FirstOrDefault().ModifiedTime; outsoleMasterExportView.ReleasedQuantity = string.Format("{0:M/d}", releasedDate); } outsoleMasterExportViewList.Add(outsoleMasterExportView); } }
private void bwLoad_DoWork(object sender, DoWorkEventArgs e) { orderList = OrdersController.Select(); rawMaterialList = RawMaterialController.Select(); sewingMasterList = SewingMasterController.Select(); outsoleMasterList = OutsoleMasterController.Select(); outsoleRawMaterialList = OutsoleRawMaterialController.Select(); outsoleReleaseMaterialList = OutsoleReleaseMaterialController.SelectByOutsoleMaster(); productionMemoList = ProductionMemoController.Select(); outsoleMaterialList = OutsoleMaterialController.Select(); rawMaterialViewModelNewList = RawMaterialController.Select_1(); //sewingMasterList.RemoveAll(s => DateTimeHelper.Create(s.SewingBalance) != dtDefault && DateTimeHelper.Create(s.SewingBalance) != dtNothing); outsoleMasterList = outsoleMasterList.OrderBy(s => s.Sequence).ToList(); int[] materialIdUpperArray = { 1, 2, 3, 4, 10 }; int[] materialIdSewingArray = { 5, 7 }; int[] materialIdOutsoleArray = { 6 }; foreach (OutsoleMasterModel outsoleMaster in outsoleMasterList) { OutsoleMasterExportViewModel outsoleMasterExportView = new OutsoleMasterExportViewModel(); outsoleMasterExportView.Sequence = outsoleMaster.Sequence; outsoleMasterExportView.ProductNo = outsoleMaster.ProductNo; OrdersModel order = orderList.FirstOrDefault(f => f.ProductNo == outsoleMaster.ProductNo); string memoId = ""; if (order != null) { outsoleMasterExportView.Country = order.Country; outsoleMasterExportView.ShoeName = order.ShoeName; outsoleMasterExportView.ArticleNo = order.ArticleNo; outsoleMasterExportView.OutsoleCode = order.OutsoleCode; outsoleMasterExportView.PatternNo = order.PatternNo; outsoleMasterExportView.Quantity = order.Quantity; outsoleMasterExportView.ETD = order.ETD; List <ProductionMemoModel> productionMemoByProductionNumberList = productionMemoList.Where(p => p.ProductionNumbers.Contains(order.ProductNo) == true).ToList(); for (int p = 0; p <= productionMemoByProductionNumberList.Count - 1; p++) { ProductionMemoModel productionMemo = productionMemoByProductionNumberList[p]; memoId += productionMemo.MemoId; if (p < productionMemoByProductionNumberList.Count - 1) { memoId += "\n"; } } outsoleMasterExportView.MemoId = memoId; } //MaterialArrivalViewModel materialArrivalOutsole = MaterialArrival(order.ProductNo, materialIdOutsoleArray); //outsoleMasterExportView.IsOutsoleMatsArrivalOk = false; //if (materialArrivalOutsole != null) //{ // outsoleMasterExportView.OutsoleMatsArrival = String.Format(new CultureInfo("en-US"), "{0:dd-MMM}", materialArrivalOutsole.Date); // outsoleMasterExportView.IsOutsoleMatsArrivalOk = materialArrivalOutsole.IsMaterialArrivalOk; //} // Update follow OutsoleRawMaterial //var osRawMaterial = outsoleRawMaterialList.Where(w => w.ProductNo == order.ProductNo).ToList(); //var actualDateList = osRawMaterial.Select(s => s.ActualDate).ToList(); //outsoleMasterExportView.IsOutsoleMatsArrivalOk = false; //if (actualDateList.Count() > 0 && actualDateList.Contains(dtDefault) == false) //{ // outsoleMasterExportView.OutsoleMatsArrival = String.Format(new CultureInfo("en-US"), "{0:dd-MMM}", actualDateList.Max()); // outsoleMasterExportView.IsOutsoleMatsArrivalOk = true; //} //else //{ // var etdDateList = osRawMaterial.Select(s => s.ETD).ToList(); // if (etdDateList.Count() > 0) // { // outsoleMasterExportView.OutsoleMatsArrival = String.Format(new CultureInfo("en-US"), "{0:dd-MMM}", etdDateList.Max()); // } //} outsoleMasterExportView.IsOutsoleMatsArrivalOk = false; var rawMaterialViewModelNew = rawMaterialViewModelNewList.FirstOrDefault(f => f.ProductNo == order.ProductNo); if (String.IsNullOrEmpty(rawMaterialViewModelNew.OUTSOLE_Remarks) && !String.IsNullOrEmpty(rawMaterialViewModelNew.OUTSOLE_ActualDate)) { outsoleMasterExportView.OutsoleMatsArrival = rawMaterialViewModelNew.OUTSOLE_ActualDate; outsoleMasterExportView.IsOutsoleMatsArrivalOk = true; } else { outsoleMasterExportView.OutsoleMatsArrival = rawMaterialViewModelNew.OUTSOLE_ETD; } outsoleMasterExportView.OutsoleLine = outsoleMaster.OutsoleLine; outsoleMasterExportView.OutsoleStartDate = outsoleMaster.OutsoleStartDate; outsoleMasterExportView.OutsoleFinishDate = outsoleMaster.OutsoleFinishDate; outsoleMasterExportView.OutsoleQuota = outsoleMaster.OutsoleQuota; outsoleMasterExportView.OutsoleBalance = outsoleMaster.OutsoleBalance; //RawMaterialModel outsoleRawMaterial = rawMaterialList.FirstOrDefault(f => f.ProductNo == outsoleMaster.ProductNo && materialIdOutsoleArray.Contains(f.MaterialTypeId)); //if (outsoleRawMaterial != null) //{ // outsoleMasterExportView.OutsoleWHBalance = outsoleRawMaterial.Remarks; //} //else //{ // outsoleMasterExportView.OutsoleWHBalance = ""; //} // Load Outsole_Remarks from OutsoleMaterial var outsoleMaterial_PO = outsoleMaterialList.Where(w => w.ProductNo == order.ProductNo).ToList(); var osMaterialSumBySupplier = outsoleMaterial_PO.GroupBy( g => g.OutsoleSupplierId) .Select(s => new { PO = order.ProductNo, Supplier = s.Key, ActualDelivery = outsoleMaterial_PO.Where(w => w.OutsoleSupplierId == s.Key) .Sum(su => su.Quantity - su.QuantityReject) }).ToList(); // if pot no one delivery. not show the balance quantity. if (osMaterialSumBySupplier.Count > 0 && order.Quantity - osMaterialSumBySupplier.Min(m => m.ActualDelivery) > 0) { // show the balance outsoleMasterExportView.OutsoleWHBalance = (order.Quantity - osMaterialSumBySupplier.Min(m => m.ActualDelivery)).ToString(); // if no one delivery, show blank if (outsoleMaterial_PO.Sum(s => s.Quantity) == 0) { outsoleMasterExportView.OutsoleWHBalance = ""; } } SewingMasterModel sewingMaster = sewingMasterList.FirstOrDefault(f => f.ProductNo == outsoleMaster.ProductNo); if (sewingMaster != null) { outsoleMasterExportView.SewingStartDate = sewingMaster.SewingStartDate; outsoleMasterExportView.SewingFinishDate = sewingMaster.SewingFinishDate; outsoleMasterExportView.SewingQuota = sewingMaster.SewingQuota; outsoleMasterExportView.SewingBalance = sewingMaster.SewingBalance; } else { outsoleMasterExportView.SewingStartDate = dtDefault; outsoleMasterExportView.SewingFinishDate = dtDefault; outsoleMasterExportView.SewingQuota = 0; outsoleMasterExportView.SewingBalance = ""; } List <OutsoleReleaseMaterialModel> outsoleReleaseMaterialList_D1 = outsoleReleaseMaterialList.Where(o => o.ProductNo == outsoleMaster.ProductNo).ToList(); int qtyReleased = outsoleReleaseMaterialList_D1.Sum(o => o.Quantity); outsoleMasterExportView.ReleasedQuantity = qtyReleased.ToString(); if (qtyReleased <= 0) { outsoleMasterExportView.ReleasedQuantity = ""; } if (qtyReleased >= outsoleMasterExportView.Quantity && outsoleReleaseMaterialList_D1.Count > 0) { DateTime releasedDate = outsoleReleaseMaterialList_D1.FirstOrDefault().ModifiedTime; outsoleMasterExportView.ReleasedQuantity = string.Format("{0:M/d}", releasedDate); } outsoleMasterExportViewList.Add(outsoleMasterExportView); } }
private void bwLoad_DoWork(object sender, DoWorkEventArgs e) { orderList = OrdersController.Select(); rawMaterialList = RawMaterialController.Select(); sewingMasterList = SewingMasterController.Select(); productionMemoList = ProductionMemoController.Select(); //sewingMasterList.RemoveAll(s => DateTimeHelper.Create(s.SewingBalance) != dtDefault && DateTimeHelper.Create(s.SewingBalance) != dtNothing); sewingMasterList = sewingMasterList.OrderBy(s => s.Sequence).ToList(); int[] materialIdUpperArray = { 1, 2, 3, 4, 10 }; int[] materialIdSewingArray = { 5, 7 }; int[] materialIdOutsoleArray = { 6 }; foreach (SewingMasterModel sewingMaster in sewingMasterList) { CutprepMasterExportViewModel cutprepMasterExportView = new CutprepMasterExportViewModel(); cutprepMasterExportView.Sequence = sewingMaster.Sequence; cutprepMasterExportView.ProductNo = sewingMaster.ProductNo; OrdersModel order = orderList.Where(o => o.ProductNo == sewingMaster.ProductNo).FirstOrDefault(); string memoId = ""; if (order != null) { cutprepMasterExportView.Country = order.Country; cutprepMasterExportView.ShoeName = order.ShoeName; cutprepMasterExportView.ArticleNo = order.ArticleNo; cutprepMasterExportView.PatternNo = order.PatternNo; cutprepMasterExportView.Quantity = order.Quantity; cutprepMasterExportView.ETD = order.ETD; List <ProductionMemoModel> productionMemoByProductionNumberList = productionMemoList.Where(p => p.ProductionNumbers.Contains(order.ProductNo) == true).ToList(); for (int p = 0; p <= productionMemoByProductionNumberList.Count - 1; p++) { ProductionMemoModel productionMemo = productionMemoByProductionNumberList[p]; memoId += productionMemo.MemoId; if (p < productionMemoByProductionNumberList.Count - 1) { memoId += "\n"; } } cutprepMasterExportView.MemoId = memoId; } MaterialArrivalViewModel materialArrivalUpper = MaterialArrival(order.ProductNo, materialIdUpperArray); cutprepMasterExportView.IsUpperMatsArrivalOk = false; if (materialArrivalUpper != null) { cutprepMasterExportView.UpperMatsArrival = String.Format(new CultureInfo("en-US"), "{0:dd-MMM}", materialArrivalUpper.Date); cutprepMasterExportView.IsUpperMatsArrivalOk = materialArrivalUpper.IsMaterialArrivalOk; } cutprepMasterExportView.SewingLine = sewingMaster.SewingLine; cutprepMasterExportView.SewingStartDate = sewingMaster.SewingStartDate; cutprepMasterExportView.SewingQuota = sewingMaster.SewingQuota; cutprepMasterExportView.SewingBalance = sewingMaster.SewingBalance; cutprepMasterExportView.CutAStartDate = sewingMaster.CutAStartDate; cutprepMasterExportView.CutAFinishDate = sewingMaster.CutAFinishDate; cutprepMasterExportView.CutAQuota = sewingMaster.CutAQuota; cutprepMasterExportView.AutoCut = sewingMaster.AutoCut; cutprepMasterExportView.LaserCut = sewingMaster.LaserCut; cutprepMasterExportView.HuasenCut = sewingMaster.HuasenCut; cutprepMasterExportView.CutABalance = sewingMaster.CutABalance; cutprepMasterExportView.PrintingBalance = sewingMaster.PrintingBalance; cutprepMasterExportView.H_FBalance = sewingMaster.H_FBalance; cutprepMasterExportView.EmbroideryBalance = sewingMaster.EmbroideryBalance; cutprepMasterExportView.CutBBalance = sewingMaster.CutBBalance; cutprepMasterExportViewList.Add(cutprepMasterExportView); } }
private void btnSave_Click(object sender, RoutedEventArgs e) { SectionModel section = cboSection.SelectedItem as SectionModel; if (section == null) { return; } List <ProductionNumberModel> productionNumberList = productionNumbers.Where(p => p != null && string.IsNullOrEmpty(p.Value.Trim()) == false).ToList(); if (productionNumberList.Count <= 0) { return; } BitmapImage picture = imgPicture.Source as BitmapImage; BitmapImage picture1 = imgPicture1.Source as BitmapImage; BitmapImage picture2 = imgPicture2.Source as BitmapImage; BitmapImage picture3 = imgPicture3.Source as BitmapImage; BitmapImage picture4 = imgPicture4.Source as BitmapImage; if (picture == null && picture1 == null && picture2 == null && picture3 == null && picture4 == null) { return; } string productionNumberString = ""; foreach (ProductionNumberModel productionNumber in productionNumberList) { productionNumberString += productionNumber.Value + ";"; } ProductionMemoModel model = new ProductionMemoModel() { SectionId = section.SectionId, ProductionNumbers = productionNumberString, Picture = null, Picture1 = null, Picture2 = null, Picture3 = null, Picture4 = null, }; if (picture != null) { model.Picture = ConvertJPGHelper.GetJPGFromBitmapImage(picture); } if (picture1 != null) { model.Picture1 = ConvertJPGHelper.GetJPGFromBitmapImage(picture1); } if (picture2 != null) { model.Picture2 = ConvertJPGHelper.GetJPGFromBitmapImage(picture2); } if (picture3 != null) { model.Picture3 = ConvertJPGHelper.GetJPGFromBitmapImage(picture3); } if (picture4 != null) { model.Picture4 = ConvertJPGHelper.GetJPGFromBitmapImage(picture4); } if (threadInsert.IsBusy == true) { return; } this.Cursor = Cursors.Wait; btnSave.IsEnabled = false; threadInsert.RunWorkerAsync(model); }
private void btnSave_Click(object sender, RoutedEventArgs e) { if (MessageBox.Show("Save?", "Confirm", MessageBoxButton.OKCancel, MessageBoxImage.Question) != MessageBoxResult.OK) { return; } string memoId = lblMemoId.Text; if (string.IsNullOrEmpty(memoId) == true) { return; } List <ProductionNumberModel> productionNumberList = productionNumbers.Where(p => p != null && string.IsNullOrEmpty(p.Value.Trim()) == false).ToList(); if (productionNumberList.Count <= 0) { return; } BitmapImage picture = imgPicture.Source as BitmapImage; BitmapImage picture1 = imgPicture1.Source as BitmapImage; BitmapImage picture2 = imgPicture2.Source as BitmapImage; BitmapImage picture3 = imgPicture3.Source as BitmapImage; BitmapImage picture4 = imgPicture4.Source as BitmapImage; if (picture == null && picture1 == null && picture2 == null && picture3 == null && picture4 == null) { return; } string productionNumberString = ""; foreach (ProductionNumberModel productionNumber in productionNumberList) { productionNumberString += productionNumber.Value + ";"; } ProductionMemoModel model = new ProductionMemoModel() { MemoId = memoId, ProductionNumbers = productionNumberString, Picture = null, Picture1 = null, Picture2 = null, Picture3 = null, Picture4 = null, }; if (picture != null) { model.Picture = ConvertJPGHelper.GetJPGFromBitmapImage(picture); } if (picture1 != null) { model.Picture1 = ConvertJPGHelper.GetJPGFromBitmapImage(picture1); } if (picture2 != null) { model.Picture2 = ConvertJPGHelper.GetJPGFromBitmapImage(picture2); } if (picture3 != null) { model.Picture3 = ConvertJPGHelper.GetJPGFromBitmapImage(picture3); } if (picture4 != null) { model.Picture4 = ConvertJPGHelper.GetJPGFromBitmapImage(picture4); } if (threadInsert.IsBusy == true) { return; } this.Cursor = Cursors.Wait; btnSave.IsEnabled = false; threadInsert.RunWorkerAsync(model); }
private void dgProductionMemo_MouseDoubleClick(object sender, MouseButtonEventArgs e) { ProductionMemoModel productionMemoView = dgProductionMemo.CurrentItem as ProductionMemoModel; if (productionMemoView == null) { return; } lblMemoId.Text = null; cboSection.SelectedItem = null; productionNumbers.Clear(); imgPicture.Source = null; imgPicture1.Source = null; imgPicture2.Source = null; imgPicture3.Source = null; imgPicture4.Source = null; ProductionMemoModel productionMemo = productionMemoList.Where(p => p.MemoId == productionMemoView.MemoId).FirstOrDefault(); if (productionMemo != null) { lblMemoId.Text = productionMemo.MemoId; SectionModel section = sectionList.Where(s => s.SectionId == productionMemo.SectionId).FirstOrDefault(); if (section != null) { cboSection.SelectedItem = section; } string[] productNumberArray = productionMemo.ProductionNumbers.Split(';'); foreach (string productNumber in productNumberArray) { if (string.IsNullOrEmpty(productNumber) == false) { productionNumbers.Add(new ProductionNumberModel() { Value = productNumber }); } } if (productionMemo.Picture != null) { imgPicture.Source = ConvertJPGHelper.GetBitmapImageFromJPG(productionMemo.Picture); } if (productionMemo.Picture1 != null) { imgPicture1.Source = ConvertJPGHelper.GetBitmapImageFromJPG(productionMemo.Picture1); } if (productionMemo.Picture2 != null) { imgPicture2.Source = ConvertJPGHelper.GetBitmapImageFromJPG(productionMemo.Picture2); } if (productionMemo.Picture3 != null) { imgPicture3.Source = ConvertJPGHelper.GetBitmapImageFromJPG(productionMemo.Picture3); } if (productionMemo.Picture4 != null) { imgPicture4.Source = ConvertJPGHelper.GetBitmapImageFromJPG(productionMemo.Picture4); } } else { MessageBox.Show("Not Found!", "Search", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void threadInsert_DoWork(object sender, DoWorkEventArgs e) { ProductionMemoModel model = e.Argument as ProductionMemoModel; e.Result = ProductionMemoController.Update(model); }