コード例 #1
0
        /// <summary>
        /// 获取某一个实体
        /// </summary>
        /// <param name="Id">标识</param>
        /// <returns>返回Entity</returns>
        public static Entity.DingDan DingDanEntityGet(string strDingDanHao)
        {
            Entity.DingDan info = new Entity.DingDan();
            DataTable      dt   = SqlDB.ExecuteDataset(CommandType.Text, "SELECT * FROM [DingDan] WHERE DingDanHao = '" + strDingDanHao + "'").Tables[0];

            if (dt != null && dt.Rows.Count > 0)
            {
                info.Id          = Basic.Utils.StrToInt(dt.Rows[0]["Id"].ToString(), 0);
                info.State       = Basic.Utils.StrToInt(dt.Rows[0]["State"].ToString(), 0);
                info.DingDanHao  = dt.Rows[0]["DingDanHao"].ToString();
                info.Subject     = dt.Rows[0]["Subject"].ToString();
                info.Body        = dt.Rows[0]["Body"].ToString();
                info.Count       = Basic.Utils.StrToInt(dt.Rows[0]["Count"].ToString(), 0);
                info.DanJia      = Basic.Utils.StrToDecimal(dt.Rows[0]["DanJia"].ToString(), 0);
                info.DingDanJinE = Basic.Utils.StrToDecimal(dt.Rows[0]["DingDanJinE"].ToString(), 0);
                info.CellName    = dt.Rows[0]["CellName"].ToString();
                info.CellMobile  = dt.Rows[0]["CellMobile"].ToString();
                info.AddTime     = Basic.Utils.StrToDateTime(dt.Rows[0]["AddTime"].ToString());
                info.Memo        = dt.Rows[0]["Memo"].ToString();
                info.Category    = Basic.Utils.StrToInt(dt.Rows[0]["Category"].ToString(), 0);

                return(info);
            }
            return(null);
        }
コード例 #2
0
ファイル: DingDan.aspx.cs プロジェクト: srsman/gaokao2015
        /// <summary>
        /// 银联在线支付
        /// </summary>
        void YinLian(Entity.DingDan info)
        {
            if (info != null)
            {
                //info.DanJia = (decimal)0.01;
                //info.DingDanJinE = (decimal)0.01;
                // 要使用各种Srv必须先使用LoadConf载入配置
                UPOPSrv.LoadConf(HttpContext.Current.Server.MapPath("/App_Data/conf.xml.config"));

                // 使用Dictionary保存参数
                System.Collections.Generic.Dictionary <string, string> param = new System.Collections.Generic.Dictionary <string, string>();

                // 填写参数
                param["transType"]          = UPOPSrv.TransType.CONSUME;                                       // 交易类型,前台只支持CONSUME 和 PRE_AUTH
                param["commodityUrl"]       = "http://gaokao.gelunjiaoyu.com/Art/GouMai/ReturnUrl.aspx";       // 商品URL
                param["commodityName"]      = "格伦高考报考网-“报考卡”";                                                 // 商品名称
                param["commodityUnitPrice"] = ((int)((info.DanJia) * 100)).ToString();                         // 商品单价,分为单位
                param["commodityQuantity"]  = info.Count.ToString();                                           // 商品数量
                param["orderNumber"]        = info.DingDanHao;                                                 // 订单号,必须唯一
                param["orderAmount"]        = ((int)((info.DingDanJinE) * 100)).ToString();                    // 交易金额
                param["orderCurrency"]      = UPOPSrv.CURRENCY_CNY;                                            // 币种
                param["orderTime"]          = DateTime.Now.ToString("yyyyMMddHHmmss");                         // 交易时间
                param["customerIp"]         = System.Web.HttpContext.Current.Request.UserHostAddress;          // 用户IP
                param["frontEndUrl"]        = "http://gaokao.gelunjiaoyu.com/Art/GouMai/YinLian/FontPay.aspx"; // 前台回调URL
                param["backEndUrl"]         = "http://gaokao.gelunjiaoyu.com/Art/GouMai/YinLian/BackPay.aspx"; // 后台回调URL

                // 创建前台交易服务对象
                FrontPaySrv srv = new FrontPaySrv(param);

                // 将前台交易服务对象产生的Html文档写入页面,从而引导用户浏览器重定向
                Response.ContentEncoding = srv.Charset; // 指定输出编码
                Response.Write(srv.CreateHtml());       // 写入页面
            }
            else
            {
                ClientScript.RegisterStartupScript(GetType(), "", "<script>artDialog11('该订单不存在...');return false;</script>");
                return;
            }
        }
