Example #1
0
        /// <summary>
        /// 编辑贷款
        /// </summary>
        /// <param name="userFromCookie"></param>
        /// <param name="context"></param>
        private void EditLoan(DriveMgr.Model.User userFromCookie, HttpContext context)
        {
            if (userFromCookie != null && new DriveMgr.BLL.Authority().IfAuthority("loan", "edit", userFromCookie.Id))
            {
                int id = Convert.ToInt32(context.Request.Params["id"]);
                DriveMgr.Model.LoanModel loanEdit = loanBll.GetLoanModel(id);
                string ui_loan_Bank_edit          = context.Request.Params["ui_loan_Bank_edit"] ?? "";
                string ui_loan_Lenders_edit       = context.Request.Params["ui_loan_Lenders_edit"] ?? "";
                string ui_loan_LoanAmount_edit    = context.Request.Params["ui_loan_LoanAmount_edit"] ?? "";
                string ui_loan_LoanDate_edit      = context.Request.Params["ui_loan_LoanDate_edit"] ?? "";
                string ui_loan_Remark_edit        = context.Request.Params["ui_loan_Remark_edit"] ?? "";

                loanEdit.Bank       = ui_loan_Bank_edit.Trim();
                loanEdit.Lenders    = ui_loan_Lenders_edit.Trim();
                loanEdit.LoanAmount = decimal.Parse(ui_loan_LoanAmount_edit);
                loanEdit.LoanDate   = DateTime.Parse(ui_loan_LoanDate_edit);
                loanEdit.Remark     = ui_loan_Remark_edit.Trim();

                loanEdit.UpdatePerson = userFromCookie.UserId;
                loanEdit.UpdateDate   = DateTime.Now;

                if (loanBll.UpdateLoan(loanEdit))
                {
                    userOperateLog.OperateInfo = "修改贷款费用";
                    userOperateLog.IfSuccess   = true;
                    userOperateLog.Description = "修改成功,贷款费用主键:" + loanEdit.Id;
                    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);
        }
Example #2
0
        /// <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();
        }