private void ProcessCommissionToAmount(HttpContext context) { context.Response.ContentType = "application/json"; DistributorsInfo userIdDistributors = DistributorsBrower.GetUserIdDistributors(Globals.GetCurrentMemberUserId(false)); MemberInfo currentMember = MemberProcessor.GetCurrentMember(); StringBuilder builder = new StringBuilder(); builder.Append("{"); if (userIdDistributors == null) { builder.Append("\"Status\":\"Eror\",\"ErrorMsg\":\"您不是分销商!\""); builder.Append("}"); context.Response.ContentType = "application/json"; context.Response.Write(builder.ToString()); } else { decimal num = DistributorsBrower.CommionsRequestSumMoney(userIdDistributors.UserId); decimal amount = decimal.Parse(context.Request["Amount"]); if ((amount < 0.01M) || (amount > (userIdDistributors.ReferralBlance - num))) { string str = "您输入正确的金额"; if ((amount - 0.01M) < (userIdDistributors.ReferralBlance - num)) { str = "最多可提现金额为:" + ((amount - 0.01M)).ToString("F2") + "元"; } builder.Append("\"Status\":\"Eror\",\"ErrorMsg\":\"" + str + "!\""); builder.Append("}"); context.Response.ContentType = "application/json"; context.Response.Write(builder.ToString()); } else { MemberAmountDetailedInfo amountinfo = new MemberAmountDetailedInfo { UserId = currentMember.UserId, UserName = currentMember.UserName, PayId = Globals.GetGenerateId(), TradeAmount = amount, TradeType = TradeType.CommissionTransfer, TradeTime = DateTime.Now, State = 1, AvailableAmount = currentMember.AvailableAmount + amount, TradeWays = TradeWays.ShopCommission, Remark = "佣金转入余额" }; if (MemberAmountProcessor.CommissionToAmount(amountinfo, userIdDistributors.UserId, amount)) { builder.Append("\"Status\":\"OK\""); } else { builder.Append("\"Status\":\"Error\""); builder.AppendFormat(",\"ErrorMsg\":\"佣金转余额失败!\"", new object[0]); } builder.Append("}"); context.Response.ContentType = "application/json"; context.Response.Write(builder.ToString()); } } }
private void ProcessCommissionToAmount(System.Web.HttpContext context) { context.Response.ContentType = "application/json"; DistributorsInfo userIdDistributors = DistributorsBrower.GetUserIdDistributors(Globals.GetCurrentMemberUserId(false)); MemberInfo currentMember = MemberProcessor.GetCurrentMember(); System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); stringBuilder.Append("{"); if (userIdDistributors == null) { stringBuilder.Append("\"Status\":\"Eror\",\"ErrorMsg\":\"您不是分销商!\""); stringBuilder.Append("}"); context.Response.ContentType = "application/json"; context.Response.Write(stringBuilder.ToString()); return; } decimal d = DistributorsBrower.CommionsRequestSumMoney(userIdDistributors.UserId); decimal num = decimal.Parse(context.Request["Amount"]); if (num < 0.01m || num > userIdDistributors.ReferralBlance - d) { string str = "您输入正确的金额"; if (num - 0.01m < userIdDistributors.ReferralBlance - d) { str = "最多可提现金额为:" + (num - 0.01m).ToString("F2") + "元"; } stringBuilder.Append("\"Status\":\"Eror\",\"ErrorMsg\":\"" + str + "!\""); stringBuilder.Append("}"); context.Response.ContentType = "application/json"; context.Response.Write(stringBuilder.ToString()); return; } if (MemberAmountProcessor.CommissionToAmount(new MemberAmountDetailedInfo { UserId = currentMember.UserId, UserName = currentMember.UserName, PayId = Globals.GetGenerateId(), TradeAmount = num, TradeType = TradeType.CommissionTransfer, TradeTime = System.DateTime.Now, State = 1, AvailableAmount = currentMember.AvailableAmount + num, TradeWays = TradeWays.ShopCommission, Remark = "佣金转入余额" }, userIdDistributors.UserId, num)) { stringBuilder.Append("\"Status\":\"OK\""); } else { stringBuilder.Append("\"Status\":\"Error\""); stringBuilder.AppendFormat(",\"ErrorMsg\":\"佣金转余额失败!\"", new object[0]); } stringBuilder.Append("}"); context.Response.ContentType = "application/json"; context.Response.Write(stringBuilder.ToString()); }
protected override void AttachChildControls() { PageTitle.AddSiteNameTitle("佣金转余额"); DistributorsInfo userIdDistributors = DistributorsBrower.GetUserIdDistributors(Globals.GetCurrentMemberUserId(false)); if (userIdDistributors != null && userIdDistributors.UserId > 0) { this.surpluscommission = userIdDistributors.ReferralBlance; decimal d = DistributorsBrower.CommionsRequestSumMoney(userIdDistributors.UserId); this.surpluscommission -= d; } System.Web.UI.HtmlControls.HtmlInputHidden htmlInputHidden = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("MaxCommission"); htmlInputHidden.Value = System.Math.Round(this.surpluscommission - 0.005m, 2).ToString(); }
protected override void AttachChildControls() { PageTitle.AddSiteNameTitle("佣金转余额"); DistributorsInfo userIdDistributors = DistributorsBrower.GetUserIdDistributors(Globals.GetCurrentMemberUserId(false)); if ((userIdDistributors != null) && (userIdDistributors.UserId > 0)) { this.surpluscommission = userIdDistributors.ReferralBlance; decimal num = DistributorsBrower.CommionsRequestSumMoney(userIdDistributors.UserId); this.surpluscommission -= num; } HtmlInputHidden hidden = (HtmlInputHidden)this.FindControl("MaxCommission"); hidden.Value = Math.Round((decimal)(this.surpluscommission - 0.005M), 2).ToString(); }