コード例 #3
0
ファイル: FontPay.aspx.cs プロジェクト: srsman/gaokao2015
        //前台回调页面
        public string NotifyCallback_Front()
        {
            if (Request.HttpMethod == "POST")
            {
                // 要使用各种Srv必须先使用LoadConf载入配置
                string url = Server.MapPath("/App_Data/conf.xml.config");
                UPOPSrv.LoadConf(url);

                //拼接银联返回信息
                Dictionary <string, string> dic = Util.NameValueCollection2StrDict(Request.Form);
                foreach (KeyValuePair <string, string> kvp in dic)
                {
                    Console.WriteLine("key={0},value={1}", kvp.Key, kvp.Value);
                    message += kvp.Key + ":" + kvp.Value + " | ";
                }


                SrvResponse resp = new SrvResponse(dic);

                //订单号
                string orderNumber = resp.Fields["orderNumber"];

                //订单交易状态
                string respCode = resp.Fields["respCode"];
                //  int PayID = Convert.ToInt32(orderNumber.Replace(UnionConfig.UnionPayingPrefix, ""));


                //更新返回信息到数据库中
                Entity.DingDan info = DAL.tengxb.dingdan.DingDanEntityGet(orderNumber);
                if (info != null)
                {
                    //支付成功,且验证过了
                    if (info.State == 0)
                    {
                        switch (resp.ResponseCode)
                        {
                        case SrvResponse.RESP_SUCCESS:
                        {
                            try
                            {
                                //string orderNumber = resp.Fields["orderNumber"];
                                //int PayID = Convert.ToInt32(orderNumber.Substring(14, orderNumber.Length - 14));
                                //修改订单的状态为“已支付”

                                info.State = 1;        //00 支付成功

                                //TRADE_SUCCESS
                                // 交易成功,且可对该交易做操作,如:多级分润、退款等。
                                if (DAL.GaoKaoCard.GaoKaoCardCount("DingDanHao = '" + info.DingDanHao + "'") < info.Count)
                                {
                                    //分配高考卡,并发送短信
                                    FenPeiGaoKaoCard.FenPeiCard(info);
                                    //展示卡号
                                    DataTable dt = DAL.GaoKaoCard.GaoKaoCardList("DingDanHao = '" + info.DingDanHao + "'");
                                    if (dt != null)
                                    {
                                        for (int i = 0; i < dt.Rows.Count; i++)
                                        {
                                            strCardList += "<p>账号:" + dt.Rows[i]["KaHao"].ToString() + " &nbsp;&nbsp; 密码:" + dt.Rows[i]["MiMa"].ToString() + "</p>";
                                        }
                                    }
                                }
                                else
                                {
                                    //展示卡号
                                    DataTable dt = DAL.GaoKaoCard.GaoKaoCardList("DingDanHao = '" + info.DingDanHao + "'");
                                    if (dt != null)
                                    {
                                        for (int i = 0; i < dt.Rows.Count; i++)
                                        {
                                            strCardList += "<p>账号:" + dt.Rows[i]["KaHao"].ToString() + " &nbsp;&nbsp; 密码:" + dt.Rows[i]["MiMa"].ToString() + "</p>";
                                        }
                                    }
                                }

                                /*返回码200代表商铺已经成功收到并正确解析出后台的通知,其他的返回码则认为通知失败,
                                 * 返回给银联支付,若不返回此码,银联会重发通知,最多5次*/
                                //Response.Write("200");
                            }
                            catch { }
                            finally {
                                Basic.Email.sendMail("*****@*****.**", "高考报考卡购买付款成功", "订单号:" + info.DingDanHao + "<br />" + info.Body + "<br />联系电话:" + info.CellMobile + "<br />" + strCardList);
                                Basic.Email.sendMail("*****@*****.**", "高考报考卡购买付款成功", "订单号:" + info.DingDanHao + "<br />" + info.Body + "<br />联系电话:" + info.CellMobile);
                            }
                        }
                        break;

                        case "02":
                            info.State = 2;    //02 卡号无效
                            break;

                        case "11":
                            info.State = 3;    //11 余额不足
                            break;

                        default:
                            info.State = 4;    //11 订单支付失败,请到您的订单列表中重新进行支付操作
                            break;
                        }

                        info.Memo = "高考报考卡_银联支付,返回的参数:" + message;
                        DAL.DingDan.DingDanEdit(info);
                    }
                    else
                    {
                        //Basic.Email.sendMail("*****@*****.**", "银联支付", "又传过来一次了fontpay");
                    }


                    strResult = info.State.ToString();
                }
            }


            return(message);
        }
