static public void AddToBaseClientsDB(ClientDB clientDB) { if (clientsDB == null) { clientsDB = new List <ClientDB>(); } clientsDB.Add(clientDB); SaveFile(); }
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 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 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; } }
static public List <string> SearchServices(ClientDB clientDB) { List <string> list = new List <string>(); if (clientDB.Credit == null) { list.Add("Кредит"); } if (clientDB.Deposit == null) { list.Add("Депозит"); } //if (clientDB. == null) //{ // AddRequestBox.Items.Add("Кредит"); //} //if (clientDB.Credit == null) //{ // AddRequestBox.Items.Add("Кредит"); //} return(list); }
public Deposit(ClientDB clientDB, int money) { this.clientDB = clientDB; this.money = money; Deposits.AddToBaseRequests(this); }