/// <summary> /// 生成随机订单号 /// </summary> /// <returns></returns> public static string BuildOuterOrderNumber(int UserID) { lgk.BLL.tb_remit remitbll = new lgk.BLL.tb_remit(); string payId = "1"; //支付编号 var len = 20 - 15 - payId.ToString().Length; var orderNumber = GetUniqueIndentifier(len) + payId + DateTime.Now.ToString("yyMMddHHmmssfff"); lgk.Model.tb_remit me = remitbll.GetModel(" UserID=" + UserID + " and Remit004='" + orderNumber + "'"); if (me != null) { return(BuildOuterOrderNumber(UserID)); } else { return(orderNumber); } }
protected void btn_Open_Click(object sender, EventArgs e) { try { lgk.Model.tb_remit me = remitbll.GetModel(" UserID=" + LoginUser.UserID + " and Remit001=2 and State=0"); //Remit001记录汇款操作类型: 1-会员激活 2-复加投资 3-会员升级 if (me != null) { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('您还有复投申请正在审核..,暂时无法进行新的申请!');", true); return; } if (PayType.Value == "4") { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('请选择付款方式!');", true); return; } if (PayType.Value == "1") { if (ourbankname.SelectedValue == "0") { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('请选择付款银行!');", true); return; } } if (PayType.Value == "0") { if (ourbankaccount.Text == "") { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('汇出账户不能为空!');", true); return; } if (bank.Text == "") { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('公司开户银行不能为空!');", true); return; } if (bankAccount.Text == "") { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('公司开户账户不能为空!');", true); return; } if (bankUserName.Text == "") { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('公司开户名不能为空!');", true); return; } if (Image1.ImageUrl == "") { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('打款凭证不能为空!');", true); return; } if (LoginUser.IsOut == 1) { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('你现在无法复投!');", true); return; } lgk.Model.tb_remit re = remitbll.GetModel(" UserID=" + LoginUser.UserID + " and Remit001=2"); if (me != null && me.State == 0) { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('你已经申请复投,请等待审核!');", true); return; } } string bankname = ""; decimal meoney = getParamAmount("Level" + LoginUser.User004) * 7; lgk.Model.tb_remit remit = new lgk.Model.tb_remit(); remit.UserID = LoginUser.UserID; remit.RemitMoney = meoney; remit.BankAccountUser = bankUserName.Text; remit.BankAccount = bankAccount.Text; remit.BankName = bank.Text; remit.RechargeableDate = DateTime.Now; remit.AddDate = DateTime.Now; remit.PassDate = DateTime.Now; remit.Remark = barmk.Text; remit.State = 0; //0-付款中 1-付款成功,等待后台审核 2-审核成功 remit.Remit001 = 2; //1-开通会员 2-复投 // remit.Remit002 = Convert.ToInt32(droplevel.Value.Trim()); remit.Remit006 = Convert.ToDecimal(PayType.Value); //支付方式 string orderCode = Util.BuildOuterOrderNumber(Convert.ToInt32(LoginUser.UserID)); remit.Remit004 = orderCode; //订单号 //remit.Remit004 = orderCode;//订单号 //remit.Remit005 = sing;//sing签名 remit.Remit005 = Image1.ImageUrl; if (PayType.Value != "0") { if (PayType.Value == "1") { remit.Remit003 = ourbankname.SelectedValue;//打款银行 bankname = ourbankname.SelectedItem.Text; } if (PayType.Value == "2") { remit.Remit003 = OurZFB.SelectedValue;//支付宝通道 bankname = OurZFB.SelectedItem.Text; } if (PayType.Value == "3") { remit.Remit003 = OurWX.SelectedValue;//微信通道 bankname = OurWX.SelectedItem.Text; } } else if (PayType.Value == "0") { remit.Remit003 = OutBank.SelectedValue; //汇出银行 } remit.Remit007 = 1; //是否提交成功 0-是 1-否 long uid = remitbll.Add(remit); if (uid > 0) { //ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('申请成功!');", true); if (PayType.Value == "0") { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('申请成功!');", true); } else { Response.Redirect("/ReciPay.aspx?money=" + meoney + "&bankcode=" + remit.Remit003 + "&remitID=" + uid + "&orderCode=" + orderCode + "&type=会员复投&UserCode=" + LoginUser.UserCode + "&payMoth=" + paymoth(PayType.Value) + "&bankname=" + bankname + "&page=r=Recast"); // btn_Open.Visible = false; //this.Ifrc.Attributes.Add("src ", "/ReciPay.aspx?money=" + meoney + "&bankcode=" + ourbankname.SelectedValue + "&remitID=" + uid + "&orderCode=" + orderCode + ""); //Response.Write("<script>window.open('/Pay.aspx?money=" + meoney + "&bankcode=" + ourbankname.SelectedValue + "&remitID=" + uid + "&orderCode=" + orderCode + "','_blank')</script>"); } BindData(); // Response.Write("<script>window.open('/Pay.aspx?money=" + meoney + "&bankcode=" + ourbankname.SelectedValue + "&remitID=" + uid + "&orderCode=" + orderCode + "')</script>"); } else { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('申请失败!');", true); } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + ex.Message + "!');", true); } }
protected void btnSubmit_Click(object sender, EventArgs e) { lgk.Model.tb_user userInfo = userBLL.GetModel(LoginUser.UserID); lgk.Model.tb_userPro userPro = proBLL.GetModelByUserID(Convert.ToInt32(userInfo.UserID)); try { if (LoginUser.IsOpend != 2) { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('您是未激活会员,无法申请会员升级!');", true); return; } lgk.Model.tb_remit me = remitbll.GetModel(" UserID=" + LoginUser.UserID + " and Remit001=3 and State=0"); //Remit001记录汇款操作类型: 1-会员激活 2-复加投资 3-会员升级 if (me != null) { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('您还有升级申请正在审核..,暂时无法进行新的申请!');", true); return; } if (PayType.Value == "4") { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('请选择付款方式!');", true); return; } if (PayType.Value == "1") { if (ourbankname.SelectedValue == "0") { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('请选择付款银行!');", true); return; } } if (ddlLevel.SelectedValue == "0") { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("Pleasepromotions") + "');", true);//请选择晋升级别 return; } if (PayType.Value == "0") { if (ourbankname.Text == "") { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('汇出银行不能为空!');", true); return; } if (ourbankaccount.Text == "") { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('汇出账户不能为空!');", true); return; } if (bank.Text == "") { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('公司开户银行不能为空!');", true); return; } if (bankAccount.Text == "") { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('公司开户账户不能为空!');", true); return; } if (bankUserName.Text == "") { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('公司开户名不能为空!');", true); return; } if (Image1.ImageUrl == "") { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('打款凭证不能为空!');", true); return; } } string bankname = ""; decimal money = getParamAmount("Level" + ddlLevel.SelectedValue) * 7; lgk.Model.tb_userPro upModel = new lgk.Model.tb_userPro(); upModel.ProMoney = money; int endLevl = Convert.ToInt32(ddlLevel.SelectedValue); //加入用户升级表 upModel.UserID = userInfo.UserID; upModel.AddDate = DateTime.Now; upModel.LastLevel = userInfo.LevelID; upModel.EndLevel = endLevl; upModel.Remark = "前台晋升"; upModel.Flag = 0; upModel.FlagDate = DateTime.Now; lgk.Model.tb_remit remit = new lgk.Model.tb_remit(); remit.UserID = LoginUser.UserID; remit.RemitMoney = getParamAmount("Level" + ddlLevel.SelectedValue) * 7; remit.BankAccountUser = bankUserName.Text; remit.BankAccount = bankAccount.Text; remit.BankName = bank.Text; remit.RechargeableDate = DateTime.Now; remit.AddDate = DateTime.Now; remit.State = 0; //0-付款中 1-付款成功,等待后台审核 2-审核成功 remit.PassDate = DateTime.Now; remit.Remit001 = 3; //1-激活会员 2-复投 3-会员升级 remit.Remark = barmk.Text; remit.Remit006 = Convert.ToDecimal(PayType.Value); //支付方式 string orderCode = Util.BuildOuterOrderNumber(Convert.ToInt32(LoginUser.UserID)); remit.Remit004 = orderCode; //订单号 remit.Remit002 = endLevl; remit.Remit005 = Image1.ImageUrl; if (PayType.Value != "0") { if (PayType.Value == "1") { remit.Remit003 = ourbankname.SelectedValue;//打款银行 bankname = ourbankname.SelectedItem.Text; } if (PayType.Value == "2") { remit.Remit003 = OurZFB.SelectedValue;//支付宝通道 bankname = OurZFB.SelectedItem.Text; } if (PayType.Value == "3") { remit.Remit003 = OurWX.SelectedValue;//微信通道 bankname = OurWX.SelectedItem.Text; } } else if (PayType.Value == "0") { remit.Remit003 = OutBank.SelectedValue;//汇出银行 } long pro = proBLL.Add(upModel); //remit.Remit007 = Convert.ToInt32(pro); long uid = remitbll.Add(remit); if (pro > 0 && uid > 0) { //ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('你的会员升级申请已被受理,请等待审核!');", true); if (PayType.Value == "0") { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('申请成功!');", true); } else { // btnSubmit.Visible = false; Response.Redirect("/ReciPay.aspx?money=" + money + "&bankcode=" + remit.Remit003 + "&remitID=" + uid + "&orderCode=" + orderCode + "&type=会员升级&UserCode=" + LoginUser.UserCode + "&payMoth=" + paymoth(PayType.Value) + "&bankname=" + bankname + "&page=ProLevel"); //Response.Write("<script>window.open('/Pay.aspx?money=" + money + "&bankcode=" + ourbankname.SelectedValue + "&remitID=" + uid + "&orderCode=" + orderCode + "','_blank')</script>"); } add_userRecord(LoginUser.UserCode, DateTime.Now, upModel.ProMoney, 2); BindData(); } else { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("checkPage") + "');", true);//操作失败!请检查页面! } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + ex.Message + "!');", true); } }