public static void CreateSleeve(SleeveModel model) { List <SleeveModel> allSleeves = Sleeve_GetAll(); if (allSleeves.Count > 0) { model.Id = allSleeves.OrderByDescending(x => x.Id).First().Id + 1; } else { model.Id = 1; } allSleeves.Add(model); allSleeves.SaveSleevesToFile(); }
private void addNewSleeveButton_Click(object sender, EventArgs e) { if (!ValidateData()) { return; } SleeveModel model = new SleeveModel() { Number = sleeveNumberTextBox.Text, Length = double.Parse(sleeveLengthTextBox.Text), LengthTolerance = double.Parse(sleeveLenghtToleranceTextBox.Text), StepHeight = double.Parse(sleeveStepHeightTextBox.Text), StepHeightTolerance = double.Parse(sleeveStepHeightToleranceTextBox.Text) }; TextConnector.CreateSleeve(model); allSleeves.Add(model); UpdateData(); callingForm.NewSleeveCreated(model); }
public static List <SleeveModel> ConvertTextToSleeve(this List <string> lines) { //Id|^|Number|^|Lenght|^|LenghtTolerance|^|StepHeight|^|StepHeightTolerance"; List <SleeveModel> output = new List <SleeveModel>(); SleeveModel curr = new SleeveModel(); foreach (string line in lines) { string[] cols = line.Split(new string[] { "|^|" }, StringSplitOptions.None); curr.Id = int.Parse(cols[0]); curr.Number = cols[1]; curr.Length = double.Parse(cols[2]); curr.LengthTolerance = double.Parse(cols[3]); curr.StepHeight = double.Parse(cols[4]); curr.StepHeightTolerance = double.Parse(cols[5]); output.Add(curr); curr = new SleeveModel(); } return(output); }
private void allSleevsComboBox_SelectionChangeCommitted(object sender, EventArgs e) { selectedSleeve = (SleeveModel)allSleevsComboBox.SelectedItem; WireUpLists(); }
public void NewSleeveCreated(SleeveModel model) { allSleeves.Add(model); UpdateNewPartSetGroupBoxes(); }