public JsonResult Login(string username, string password, string checkCode) { int num; JsonResult jsonResult; string host = System.Web.HttpContext.Current.Request.Url.Host; try { this.CheckInput(username, password); this.CheckCheckCode(username, checkCode); ManagerInfo managerInfo = this._iManagerService.Login(username, password, true); if (managerInfo == null) { throw new TaoLaException("用户名和密码不匹配"); } this.ClearErrorTimes(username); jsonResult = base.Json(new { success = true, userId = UserCookieEncryptHelper.Encrypt(managerInfo.Id, "Admin") }); } catch (TaoLaException himallException1) { TaoLaException ex = himallException1; num = this.SetErrorTimes(username); jsonResult = base.Json(new { success = false, msg = ex.Message, errorTimes = num, minTimesWithoutCheckCode = 3 }); } catch (Exception exception2) { Exception exception = exception2; num = this.SetErrorTimes(username); Exception exception1 = base.GerInnerException(exception); string message = "未知错误"; if (!(exception1 is TaoLaException)) { Log.Error(string.Concat("用户", username, "登录时发生异常"), exception); } else { message = exception1.Message; } jsonResult = base.Json(new { success = false, msg = message, errorTimes = num, minTimesWithoutCheckCode = 3 }); } return(jsonResult); }
public void AddCashDepositDetails(CashDepositDetailInfo cashDepositDetail) { this.context.CashDepositDetailInfo.Add(cashDepositDetail); CashDepositInfo currentBalance = this.context.CashDepositInfo.FindById <CashDepositInfo>(cashDepositDetail.CashDepositId); if ((cashDepositDetail.Balance >= new decimal(0) ? false : (currentBalance.CurrentBalance + cashDepositDetail.Balance) < new decimal(0))) { TaoLaException exception = new TaoLaException("扣除金额不能多余店铺可用余额"); } currentBalance.CurrentBalance = currentBalance.CurrentBalance + cashDepositDetail.Balance; if (cashDepositDetail.Balance > new decimal(0)) { currentBalance.EnableLabels = true; } if (cashDepositDetail.Balance > new decimal(0)) { currentBalance.TotalBalance = currentBalance.TotalBalance + cashDepositDetail.Balance; currentBalance.Date = DateTime.Now; } this.context.SaveChanges(); }