Пример #1
0
 private void VIN_TextChanged(object sender, TextChangedEventArgs e)
 {
     try
     {
         if (VIN.Text.Length == 17)
         {
             if (LogicTransport.GetIdByVIN(VIN.Text) == 0)
             {
                 Change.IsEnabled = false;
                 MessageBoxResult message = MessageBox.Show("Транспорта с таким VIN кодом не существует, желаете добавить новый транспорт?", "Транспорт не найден", MessageBoxButton.YesNo);
                 if (message == MessageBoxResult.Yes)
                 {
                     Transport.AddTransport addTransport = new Transport.AddTransport();
                     LogicWindow.FromChangeDriver();
                     addTransport.Show();
                 }
             }
             else
             {
                 Change.IsEnabled = true;
                 Logic.SecurityContext.CurrentTransport = LogicTransport.GetIdByVIN(VIN.Text);
                 CurrentDriverList.ItemsSource          = DriverLogic.GetListDrivers().DefaultView;
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Пример #2
0
 private void VIN_SelectionChanged(object sender, RoutedEventArgs e)
 {
     try
     {
         if (VIN.Text.Length == 17)
         {
             if (LogicTransport.GetIdByVIN(VIN.Text) == 0)
             {
                 CheckTransport = false;
                 MessageBoxResult message = MessageBox.Show("Транспорта с таким VIN кодом не существует, желаете добавить новый транспорт?", "Транспорт не найден", MessageBoxButton.YesNo);
                 if (message == MessageBoxResult.Yes)
                 {
                     Transport.AddTransport addTransport = new Transport.AddTransport();
                     LogicWindow.FromAddLicense();
                     addTransport.Show();
                 }
             }
             else
             {
                 CheckTransport = true;
             }
             if (CheckTransport && CheckDriver)
             {
                 Add.IsEnabled = true;
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Пример #3
0
        private void Change_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                TransportModel transport = new TransportModel()
                {
                    Manufacturer      = Manufacturer.Text,
                    Model             = Model.Text,
                    CategoryTransport = LogicCategoryTransport.GetIdByName(CategoryTransport.Text),
                    YearTransport     = YearTransport.Text,
                    NumberEngine      = NumberEngine.Text,
                    ModelEngine       = ModelEngine.Text,
                    YearEngine        = YearEngine.Text,
                    PowerEngineKVT    = PowerEngineK.Text,
                    PowerEngineH      = PowerEngineH.Text,
                    MaxLoad           = double.Parse(MaxLoad.Text),
                    Color             = Color.Text,
                    Weight            = double.Parse(Weight.Text),
                    VIN         = VIN.Text,
                    TypeOfDrive = LogicTypeOfDrive.GetIdByName(TypeOfDrive.Text),
                    Description = Description.Text
                };

                LogicTransport.ChangeTransport(transport);
                MessageBox.Show("Транспорт успешно изменен");

                TransportList transportList = new TransportList();
                transportList.Show();
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #4
0
        private void Add_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                InsurancesModel insurances = new InsurancesModel()
                {
                    IdTransport    = LogicTransport.GetIdByVIN(VIN.Text),
                    InsurancesDate = DateInsurance.SelectedDate.Value,
                    ExpireDate     = DateExpire.SelectedDate.Value,
                    Series         = Series.Text,
                    Number         = Number.Text,
                    Type           = LogicTypeInsurances.GetIdByName(Type.Text),
                    Sum            = double.Parse(Sum.Text)
                };
                LogicInsurances.SaveInsurance(insurances);
                MessageBox.Show("Страховка успешно зарегистрирована");

                InspectorMainWindow inspector = new InspectorMainWindow();
                inspector.Show();
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #5
0
        private void Grid_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                CategoryTransport.ItemsSource = LogicCategoryTransport.GetNameCategory();
                TypeOfDrive.ItemsSource       = LogicTypeOfDrive.GetNameType();

                TransportModel transport = LogicTransport.GetCurrentTransport();
                Manufacturer.Text  = transport.Manufacturer;
                Model.Text         = transport.Model;
                YearTransport.Text = transport.YearTransport;
                NumberEngine.Text  = transport.NumberEngine;
                ModelEngine.Text   = transport.ModelEngine;
                YearEngine.Text    = transport.YearEngine;
                PowerEngineK.Text  = transport.PowerEngineKVT;
                PowerEngineH.Text  = transport.PowerEngineH;
                MaxLoad.Text       = transport.MaxLoad.ToString();
                Weight.Text        = transport.Weight.ToString();
                Color.Text         = transport.Color;
                VIN.Text           = transport.VIN;
                Description.Text   = transport.Description;
                CategoryTransport.SelectedIndex = transport.CategoryTransport - 1;
                TypeOfDrive.SelectedIndex       = transport.TypeOfDrive - 1;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #6
0
        private void TransportList_Loaded(object sender, RoutedEventArgs e)
        {
            dtTransport            = LogicTransport.GetTransportList();
            Transports.ItemsSource = dtTransport.DefaultView;

            Transports.Columns[0].Width = 200;
            Transports.Columns[1].Width = 100;
            Transports.Columns[2].Width = 100;
            Transports.Columns[3].Width = 100;
            Transports.Columns[4].Width = 160;
            Transports.Columns[5].Width = 100;
        }
Пример #7
0
        private void Delete_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                LogicTransport.DeleteTransport();
                MessageBox.Show("Автомобиль успешно удален");

                TransportList transportList = new TransportList();
                transportList.Show();
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #8
0
        private void TransportList_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            try
            {
                if (Transports.SelectedCells.Count() > 0)
                {
                    LogicTransport.CurrentTransport(dtTransport.Rows[Transports.SelectedIndex].ItemArray[4].ToString());

                    CurrentTransport currentTransport = new CurrentTransport();
                    currentTransport.Show();
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #9
0
        private void Change_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (NextDriverList.SelectedCells.Count > 0)
                {
                    LogicTransport.ChangeDriver(dtDriver.Rows[NextDriverList.SelectedIndex].ItemArray[2].ToString());
                    MessageBox.Show("Смена владельца прошла успешно!");
                    Logic.SecurityContext.CurrentTransport = 0;

                    InspectorMainWindow inspector = new InspectorMainWindow();
                    inspector.Show();
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #10
0
        private void Add_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                LicenseModel license = new LicenseModel();
                license.IdDriver      = DriverLogic.GetIdByPassport(PassportDriver.Text);
                license.IdTransport   = LogicTransport.GetIdByVIN(VIN.Text);
                license.LicenseDate   = LicenseDate.SelectedDate.Value;
                license.ExpireDate    = ExpireDate.SelectedDate.Value;
                license.LicenseSeries = Series.Text;
                license.LicenseNumber = Number.Text;

                CategoryLicenseModel category = new CategoryLicenseModel();

                List <string> listCategory = new List <string>();
                if (M.IsChecked == true)
                {
                    category.M = true;
                }
                if (A.IsChecked == true)
                {
                    category.A = true;
                }
                if (A1.IsChecked == true)
                {
                    category.A1 = true;
                }
                if (B.IsChecked == true)
                {
                    category.B = true;
                }
                if (D1.IsChecked == true)
                {
                    category.D1 = true;
                }
                if (D.IsChecked == true)
                {
                    category.D = true;
                }
                if (CE.IsChecked == true)
                {
                    category.CE = true;
                }
                if (C1E.IsChecked == true)
                {
                    category.C1E = true;
                }
                if (BE.IsChecked == true)
                {
                    category.BE = true;
                }
                if (B1.IsChecked == true)
                {
                    category.B1 = true;
                }
                if (C.IsChecked == true)
                {
                    category.C = true;
                }
                if (C1.IsChecked == true)
                {
                    category.C1 = true;
                }
                if (D1E.IsChecked == true)
                {
                    category.D1E = true;
                }
                if (DE.IsChecked == true)
                {
                    category.DE = true;
                }
                if (Tm.IsChecked == true)
                {
                    category.Tm = true;
                }
                if (Tb.IsChecked == true)
                {
                    category.Tb = true;
                }


                LogicLicense.SaveLicense(license);
                category.IdLicense = LogicLicense.GetId(Series.Text + Number.Text);
                LogicCategoryLicense.SaveCategory(category);
                MessageBox.Show("Водительское удостоверение успешно сохранено!");

                InspectorMainWindow inspector = new InspectorMainWindow();
                inspector.Show();
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #11
0
 private void NameDriver_TextChanged(object sender, TextChangedEventArgs e)
 {
     dtTransport            = LogicTransport.GetFilterListTransport(NameDriver.Text);
     Transports.ItemsSource = dtTransport.DefaultView;
 }