//生成短信充值订单 /// <summary> /// 生成短信充值订单 /// </summary> private void CreateOrder() { if (hidPayWay.Value != null && hidPayWay.Value != "") { MRatesSet = (Tb_Sms_RateSet)ViewState["MRatesSet"]; //短信充值记录--充值订单 Tb_Sms_ReCharge MRecharge = new Tb_Sms_ReCharge(); //短信参数信息 if (MRatesSet != null && MRatesSet.RatesMoney > 0) { //生成订单号 string orderid = new PbProject.Logic.SQLEXBLL.SQLEXBLL_Base().GetNewOrderId("2"); if (orderid != "") { IHashObject parameter = new HashObject(); Random Rdm = new Random(); MRecharge.OrderId = orderid; MRecharge.CpyNo = mCompany.UninCode; MRecharge.InPayNo = new PbProject.Logic.Order.Tb_Ticket_OrderBLL().GetIndexId(); //DateTime.Now.ToString("yyMMddHHmmss") + Rdm.Next(100, 999).ToString(); MRecharge.PayNo = ""; //DateTime.Now.ToString("yyMMddHHmmss"); MRecharge.ReChargeMoney = MRatesSet.RatesMoney; MRecharge.ReChargeCount = MRatesSet.RatesCount; MRecharge.ReChargeDate = DateTime.Now; MRecharge.ReChargeState = 0; MRecharge.PayType = int.Parse(hidPayWay.Value); //生成订单 bool rsorder = (bool)baseDataManage.CallMethod("Tb_Sms_ReCharge", "Insert", null, new object[] { MRecharge }); List <Tb_Sms_User> listsmsUser = baseDataManage.CallMethod("Tb_Sms_User", "GetList", null, new Object[] { " CpyNo= '" + mCompany.UninCode + "'" }) as List <Tb_Sms_User>; if (listsmsUser.Count < 1) { Tb_Sms_User Msmsuser = new Tb_Sms_User(); Msmsuser.CpyNo = mCompany.UninCode; Msmsuser.SmsCount = 0; Msmsuser.SmsRemainCount = 0; Msmsuser.SmsDate = Convert.ToDateTime(DateTime.Now); Msmsuser.SmsUserType = mCompany.RoleType; bool rssmsuser = (bool)baseDataManage.CallMethod("Tb_Sms_User", "Insert", null, new object[] { Msmsuser }); } if (rsorder == true) { Session["SmsRecharge"] = MRecharge; ////跳转支付页面 Page.ClientScript.RegisterStartupScript(this.GetType(), DateTime.Now.Ticks.ToString(), "openUrl('" + orderid + "');", true); } else { Page.ClientScript.RegisterStartupScript(GetType(), Guid.NewGuid().ToString(), "showdialogOne('支付失败');", true); } } } } else { Page.ClientScript.RegisterStartupScript(GetType(), Guid.NewGuid().ToString(), "showdialogOne('请选择支付方式');", true); return; } }
protected void GetOneSetInfo() { Tb_Sms_RateSet Mreteset = baseDataManage.CallMethod("Tb_Sms_RateSet", "GetById", null, new object[] { ViewState["id"].ToString() }) as Tb_Sms_RateSet; SmsRatesCount.Text = Mreteset.RatesCount.ToString(); //SmsRatesMoney.Text = Mreteset.RatesMoney.ToString(); SmsRatesRemark.Text = Mreteset.RatesRemark; SmsRatesUnitPrice.Text = Mreteset.RatesUnitPrice.ToString(); rblSmsRatesState.SelectedValue = Mreteset.RatesState.ToString(); }
/// <summary> /// 页面信息绑定 /// </summary> private void DataBindInfo() { MRatesSet = baseDataManage.CallMethod("Tb_Sms_RateSet", "GetById", null, new object[] { ViewState["ratesetid"].ToString() }) as Tb_Sms_RateSet; SmsRatesMoney = MRatesSet.RatesMoney.ToString("f2"); SmsRatesCount = MRatesSet.RatesCount.ToString(); SmsRatesUnitPrice = MRatesSet.RatesUnitPrice.ToString("f2"); SmsRatesRemark = MRatesSet.RatesRemark; lblPay.Text = MRatesSet.RatesMoney.ToString("f2"); ViewState["MRatesSet"] = MRatesSet; }
/// <summary> /// 购买短信 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnBuy_Click(object sender, EventArgs e) { if (rblSmsTemplate.SelectedValue == "") { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "key", "<script>alert('请选择充值项!')</script>", false); } else { //选择的短信条数 Tb_Sms_RateSet MRatesSet = baseDataManage.CallMethod("Tb_Sms_RateSet", "GetById", null, new object[] { rblSmsTemplate.SelectedValue.ToString() }) as Tb_Sms_RateSet; if (mCompany.RoleType == 4 || mCompany.RoleType == 5) { //运营商短信 List <Tb_Sms_User> listSmsUser = baseDataManage.CallMethod("Tb_Sms_User", "GetList", null, new Object[] { "CpyNo='" + mSupCompany.UninCode + "'" }) as List <Tb_Sms_User>; if (listSmsUser != null && listSmsUser.Count > 0) { if (listSmsUser[0].SmsRemainCount >= MRatesSet.RatesCount) { Response.Redirect("Payment.aspx?ratesetid=" + rblSmsTemplate.SelectedValue + "¤tuserid=" + this.currentuserid.Value.ToString()); } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "key", "<script>alert('运营商短信条数不足!')</script>", false); } } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "key", "<script>alert('短信商不存在!')</script>", false); } } else { Response.Redirect("Payment.aspx?ratesetid=" + rblSmsTemplate.SelectedValue + "¤tuserid=" + this.currentuserid.Value.ToString()); } } }