protected void btnSave_Click(object sender, EventArgs e) { try { CustomList <ASL.Hr.DAO.LoanType> lstLoanType = LoanTypeList; if (lstLoanType.Count == 0) { ASL.Hr.DAO.LoanType newLoanType = new ASL.Hr.DAO.LoanType(); lstLoanType.Add(newLoanType); } SetDataFromControlToObj(ref lstLoanType); //if (!CheckUserAuthentication(lstBank)) return; manager.SaveLoanType(ref lstLoanType); ((PageBase)this.Page).SuccessMessage = (StaticInfo.SavedSuccessfullyMsg); } catch (SqlException ex) { ((PageBase)this.Page).ErrorMessage = (ExceptionHelper.getSqlExceptionMessage(ex)); } catch (Exception ex) { ((PageBase)this.Page).ErrorMessage = (ExceptionHelper.getExceptionMessage(ex)); } }
protected void Page_Load(object sender, EventArgs e) { try { if (IsPostBack.IsFalse()) { //InitializeCombo(); InitializeSession(); } else { Page.ClientScript.GetPostBackEventReference(this, String.Empty); String eventTarget = Request["__EVENTTARGET"].IsNullOrEmpty() ? String.Empty : Request["__EVENTTARGET"]; if (Request["__EVENTTARGET"] == "SearchLoanType") { LoanTypeList = new CustomList <ASL.Hr.DAO.LoanType>(); ASL.Hr.DAO.LoanType searchLoan = Session[ASL.STATIC.StaticInfo.SearchSessionVarName] as ASL.Hr.DAO.LoanType; LoanTypeList.Add(searchLoan); if (searchLoan.IsNotNull()) { PopulateBankInformation(searchLoan); } } } } catch (Exception ex) { throw ex; } }
private void PopulateBankInformation(ASL.Hr.DAO.LoanType loanType) { try { txtLoanType.Text = loanType.LoanType1; txtDescription.Text = loanType.Description; txtMaximumPercenttage.Text = loanType.MaxPercent.ToString(); } catch (Exception ex) { throw (ex); } }
private void SetDataFromControlToObj(ref CustomList <ASL.Hr.DAO.LoanType> lstLoanType) { try { ASL.Hr.DAO.LoanType obj = lstLoanType[0]; obj.LoanType1 = txtLoanType.Text; obj.Description = txtDescription.Text; obj.MaxPercent = txtMaximumPercenttage.Text.ToDecimal(); } catch (Exception ex) { throw (ex); } }