public static List <PartSetModel> ConvertTextToPartSet(this List <string> lines) { //Id|^|Name|^|SleeveId|^|BearingId|^|CounterSleeveId; List <PartSetModel> output = new List <PartSetModel>(); PartSetModel curr = new PartSetModel(); List <SleeveModel> sleeves = TextConnector.Sleeve_GetAll(); List <BearingModel> bearings = TextConnector.Bearing_GetAll(); List <CounterSleeveModel> counterSleeves = TextConnector.CounterSleeve_GetAll(); foreach (string line in lines) { string[] cols = line.Split(new string[] { "|^|" }, StringSplitOptions.None); curr.Id = int.Parse(cols[0]); curr.Name = cols[1]; curr.Sleeve = sleeves.Where(x => x.Id == int.Parse(cols[2])).First(); curr.Bearing = bearings.Where(x => x.Id == int.Parse(cols[3])).First(); curr.CounterSleeve = counterSleeves.Where(x => x.Id == int.Parse(cols[4])).First(); output.Add(curr); curr = new PartSetModel(); } return(output); }
public CreateCounterSleeve(ICounterSleeveRequestor caller) { InitializeComponent(); callingForm = caller; allCounterSleeves = TextConnector.CounterSleeve_GetAll(); UpdateData(); WireUpLists(); }
public OtherPartsViewer(IPartSetRequestor caller) { InitializeComponent(); callingForm = caller; allPartSets = TextConnector.PartSet_GetAll(); allSleeves = TextConnector.Sleeve_GetAll(); allCounterSleeves = TextConnector.CounterSleeve_GetAll(); allBearings = TextConnector.Bearing_GetAll(); UpdatePartSetList(); UpdateNewPartSetGroupBoxes(); if (selectedPartSet.Id != 0) { WireUpLists(); } }