コード例 #4
0
ファイル: DingDan.aspx.cs プロジェクト: srsman/gaokao2015
        /// <summary>
        /// 选择支付方式后,去购买
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void imgSave_Click(object sender, ImageClickEventArgs e)
        {
            int intCheck = 0;

            if (rbtZhiFuBao.Checked == true)
            {
                intCheck = 1;
            }
            if (rbtYinLian.Checked == true)
            {
                intCheck = 2;
            }
            if (intCheck == 0)
            {
                Basic.MsgHelper.AlertBackMsg("请选择付款方式");
            }
            else
            {
                string strCellName   = this.txtCellName.Text.Trim();
                string strCellMobile = this.txtCellMobile.Text.Trim();
                string strCount      = this.txtCount.Text.Trim();
                if (strCellName == "")
                {
                    //联系人姓名
                    Basic.MsgHelper.AlertBackMsg("请填写联系人姓名");
                }
                if (strCellMobile == "")
                {
                    //联系人手机
                    Basic.MsgHelper.AlertBackMsg("请填写联系人手机");
                }


                //购卡数量
                if (strCount == "")
                {
                    Basic.MsgHelper.AlertBackMsg("请填写购买数量");
                }
                else if (strCount == "0")
                {
                    Basic.MsgHelper.AlertBackMsg("购卡数量不能为0");
                }
                else if (new Regex("^[1-9]\\d*$").IsMatch(strCount) == false)
                {
                    Basic.MsgHelper.AlertBackMsg("购卡数量必须为阿拉伯数字");
                }
                int intCount = int.Parse(strCount);

                //卡的单价
                decimal decDanJia = decimal.Parse(lblDanJia.Text);

                //总金额
                decimal decTotleJinE = decDanJia * intCount;

                //购卡省份
                string strProvinceName = hiddProvinceName.Value;

                //订单名称
                //string strSubject = strCellName + "购买了" + intCount + "张," + strProvinceName + "的" + strCardLeiBie;
                string strSubject = strCellName + "购买了" + intCount + "张," + strProvinceName + " 艺考VIP卡";


                //订单详情
                string strBody = strCellName + "(" + strCellMobile + ")于" + DateTime.Now + ",购买了" + intCount + "张," + strProvinceName + "的艺考VIP卡,每张卡的金额为" + lblDanJia.Text + ",此次订单的总金额为" + decTotleJinE + "。";



                //构建实体对象
                Entity.DingDan info = new Entity.DingDan();

                info.AddTime     = DateTime.Now;
                info.Subject     = strSubject;
                info.Body        = strBody;
                info.CellMobile  = strCellMobile;
                info.CellName    = strCellName;
                info.Count       = intCount;
                info.DanJia      = decDanJia;
                info.DingDanHao  = string.Format("{0:yyyyMMddHHmmssff}", DateTime.Now); //订单号
                info.DingDanJinE = decTotleJinE;                                        //订单总金额
                info.State       = 0;                                                   //订单状态
                info.Memo        = "";
                info.ProvinceId  = 0;
                info.WenLi       = 0;
                info.Address     = "";

                int intDingDanId = 0;
                //订单保存成功,现在需要去支付了
                switch (intCheck)
                {
                case 1:      //支付宝
                    info.Category = 1;
                    intDingDanId  = DAL.DingDan.DingDanAdd(info);
                    if (intDingDanId > 0)
                    {
                        //支付宝
                        ZhiFuBao(intDingDanId);
                    }
                    else
                    {
                        //订单保存失败
                        Basic.MsgHelper.AlertBackMsg("订单保存失败");
                    }
                    break;

                case 2:      //银联
                    info.Category = 2;
                    intDingDanId  = DAL.DingDan.DingDanAdd(info);
                    if (intDingDanId > 0)
                    {
                        YinLian(info);
                    }
                    else
                    {
                        //订单保存失败
                        Basic.MsgHelper.AlertBackMsg("订单保存失败");
                    }
                    break;

                default:
                    Basic.MsgHelper.AlertBackMsg("订单保存失败");
                    break;
                }
            }
        }
