Пример #1
0
 /// <summary>
 /// Обновляет информацию о текущем ВС
 /// </summary>
 private void UpdateControl()
 {
     textBoxAircraftModel.Text             = currentAircraft.Model;
     textBoxManufactureDate.Text           = currentAircraft.ManufactureDate.ToString(new TermsProvider()["DateFormat"].ToString());
     dateTimePickerManufactureDate.MaxDate = DateTime.Now;
     dateTimePickerManufactureDate.Value   = currentAircraft.ManufactureDate;
     textBoxSerialNumber.Text       = currentAircraft.SerialNumber;
     textBoxRegistrationNumber.Text = currentAircraft.RegistrationNumber;
     textBoxOwner.Text    = currentAircraft.Owner;
     textBoxOperator.Text = currentAircraft.Operator.Name;
     if (currentAircraft is WestAircraft)
     {
         WestAircraft westAircraft = (WestAircraft)currentAircraft;
         textBoxAircraftTypeCertificateNo.Text = westAircraft.TypeCertificateNumber;
         textBoxVariableNumber.Text            = westAircraft.VariableNumber;
         textBoxLineNumber.Text = westAircraft.LineNumber;
     }
     if (currentAircraft is AircraftProxy)
     {
         AircraftProxy westAircraft = (AircraftProxy)currentAircraft;
         textBoxAircraftTypeCertificateNo.Text = westAircraft.TypeCertificateNumber;
         textBoxVariableNumber.Text            = westAircraft.VariableNumber;
         textBoxLineNumber.Text = westAircraft.LineNumber;
     }
     CheckAircraftType();
     UpdateDateAsOf();
     CheckPermission();
 }
Пример #2
0
        /// <summary>
        /// Проверяет, какой тип судна отображается
        /// </summary>
        private void CheckAircraftType()
        {
            bool isWestAircraft = currentAircraft.Type == AircraftType.West ? true : false;

            if (isWestAircraft)
            {
                WestAircraft aircraft = currentAircraft as WestAircraft;
                if (aircraft != null)
                {
                    textBoxVariableNumber.Text            = aircraft.VariableNumber;
                    textBoxLineNumber.Text                = aircraft.LineNumber;
                    textBoxAircraftTypeCertificateNo.Text = aircraft.TypeCertificateNumber;
                }
                Height = 7 * (HEIGHT_INTERVAL + TEXT_BOX_HEIGHT) + TOP_MARGIN + BOTTOM_MARGIN;
            }
            else
            {
                Height = 6 * (HEIGHT_INTERVAL + TEXT_BOX_HEIGHT) + TOP_MARGIN + BOTTOM_MARGIN;
            }
            labelVariableNumber.Visible              = isWestAircraft;
            labelLineNumber.Visible                  = isWestAircraft;
            labelAircraftTypeCertificateNo.Visible   = isWestAircraft;
            textBoxVariableNumber.Visible            = isWestAircraft;
            textBoxLineNumber.Visible                = isWestAircraft;
            textBoxAircraftTypeCertificateNo.Visible = isWestAircraft;
        }
Пример #3
0
 ///<summary>
 /// Обновляет информацию о ВС
 ///</summary>
 public override void UpdateData()
 {
     labelModelValue.Text = currentAircraft.Model;
     labelRegistrationNumberValue.Text = currentAircraft.RegistrationNumber;
     labelSerialNumberValue.Text       = currentAircraft.SerialNumber;
     labelManufactureDateValue.Text    = currentAircraft.ManufactureDate.ToString(new TermsProvider()["DateFormat"].ToString());
     if (currentAircraft.Type == AircraftType.West)
     {
         if (currentAircraft is AircraftProxy)
         {
             AircraftProxy aircraftProxy = (AircraftProxy)currentAircraft;
             labelCertificateNumberValue.Text = aircraftProxy.TypeCertificateNumber;
             labelLineNumberValue.Text        = aircraftProxy.LineNumber;
             labelVariableNumberValue.Text    = aircraftProxy.VariableNumber;
         }
         else
         {
             WestAircraft westAircraft = (WestAircraft)currentAircraft;
             labelCertificateNumberValue.Text = westAircraft.TypeCertificateNumber;
             labelLineNumberValue.Text        = westAircraft.LineNumber;
             labelVariableNumberValue.Text    = westAircraft.VariableNumber;
         }
         labelCertificateNumber.Visible = true;
         labelLineNumber.Visible        = true;
         labelVariableNumber.Visible    = true;
         linkAircraftGeneralData.Top    = labelVariableNumber.Bottom + LINK_TOP_MARGIN;
     }
     else
     {
         labelCertificateNumber.Visible = false;
         labelLineNumber.Visible        = false;
         labelVariableNumber.Visible    = false;
         linkAircraftGeneralData.Top    = labelManufactureDate.Bottom + LINK_TOP_MARGIN;
     }
 }
