static public int PaymentCredit(string fio, string login, int money) { ClientDB client = ClientsDB.SearchClient(login, fio); if (client == null) { return(-1); } return(client.Credit.TakeMoney(money)); }
static public void DeleteData(string fio, string login) { ClientDB clientDB; if ((clientDB = ClientsDB.CheckClient(fio, login)) == null) { return; } clientDB.Credit = null; }
static public void SetCredits() { if (credits == null) { credits = new List <Credit>(); } credits.Clear(); credits = ClientsDB.GetCredits(); foreach (var item in credits) { Console.WriteLine(item.FIO); } }
static public void TakeRequest(string fio, string login) { ClientDB clientDB; if ((clientDB = ClientsDB.CheckClient(fio, login)) == null) { clientDB = new ClientDB(fio, login); ClientsDB.AddToBaseClientsDB(clientDB); } clientDB.Credit = new Credit(fio, login); ClientsDB.UpdateFile(true, true); }
private void DeleteCMButton_Click(object sender, EventArgs e) { if (dataGridViewCredits.Rows.Count == 0) { return; } ClientsDB.SearchClient( dataGridViewCredits.CurrentRow.Cells[0].Value.ToString(), dataGridViewCredits.CurrentRow.Cells[1].Value.ToString()).Credit = null; ClientsDB.UpdateFile(true, true); dataGridViewCredits.Rows.RemoveAt(dataGridViewCredits.SelectedCells[0].RowIndex); }
private void PaymentCreditButton_Click(object sender, EventArgs e) { if (dataGridViewCashier.Rows.Count == 0) { return; } try { moneyTextBox.Text = Cashier.PaymentCredit( dataGridViewCashier.CurrentRow.Cells[0].Value.ToString(), dataGridViewCashier.CurrentRow.Cells[1].Value.ToString(), Convert.ToInt32(moneyTextBox.Text)).ToString(); ClientsDB.UpdateFile(true, true); } catch { } }
private void Form1_Load(object sender, EventArgs e) { ClientsDB.UpdateFile(false, true); Credits.SetCredits(); Requests.UpdateFile(false, true); InitTableCreditsManager(); InitTableCashier(); //Кнопки EnterClient.Enabled = true; ExitClient.Enabled = false; ReqestButtonClient.Visible = false; GetInfoButtonClient.Visible = false; AddRequestBox.Visible = false; InfoClient.Visible = false; }
private void EnterClient_Click(object sender, EventArgs e) { Console.WriteLine("dsdsd"); if (LoginClient.Text == "" || FIOClient.Text == "") { return; } EnterClient.Enabled = false; LoginClientLable.Visible = false; LoginClient.Visible = false; FIOClient.Visible = false; FIOClientLable.Visible = false; ExitClient.Enabled = true; ReqestButtonClient.Visible = true; GetInfoButtonClient.Visible = true; AddRequestBox.Visible = true; clientDB = ClientsDB.SearchClient(LoginClient.Text, FIOClient.Text); if (clientDB == null) { Console.WriteLine("11"); client = new Client(LoginClient.Text, FIOClient.Text); AddRequestBox.Items.Add("Кредит"); AddRequestBox.Items.Add("Депозит"); //AddRequestBox.Items.Add("Страхование"); //AddRequestBox.Items.Add("Карта"); InfoClient.Visible = false; GetInfoButtonClient.Enabled = false; } else { client = new Client(LoginClient.Text, FIOClient.Text); foreach (var c in ClientDB.SearchServices(clientDB)) { AddRequestBox.Items.Add(c); } InfoClient.Visible = true; GetInfoButtonClient.Enabled = true; } }
private void UpdateCSButton_Click(object sender, EventArgs e) { dataGridViewCashier.Rows.Clear(); var list = ClientsDB.GetClientsDB(); if (list == null) { return; } foreach (var item in list) { if (item.Credit == null) { continue; } dataGridViewCashier.Rows.Add( item.Fio, item.Login, item.Credit.CurrentMoney.ToString() + "/" + item.Credit.MaxMoney.ToString()); } }