public JsonResult EditChequeBook(int ChequeBookID) { KeystoneProject.Buisness_Logic.MasterFinacialAccounts.BL_ChequeBook objDBService = new BL_ChequeBook(); ChequeBook ServiceModl = new ChequeBook(); List <ChequeBook> SearchList = new List <ChequeBook>(); DataSet ds = objDBService.FillData(ChequeBookID); ServiceModl.ChequeBookID = ds.Tables[0].Rows[0]["ChequeBookID"].ToString(); foreach (DataRow dr in ds.Tables[0].Rows) { SearchList.Add(new ChequeBook { BankID = dr["BankID"].ToString(), BankName = dr["BankName"].ToString(), BankAccountID = dr["BankAccountID"].ToString(), AccountName = dr["AccountName"].ToString(), ChequeBookID = dr["ChequeBookID"].ToString(), ChequeLayoutID = dr["ChequeLayoutID"].ToString(), LayoutName = dr["LayoutName"].ToString(), ChequeBookName = dr["BookName"].ToString(), ChequeNoFrom = dr["ChequeSNo"].ToString(), ChequeNoTo = dr["ChequeENo"].ToString(), }); } return(new JsonResult { Data = SearchList, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public Response RemoveCustomer(Account account, Response response) { //update all string fileDirectory = Path.Combine(_hostingEnv.ContentRootPath, string.Format("Storage")); string accountPath = Path.Combine(fileDirectory, "accounts" + Constants.JsonFormat); string credentialPath = Path.Combine(fileDirectory, "credentials" + Constants.JsonFormat); string chequePath = Path.Combine(fileDirectory, "cheque" + Constants.JsonFormat); try { User user = new User(); user.AccountNumber = account.AccountNumber; ChequeBook cheque = new ChequeBook(); cheque.AccountNumber = account.AccountNumber; bool folderExists = Directory.Exists(fileDirectory); if (folderExists) { bool fileExists = File.Exists(accountPath); List <Account> accounts = new List <Account>(); if (fileExists) { accounts = JsonConvert.DeserializeObject <List <Account> >(GetJsonFileContents(accountPath)); } accounts.Remove(account); File.WriteAllText(accountPath, JsonConvert.SerializeObject(accounts)); fileExists = File.Exists(credentialPath); List <User> users = new List <User>(); if (fileExists) { users = JsonConvert.DeserializeObject <List <User> >(GetJsonFileContents(credentialPath)); } users.Remove(user); File.WriteAllText(credentialPath, JsonConvert.SerializeObject(users)); fileExists = File.Exists(chequePath); List <ChequeBook> chequeBooks = new List <ChequeBook>(); if (fileExists) { chequeBooks = JsonConvert.DeserializeObject <List <ChequeBook> >(GetJsonFileContents(chequePath)); } chequeBooks.Remove(cheque); File.WriteAllText(chequePath, JsonConvert.SerializeObject(chequeBooks)); } response.Successfull = true; response.ResponseObject = user; } catch (Exception e) { response.errorMessage = e.Message; response.Successfull = false; response.ResponseObject = null; } _updateBankingSystemDB.UpdateAccounts(accountPath); _updateBankingSystemDB.UpdateCheque(chequePath); _updateBankingSystemDB.UpdateCredentials(credentialPath); return(response); }
public async Task <string> IssueChequeBook(ChequeBook chequeBook) { chequeBook.ChequeBookNumber = RandomNumberHelper.GenerateNumber(); await bankDBContext.AddAsync <ChequeBook>(chequeBook); await bankDBContext.SaveChangesAsync(); return(chequeBook.ChequeBookNumber); }
public static async Task <ChequeBook> UpdateChequeBookAsync(IRestDataMapper mapper, ChequeBook data) { ChequeBook reds = new ChequeBook(); if (mapper == null) { return(reds); } string url = $"chequebook/api/v1/chequebooks/{data.id}"; reds = await mapper.PutDataAsync(url, data); return(reds); }
public ActionResult ChequeBook(ChequeBook objmodels) { objmodels.ChequeBookID = Request.Form["ChequeBookID"]; objmodels.ChequeBookName = Request.Form["ChequeBookName"]; objmodels.BankID = Request.Form["BankID"]; objmodels.BankName = Request.Form["BankName"]; objmodels.BankAccountID = Request.Form["BankAccountID"]; objmodels.AccountName = Request.Form["AccountName"]; objmodels.ChequeLayoutID = Request.Form["ChequeLayoutID"]; objmodels.LayoutName = Request.Form["LayoutName"]; if (objbl.Save(objmodels)) { } return(View()); }
public DataSet GetBank(string BankName, string Bank) { DataSet ds = new DataSet(); try { KeystoneProject.Models.MasterFinacialAccounts.ChequeBook obj = new ChequeBook(); Connect(); SqlCommand cmd = new SqlCommand("select BankID,BankName from Bank where BankName like '" + BankName + "%" + "' and BankID like '" + Bank + "%" + "' and RowStatus=0 order by BankName asc", con); con.Open(); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(ds); con.Close(); } catch (Exception) { } return(ds); }
public static ChequeBook CreateNewChequeBook(this ChequeBook book, Branch br, User us, Purchase pu) { return(book = new ChequeBook() { id = 0, bookDescription = $"Paid to Purchase Invoice {pu.invoiceNo} of {pu.supplier.name}", bookType = ConstValues.BT_DEBITED, chequeNo = string.Empty, transactionDate = pu.purchaseDate, description = string.Empty, chequeAmount = pu.chqAmount, chequeStatus = ConstValues.CHQ_STAT[0], branch = br, user = us, purchase = pu, branchAccount = null, releseDate = DateTime.Now, saleInvoice = null }); }
protected void Chkbklist() { OracleConnection oraConn = new OracleConnection(Session["constring"].ToString()); if (oraConn.State != ConnectionState.Open) { oraConn.Open(); } DataTable dtChbookNo = new DataTable(); ChequeBook objCB = new ChequeBook(); if (ddlScheme.SelectedValue.Trim() != "") { lblAccType.Text = ddlScheme.SelectedValue; sSql = objCB.chequebookstock(lblAccType.Text, Convert.ToInt32(ddlBranch.SelectedValue)); dtChbookNo = objDataFetch.DatatablePassSQL(sSql); } txtAccNo.Focus(); }
public IHttpActionResult StopChequeBook([FromBody] ChequeBook chequebook) { try { if (!ModelState.IsValid) { return(BadRequest("Invalid data.")); } string stopChequeBookReq = App.GetRedboxStopChequeBookPayload(chequebook); string stopChequeBookRes = App.CallRedbox(stopChequeBookReq); LogWorker logworker = new LogWorker("ChequeBookController", "StopChequeBook", "Ok"); return(Ok(stopChequeBookRes)); } catch (Exception ex) { LogWorker logworker = new LogWorker("ChequeBookController", "StopChequeBook", ex.ToString()); return(InternalServerError()); } }
public static string GetRedboxRequestChequeBookPayload(ChequeBook chequebook) { string channel = ConfigurationManager.AppSettings["channel"]; string payload = ""; Random reqTranId = new Random(); try { payload = "<soapenv:Envelope xmlns: soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns: soap =\"http://soap.request.manager.redbox.stanbic.com/\">" + "<soapenv:Header/>" + "<soapenv:Body>" + "<soap:request>" + "<channel>" + channel + "</channel>" + "<type>REQUEST_CHEQUE_BOOK</type>" + "<customerId>" + chequebook.CustomerId + "</customerId>" + "<customerIdType>" + chequebook.CustomerIdType + "</customerIdType>" + "<submissionTime>" + chequebook.SubmissionTime + "</submissionTime>" + "<reqTranId>" + reqTranId.Next(100000, 999999) + "</reqTranId>" + "<body>" + "<![CDATA[" + "<otherRequestDetails>" + "<passId>" + chequebook.PassId + "</passId>" + "<passIdType>" + chequebook.PassIdType + "</passIdType>" + "<passCodeType>" + chequebook.PassCodeType + "</passCodeType>" + "<passCode>" + chequebook.PassCode + "</passCode>" + "</otherRequestDetails>" + "]]>" + "</body>" + "</soap:request>" + "</soapenv:Body>"; } catch { throw; } return(payload); }
protected void rblDeposit_SelectedIndexChanged(object sender, EventArgs e) { ChequeBook objCB = new ChequeBook(); //AK+LS 02/04/2016 keep before the if block //lblAccType.Text = ""; if (rblDeposit.SelectedValue.ToUpper().Trim() == "DEPOSIT") { //AK+LS 02/04/2016 Keep after the if cond since general in different scenarios lblAccType.Text = ""; sSql = objCB.DepositScheme(Convert.ToInt32(ddlBranch.SelectedValue)); objDataFetch.FillDdl(sSql, ddlScheme, "abbr", "scheme"); ddlScheme.Items.Insert(0, "----Select----"); } else if (rblDeposit.SelectedValue.ToUpper().Trim() == "OVERDRAFT") { lblAccType.Text = ""; sSql = objCB.ODscheme(Convert.ToInt32(ddlBranch.SelectedValue)); objDataFetch.FillDdl(sSql, ddlScheme, "abbr", "scheme"); ddlScheme.Items.Insert(0, "----Select----"); } }
public bool Save(ChequeBook obj) { Connect(); SqlCommand cmd = new SqlCommand("IUChequeBook", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@HospitalID", HospitalID); cmd.Parameters.AddWithValue("@LocationID", LocationID); if (obj.ChequeBookID == "0" || obj.ChequeBookID == null || obj.ChequeBookID == "") { cmd.Parameters.AddWithValue("@ChequeBookID", 0); cmd.Parameters["@ChequeBookID"].Direction = ParameterDirection.Output; cmd.Parameters.AddWithValue("@Mode", "Add"); } else { cmd.Parameters.AddWithValue("@ChequeBookID", obj.ChequeBookID); cmd.Parameters.AddWithValue("@Mode", "Edit"); } //if (obj.ReferenceCode == null) //{ // cmd.Parameters.AddWithValue("@ReferenceCode", string.Empty); //} //else //{ // cmd.Parameters.AddWithValue("@ReferenceCode", obj.ReferenceCode); //} if (obj.BankID == null) { cmd.Parameters.AddWithValue("@BankID", 0); } else { cmd.Parameters.AddWithValue("@BankID", obj.BankID); } if (obj.BankAccountID == null) { cmd.Parameters.AddWithValue("@BankAccountID", 0); } else { cmd.Parameters.AddWithValue("@BankAccountID", obj.BankAccountID); } if (obj.ChequeLayoutID == null) { cmd.Parameters.AddWithValue("@ChequeLayoutID", 0); } else { cmd.Parameters.AddWithValue("@ChequeLayoutID", obj.ChequeLayoutID); } if (obj.ChequeBookName == null) { cmd.Parameters.AddWithValue("@BookName", 0); } else { cmd.Parameters.AddWithValue("@BookName", obj.ChequeBookName); } if (obj.ChequeNoFrom == null) { cmd.Parameters.AddWithValue("@ChequeSNo", 0); } else { cmd.Parameters.AddWithValue("@ChequeSNo", obj.ChequeNoFrom); } if (obj.ChequeNoTo == null) { cmd.Parameters.AddWithValue("@ChequeENo", 0); } else { cmd.Parameters.AddWithValue("@ChequeENo", obj.ChequeNoTo); } cmd.Parameters.AddWithValue("@CreationID", UserID); con.Open(); int i = cmd.ExecuteNonQuery(); con.Close(); if (i > 0) { return(true); } else { return(false); } }
public async Task <ResponseDto> IssueChequeBook(ChequeBook chequeBook) { var chequeBookNumber = await chequeBookRepository.IssueChequeBook(chequeBook); return(new ResponseDto($"ChequeBook has been issued with number: {chequeBookNumber}")); }
protected void txtAccNo_TextChanged(object sender, EventArgs e) { OracleConnection oraConn = new OracleConnection(Session["constring"].ToString()); if (oraConn.State != ConnectionState.Open) { oraConn.Open(); } int branch = 0; //DataTable dtGLdetails = new DataTable(); DataTable dtDetail = new DataTable(); DataTable dtChequeClosed = new DataTable(); DataTable dtPrintCheBuk = new DataTable(); string sSQL = ""; double dblCheqSno = 0.00; try //AK+LS 02/04/2016 can be opened before conn string { //AK+LS 02/04/2016 should keep outside the try since no chance of getting exceptions in these declarations. //AK+LS 02/04/2016 end---- branch = (int)Session["BranchLogin"]; if (ddlScheme.SelectedValue.ToUpper().Trim() == "----SELECT----") { ScriptManager.RegisterStartupScript(this.UpdatePanel4, typeof(string), "Alert", "alert('Select the Scheme and proceed ');", true); lblAccType.Text = ""; txtAccNo.Text = ""; lblName.Text = ""; return; } else { if (txtAccNo.Text.Trim() != string.Empty) { ChequeBook objCB = new ChequeBook(); ddlBranch.Enabled = false; rblDeposit.Enabled = false; ddlScheme.Enabled = false; dtDetail = objGlobal.GetClientNoAndName(branch, txtAccNo.Text, lblAccType.Text.ToUpper(), oraConn); if (dtDetail.Rows.Count > 0) { lblName.Text = dtDetail.Rows[0]["ACCHOLDERNAME"].ToString(); } else { ScriptManager.RegisterStartupScript(this.UpdatePanel4, typeof(string), "Alert", "alert('Invalid Account Number ');", true); return; } if (rblDeposit.SelectedValue.ToUpper().Trim() == "DEPOSIT") { //oraConn.Dispose();//AK+LS 02/04/2016 why it is disposed each time???? sSql = objCB.DepClose(lblAccType.Text.ToUpper().Trim(), txtAccNo.Text.Trim(), Convert.ToInt32(ddlBranch.SelectedValue)); } else if (rblDeposit.SelectedValue.ToUpper().Trim() == "OVERDRAFT") { //oraConn.Dispose();//AK+LS 02/04/2016 why it is disposed each time???? sSql = objCB.ODClose(lblAccType.Text.ToUpper().Trim(), txtAccNo.Text.Trim(), Convert.ToInt32(ddlBranch.SelectedValue)); } objDataFetch.loginconnection = oraConn.ToString(); dtChequeClosed = objDataFetch.DatatablePassSQL(sSql); objLog.WriteLog("CheckBookIssue App:: Inserting Values to the application " + ddlBranch.SelectedValue); //AK+LS 02/04/2016 null checking is not necessary??? if (dtChequeClosed.Rows.Count > 0) { if (dtChequeClosed.Rows[0]["DEPM_CLOSEDYN"].ToString().ToUpper().Trim() == "Y") { //AK+LS 02/04/2016 Make the msg proper with C as small case A/c already closed ScriptManager.RegisterStartupScript(this.UpdatePanel4, typeof(string), "Alert", "alert('A/c already closed');", true); rblDeposit.Enabled = true; txtAccNo.Text = ""; lblName.Text = ""; return; } } else { rblDeposit.Enabled = true; ddlScheme.Enabled = true; ddlScheme.SelectedIndex = 0; txtAccNo.Text = ""; //AK+LS 02/04/2016 Make the msg proper with C as small case A/c does not exist ScriptManager.RegisterStartupScript(this.UpdatePanel4, typeof(string), "Alert", "alert('A/c does not exist');", true); return; } sSQL = " SELECT CHQH_SNO, CHQH_ACABBR,CHQH_ACNO,CHQH_BOOKNO,CHQH_NOOFLEAFS,CHQH_FROMNUMBER,CHQH_TO,CHQH_BRANCH ,CHQH_PRINTEDYN"; sSQL += " FROM CHEQUEH "; sSQL += " WHERE NVL(CHQH_PRINTEDYN,'N') <> 'Y' "; sSQL += " AND CHQH_ACABBR= '" + lblAccType.Text.ToUpper().Trim() + "'"; sSQL += " AND CHQH_ACNO= " + txtAccNo.Text; sSQL += " AND CHQH_BRANCH=" + ddlBranch.SelectedValue; dtPrintCheBuk = objDataFetch.DatatablePassSQL(sSQL); //Session["dtPrintCheBuk"] = dtPrintCheBuk; if (dtPrintCheBuk.Rows.Count > 0) { dblCheqSno = Convert.ToDouble(dtPrintCheBuk.Rows[0]["CHQH_SNO"].ToString()); Session["CHEQUESNO"] = dblCheqSno; txtChqBukNum.Text = dtPrintCheBuk.Rows[0]["CHQH_BOOKNO"].ToString(); txtLeafFrom.Text = dtPrintCheBuk.Rows[0]["CHQH_FROMNUMBER"].ToString(); txtLeafTo.Text = dtPrintCheBuk.Rows[0]["CHQH_TO"].ToString(); lblNoOfLeaves.Text = dtPrintCheBuk.Rows[0]["CHQH_NOOFLEAFS"].ToString(); } else { ScriptManager.RegisterStartupScript(this.UpdatePanel4, typeof(string), "Alert", "alert('No cheque is issued for this Account Number');", true); lblName.Text = ""; txtAccNo.Text = ""; txtAccNo.Focus(); return; } } } btnPrint.Focus(); } catch (Exception ex) { objLog.WriteLog("CheBukFormatPrint:txtAccNo_Text event error : " + ex.Message); ClientScript.RegisterStartupScript(Page.GetType(), "VALIDATION", "<script language='javascript'>alert('" + ex.Message + "')</script>"); } finally { objLog.WriteLog("CheBukFormatPrint.aspx---> txtAccNo_TextChanged---> txtAccNo_TextChanged event reached finally block"); if (oraConn.State == ConnectionState.Open) { oraConn.Close(); } oraConn.Dispose(); OracleConnection.ClearAllPools(); //AK+LS 02/04/2016 missing writelog here } }
public Response ChequeBook(Account account, Response response) { //update cheque //Transactions of the specific user string fileDirectory = Path.Combine(_hostingEnv.ContentRootPath, string.Format("Storage")); string accountPath = Path.Combine(fileDirectory, "accounts" + Constants.JsonFormat); string chequePath = Path.Combine(fileDirectory, "cheque" + Constants.JsonFormat); try { string json = _customerService.GetJsonFileContents(accountPath); if (!string.IsNullOrEmpty(json)) { List <Account> accounts = JsonConvert.DeserializeObject <List <Account> >(json); Account authorized = accounts.Where <Account>(x => x.AccountNumber == account.AccountNumber).FirstOrDefault(); if (authorized != null) { List <ChequeBook> chequeBooks = new List <ChequeBook>(); ChequeBook chequeBook = new ChequeBook(); json = _customerService.GetJsonFileContents(chequePath); if (!string.IsNullOrEmpty(json)) { chequeBooks = JsonConvert.DeserializeObject <List <ChequeBook> >(json); ChequeBook request = chequeBooks.Where <ChequeBook>(x => x.AccountNumber == authorized.AccountNumber).FirstOrDefault(); if (request != null) { string status = string.Empty; if (chequeBook.ChequeBookStatus) { status = "Approved"; } else { status = "Pending with Bank"; } response.errorMessage = "Customer with Request number : " + request.RequestId + " and Account Number : " + account.AccountNumber + " already requested for cheque book and status is : " + status; response.Successfull = false; response.ResponseObject = null; } else { chequeBook.RequestId = _customerService.GenerateRandomNumber(99999); chequeBook.AccountNumber = authorized.AccountNumber; chequeBook.ChequeBookStatus = false; chequeBooks.Add(chequeBook); File.WriteAllText(chequePath, JsonConvert.SerializeObject(chequeBooks)); response.errorMessage = string.Empty; response.Successfull = true; response.ResponseObject = null; } } else { chequeBook.RequestId = _customerService.GenerateRandomNumber(99999); chequeBook.AccountNumber = authorized.AccountNumber; chequeBook.ChequeBookStatus = false; chequeBooks.Add(chequeBook); File.WriteAllText(chequePath, JsonConvert.SerializeObject(chequeBooks)); response.errorMessage = string.Empty; response.Successfull = true; response.ResponseObject = null; } } else { response.errorMessage = "Customer with Account Number : " + account.AccountNumber + " doesn't exists."; response.Successfull = false; response.ResponseObject = null; } } else { response.errorMessage = "Invalid request given by the user."; response.Successfull = false; response.ResponseObject = null; } } catch (Exception exception) { response.errorMessage = exception.Message; response.Successfull = false; response.ResponseObject = null; } _updateBankingSystemDB.UpdateCheque(chequePath); return(response); }