public string AddLoan(LoanModel model, int type) { if (type == 1) //添加 { return(_bll.AddLoan(model) ? JsonConvert.SerializeObject(AlertHelper.SuccessMessage()) : JsonConvert.SerializeObject(AlertHelper.ErrorMessage())); } return(_bll.BuildPlan(model) ? JsonConvert.SerializeObject(AlertHelper.SuccessMessage()) : JsonConvert.SerializeObject(AlertHelper.ErrorMessage())); }
/// <summary> /// 添加贷款费用 /// </summary> /// <param name="userFromCookie"></param> /// <param name="context"></param> private void AddLoan(DriveMgr.Model.User userFromCookie, HttpContext context) { if (userFromCookie != null && new DriveMgr.BLL.Authority().IfAuthority("loan", "add", userFromCookie.Id)) { string ui_loan_Bank_add = context.Request.Params["ui_loan_Bank_add"] ?? ""; string ui_loan_Lenders_add = context.Request.Params["ui_loan_Lenders_add"] ?? ""; string ui_loan_LoanAmount_add = context.Request.Params["ui_loan_LoanAmount_add"] ?? ""; string ui_loan_LoanDate_add = context.Request.Params["ui_loan_LoanDate_add"] ?? ""; string ui_loan_Remark_add = context.Request.Params["ui_loan_Remark_add"] ?? ""; DriveMgr.Model.LoanModel loanAdd = new Model.LoanModel(); loanAdd.Bank = ui_loan_Bank_add.Trim(); loanAdd.Lenders = ui_loan_Lenders_add.Trim(); loanAdd.LoanAmount = decimal.Parse(ui_loan_LoanAmount_add); loanAdd.LoanDate = DateTime.Parse(ui_loan_LoanDate_add); loanAdd.Remark = ui_loan_Remark_add.Trim(); loanAdd.CreateDate = DateTime.Now; loanAdd.CreatePerson = userFromCookie.UserId; loanAdd.UpdatePerson = userFromCookie.UserId; loanAdd.UpdateDate = DateTime.Now; if (loanBll.AddLoan(loanAdd)) { userOperateLog.OperateInfo = "添加贷款费用"; userOperateLog.IfSuccess = true; userOperateLog.Description = "添加成功,贷款银行:" + ui_loan_Bank_add.Trim(); context.Response.Write("{\"msg\":\"添加成功!\",\"success\":true}"); } else { userOperateLog.OperateInfo = "添加贷款费用"; userOperateLog.IfSuccess = false; userOperateLog.Description = "添加失败"; context.Response.Write("{\"msg\":\"添加失败!\",\"success\":false}"); } } else { userOperateLog.OperateInfo = "添加贷款费用"; userOperateLog.IfSuccess = false; userOperateLog.Description = "无权限,请联系管理员"; context.Response.Write("{\"msg\":\"无权限,请联系管理员!\",\"success\":false}"); } DriveMgr.BLL.UserOperateLog.InsertOperateInfo(userOperateLog); }
/// <summary> /// To save details to database /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btn_Save_Click(object sender, EventArgs e) { string message = ""; LoanBO objLoan = new LoanBO(); objLoan.EncumbranceId = Convert.ToInt32(ViewState["ENCUMBRANCEID"]); objLoan.Encumbrancepurpose = txtPurposeofencumbrance.Text.Trim(); LoanBLL objLoanBLL = new LoanBLL(); if (objLoan.EncumbranceId == 0) { objLoan.CreatedBy = Convert.ToInt32(Session["USER_ID"]); message = objLoanBLL.AddLoan(objLoan); if (string.IsNullOrEmpty(message) || message == "" || message == "null") { message = "Data saved successfully"; } } else { objLoan.UpdatedBy = Convert.ToInt32(Session["USER_ID"]); message = objLoanBLL.UpdateLoan(objLoan); // SetUpdateMode(false); if (string.IsNullOrEmpty(message) || message == "" || message == "null") { message = "Data updated successfully"; } SetUpdateMode(false); } if (message != "") { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true); } ClearDetails(); BindGrid(); }