コード例 #5
0
ファイル: DingDan.aspx.cs プロジェクト: srsman/gaokao2015
        /// <summary>
        /// 支付宝 支付
        /// </summary>
        void ZhiFuBao(int intDingDanId)
        {
            Entity.DingDan info = DAL.DingDan.DingDanEntityGet(intDingDanId);

            if (info != null)
            {
                #region 支付宝即时到账参数

                //合作方身份id
                string partner = "2088801581813827";

                //支付类型
                string payment_type = "1";
                //必填,不能修改
                //服务器异步通知页面路径
                string notify_url = "http://gaokao.gelunjiaoyu.com/Art/GouMai/NotifyUrl.aspx";
                //需http://格式的完整路径,不能加?id=123这类自定义参数

                //页面跳转同步通知页面路径
                string return_url = "http://gaokao.gelunjiaoyu.com/Art/GouMai/ReturnUrl.aspx";
                //需http://格式的完整路径,不能加?id=123这类自定义参数,不能写成http://localhost/

                //卖家支付宝帐户
                string seller_email = "*****@*****.**";
                string seller_id    = "2088801581813827";
                //必填

                //商户订单号
                string out_trade_no = info.DingDanHao;
                //商户网站订单系统中唯一订单号,必填

                int Count = info.Count;

                //订单名称
                string subject = info.Subject;
                //必填

                //付款金额
                string total_fee = string.Format("{0:N2}", info.DingDanJinE.ToString());
                //必填

                //订单描述
                string body = info.Body;



                //商品展示地址
                string show_url = "http://gaokao.gelunjiaoyu.com/Art/GouMai/ShowUrl.aspx";
                //需以http://开头的完整路径,例如:/gaokao/myorder.html

                //防钓鱼时间戳
                string anti_phishing_key = "";
                //若要使用请调用类文件submit中的query_timestamp函数

                //客户端的IP地址
                string exter_invoke_ip = Request.UserHostAddress;
                //非局域网的外网IP地址,如:221.0.0.1



                //代签名字符串
                string preStr = "_input_charset=utf-8" +
                                "&body=" + body +
                                "&exter_invoke_ip=" + exter_invoke_ip +
                                "&notify_url=" + notify_url +
                                "&out_trade_no=" + out_trade_no +
                                "&partner=" + partner +
                                "&payment_type=" + payment_type +
                                "&return_url=" + return_url +
                                "&seller_email=" + seller_email +
                                "&service=" + "create_direct_pay_by_user" +
                                "&show_url=" + show_url +
                                "&subject=" + subject +
                                "&total_fee=" + total_fee;

                #endregion

                #region 调用支付宝接口,发送请求

                ////////////////////////////////////////////////////////////////////////////////////////////////

                //把请求参数打包成数组
                SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>();
                //sParaTemp.Add("anti_phishing_key", anti_phishing_key);
                sParaTemp.Add("_input_charset", Config.Input_charset.ToLower());
                sParaTemp.Add("body", body);
                sParaTemp.Add("exter_invoke_ip", exter_invoke_ip);
                sParaTemp.Add("notify_url", notify_url);
                sParaTemp.Add("out_trade_no", out_trade_no);
                sParaTemp.Add("partner", partner);
                sParaTemp.Add("payment_type", payment_type);
                sParaTemp.Add("return_url", return_url);
                sParaTemp.Add("seller_email", seller_email);
                sParaTemp.Add("service", "create_direct_pay_by_user");
                //sParaTemp.Add("seller_id", seller_id);
                sParaTemp.Add("show_url", show_url);
                sParaTemp.Add("subject", subject);
                sParaTemp.Add("total_fee", total_fee);
                //sParaTemp.Add("sign", AlipayMD5.Sign(preStr, "tozq0prk7lau6ue1khoq5kg1ek17qvmd", Config.Input_charset.ToLower()));
                //sParaTemp.Add("sign_type", Config.Sign_type);

                Config.Key = "tozq0prk7lau6ue1khoq5kg1ek17qvmd";

                //建立请求
                string sHtmlText = Submit.BuildRequest(sParaTemp, "get", "确认");

                Response.Write(sHtmlText);

                #endregion
            }
            else
            {
                Basic.MsgHelper.AlertBackMsg("服务器正忙...");
            }
        }
