示例#1
0
 public string AddLoanType(DimLoanTypeModel model, int type)
 {
     if (type == 1) //添加
     {
         return(_bll.AddLoanType(model.Name) > 0
                    ? JsonConvert.SerializeObject(AlertHelper.SuccessMessage())
                    : JsonConvert.SerializeObject(AlertHelper.ErrorMessage()));
     }
     return(_bll.UpdateLoanType(model)
                ? JsonConvert.SerializeObject(AlertHelper.SuccessMessage("修改成功"))
                : JsonConvert.SerializeObject(AlertHelper.ErrorMessage("修改失败")));
 }
示例#2
0
 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()));
 }
示例#3
0
        public string AddCustomer(CustomerModel model, int type)
        {
            string errorMsg = "";

            model.Name = StringHelper.GetFirstPYLetter(model.RealName);
            if (type == 1) //添加
            {
                if (!_bll.CustomerAddValidate(model, ref errorMsg))
                {
                    return(JsonConvert.SerializeObject(AlertHelper.WarningMessage(errorMsg)));
                }
                int id = _bll.AddCustomer(model);
                return(id > 0
                           ? JsonConvert.SerializeObject(AlertHelper.SuccessMessage())
                           : JsonConvert.SerializeObject(AlertHelper.ErrorMessage()));
            }
            return(_bll.UpdateCustomer(model)
                       ? JsonConvert.SerializeObject(AlertHelper.SuccessMessage("修改成功"))
                       : JsonConvert.SerializeObject(AlertHelper.ErrorMessage("修改失败")));
        }
示例#4
0
        public string AddUser(UserModel model, int type)
        {
            if (type == 1) //添加
            {
                if (!_bll.UserNameExists(model.LoginName))
                {
                    return(JsonConvert.SerializeObject(AlertHelper.WarningMessage("用户名已存在")));
                }
                model.Password = MD5Helper.GetMd5Hash(model.Password);
                int id = _bll.AddUser(model);
                return(id > 0
                           ? JsonConvert.SerializeObject(AlertHelper.SuccessMessage())
                           : JsonConvert.SerializeObject(AlertHelper.ErrorMessage()));
            }
            UserModel info = _bll.GetUserModel(model.ID);

            if (!info.Password.Equals(model.Password))
            {
                model.Password = MD5Helper.GetMd5Hash(model.Password);
            }
            return(_bll.UpdateUser(model)
                       ? JsonConvert.SerializeObject(AlertHelper.SuccessMessage("修改成功"))
                       : JsonConvert.SerializeObject(AlertHelper.ErrorMessage("修改失败")));
        }
示例#5
0
 public string AddRepayment(RepaymentModel model)
 {
     return(_bll.AddRepayment(model) > 1
                ? JsonConvert.SerializeObject(AlertHelper.SuccessMessage())
                : JsonConvert.SerializeObject(AlertHelper.ErrorMessage()));
 }
示例#6
0
 public string RepayLoanByID(int repayID)
 {
     return(_bll.RepayLoanByID(repayID)
                ? JsonConvert.SerializeObject(AlertHelper.SuccessMessage("还款成功"))
                : JsonConvert.SerializeObject(AlertHelper.ErrorMessage("还款失败")));
 }