protected void btnSubmit_Click(object sender, EventArgs e) { LoanDetails newLoan = Session["LoanDetails"] as LoanDetails; Employee emp = Session["EmpDetails"] as Employee; newLoan.InitiatedBy = emp.EmpID; var loanColl = XMLReader.LoanXMLReader(); if (!loanColl.LoanList.Any(item => item.loanNo == newLoan.loanNo)) { loanColl.LoanList.Add(newLoan); XMLWriter.LoanXMLWriter(loanColl); } Response.Redirect("~/Dashboard.aspx"); }
protected void btnApprove_Click(object sender, EventArgs e) { var loanColl = XMLReader.LoanXMLReader(); LoanDetails newLoan = null; Employee emp = Session["EmpDetails"] as Employee; if (emp.Role.ToUpper() != "ADMIN") { newLoan = loanColl.LoanList.Where(item => item.loanNo == Request.QueryString["loanNo"]).SingleOrDefault(); } else { newLoan = Session["LoanDetails"] as LoanDetails; } loanColl.LoanList.Remove(newLoan); newLoan.PendingWith = string.Empty; newLoan.loanStatus = "Approved"; loanColl.LoanList.Add(newLoan); XMLWriter.LoanXMLWriter(loanColl); Response.Redirect("~/Dashboard.aspx"); }