Пример #1
0
        private void GetLoan_Click(object sender, EventArgs e)
        {
            if (DepositName.Text == "")
            {
                MessageBox.Show("Введите имя депозита!");
                return;
            }
            else if (Shop.IndOfDepByName(DepositName.Text) != -1)
            {
                MessageBox.Show("Депозит с таким именем уже существует! Попробуйте другое!");
                DepositName.Clear();
                return;
            }
            string  name = DepositName.Text;
            Deposit dep  = new Deposit(Products, Client)
            {
                Name = name
            };

            MessageBox.Show("Срок кредита: 60 дней\n" +
                            $"Размер кредита: {dep.Price} грн\n" +
                            $"Процентная ставка: {Shop.GetRate(Client)*100}%");
            if (MessageBox.Show("Вы желаете сохранить залоговый билет?", "", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                Form ticket = new ReportForm(Shop, dep);
                ticket.ShowDialog();
            }
            Shop.Deposits.Add(dep);
            Products.Clear();
            productBindingSource1.ResetBindings(false);
            Deposits = Shop.FindDepositsByClient(Client);
            depositBindingSource.DataSource = Deposits;
            Shop.IsDirty         = true;
            BuyOutButton.Enabled = true;
            GetLoan.Enabled      = false;
            DepositName.Clear();
            if (Deposits.Count == 1)
            {
                productBindingSource.DataSource = Deposits[0].Products;
                DateTimeBox.Text       = Deposits[0].DateTime.ToString();
                DateTimeBuyOutBox.Text = Deposits[0].DateTimeBuyOut.ToString();
                PriceBox.Text          = Deposits[0].Price.ToString();
            }
        }
        private void ReportButton_Click(object sender, EventArgs e)
        {
            Form report = new ReportForm(Shop);

            report.ShowDialog();
        }