コード例 #1
0
        public static void CreateBearing(BearingModel model)
        {
            List <BearingModel> allBearings = Bearing_GetAll();

            if (allBearings.Count > 0)
            {
                model.Id = allBearings.OrderByDescending(x => x.Id).First().Id + 1;
            }

            else
            {
                model.Id = 1;
            }

            allBearings.Add(model);

            allBearings.SaveBearingsToFile();
        }
コード例 #2
0
        private void addNewBearingButton_Click(object sender, EventArgs e)
        {
            if (!ValidateData())
            {
                return;
            }
            BearingModel model = new BearingModel()
            {
                Number          = bearingNumberTextBox.Text,
                Length          = double.Parse(bearingLengthTextBox.Text),
                LengthTolerance = double.Parse(bearingLengthToleranceTextBox.Text),
                Step            = double.Parse(bearingStepTextBox.Text),
                StepTolerance   = double.Parse(bearingStepToleranceTextBox.Text)
            };

            TextConnector.CreateBearing(model);

            allBearings.Add(model);

            UpdateData();

            callingForm.NewBearingCreated(model);
        }
コード例 #3
0
        public static List <BearingModel> ConvertTextToBearing(this List <string> lines)
        {
            //Id|^|Number|^|Lenght|^|LenghtTolerance|^|Step|^|StepTolerance";

            List <BearingModel> output = new List <BearingModel>();
            BearingModel        curr   = new BearingModel();

            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.Step            = double.Parse(cols[4]);
                curr.StepTolerance   = double.Parse(cols[5]);

                output.Add(curr);
                curr = new BearingModel();
            }

            return(output);
        }
コード例 #4
0
 private void allBearingsComboBox_SelectionChangeCommitted(object sender, EventArgs e)
 {
     selectedBearing = (BearingModel)allBearingsComboBox.SelectedItem;
     WireUpLists();
 }
コード例 #5
0
 public void NewBearingCreated(BearingModel model)
 {
     allBearings.Add(model);
     UpdateNewPartSetGroupBoxes();
 }