Пример #4
0
        /// <summary>
        /// Возвращает значение, показывающее были ли изменения в данном элементе управления
        /// </summary>
        /// <returns></returns>
        public bool GetChangeStatus()
        {
            // Проверяем, изменены ли поля WestAircraft
            bool changedWestAircraftFields = false;

            if (currentAircraft is WestAircraft)
            {
                WestAircraft westAircraft = (WestAircraft)currentAircraft;
                if ((textBoxAircraftTypeCertificateNo.Text != westAircraft.TypeCertificateNumber) || (textBoxVariableNumber.Text != westAircraft.VariableNumber || (textBoxLineNumber.Text != westAircraft.LineNumber)))
                {
                    changedWestAircraftFields = true;
                }
                else
                {
                    changedWestAircraftFields = false;
                }
            }
            if (currentAircraft is AircraftProxy)
            {
                AircraftProxy westAircraft = (AircraftProxy)currentAircraft;
                if ((textBoxAircraftTypeCertificateNo.Text != westAircraft.TypeCertificateNumber) || (textBoxVariableNumber.Text != westAircraft.VariableNumber || (textBoxLineNumber.Text != westAircraft.LineNumber)))
                {
                    changedWestAircraftFields = true;
                }
                else
                {
                    changedWestAircraftFields = false;
                }
            }
            // Проверям остальные поля
            if ((textBoxAircraftModel.Text != currentAircraft.Model) || (dateTimePickerManufactureDate.Value != currentAircraft.ManufactureDate) || (textBoxSerialNumber.Text != currentAircraft.SerialNumber) || (textBoxRegistrationNumber.Text != currentAircraft.RegistrationNumber) || (textBoxOwner.Text != currentAircraft.Owner) || (changedWestAircraftFields))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #5
0
 /// <summary>
 /// Сохранаяет данные текущего ВС
 /// </summary>
 public void SaveData()
 {
     if (textBoxAircraftModel.Text != currentAircraft.Model)
     {
         currentAircraft.Model = textBoxAircraftModel.Text;
     }
     if (dateTimePickerManufactureDate.Value != currentAircraft.ManufactureDate)
     {
         currentAircraft.ManufactureDate = dateTimePickerManufactureDate.Value;
     }
     if (textBoxSerialNumber.Text != currentAircraft.SerialNumber)
     {
         currentAircraft.SerialNumber = textBoxSerialNumber.Text;
     }
     if (textBoxRegistrationNumber.Text != currentAircraft.RegistrationNumber)
     {
         currentAircraft.RegistrationNumber   = textBoxRegistrationNumber.Text;
         linkMonthlyUtilization.Text          = currentAircraft.AircraftFrame + ". Log Book";
         linkMonthlyUtilization.DisplayerText = currentAircraft.AircraftFrame + ". Log Book";
         if (DisplayerRequested != null)
         {
             DisplayerRequested(this, new ReferenceEventArgs(null, ReflectionTypes.ChangeTextOfContainingDisplayer, currentAircraft.RegistrationNumber + ". Aircraft General Data"));
         }
     }
     if (textBoxOwner.Text != currentAircraft.Owner)
     {
         currentAircraft.Owner = textBoxOwner.Text;
     }
     if (currentAircraft is WestAircraft)
     {
         WestAircraft westAircraft = (WestAircraft)currentAircraft;
         if (textBoxAircraftTypeCertificateNo.Text != westAircraft.TypeCertificateNumber)
         {
             westAircraft.TypeCertificateNumber = textBoxAircraftTypeCertificateNo.Text;
         }
         if (textBoxVariableNumber.Text != westAircraft.VariableNumber)
         {
             westAircraft.VariableNumber = textBoxVariableNumber.Text;
         }
         if (textBoxLineNumber.Text != westAircraft.LineNumber)
         {
             westAircraft.LineNumber = textBoxLineNumber.Text;
         }
     }
     if (currentAircraft is AircraftProxy)
     {
         AircraftProxy westAircraft = (AircraftProxy)currentAircraft;
         if (textBoxAircraftTypeCertificateNo.Text != westAircraft.TypeCertificateNumber)
         {
             westAircraft.TypeCertificateNumber = textBoxAircraftTypeCertificateNo.Text;
         }
         if (textBoxVariableNumber.Text != westAircraft.VariableNumber)
         {
             westAircraft.VariableNumber = textBoxVariableNumber.Text;
         }
         if (textBoxLineNumber.Text != westAircraft.LineNumber)
         {
             westAircraft.LineNumber = textBoxLineNumber.Text;
         }
     }
 }