public void Refuse(HttpContext context) { if (base.CurrentSiteSetting.IsDemoSite) { throw new HidistroAshxException("演示站点,无法真实付款"); } string empty = string.Empty; int? intParam = base.GetIntParam(context, "id", true); if (!intParam.HasValue || intParam < 1) { throw new HidistroAshxException("错误的数据编号"); } string parameter = base.GetParameter(context, "Reason", true); if (string.IsNullOrWhiteSpace(parameter)) { throw new HidistroAshxException("请填写拒绝申请的原因"); } if (parameter.Length > 50) { throw new HidistroAshxException("拒绝原因不能超过50字符"); } if (MemberHelper.DealBalanceDrawRequestById(intParam.Value, false, ref empty, parameter)) { BalanceDrawRequestInfo balanceDrawRequestInfo = new ReferralDao().Get <BalanceDrawRequestInfo>(intParam.Value.ToInt(0)); string text = ""; text = ((!balanceDrawRequestInfo.IsWeixin.HasValue || !balanceDrawRequestInfo.IsWeixin.Value) ? ((!balanceDrawRequestInfo.IsAlipay.HasValue || !balanceDrawRequestInfo.IsAlipay.Value) ? ("银行卡:" + balanceDrawRequestInfo.BankName + "(" + balanceDrawRequestInfo.AccountName + ")") : ("支付宝:" + balanceDrawRequestInfo.AlipayCode)) : "微信"); MemberInfo user = Users.GetUser(balanceDrawRequestInfo.UserId); Messenger.DrawResultMessager(user, null, balanceDrawRequestInfo.Amount, text, balanceDrawRequestInfo.RequestTime, false, parameter); base.ReturnSuccessResult(context, "拒绝申请成功", 0, true); return; } throw new HidistroAshxException("提现申请操作失败"); }
public static ReferralInfo GetReferralInfo(int userId) { ReferralDao referralDao = new ReferralDao(); return(referralDao.Get <ReferralInfo>(userId)); }
private void btnDraw_Click(object sender, EventArgs e) { BalanceDrawRequestQuery balanceDrawRequestQuery = new BalanceDrawRequestQuery(); balanceDrawRequestQuery.PageIndex = 1; balanceDrawRequestQuery.PageSize = this.pager.PageSize; balanceDrawRequestQuery.UserId = HiContext.Current.UserId; decimal num = default(decimal); num = MemberProcessor.GetUserUseSplittin(HiContext.Current.UserId); DbQueryResult mySplittinDraws = MemberProcessor.GetMySplittinDraws(balanceDrawRequestQuery, 1); SiteSettings masterSettings = SettingsManager.GetMasterSettings(); if (mySplittinDraws.TotalRecords > 0) { this.ShowMessage("上笔提现管理员还没有处理,只有处理完后才能再次申请提现", false, "", 1); } else if (!this.IsDefault.Visible && !this.IsWithdrawToAccount.Visible && !this.IsWeixin.Visible && !this.IsAlipay.Visible) { this.ShowMessage("没有合适的提现方式,请与管理员联系", false, "", 1); } else if (!this.IsDefault.Checked && !this.IsWithdrawToAccount.Checked && !this.IsWeixin.Checked && !this.IsAlipay.Checked) { this.ShowMessage("请选择提现方式", false, "", 1); } else { decimal num2 = default(decimal); if (!decimal.TryParse(this.txtAmount.Text.Trim(), out num2)) { this.ShowMessage("提现金额输入错误,请重新输入提现金额", false, "", 1); } else if (num2 < masterSettings.MinimumSingleShot) { this.ShowMessage("每次提现金额必须多于" + this.lblminDraws.Text + "元", false, "", 1); } else if (num2 > num) { this.ShowMessage("可提现奖励不足,请重新输入提现金额", false, "", 1); } else if (string.IsNullOrEmpty(this.txtTradePassword.Text)) { this.ShowMessage("请输入交易密码", false, "", 1); } else if (!MemberProcessor.ValidTradePassword(this.txtTradePassword.Text)) { this.ShowMessage("交易密码不正确,请重新输入", false, "", 1); } else { MemberInfo user = HiContext.Current.User; if (!user.IsOpenBalance) { this.ShowMessage("请先开通预付款账户", false, "", 1); } else { SplittinDrawInfo splittinDrawInfo = new SplittinDrawInfo(); splittinDrawInfo.UserId = user.UserId; splittinDrawInfo.UserName = user.UserName; splittinDrawInfo.Amount = num2; splittinDrawInfo.RequestDate = DateTime.Now; splittinDrawInfo.BankName = this.txtBankName.Text.Trim(); splittinDrawInfo.AccountName = this.txtAccountName.Text.Trim(); splittinDrawInfo.MerchantCode = this.txtMerchantCode.Text.Trim(); splittinDrawInfo.AlipayCode = this.txtAlipayCode.Text.Trim(); splittinDrawInfo.AlipayRealName = this.txtAlipayRealName.Text; splittinDrawInfo.Remark = this.txtRemark.Text.Trim(); splittinDrawInfo.ManagerRemark = ""; splittinDrawInfo.IsWithdrawToAccount = this.IsWithdrawToAccount.Checked; splittinDrawInfo.IsAlipay = this.IsAlipay.Checked; splittinDrawInfo.IsWeixin = this.IsWeixin.Checked; if (splittinDrawInfo.IsWithdrawToAccount) { splittinDrawInfo.AuditStatus = 2; splittinDrawInfo.AccountDate = DateTime.Now; splittinDrawInfo.ManagerRemark = "提现至预付款账户" + (string.IsNullOrEmpty(splittinDrawInfo.Remark.ToNullString()) ? "" : ("(买家备注:" + splittinDrawInfo.Remark.ToNullString() + ")")); } else { splittinDrawInfo.AuditStatus = 1; } OnLinePayment onLinePayment; if (this.IsAlipay.Checked) { splittinDrawInfo.BankName = "0"; splittinDrawInfo.AccountName = "0"; splittinDrawInfo.MerchantCode = "0"; SplittinDrawInfo splittinDrawInfo2 = splittinDrawInfo; onLinePayment = OnLinePayment.NoPay; splittinDrawInfo2.RequestState = onLinePayment.GetHashCode().ToNullString(); } else if (this.IsWeixin.Checked || splittinDrawInfo.IsWithdrawToAccount) { splittinDrawInfo.BankName = "0"; splittinDrawInfo.AccountName = "0"; splittinDrawInfo.MerchantCode = "0"; splittinDrawInfo.AlipayCode = "0"; splittinDrawInfo.AlipayRealName = "0"; if (this.IsWeixin.Checked) { SplittinDrawInfo splittinDrawInfo3 = splittinDrawInfo; onLinePayment = OnLinePayment.NoPay; splittinDrawInfo3.RequestState = onLinePayment.GetHashCode().ToNullString(); } } else { splittinDrawInfo.AlipayCode = "0"; splittinDrawInfo.AlipayRealName = "0"; } if (this.ValidateBalanceDrawRequest(splittinDrawInfo)) { if (MemberProcessor.SplittinDrawRequest(splittinDrawInfo)) { if (splittinDrawInfo.IsWithdrawToAccount) { ReferralDao referralDao = new ReferralDao(); SplittinDetailInfo splittinDetailInfo = new SplittinDetailInfo(); splittinDetailInfo.OrderId = string.Empty; splittinDetailInfo.UserId = splittinDrawInfo.UserId; splittinDetailInfo.UserName = splittinDrawInfo.UserName; splittinDetailInfo.IsUse = true; splittinDetailInfo.TradeDate = DateTime.Now; splittinDetailInfo.TradeType = SplittingTypes.DrawRequest; splittinDetailInfo.Expenses = splittinDrawInfo.Amount; splittinDetailInfo.Balance = referralDao.GetUserUseSplittin(splittinDrawInfo.UserId) - splittinDrawInfo.Amount; splittinDetailInfo.Remark = ""; referralDao.Add(splittinDetailInfo, null); this.SaveBalance(splittinDrawInfo.UserId, splittinDrawInfo.Amount); this.ShowMessage("提现成功,申请金额已转至您的预付款账户", true, "", 1); Users.ClearUserCache(splittinDrawInfo.UserId, user.SessionId); this.BindSplittinDraw(); } else { this.btnDraw.Visible = false; this.ShowMessage("提现申请成功,等待管理员的审核", true, "", 1); this.BindSplittinDraw(); } this.Clear(); } else { this.ShowMessage("提现申请失败,请重试", false, "", 1); } } } } } }
public static bool AccepteDraw(long journalNumber, string managerRemark) { Database database = DatabaseFactory.CreateDatabase(); bool result; using (System.Data.Common.DbConnection dbConnection = database.CreateConnection()) { dbConnection.Open(); System.Data.Common.DbTransaction dbTransaction = dbConnection.BeginTransaction(); try { ReferralDao referralDao = new ReferralDao(); if (!referralDao.AccepteDraw(journalNumber, managerRemark)) { dbTransaction.Rollback(); result = false; } else { SplittinDrawInfo splittinDraw = referralDao.GetSplittinDraw(journalNumber); if (splittinDraw == null) { dbTransaction.Rollback(); result = false; } else { if (!referralDao.AddSplittinDetail(new SplittinDetailInfo { OrderId = string.Empty, UserId = splittinDraw.UserId, UserName = splittinDraw.UserName, IsUse = true, TradeDate = DateTime.Now, TradeType = SplittingTypes.DrawRequest, Expenses = new decimal?(splittinDraw.Amount), Balance = referralDao.GetUserUseSplittin(splittinDraw.UserId) - splittinDraw.Amount, Remark = managerRemark })) { dbTransaction.Rollback(); result = false; } else { dbTransaction.Commit(); result = true; } } } } catch (Exception var_6_11F) { dbTransaction.Rollback(); result = false; } finally { dbConnection.Close(); } } return(result); }