//--------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------- //------------------------------------ Array Part operations ---------------------------------------- //--------------------------------------------------------------------------------------------------- // Make all the parts in an array invisible public static void HideAll(Part[] parts) { foreach (Part part in parts) // For each part { PartAdapter.Hide(part); // Hide it } }
// Fill dropdown based on parts array public static void FillDropdown(Part[] parts, Dropdown dropdown) { dropdown.options.Clear(); // Clear previous options string[] names = PartAdapter.GetNames(parts); // Get array of names dropdown.captionText.text = names[0]; // Set caption foreach (string name in names) // For each name { dropdown.options.Add(new Dropdown.OptionData(name)); // Add it to the dropdown options } }
// Toggle the part visibility public static void Toggle(Part part) { if (PartAdapter.IsHidden(part)) { PartAdapter.Show(part); } else if (PartAdapter.IsShown(part)) { PartAdapter.Hide(part); } }
// Find index of a visible part in an array (1st occurance) public static int FindShown(Part[] parts) { for (int i = 0; i < parts.Length; i++) // For each part { if (PartAdapter.IsShown(parts[i])) // If it is visible { return(i); // Return index } } return(-1); // If no visible parts found, return -1 }
private bool CheckIfPartWasDeleted(string partnum) { var exist = false; using (var pad = new PartAdapter(oTrans)) { pad.BOConnect(); try { exist = pad.GetByID(partnum); } catch { } } return(exist); }
// Make only one part in an array visible (only "stock" part) public static void ShowOEM(Part[] parts) { PartAdapter.ShowOne(parts, PartAdapter.FindOEM(parts)); // Show OEM part }
// Make only one part in an array visible (from specific dropdown) public static void ShowOne(Part[] parts, Dropdown dropdown) { PartAdapter.ShowOne(parts, dropdown.value); // Show part at current dropdown selection }
// Make only one part in an array visible (at specific index) public static void ShowOne(Part[] parts, int i) { PartAdapter.HideAll(parts); // Hide all parts PartAdapter.Show(parts[i]); // Show selected part }
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(); }
private Guid[] GetUuids(ApplicationHeader applicationHeader, string[] cprNumbers) { PartAdapter adpt = new PartAdapter(Properties.Settings.Default.CPRBrokerWebServiceUrl); return(Array.ConvertAll <string, Guid>(cprNumbers, cpr => adpt.GetUuid(applicationHeader.ApplicationToken, cpr))); }
public void SetShownIndex(int i) { PartAdapter.ShowOne(parts, i); dropdown.value = i; }
public int GetShownIndex() { return(PartAdapter.FindShown(parts)); }
// What happens when dropdown value is changed? public void OnDropdownChange() { PartAdapter.ShowOne(parts, dropdown); // Show dropdown selection }
public Part[] parts; // array of parts // What happens when this object is initialized? public void Initialize() { PartAdapter.FillDropdown(parts, dropdown); // Setup the dropdown from parts array PartAdapter.ShowOEM(parts); // Show only OEM part initially this.InitializeDropdownListener(); // Set listener to dropdown }