private bool CheckIfPartWasDeleted(string partnum) { var exist = false; using (var pad = new PartAdapter(oTrans)) { pad.BOConnect(); try { exist = pad.GetByID(partnum); } catch { } } return(exist); }
private static void btnGenWH_Click(object sender, System.EventArgs args) { PartAdapter InsertWH = new PartAdapter(oTrans); InsertWH.BOConnect(); if (edvPart.dataView[edvPart.Row]["Company"].ToString() == "19268") { string[] ArrWH = { "310322", "310323", "310324", "310325", "310326", "310327", "310328", "310329", "310330", "310331", "310332", "310333", "310334", "310335", "310336", "310337", "310338", "310339", "310340", "310341", "310342", "310345", "310346", "310347", "310348", "310349", "310350", "310351", "310354", "310355", "310356", "310357", "310358", "310352", "310353" }; for (int i = 0; i <= ArrWH.Length - 1; i++) { InsertWH.GetByID(edvPart.dataView[edvPart.Row]["PartNum"].ToString()); InsertWH.GetNewPartWhse(edvPart.dataView[edvPart.Row]["PartNum"].ToString(), "MfgSys"); DataRow newXAttchRow = InsertWH.PartData.PartWhse[InsertWH.PartData.PartWhse.Rows.Count - 1]; newXAttchRow["Company"] = edvPart.dataView[edvPart.Row]["Company"].ToString(); newXAttchRow["PartNum"] = edvPart.dataView[edvPart.Row]["PartNum"].ToString(); newXAttchRow["WarehouseCode"] = ArrWH[i].ToString(); try { InsertWH.Update(); } catch (Exception ex) { } } } else { if ((edvPart.dataView[edvPart.Row]["ClassID"].ToString() == "FG") || (edvPart.dataView[edvPart.Row]["ClassID"].ToString() == "SFG")) { string[] ArrWH = { "320328", "320330", "320331", "320332", "320333", "320334", "320335", "320337", "320338", "320339", "320341", "320329" }; for (int i = 0; i <= ArrWH.Length - 1; i++) { InsertWH.GetByID(edvPart.dataView[edvPart.Row]["PartNum"].ToString()); InsertWH.GetNewPartWhse(edvPart.dataView[edvPart.Row]["PartNum"].ToString(), "MfgSys"); DataRow newXAttchRow = InsertWH.PartData.PartWhse[InsertWH.PartData.PartWhse.Rows.Count - 1]; newXAttchRow["Company"] = edvPart.dataView[edvPart.Row]["Company"].ToString(); newXAttchRow["PartNum"] = edvPart.dataView[edvPart.Row]["PartNum"].ToString(); newXAttchRow["WarehouseCode"] = ArrWH[i].ToString(); try { InsertWH.Update(); } catch (Exception ex) { } } } else if (edvPart.dataView[edvPart.Row]["ClassID"].ToString() == "DM") { string[] ArrWH = { "320321", "320322", "320336", "320337", "320338", "320329" }; for (int i = 0; i <= ArrWH.Length - 1; i++) { InsertWH.GetByID(edvPart.dataView[edvPart.Row]["PartNum"].ToString()); InsertWH.GetNewPartWhse(edvPart.dataView[edvPart.Row]["PartNum"].ToString(), "MfgSys"); DataRow newXAttchRow = InsertWH.PartData.PartWhse[InsertWH.PartData.PartWhse.Rows.Count - 1]; newXAttchRow["Company"] = edvPart.dataView[edvPart.Row]["Company"].ToString(); newXAttchRow["PartNum"] = edvPart.dataView[edvPart.Row]["PartNum"].ToString(); newXAttchRow["WarehouseCode"] = ArrWH[i].ToString(); try { InsertWH.Update(); } catch (Exception ex) { } } } else if (edvPart.dataView[edvPart.Row]["ClassID"].ToString() == "IM") { string[] ArrWH = { "320323", "320324", "320337", "320338" }; for (int i = 0; i <= ArrWH.Length - 1; i++) { InsertWH.GetByID(edvPart.dataView[edvPart.Row]["PartNum"].ToString()); InsertWH.GetNewPartWhse(edvPart.dataView[edvPart.Row]["PartNum"].ToString(), "MfgSys"); DataRow newXAttchRow = InsertWH.PartData.PartWhse[InsertWH.PartData.PartWhse.Rows.Count - 1]; newXAttchRow["Company"] = edvPart.dataView[edvPart.Row]["Company"].ToString(); newXAttchRow["PartNum"] = edvPart.dataView[edvPart.Row]["PartNum"].ToString(); newXAttchRow["WarehouseCode"] = ArrWH[i].ToString(); try { InsertWH.Update(); } catch (Exception ex) { } } } else if (edvPart.dataView[edvPart.Row]["ClassID"].ToString() == "PK") { string[] ArrWH = { "320325", "320326", "320337", "320338" }; for (int i = 0; i <= ArrWH.Length - 1; i++) { InsertWH.GetByID(edvPart.dataView[edvPart.Row]["PartNum"].ToString()); InsertWH.GetNewPartWhse(edvPart.dataView[edvPart.Row]["PartNum"].ToString(), "MfgSys"); DataRow newXAttchRow = InsertWH.PartData.PartWhse[InsertWH.PartData.PartWhse.Rows.Count - 1]; newXAttchRow["Company"] = edvPart.dataView[edvPart.Row]["Company"].ToString(); newXAttchRow["PartNum"] = edvPart.dataView[edvPart.Row]["PartNum"].ToString(); newXAttchRow["WarehouseCode"] = ArrWH[i].ToString(); try { InsertWH.Update(); } catch (Exception ex) { } } } else if (edvPart.dataView[edvPart.Row]["ClassID"].ToString() == "CT") { string[] ArrWH = { "320340" }; for (int i = 0; i <= ArrWH.Length - 1; i++) { InsertWH.GetByID(edvPart.dataView[edvPart.Row]["PartNum"].ToString()); InsertWH.GetNewPartWhse(edvPart.dataView[edvPart.Row]["PartNum"].ToString(), "MfgSys"); DataRow newXAttchRow = InsertWH.PartData.PartWhse[InsertWH.PartData.PartWhse.Rows.Count - 1]; newXAttchRow["Company"] = edvPart.dataView[edvPart.Row]["Company"].ToString(); newXAttchRow["PartNum"] = edvPart.dataView[edvPart.Row]["PartNum"].ToString(); newXAttchRow["WarehouseCode"] = ArrWH[i].ToString(); try { InsertWH.Update(); } catch (Exception ex) { } } } } InsertWH.Dispose(); }