コード例 #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SortedDictionary <string, string> sPara = GetRequestGet();

            if (sPara.Count > 0)//判断是否有带返回参数
            {
                Notify aliNotify    = new Notify();
                bool   verifyResult = aliNotify.Verify(sPara, Request.QueryString["notify_id"], Request.QueryString["sign"]);

                if (verifyResult)//验证成功
                {
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    //请在这里加上商户的业务逻辑程序代码

                    //——请根据您的业务逻辑来编写程序(以下代码仅作参考)——
                    //获取支付宝的通知返回参数,可参考技术文档中服务器异步通知参数列表

                    //商户订单号
                    string out_trade_no = Request.QueryString["out_trade_no"];
                    //支付宝交易号
                    string trade_no = Request.QueryString["trade_no"];
                    //交易状态
                    string trade_status = Request.QueryString["trade_status"];
                    //更新返回信息到数据库中
                    Entity.DingDan info = DAL.tengxb.dingdan.DingDanEntityGet(out_trade_no);
                    if (info != null)
                    {
                        if (Request.QueryString["trade_status"] == "TRADE_FINISHED" || Request.QueryString["trade_status"] == "TRADE_SUCCESS")
                        {
                            //TRADE_SUCCESS
                            // 交易成功,且可对该交易做操作,如:多级分润、退款等。
                            strResult = "success";
                            //在notifyUrl页面中已经进行账号分配处理了

                            if (DAL.GaoKaoCard.GaoKaoCardCount("DingDanHao = '" + info.DingDanHao + "'") < info.Count)
                            {
                                //分配高考卡,并发送短信
                                FenPeiGaoKaoCard.FenPeiCard(info);
                                //展示卡号
                                DataTable dt = DAL.GaoKaoCard.GaoKaoCardList("DingDanHao = '" + info.DingDanHao + "'");
                                if (dt != null)
                                {
                                    for (int i = 0; i < dt.Rows.Count; i++)
                                    {
                                        strCardList += "<p>账号:" + dt.Rows[i]["KaHao"].ToString() + " &nbsp;&nbsp; 密码:" + dt.Rows[i]["MiMa"].ToString() + "</p>";
                                    }
                                }
                            }
                            else
                            {
                                //展示卡号
                                DataTable dt = DAL.GaoKaoCard.GaoKaoCardList("DingDanHao = '" + info.DingDanHao + "'");
                                if (dt != null)
                                {
                                    for (int i = 0; i < dt.Rows.Count; i++)
                                    {
                                        strCardList += "<p>账号:" + dt.Rows[i]["KaHao"].ToString() + " &nbsp;&nbsp; 密码:" + dt.Rows[i]["MiMa"].ToString() + "</p>";
                                    }
                                }
                            }
                        }
                        else
                        {
                            //付款失败
                            // Basic.SendMobile.SendMobileMsg("15810621454", "付款失败");
                        }
                    }
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////
                }
                else//验证失败
                {
                    strResult = "fail";
                    Response.Write("fail");
                }
            }
            else
            {
                strResult = "无通知参数";
                // Response.Write("无通知参数");
            }
        }
