public static void CreateCounterSleeve(CounterSleeveModel model) { List <CounterSleeveModel> allCounterSleeves = CounterSleeve_GetAll(); if (allCounterSleeves.Count > 0) { model.Id = allCounterSleeves.OrderByDescending(x => x.Id).First().Id + 1; } else { model.Id = 1; } allCounterSleeves.Add(model); allCounterSleeves.SaveCounterSleevesToFile(); }
private void addNewSpringButton_Click(object sender, EventArgs e) { if (!ValidateData()) { return; } CounterSleeveModel model = new CounterSleeveModel() { Number = counterSleeveNumberTextBox.Text, LengthOne = double.Parse(counterSleeveLenghtOneTextBox.Text), LengthOneTolerance = double.Parse(counterSleeveLenghtOneToleranceTextBox.Text), LengthTwo = double.Parse(counterSleeveLenghtTwoTextBox.Text), LengthTwoTolerance = double.Parse(counterSleeveLenghtTwoToleranceTextBox.Text) }; TextConnector.CreateCounterSleeve(model); allCounterSleeves.Add(model); UpdateData(); callingForm.NewCounterSleeveCreated(model); }
public static List <CounterSleeveModel> ConvertTextToCounterSleeve(this List <string> lines) { //Id|^|Number|^|LengthOne|^|LengthOneTolerance|^|LengthTwo|^|LengthTwoTolerance"; List <CounterSleeveModel> output = new List <CounterSleeveModel>(); CounterSleeveModel curr = new CounterSleeveModel(); foreach (string line in lines) { string[] cols = line.Split(new string[] { "|^|" }, StringSplitOptions.None); curr.Id = int.Parse(cols[0]); curr.Number = cols[1]; curr.LengthOne = double.Parse(cols[2]); curr.LengthOneTolerance = double.Parse(cols[3]); curr.LengthTwo = double.Parse(cols[4]); curr.LengthTwoTolerance = double.Parse(cols[5]); output.Add(curr); curr = new CounterSleeveModel(); } return(output); }
public void NewCounterSleeveCreated(CounterSleeveModel model) { allCounterSleeves.Add(model); UpdateNewPartSetGroupBoxes(); }
private void allCounterSleevsComboBox_SelectionChangeCommitted(object sender, EventArgs e) { selectedCounterSleeve = (CounterSleeveModel)allCounterSleevsComboBox.SelectedItem; WireUpLists(); }