///<summary> ///Регистрация аккаунта ///</summary> public bool RegistrateAccount(string _table_name) { if (this.isPreviouslyCreated(false)) { return(false); } else { try { SQLManager _sqlManager = new SQLManager(); if (_table_name == "users_list_table") { _sqlManager.InsertData("users_list_table", "_name, _login, _password, _date_of_birth, _home_path, _seria", $"'{username}', {loginUser}, '{userpassword}', '{dateOfBirth}', '{homePath}', '{seria}'"); } else { _sqlManager.InsertData($"{_table_name}", "_name, _password", "'{username}', '{userpassword}'"); } return(true); } catch (Exception ex) { Log.Error(ex.Message); return(false); } } }
///<summary> ///Регистрация заявки пользователя на кредит ///</summary> public void ApplicationInput(string _login) { string _user_gender = Input("Пол(муж/жен): "); int _user_age = Convert.ToInt32(Input("Возраст: ")); string _married = Input("Семейное положение(холост/семеянин/вразводе/вдовец/вдова): "); string _nationality = Input("Гражданство (Таджикистан/Зарубеж): "); int _credit_summ_from_general_revenue = Convert.ToInt32(Input("Cумма кредита от общего дохода: ")); string _credit_aim = Input("Цель кредита(бытовая техника/ремонт/телефон/прочее): "); int _credit_term = Convert.ToInt32(Input("Срок кредита: ")); int _credit_summ = Convert.ToInt32(Input("Сумма кредита: ")); ClientApplication _client = new ClientApplication(_login); _client.CreateApplication(_user_gender, _married, _user_age, _nationality, _credit_summ_from_general_revenue, _credit_aim, _credit_term); bool _isAccepted = _client.AcceptedToCredit(); string _status = "NONE"; if (_isAccepted) { _status = "OK"; } else { _status = "DISOK"; } SQLManager _sqlManger = new SQLManager(); _sqlManger.UpdateData("users_application", $"_status='{_status}'", $"_login={_login}"); string date = $"{DateTime.Now.Day.ToString()}.{DateTime.Now.Month.ToString()}.{DateTime.Now.Year.ToString()}"; _sqlManger.InsertData("payment_list", "_login, _date, _summ", $"'{_login}', '{date}', {_credit_summ}"); }
///<summary> ///Внесение денег ///</summary> public void PaymentStory(float _summ, string _login) { SQLManager _sqlManger = new SQLManager(); string date = $"{DateTime.Now.Day.ToString()}.{DateTime.Now.Month.ToString()}.{DateTime.Now.Year.ToString()}"; float _toPlay = 0.0f; SqlConnection _sqlConn = new SqlConnection(_sqlManger.ConnectionString()); _sqlConn.Open(); if (_sqlConn.State == ConnectionState.Open) { SqlCommand _sqlCmd = new SqlCommand($"select _summ from [Faridun].[dbo].[payment_list] where _login={_login}", _sqlConn); SqlDataReader _reader = _sqlCmd.ExecuteReader(); while (_reader.Read()) { _toPlay = float.Parse(_reader.GetValue(0).ToString().Trim().Replace('.', ',')); } _reader.Close(); _sqlConn.Close(); } _summ = _toPlay - _summ; _sqlManger.InsertData("payment_list", "_login, _date, _summ", $"{_login}, '{date}', {_summ}"); if (_summ <= 0) { _sqlManger.UpdateData("users_application", "_is_payed=1", $"_login={_login}"); } }
///<summary> ///Регистрация заявки пользователя для получения кредита ///</summary> public void CreateApplication(string _gender, string _isMarried, int _age, string _nation, int _creditSumm, string _creditAim, int _creditTerm) { SQLManager _sqlManager = new SQLManager(); _sqlManager.InsertData("users_application", "_login, _user_gender, _user_age, _married, _nationality, _credit_summ_from_general_revenue, _credit_history, _arrearage_in_credit_history, _credit_aim, _credit_term, _status, _balls, _results, _is_payed", $"{_login}, '{_gender}', {_age}, '{_isMarried}', '{_nation}', {_creditSumm}, {this.CreditsCount()}, {this.CreditArrearage()}, '{_creditAim}', {_creditTerm}, 'NONE', 0, 0, 0"); }