Exemple #1
0
 public AutoList(bool CanAdd, AutoForStorage model) : this()
 {
     AddButton.Enabled    = !CanAdd;
     AddNewButton.Enabled = CanAdd;
     Model = model;
     ShowList();
 }
Exemple #2
0
 public static void ClientLease(string id, List <string> returnautomobile, ref List <Lease> auto)
 {
     try
     {
         Client client = ClientSearch(id);
         foreach (string automobile in returnautomobile)
         {
             Lease findautomobile = client.leaseList.Where(lease => (lease.LeasedAutomobile.ID.Equals(automobile) && lease.ReturnDate.Date.Year.Equals(1))).SingleOrDefault();
             findautomobile.ReturnDate = DateTime.Today;
             SumsService    service           = new SumsService(findautomobile.Sum.SumLease, findautomobile.Sum.SumPenny, findautomobile.Sum.CommonSum);
             AutoForStorage model             = AutoModelsListService.CarSearch(findautomobile.LeasedAutomobile.Mark + " " + findautomobile.LeasedAutomobile.Model);
             AutoService    automobileservice = new AutoService(model.Automobiles);
             automobileservice.automobileSearch(findautomobile.LeasedAutomobile.ID).Enable     = true;
             automobileservice.automobileSearch(findautomobile.LeasedAutomobile.ID).DateReturn = DateTime.MinValue;
             if (findautomobile.ReturnDate.Subtract(findautomobile.LeaseDate).TotalDays <= findautomobile.DaysLease)
             {
                 findautomobile.Sum.SumLease = service.countSumLease(findautomobile.LeasedAutomobile.SumLease, findautomobile.ReturnDate.Subtract(findautomobile.LeaseDate).TotalDays);
             }
             else
             {
                 findautomobile.Sum.SumLease = service.countSumLease(findautomobile.LeasedAutomobile.SumLease, findautomobile.DaysLease);
                 client.Debt = true;
                 findautomobile.Sum.SumPenny = service.countSumPenny(AutoListStorage.penny, findautomobile.LeasedAutomobile.SumLease, findautomobile.ReturnDate.Subtract(findautomobile.LeaseDate).TotalDays - findautomobile.DaysLease);
             }
             findautomobile.Sum.CommonSum = service.countCommonSum();
             auto.Add(findautomobile);
         }
     }
     catch
     {
         throw;
     }
 }
Exemple #3
0
        private void OpenInfoButton_Click(object sender, EventArgs e)
        {
            Control btn = (Control)sender;

            AutoForStorage openCar = new AutoForStorage();

            openCar = AutoModelsListService.CarSearch(btn.Name.Remove(0, 4));

            if (openCar != null)
            {
                AutoCard autocard = new AutoCard(openCar.ThisAutoModel.Mark, openCar.ThisAutoModel.Model, openCar.ThisAutoModel.Country, openCar.ThisAutoModel.Category.Name,
                                                 openCar.ThisAutoModel.Fuel, openCar.ThisAutoModel.FuelPerHour.ToString(), openCar.ThisAutoModel.SumLease.ToString(), openCar.CarsAmount.ToString(), openCar.ThisAutoModel.AutoPhoto);
                autocard.Show();
            }
            else
            {
                AutoCard autocard = new AutoCard();
                autocard.Show();
            }
        }
Exemple #4
0
        private void OpenAllButton_Click(object sender, EventArgs e)
        {
            Control btn = (Control)sender;

            AutoForStorage openCar = new AutoForStorage();

            openCar = AutoModelsListService.CarSearch(btn.Name);

            if (openCar != null)
            {
                AutoList automobilelist = new AutoList(flagCanAdd, openCar);
                automobilelist.Show();
            }
            else
            {
                AutoList automobilelist = new AutoList(flagCanAdd);
                automobilelist.Show();
            }
            //this.Refresh();
        }
Exemple #5
0
 public NewAutoOfModel(AutoForStorage model)
 {
     InitializeComponent();
     Model = model;
 }
 public static bool CarRegistration(AutoForStorage car)
 {
     AutoListStorage.Cars.Add(car);
     return(true);
 }
Exemple #7
0
 public AutoService(AutoForStorage automobile) : base(automobile)
 {
 }
Exemple #8
0
 private void ReadyButton_Click(object sender, EventArgs e)
 {
     if (NameTextBox2.TextLength != 0 && NameTextBox1.Text.Length != 0 &&
         CountryComboBox.Text.Length != 0 && CategoryComboBox.Text.Length != 0 &&
         SumLeaseMaskedTextBox.MaskFull && PhotoPictureBox.Image != null)
     {
         AutoModel car = new AutoModel(NameTextBox1.Text, NameTextBox2.Text, CountryComboBox.Text, AutoCategoryListService.Search(CategoryComboBox.Text),
                                       FuelTextBox.Text, Double.Parse(FuelInHourTextBox.Text), Double.Parse(SumLeaseMaskedTextBox.Text.Remove(5, 2)), PhotoPictureBox.Image, AutoListStorage.Cars.Count + 1);
         AutoForStorage autoForStorage = new AutoForStorage(car, Convert.ToInt32(CountAutoDomainUpDown.Text));
         AutoModelsListService.CarRegistration(autoForStorage);
         DialogResult result;
         if (Convert.ToInt32(CountAutoDomainUpDown.Text) != 0)
         {
             result = MessageBox.Show("Регистрация новой модели автомобиля успешно завершена. Желаете зарегестрировать автомобили данной модели?", "",
                                      MessageBoxButtons.YesNo, MessageBoxIcon.Question);
             if (result == DialogResult.Yes)
             {
                 for (int i = 1; i <= Convert.ToInt32(CountAutoDomainUpDown.Text); i++)
                 {
                     NewAutoOfModel newauto = new NewAutoOfModel(autoForStorage);
                     newauto.FlagFrom = false;
                     newauto.ShowDialog();
                 }
             }
         }
         else
         {
             result = MessageBox.Show("Регистрация новой модели автомобиля успешно завершена", "",
                                      MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         this.Close();
     }
     else
     {
         if (NameTextBox2.TextLength == 0)
         {
             NameTextBox2.BackColor = Color.IndianRed;
         }
         if (NameTextBox1.TextLength == 0)
         {
             NameTextBox1.BackColor = Color.IndianRed;
         }
         if (FuelInHourTextBox.TextLength == 0)
         {
             FuelInHourTextBox.BackColor = Color.IndianRed;
         }
         if (FuelTextBox.TextLength == 0)
         {
             FuelTextBox.BackColor = Color.IndianRed;
         }
         if (CountryComboBox.Text.Length == 0)
         {
             CountryComboBox.BackColor = Color.IndianRed;
         }
         if (CategoryComboBox.Text.Length == 0)
         {
             CategoryComboBox.BackColor = Color.IndianRed;
         }
         if (!SumLeaseMaskedTextBox.MaskFull)
         {
             SumLeaseMaskedTextBox.BackColor = Color.IndianRed;
         }
         if (PhotoPictureBox.Image == null)
         {
             PhotoPictureBox.BackColor = Color.IndianRed;
         }
     }
 }