コード例 #7
0
ファイル: BackPay.aspx.cs プロジェクト: srsman/gaokao2015
        //后台回调页面
        public string NotifyCallback_Back()
        {
            if (Request.HttpMethod == "POST")
            {
                // 要使用各种Srv必须先使用LoadConf载入配置
                string url = Server.MapPath("/App_Data/conf.xml.config");
                UPOPSrv.LoadConf(url);

                //拼接银联返回信息
                Dictionary <string, string> dic = Util.NameValueCollection2StrDict(Request.Form);
                foreach (KeyValuePair <string, string> kvp in dic)
                {
                    Console.WriteLine("key={0},value={1}", kvp.Key, kvp.Value);
                    message += kvp.Key + ":" + kvp.Value + " | ";
                }


                SrvResponse resp = new SrvResponse(dic);

                //订单号
                string orderNumber = resp.Fields["orderNumber"];

                //订单交易状态
                string respCode = resp.Fields["respCode"];
                //  int PayID = Convert.ToInt32(orderNumber.Replace(UnionConfig.UnionPayingPrefix, ""));


                //更新返回信息到数据库中
                Entity.DingDan info = DAL.DingDan.DingDanEntityGetByDingDanHao(orderNumber);
                if (info != null)
                {
                    //支付成功,且验证过了
                    if (info.State == 0)
                    {
                        switch (resp.ResponseCode)
                        {
                        case "00":
                            //修改订单的状态为“已支付”
                            info.State = 1;    //00 支付成功

                            Basic.Email.sendMail("*****@*****.**", "艺术高考VIP卡购买付款成功", "订单号:" + info.DingDanHao + "<br />" + info.Body + "<br />联系电话:" + info.CellMobile);
                            Basic.Email.sendMail("*****@*****.**", "艺术高考VIP卡购买付款成功", "订单号:" + info.DingDanHao + "<br />" + info.Body + "<br />联系电话:" + info.CellMobile);

                            //TRADE_SUCCESS
                            // 交易成功,且可对该交易做操作,如:多级分润、退款等。
                            if (DAL.GaoKaoCard.GaoKaoCardCount("DingDanHao = '" + info.DingDanHao + "'") < info.Count)
                            {
                                //分配高考卡,并发送短信
                                FenPeiGaoKaoCard.FenPeiCard(info, 1);
                            }

                            /*返回码200代表商铺已经成功收到并正确解析出后台的通知,其他的返回码则认为通知失败,
                             * 返回给银联支付,若不返回此码,银联会重发通知,最多5次*/
                            Response.Write("200");

                            break;

                        case "02":
                            info.State = 2;    //02 卡号无效
                            break;

                        case "11":
                            info.State = 3;    //11 余额不足
                            break;

                        default:
                            info.State = 4;    // 订单支付失败,请到您的订单列表中重新进行支付操作
                            break;
                        }


                        info.Memo = "艺考VIP卡_银联支付,返回的参数:" + message;
                        DAL.DingDan.DingDanEdit(info);
                    }
                    else
                    {
                        // Basic.Email.sendMail("*****@*****.**", "银联支付", "又传过来一次了backpay");
                    }
                }
            }
            return(string.Empty);
        }
コード例 #8
0
        //交易状态,
        //只是生成订单的话,默认为0
        //返回的状态值,以此对应如下:
        //1.WAIT_BUYER_PAY:1       交易创建,等待买家付款。
        //2.TRADE_CLOSED:2       (1)在指定时间段内未支付时关闭的交易;(2)在交易完成全额退款成功时关闭的交易。
        //3.TRADE_SUCCESS:3    交易成功,且可对该交易做操作,如:多级分润、退款等。
        //4.TRADE_PENDING:4    等待卖家收款(买家付款后,如果卖家账号被冻结)。
        //5.TRADE_FINISHED:5    交易成功且结束,即不可再做任何操作
        protected void Page_Load(object sender, EventArgs e)
        {
            SortedDictionary <string, string> sPara = GetRequestPost();

            if (sPara.Count > 0)//判断是否有带返回参数
            {
                Notify aliNotify    = new Notify();
                bool   verifyResult = aliNotify.Verify(sPara, Request.Form["notify_id"], Request.Form["sign"]);

                if (verifyResult)//验证成功
                {
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    //请在这里加上商户的业务逻辑程序代码

                    //商户订单号
                    string out_trade_no = Request.Form["out_trade_no"];
                    //支付宝交易号
                    string trade_no = Request.Form["trade_no"];
                    //交易状态
                    string trade_status = Request.Form["trade_status"];

                    //更新返回信息到数据库中
                    Entity.DingDan info = DAL.tengxb.dingdan.DingDanEntityGet(out_trade_no);
                    if (info != null)
                    {
                        //更新数据库中的状态值
                        info.State = 3;
                        switch (Request.Form["trade_status"])
                        {
                        case "WAIT_BUYER_PAY":
                            info.State = 1;
                            break;

                        case "TRADE_CLOSED":
                            info.State = 2;
                            break;

                        case "TRADE_SUCCESS":
                            info.State = 3;
                            break;

                        case "TRADE_PENDING":
                            info.State = 4;
                            break;

                        case "TRADE_FINISHED":
                            info.State = 5;
                            break;

                        default:
                            break;
                        }

                        info.Memo = "支付宝交易号:" + trade_no;
                        DAL.DingDan.DingDanEdit(info);
                    }


                    if (Request.Form["trade_status"] == "TRADE_FINISHED" || Request.Form["trade_status"] == "TRADE_SUCCESS")
                    {
                        Basic.Email.sendMail("*****@*****.**", "艺术高考VIP卡购买付款成功", "订单号:" + info.DingDanHao + "<br />" + info.Body + "<br />联系电话:" + info.CellMobile);
                        Basic.Email.sendMail("*****@*****.**", "艺术高考VIP卡购买付款成功", "订单号:" + info.DingDanHao + "<br />" + info.Body + "<br />联系电话:" + info.CellMobile);

                        //TRADE_SUCCESS
                        // 交易成功,且可对该交易做操作,如:多级分润、退款等。
                        if (DAL.GaoKaoCard.GaoKaoCardCount("DingDanHao = '" + info.DingDanHao + "'") < info.Count)
                        {
                            //分配高考卡,并发送短信
                            FenPeiGaoKaoCard.FenPeiCard(info, 1);
                        }
                    }
                    else
                    {
                        //付款失败
                        // Basic.SendMobile.SendMobileMsg("18500525896", "付款失败");
                    }

                    Response.Write("success");  //请不要修改或删除
                }
                else//验证失败
                {
                    Response.Write("fail");
                }
            }
            else
            {
                Response.Write("无通知参数");
            }
        }
