Example #1
0
        /// <summary>
        /// Сохранение измененных данных в редактируемом элементе
        /// </summary>
        public bool SaveData()
        {
/*            string message = "";
 *          if (generalInformationControl.PartNumber == "")
 *          {
 *              GetMessage(ref message, "Part Number");
 *          }
 *          if (generalInformationControl.SerialNumber == "")
 *          {
 *              GetMessage(ref message, "Serial Number");
 *          }
 *          if (generalInformationControl.Description == "")
 *          {
 *              GetMessage(ref message, "Description");
 *          }
 *          if (message != "")
 *          {
 *              MessageBox.Show(message, new TermsProvider()["SystemName"].ToString(), MessageBoxButtons.OK,
 *                              MessageBoxIcon.Exclamation);
 *              return false;
 *          }*/
            generalInformationControl.Focus();
            baseDetailHeaderControl.SaveData();
            generalInformationControl.SaveData();
            compliancePerformanceControl.SaveData();
            warrantyControl.SaveData();
            easaControl.SaveData();
            if (!currentDetail.InUse)
            {
                storeControl.SaveData();
            }

            try
            {
                currentDetail.Save(true);
            }
            catch (Exception ex)
            {
                Program.Provider.Logger.Log("Error while saving data", ex);
                return(false);
            }
            UpdateDetail(false);
            return(true);
        }
Example #2
0
        /// <summary>
        /// Данные работы обновляются по введенным значениям
        /// </summary>
        private bool SaveData()
        {
            if (SerialNumber == "")
            {
                SimpleBalloon.Show(textBoxSerialNumber, ToolTipIcon.Warning, "Value expected", "Please enter serial number");
                return(false);
            }
            if (PartNumber == "")
            {
                SimpleBalloon.Show(textBoxPartNumber, ToolTipIcon.Warning, "Value expected", "Please enter part number");
                return(false);
            }
            if (DetailPattern != currentDetail.DetailPattern)
            {
                currentDetail.DetailPattern = DetailPattern;
            }
            if (SerialNumber != currentDetail.SerialNumber)
            {
                currentDetail.SerialNumber = SerialNumber;
            }
            if (PartNumber != currentDetail.PartNumber)
            {
                currentDetail.PartNumber = PartNumber;
            }
            if (Description != currentDetail.Description)
            {
                currentDetail.Description = Description;
            }
            if (ShelfLife != currentDetail.ShelfLife)
            {
                currentDetail.ShelfLife = ShelfLife;
            }
            if (ExpiryDate != currentDetail.ExpirationDate)
            {
                currentDetail.ExpirationDate = ExpiryDate;
            }
            if (NotificationDate != currentDetail.NotificationDate)
            {
                currentDetail.NotificationDate = NotificationDate;
            }
            if (Serviceable != currentDetail.Serviceable)
            {
                currentDetail.Serviceable = Serviceable;
            }
            if (Remarks != currentDetail.Remarks)
            {
                currentDetail.Remarks = Remarks;
            }

            try
            {
                if (mode == ScreenMode.Add)
                {
                    parentStore.Add(currentDetail);
                    mode = ScreenMode.Edit;
                }
                else
                {
                    currentDetail.Save();
                }
            }
            catch (Exception ex)
            {
                Program.Provider.Logger.Log("Error while saving data", ex);
                return(false);
            }
            return(true);
        }