Beispiel #1
0
        private void Button2_Click(object sender, EventArgs e)
        {
            int[] revenueFromEquipment     = new int[_duration + 1];
            int[] equipmentMaintenanceCost = new int[_duration + 1];
            int[] sellingPrice             = new int[_duration + 1];
            try
            {
                for (int i = 1; i < _duration + 2; i++)
                {
                    revenueFromEquipment[i - 1]     = int.Parse(tableLayoutPanel1.GetControlFromPosition(i, 2).Text);
                    equipmentMaintenanceCost[i - 1] = int.Parse(tableLayoutPanel1.GetControlFromPosition(i, 3).Text);
                    sellingPrice[i - 1]             = int.Parse(tableLayoutPanel1.GetControlFromPosition(i, 1).Text);
                }

                var(profit, yearsWhenChange) = EquipmentReplacementLogic.EquipmentReplacementLogic.Run(revenueFromEquipment, equipmentMaintenanceCost,
                                                                                                       sellingPrice, _duration + 1, _costNew, _initialAge);
                FormResult resultForm = new FormResult(profit, yearsWhenChange);
                resultForm.Show();
            }
            catch
            {
                ErorForm erorForm = new ErorForm();
                erorForm.Show();
            }
        }
Beispiel #2
0
 private void Button2_Click(object sender, EventArgs e)
 {
     try
     {
         var size       = int.Parse(maskedTextBoxDuration.Text.Trim());
         var initialAge = int.Parse(maskedTextBoxInitialAge.Text.Trim());
         var newCost    = int.Parse(maskedTextBoxNewCost.Text.Trim());
         if (size < 1 || newCost < 1)
         {
             throw new Exception();
         }
         if (initialAge >= size)
         {
             initialAge = size;
         }
         DataTableForm dataTable = new DataTableForm(size, initialAge, newCost);
         dataTable.Show();
     }
     catch
     {
         ErorForm erorForm = new ErorForm();
         erorForm.Show();
     }
 }