コード例 #9
0
        /*艺考*/
        public static void FenPeiCard(Entity.DingDan info, int intIsArt)
        {
            //验证成功,验证是否缴费,如果是已经缴费,
            if (info != null)
            {
                //将卡号和密码发送短信给用户

                //发送内容为什么呢?,卡号和密码怎么来的呢?

                int count = 0;

                string strMobileContent = "用户您好:您于" + string.Format("{0:yyyy-MM-dd HH:mm}", DateTime.Now) + " 购买的格伦高考报考卡";
                if (info.Count > 0)
                {
                    for (int i = 0; i < info.Count; i++)
                    {
                        Entity.GaoKaoCard infoCard = new Entity.GaoKaoCard();
                        infoCard.KaHao            = GetKaHao();                               //卡号
                        infoCard.MiMa             = "GKBK" + new Random().Next(10000, 99999); //密码
                        infoCard.StudentId        = 0;
                        infoCard.ProvinceId       = 0;
                        infoCard.Belong           = 2; //卡的属性:1总部 2网上购买 3加盟店 4代理商
                        infoCard.DianId           = 4;
                        infoCard.CardLevel        = 4; //卡的级别:2 高考查询卡,3 高考测试卡,4 格伦高考卡,5 VIP测试卡,6 报考VIP卡
                        infoCard.IsPause          = 0;
                        infoCard.AllowChangeCount = 30;
                        infoCard.HaveChangeCount  = 0;
                        infoCard.EndTime          = DateTime.Parse("2015-09-01");
                        //  infoCard.RegisterDate = DateTime.Now;
                        infoCard.Memo       = "网上购买";
                        infoCard.DingDanHao = info.DingDanHao;

                        int GaoKaoCardId = DAL.GaoKaoCard.GaoKaoCardAdd(infoCard);
                        if (GaoKaoCardId > 0)
                        {
                            DAL.GaoKaoCard.GaoKaoCardIsArt(GaoKaoCardId);
                            strMobileContent += "卡号:" + infoCard.KaHao + ",密码:" + infoCard.MiMa + ";";

                            count++;
                        }
                    }
                }
                if (count == info.Count)
                {
                    //发送短信
                    if (strMobileContent.EndsWith(";"))
                    {
                        strMobileContent = strMobileContent.Substring(0, strMobileContent.Length - 1);
                    }

                    strMobileContent += "请保存好您的账号密码。";

                    Basic.SendMobile.SendMobileMsg(info.CellMobile, strMobileContent);
                    //  Basic.Email.sendMail("*****@*****.**", "购买报考卡(第二版本1)", strMobileContent);
                }
                else
                {
                    string strContent = "订单表中,订单号为" + info.DingDanHao + "的考生,在付款之后,往gaokaocard表中插入数据时失败,请处理。";
                    //18610241135
                    Basic.SendMobile.SendMobileMsg("18500525896", strContent);
                    //  Basic.Email.sendMail("*****@*****.**", "购买报考卡(第二版本2)", strContent);
                }
            }
        }