public ActionResult WithDraw(DrawCash drawCash) { drawCash.MemberId = CommonHelper.CurrentUser.MemberID; drawCash.ApplyStatus = 0;//审核中 if (drawCash.Money > drawCash.LeftAccount) { assignMessage("提现金额不能大于可提现余额", false); return(RedirectToAction("WithDraw")); } drawCash.LeftAccount = drawCash.LeftAccount - drawCash.Money; int num = accountSv.DrawCash(drawCash); if (num > 0)//提现申请成功 { assignMessage("提现申请成功,请等待审核", true); } else { assignMessage("提现失败", false); } return(RedirectToAction("WithDraw")); }
public ActionResult WithDraw(decimal leftAccount, decimal money) { DrawCash drawCash = new DrawCash(); drawCash.MemberId = CommonHelper.CurrentUser.MemberID; drawCash.ApplyStatus = 0; //审核中 drawCash.Money = money; //取现金额 if (money > leftAccount) { assignMessage("提现金额不能大于可提现余额", false); return(RedirectToAction("Index")); } drawCash.LeftAccount = leftAccount - drawCash.Money; int num = accountSv.DrawCash(drawCash); if (num > 0)//提现申请成功 { assignMessage("提现申请成功,请等待审核", true); } else { assignMessage("提现失败", false); } return(RedirectToAction("Index")); }
public ActionResult Index(UserWithDrawPageModel parameter) { #region 体现 DrawCash drawCash = accountSv.GetLastestDrawCash(CommonHelper.CurrentUser.MemberID); //可提金额 ViewBag.LeftAccount = drawCash == null ? CommonHelper.CurrentUser.Account : drawCash.LeftAccount; #endregion #region 列表 DrawCash drawCashSearch = new DrawCash { MemberId = CommonHelper.CurrentUser.MemberID, StartTime = parameter.StartTime, EndTime = parameter.EndTime }; List <DrawCash> list = accountSv.GetDrawCashRecord(drawCashSearch, null); var c = list.Skip(parameter.SkipCount - 1).Take(parameter.PageSize); UserWithDrawPageResult <DrawCash> page = new UserWithDrawPageResult <DrawCash> { PageIndex = parameter.PageIndex, PageSize = parameter.PageSize, TotalItemCount = list.Count, Items = c, Parameter = parameter }; #endregion return(View(page)); }
/// <summary> /// 提现申请 /// </summary> /// <returns></returns> public ActionResult WithDraw() { DrawCash drawCash = accountSv.GetLastestDrawCash(CommonHelper.CurrentUser.MemberID); if (drawCash == null) { drawCash = new DrawCash(); drawCash.FrozenMoney = 0; drawCash.LeftAccount = CommonHelper.CurrentUser.Account; } else { drawCash.FrozenMoney = CommonHelper.CurrentUser.Account - drawCash.LeftAccount; drawCash.Money = 0; } return(View(drawCash)); }
/// <summary> /// 提现申请 /// </summary> /// <param name="drawCash"></param> public int DrawCash(DrawCash drawCash) { int num = 0; using (TransactionScope transaction = new TransactionScope()) { try { string sql = $@"insert into DrawCash ( MemberId, Money, ApplyTime, ApplyStatus, LeftAccount ) values ( {drawCash.MemberId}, {drawCash.Money}, GETDATE(), {drawCash.ApplyStatus}, {drawCash.LeftAccount} )" ; num = DbHelper.ExecuteSqlCommand(sql, null); transaction.Complete(); } catch (Exception ex) { } finally { transaction.Dispose(); } } return(num); }
/// <summary> /// 获取提现/申请列表 /// </summary> /// <param name="drawCash"></param> /// <param name="applyStatus"></param> /// <returns></returns> public List <DrawCash> GetDrawCashRecord(DrawCash drawCash, int?applyStatus) { List <DrawCash> list = new List <Models.DrawCash>(); StringBuilder strBd = new StringBuilder(); strBd.Append($@"select *from DrawCash where MemberId = {drawCash.MemberId} "); if (!string.IsNullOrEmpty(drawCash.StartTime)) { strBd.Append($" and ApplyTime >= '{drawCash.StartTime}'"); } if (!string.IsNullOrEmpty(drawCash.EndTime)) { strBd.Append($" and ApplyTime <= '{drawCash.EndTime}'"); } if (applyStatus != null) { strBd.Append($" and ApplyStatus = {applyStatus.Value}"); } return(DbHelper.Query <DrawCash>(strBd.ToString())); }