Esempio n. 1
0
        private void SumCountButton_Click(object sender, EventArgs e)
        {
            try
            {
                List <Lease> auto = new List <Lease>();
                ClientListService.ClientLease(IDClientTextBox.Text, returnCars, ref auto);
                foreach (Lease i in auto)
                {
                    DialogResult result = MessageBox.Show("Сумма к оплате: " + i.Sum.CommonSum + "$. Потдвердить оплату?",
                                                          i.LeasedAutomobile.Mark + " " + i.LeasedAutomobile.Model + " (" + i.LeasedAutomobile.ID + ")", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (result == DialogResult.No)
                    {
                        ClientListService.AnnulmentReturn(i);
                    }
                    else
                    {
                        NewMileage mileage = new NewMileage(i.LeasedAutomobile);
                        mileage.ShowDialog();
                    }
                }

                Client client = ClientListService.ClientSearch(IDClientTextBox.Text);
                if (client != null)
                {
                    repaint();
                    showCars();
                    tableClientPanel.Show();
                }
            }
            catch
            {
                MessageBox.Show("Ошибка", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 2
0
        private void AutoAddButton_Click(object sender, EventArgs e)
        {
            Control btn = (Control)sender;

            Client openClient = new Client();

            openClient = ClientListService.ClientSearch(btn.Name.Remove(3));
            try
            {
                if (openClient.leaseList.Count < 7)
                {
                    Automobile.Enable = false;
                    Lease lease = new Lease(Automobile, DateTime.Today);

                    FrmDateForUse numDays = new FrmDateForUse(lease, openClient);
                    numDays.ShowDialog();

                    this.Close();
                }
                else
                {
                    MessageBox.Show("У клиента слишком много автомобилей.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (NullReferenceException)
            {
                MessageBox.Show("Вы пытаетесь добавить несуществующему клиенту автомобиль.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 3
0
        private void OpenButton_Click(object sender, EventArgs e)
        {
            Control btn = (Control)sender;

            Client openClient = new Client();

            openClient = ClientListService.ClientSearch(btn.Name);

            if (openClient != null)
            {
                ClientCardInfo infocard = new ClientCardInfo(flagCanChange, openClient);
                infocard.Show();
            }
            else
            {
                ClientCardInfo infocard = new ClientCardInfo(flagCanChange);
                infocard.Show();
            }
        }
Esempio n. 4
0
        private void SearchButton_Click(object sender, EventArgs e)
        {
            if (SearchTextBox.Text == "")
            {
                MessageBox.Show("Введите данные для поиска", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                List <Client> searchedClients = new List <Client>();

                if (SurnameRadioButton.Checked)
                {
                    searchedClients = ClientListService.ClientSearch(1, SearchTextBox.Text).ToList();
                }
                else if (NameRadioButton.Checked)
                {
                    searchedClients = ClientListService.ClientSearch(2, SearchTextBox.Text).ToList();
                }
                else if (IDRadioButton.Checked)
                {
                    searchedClients = ClientListService.ClientSearch(3, SearchTextBox.Text).ToList();
                }

                clientListTable.Hide();
                repaint();

                if (searchedClients.Count == 0)
                {
                    MessageBox.Show("Такие клиенты не найдены.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    ShowList(ClientListStorage.Clients);
                }
                else
                {
                    ShowList(searchedClients);
                }
                clientListTable.Show();
            }
        }