예제 #1
0
        /// <summary>
        /// Данные работы обновляются по введенным значениям
        /// </summary>
        private bool SaveData()
        {
            double eps = 0.00000001;
            double hours;
            double cycles;

            if (!UsefulMethods.CheckDoubleValue(textBoxHours.Text, out hours, "Hours"))
            {
                SimpleBalloon.Show(textBoxHours, ToolTipIcon.Warning, "Incorrect value", "Please enter the float number");
                return(false);
            }
            if (!UsefulMethods.CheckDoubleValue(textBoxCycles.Text, out cycles, "Cycles"))
            {
                SimpleBalloon.Show(textBoxCycles, ToolTipIcon.Warning, "Incorrect value", "Please enter the float number");
                return(false);
            }
            if (currentAircraft.UtilizationInterval.UtilizationIntervalType != UtilzationIntervalType)
            {
                currentAircraft.UtilizationInterval.UtilizationIntervalType = UtilzationIntervalType;
            }
            if (Math.Abs(currentAircraft.UtilizationInterval.Hours - hours) > eps)
            {
                currentAircraft.UtilizationInterval.Hours = hours;
            }
            if (Math.Abs(currentAircraft.UtilizationInterval.Cycles - cycles) > eps)
            {
                currentAircraft.UtilizationInterval.Cycles = cycles;
            }

            try
            {
                currentAircraft.Save(true);
            }
            catch (Exception ex)
            {
                Program.Provider.Logger.Log("Error while saving data", ex);
                return(false);
            }
            return(true);
        }