Пример #1
0
        /// <summary>
        /// 根据主键值更新记录的全部字段(注意:该方法不会对自增字段、timestamp类型字段以及主键字段更新!如果要更新主键字段,请使用Update方法)。
        /// 如果数据库有数据被更新了则返回True,否则返回False
        /// </summary>
        /// <param name="db">数据库操作对象</param>
        /// <param name="payAliResult">待更新的实体对象</param>
        public int UpdatePayAliResult(PayAliResultEntity entity)
        {
            string    sql = @" UPDATE dbo.[PayAliResult] SET
                       [buyeremail]=@Buyeremail,[buyerid]=@Buyerid,[issuccess]=@Issuccess,[notifytime]=@Notifytime,[notifytype]=@Notifytype,[outtradeno]=@Outtradeno,[paymenttype]=@Paymenttype,[selleremail]=@Selleremail,[sellerid]=@Sellerid,[subject]=@Subject,[totalfee]=@Totalfee,[tradeno]=@Tradeno,[tradestatus]=@Tradestatus,[CreateTime]=@CreateTime,[HasDeal]=@HasDeal
                       WHERE [Id]=@id";
            DbCommand cmd = db.GetSqlStringCommand(sql);

            db.AddInParameter(cmd, "@Id", DbType.Int32, entity.Id);
            db.AddInParameter(cmd, "@Buyeremail", DbType.String, entity.Buyeremail);
            db.AddInParameter(cmd, "@Buyerid", DbType.String, entity.Buyerid);
            db.AddInParameter(cmd, "@Issuccess", DbType.String, entity.Issuccess);
            db.AddInParameter(cmd, "@Notifytime", DbType.String, entity.Notifytime);
            db.AddInParameter(cmd, "@Notifytype", DbType.String, entity.Notifytype);
            db.AddInParameter(cmd, "@Outtradeno", DbType.String, entity.Outtradeno);
            db.AddInParameter(cmd, "@Paymenttype", DbType.String, entity.Paymenttype);
            db.AddInParameter(cmd, "@Selleremail", DbType.String, entity.Selleremail);
            db.AddInParameter(cmd, "@Sellerid", DbType.String, entity.Sellerid);
            db.AddInParameter(cmd, "@Subject", DbType.String, entity.Subject);
            db.AddInParameter(cmd, "@Totalfee", DbType.String, entity.Totalfee);
            db.AddInParameter(cmd, "@Tradeno", DbType.String, entity.Tradeno);
            db.AddInParameter(cmd, "@Tradestatus", DbType.String, entity.Tradestatus);
            db.AddInParameter(cmd, "@CreateTime", DbType.DateTime, entity.CreateTime);
            db.AddInParameter(cmd, "@HasDeal", DbType.Int32, entity.HasDeal);
            return(db.ExecuteNonQuery(cmd));
        }
Пример #2
0
        /// <summary>
        /// 插入一条记录到表PayAliResult,如果表中存在自增字段,则返回值为新记录的自增字段值,否则返回0
        /// </summary>
        /// <param name="db">数据库操作对象</param>
        /// <param name="payAliResult">待插入的实体对象</param>
        public int AddPayAliResult(PayAliResultEntity entity)
        {
            string    sql = @"insert into PayAliResult( [buyeremail],[buyerid],[issuccess],[notifytime],[notifytype],[outtradeno],[paymenttype],[selleremail],[sellerid],[subject],[totalfee],[tradeno],[tradestatus],[CreateTime],[HasDeal])VALUES
			            ( @Buyeremail,@Buyerid,@Issuccess,@Notifytime,@Notifytype,@Outtradeno,@Paymenttype,@Selleremail,@Sellerid,@Subject,@Totalfee,@Tradeno,@Tradestatus,@CreateTime,@HasDeal);
			SELECT SCOPE_IDENTITY();"            ;
            DbCommand cmd = db.GetSqlStringCommand(sql);

            db.AddInParameter(cmd, "@Buyeremail", DbType.String, entity.Buyeremail);
            db.AddInParameter(cmd, "@Buyerid", DbType.String, entity.Buyerid);
            db.AddInParameter(cmd, "@Issuccess", DbType.String, entity.Issuccess);
            db.AddInParameter(cmd, "@Notifytime", DbType.String, entity.Notifytime);
            db.AddInParameter(cmd, "@Notifytype", DbType.String, entity.Notifytype);
            db.AddInParameter(cmd, "@Outtradeno", DbType.String, entity.Outtradeno);
            db.AddInParameter(cmd, "@Paymenttype", DbType.String, entity.Paymenttype);
            db.AddInParameter(cmd, "@Selleremail", DbType.String, entity.Selleremail);
            db.AddInParameter(cmd, "@Sellerid", DbType.String, entity.Sellerid);
            db.AddInParameter(cmd, "@Subject", DbType.String, entity.Subject);
            db.AddInParameter(cmd, "@Totalfee", DbType.String, entity.Totalfee);
            db.AddInParameter(cmd, "@Tradeno", DbType.String, entity.Tradeno);
            db.AddInParameter(cmd, "@Tradestatus", DbType.String, entity.Tradestatus);
            db.AddInParameter(cmd, "@CreateTime", DbType.DateTime, entity.CreateTime);
            db.AddInParameter(cmd, "@HasDeal", DbType.Int32, entity.HasDeal);
            object identity = db.ExecuteScalar(cmd);

            if (identity == null || identity == DBNull.Value)
            {
                return(0);
            }
            return(Convert.ToInt32(identity));
        }
Пример #3
0
        /// <summary>
        /// 判断当前节点是否已存在相同的
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int  ExistNum(PayAliResultEntity entity)
        {
            ///id=0,判断总数,ID>0判断除自己之外的总数
            string sql = @"Select count(1) from dbo.[PayAliResult] WITH(NOLOCK) ";

            string where = "where ";
            if (entity.Id == 0)
            {
            }
            else
            {
            }
            sql = sql + where;
            DbCommand cmd = db.GetSqlStringCommand(sql);

            if (entity.Id > 0)
            {
                db.AddInParameter(cmd, "@Id", DbType.Int32, entity.Id);
            }
            object identity = db.ExecuteScalar(cmd);

            if (identity == null || identity == DBNull.Value)
            {
                return(0);
            }
            return(Convert.ToInt32(identity));
        }
Пример #4
0
        /// <summary>
        /// 读取记录列表。
        /// </summary>
        /// <param name="db">数据库操作对象</param>
        /// <param name="columns">需要返回的列,不提供任何列名时默认将返回所有列</param>
        public IList <PayAliResultEntity> GetPayAliResultAll()
        {
            string sql = @"SELECT    [Id],[buyeremail],[buyerid],[issuccess],[notifytime],[notifytype],[outtradeno],[paymenttype],[selleremail],[sellerid],[subject],[totalfee],[tradeno],[tradestatus],[CreateTime],[HasDeal] from dbo.[PayAliResult] WITH(NOLOCK)	";
            IList <PayAliResultEntity> entityList = new List <PayAliResultEntity>();
            DbCommand cmd = db.GetSqlStringCommand(sql);

            using (IDataReader reader = db.ExecuteReader(cmd))
            {
                while (reader.Read())
                {
                    PayAliResultEntity entity = new PayAliResultEntity();
                    entity.Id          = StringUtils.GetDbInt(reader["Id"]);
                    entity.Buyeremail  = StringUtils.GetDbString(reader["Buyeremail"]);
                    entity.Buyerid     = StringUtils.GetDbString(reader["Buyerid"]);
                    entity.Issuccess   = StringUtils.GetDbString(reader["Issuccess"]);
                    entity.Notifytime  = StringUtils.GetDbString(reader["Notifytime"]);
                    entity.Notifytype  = StringUtils.GetDbString(reader["Notifytype"]);
                    entity.Outtradeno  = StringUtils.GetDbString(reader["Outtradeno"]);
                    entity.Paymenttype = StringUtils.GetDbString(reader["Paymenttype"]);
                    entity.Selleremail = StringUtils.GetDbString(reader["Selleremail"]);
                    entity.Sellerid    = StringUtils.GetDbString(reader["Sellerid"]);
                    entity.Subject     = StringUtils.GetDbString(reader["Subject"]);
                    entity.Totalfee    = StringUtils.GetDbString(reader["Totalfee"]);
                    entity.Tradeno     = StringUtils.GetDbString(reader["Tradeno"]);
                    entity.Tradestatus = StringUtils.GetDbString(reader["Tradestatus"]);
                    entity.CreateTime  = StringUtils.GetDbDateTime(reader["CreateTime"]);
                    entity.HasDeal     = StringUtils.GetDbInt(reader["HasDeal"]);
                    entityList.Add(entity);
                }
            }
            return(entityList);
        }
Пример #5
0
        /// <summary>
        /// 根据主键值读取记录。如果数据库不存在这条数据将返回null
        /// </summary>
        /// <param name="db">数据库操作对象</param>
        /// <param name="columns">需要返回的列,不提供任何列名时默认将返回所有列</param>
        public PayAliResultEntity GetPayAliResult(int id)
        {
            string    sql = @"SELECT  [Id],[buyeremail],[buyerid],[issuccess],[notifytime],[notifytype],[outtradeno],[paymenttype],[selleremail],[sellerid],[subject],[totalfee],[tradeno],[tradestatus],[CreateTime],[HasDeal]
							FROM
							dbo.[PayAliResult] WITH(NOLOCK)	
							WHERE [Id]=@id"                            ;
            DbCommand cmd = db.GetSqlStringCommand(sql);

            db.AddInParameter(cmd, "@Id", DbType.Int32, id);
            PayAliResultEntity entity = new PayAliResultEntity();

            using (IDataReader reader = db.ExecuteReader(cmd))
            {
                if (reader.Read())
                {
                    entity.Id          = StringUtils.GetDbInt(reader["Id"]);
                    entity.Buyeremail  = StringUtils.GetDbString(reader["Buyeremail"]);
                    entity.Buyerid     = StringUtils.GetDbString(reader["Buyerid"]);
                    entity.Issuccess   = StringUtils.GetDbString(reader["Issuccess"]);
                    entity.Notifytime  = StringUtils.GetDbString(reader["Notifytime"]);
                    entity.Notifytype  = StringUtils.GetDbString(reader["Notifytype"]);
                    entity.Outtradeno  = StringUtils.GetDbString(reader["Outtradeno"]);
                    entity.Paymenttype = StringUtils.GetDbString(reader["Paymenttype"]);
                    entity.Selleremail = StringUtils.GetDbString(reader["Selleremail"]);
                    entity.Sellerid    = StringUtils.GetDbString(reader["Sellerid"]);
                    entity.Subject     = StringUtils.GetDbString(reader["Subject"]);
                    entity.Totalfee    = StringUtils.GetDbString(reader["Totalfee"]);
                    entity.Tradeno     = StringUtils.GetDbString(reader["Tradeno"]);
                    entity.Tradestatus = StringUtils.GetDbString(reader["Tradestatus"]);
                    entity.CreateTime  = StringUtils.GetDbDateTime(reader["CreateTime"]);
                    entity.HasDeal     = StringUtils.GetDbInt(reader["HasDeal"]);
                }
            }
            return(entity);
        }
Пример #6
0
        /// <summary>
        /// 读取记录列表。
        /// </summary>
        /// <param name="db">数据库操作对象</param>
        /// <param name="columns">需要返回的列,不提供任何列名时默认将返回所有列</param>
        public IList <PayAliResultEntity> GetPayAliResultList(int pagesize, int pageindex, ref int recordCount)
        {
            string sql = @"SELECT   [Id],[buyeremail],[buyerid],[issuccess],[notifytime],[notifytype],[outtradeno],[paymenttype],[selleremail],[sellerid],[subject],[totalfee],[tradeno],[tradestatus],[CreateTime],[HasDeal]
						FROM
						(SELECT ROW_NUMBER() OVER (ORDER BY Id desc) AS ROWNUMBER,
						 [Id],[buyeremail],[buyerid],[issuccess],[notifytime],[notifytype],[outtradeno],[paymenttype],[selleremail],[sellerid],[subject],[totalfee],[tradeno],[tradestatus],[CreateTime],[HasDeal] from dbo.[PayAliResult] WITH(NOLOCK)	
						WHERE  1=1 ) as temp 
						where rownumber BETWEEN ((@PageIndex - 1) * @PageSize + 1) AND @PageIndex * @PageSize"                        ;

            string sql2 = @"Select count(1) from dbo.[PayAliResult] with (nolock) ";
            IList <PayAliResultEntity> entityList = new List <PayAliResultEntity>();
            DbCommand cmd = db.GetSqlStringCommand(sql);

            db.AddInParameter(cmd, "@PageIndex", DbType.Int32, pageindex);
            db.AddInParameter(cmd, "@PageSize", DbType.Int32, pagesize);

            using (IDataReader reader = db.ExecuteReader(cmd))
            {
                while (reader.Read())
                {
                    PayAliResultEntity entity = new PayAliResultEntity();
                    entity.Id          = StringUtils.GetDbInt(reader["Id"]);
                    entity.Buyeremail  = StringUtils.GetDbString(reader["Buyeremail"]);
                    entity.Buyerid     = StringUtils.GetDbString(reader["Buyerid"]);
                    entity.Issuccess   = StringUtils.GetDbString(reader["Issuccess"]);
                    entity.Notifytime  = StringUtils.GetDbString(reader["Notifytime"]);
                    entity.Notifytype  = StringUtils.GetDbString(reader["Notifytype"]);
                    entity.Outtradeno  = StringUtils.GetDbString(reader["Outtradeno"]);
                    entity.Paymenttype = StringUtils.GetDbString(reader["Paymenttype"]);
                    entity.Selleremail = StringUtils.GetDbString(reader["Selleremail"]);
                    entity.Sellerid    = StringUtils.GetDbString(reader["Sellerid"]);
                    entity.Subject     = StringUtils.GetDbString(reader["Subject"]);
                    entity.Totalfee    = StringUtils.GetDbString(reader["Totalfee"]);
                    entity.Tradeno     = StringUtils.GetDbString(reader["Tradeno"]);
                    entity.Tradestatus = StringUtils.GetDbString(reader["Tradestatus"]);
                    entity.CreateTime  = StringUtils.GetDbDateTime(reader["CreateTime"]);
                    entity.HasDeal     = StringUtils.GetDbInt(reader["HasDeal"]);
                    entityList.Add(entity);
                }
            }
            cmd = db.GetSqlStringCommand(sql2);
            using (IDataReader reader = db.ExecuteReader(cmd))
            {
                if (reader.Read())
                {
                    recordCount = StringUtils.GetDbInt(reader[0]);
                }
                else
                {
                    recordCount = 0;
                }
            }
            return(entityList);
        }
Пример #7
0
        /// <summary>
        /// 阿里支付通知
        /// </summary>
        public void PayAliPayNotify()
        {
            SortedDictionary <string, string> sPara = GetRequestPost();

            LogUtil.Log("订单付款回调接口,订单号:", "");

            if (sPara.Count > 0)//判断是否有带返回参数
            {
                alipayNotify aliNotify    = new alipayNotify();
                bool         verifyResult = aliNotify.Verify(sPara, Request.Form["notify_id"], Request.Form["sign"]); //验证消息是否是支付宝发出的合法消息

                if (verifyResult)                                                                                     //验证成功
                {
                    LogUtil.Log("订单付款回调成功:", "");
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    //请在这里加上商户的业务逻辑程序代码


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

                    //商户订单号

                    string out_trade_no = Request.Form["out_trade_no"];
                    //支付宝交易号
                    string trade_no = Request.Form["trade_no"];
                    LogUtil.Log("订单付款回调成功:", out_trade_no);
                    LogUtil.Log("订单付款回调成功:", trade_no);
                    //交易状态
                    //&trade_no = 2016101021001004470296721955
                    string             trade_status = Request.Form["trade_status"]; //
                    string             buyer_email  = Request.Form["buyer_email"];  //lgzh306%40126.com
                    string             buyer_id     = Request.Form["buyer_id"];     //2088602184028472
                    string             exterface    = Request.Form["exterface"];    //create_direct_pay_by_user
                    string             is_success   = Request.Form["is_success"];   //T
                    string             notify_id    = Request.Form["notify_id"];    //RqPnCoPT3K9%252Fvwbh3InWeOSzrvky7IAV3JJOfdsL5TFWKbTMC8BGq%252Bm99WAaYWgnOmS6
                    string             notify_time  = Request.Form["notify_time"];  //2016-10-10+15%3A48%3A34
                    string             notify_type  = Request.Form["notify_type"];  //trade_status_sync
                    string             payment_type = Request.Form["payment_type"]; //1
                    string             seller_email = Request.Form["seller_email"]; //20718505%40qq.com
                    string             seller_id    = Request.Form["seller_id"];    //2088421564177650
                    string             subject      = Request.Form["subject"];      //111
                    string             total_fee    = Request.Form["total_fee"];    //0.01
                    PayAliResultEntity _entity      = new PayAliResultEntity();
                    _entity.Buyeremail  = buyer_email;
                    _entity.Buyerid     = buyer_id;
                    _entity.CreateTime  = DateTime.Now;
                    _entity.HasDeal     = 0;
                    _entity.Issuccess   = is_success;
                    _entity.Notifytime  = notify_time;
                    _entity.Notifytype  = notify_type;
                    _entity.Outtradeno  = out_trade_no;
                    _entity.Paymenttype = payment_type;
                    _entity.Selleremail = seller_email;
                    _entity.Sellerid    = seller_id;
                    _entity.Subject     = subject;
                    _entity.Totalfee    = total_fee;
                    _entity.Tradeno     = trade_no;
                    _entity.Tradestatus = trade_status;
                    LogUtil.Log("订单付款回调成功:", JsonJC.ObjectToJson(_entity));

                    PayAliResultBLL.Instance.AddPayAliResult(_entity);

                    //http://pay.ddbbqp.com/return_url.aspx?buyer_email=lgzh306%40126.com&buyer_id=2088602184028472&exterface=create_direct_pay_by_user&is_success=T&notify_id=RqPnCoPT3K9%252Fvwbh3InWeOSzrvky7IAV3JJOfdsL5TFWKbTMC8BGq%252Bm99WAaYWgnOmS6&notify_time=2016-10-10+15%3A48%3A34&notify_type=trade_status_sync&out_trade_no=test20161010092017&payment_type=1&seller_email=20718505%40qq.com&seller_id=2088421564177650&subject=111&total_fee=0.01&trade_no=2016101021001004470296721955&trade_status=TRADE_SUCCESS&sign=4d4f0c35e95f4dce7c34c1ff70e321fd&sign_type=MD5

                    LogUtil.Log("订单付款回调成功:", "222222");
                    if (Request.Form["trade_status"] == "TRADE_FINISHED" || Request.Form["trade_status"] == "TRADE_SUCCESS")
                    {
                        LogUtil.Log("订单付款回调成功:", "33333333333");
                        //判断该笔订单是否在商户网站中已经做过处理
                        VWOrderEntity _order = OrderBLL.Instance.GetVWOrderByCode(StringUtils.GetDbLong(out_trade_no));
                        if (_order.Status == (int)OrderStatus.WaitPay)
                        {
                            LogUtil.Log("订单付款回调成功:", "44444444");
                            AssetReChargeEntity _asset = new AssetReChargeEntity();
                            _asset.Amt           = StringUtils.GetDbDecimal(_entity.Totalfee);
                            _asset.BankCode      = buyer_id;
                            _asset.CardNo        = buyer_email;
                            _asset.TranSerialNum = trade_no;
                            _asset.CreateTime    = DateTime.Now;
                            _asset.MemId         = _order.MemId;
                            _asset.IpAddress     = IPAddress.IP;
                            _asset.PayType       = 1;

                            LogUtil.Log("订单付款回调成功:", "555555");
                            if (OrderBLL.Instance.PayFinished(StringUtils.GetDbLong(out_trade_no), _asset) > 0)
                            {
                                EmailSendBLL.Instance.OrderRemind(out_trade_no);
                                LogUtil.Log("订单付款成功,订单号:", out_trade_no.ToString());
                            }
                            else
                            {
                                LogUtil.Log("订单付款成功更新失败,订单号:", out_trade_no.ToString());
                            }
                        }
                        //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
                        //如果有做过处理,不执行商户的业务程序
                    }
                    else
                    {
                        LogUtil.Log("订单付款成功更新失败,订单号:", out_trade_no.ToString() + " 订单状态:" + Request.QueryString["trade_status"]);
                    }
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////
                }
                else
                {
                    LogUtil.Log("订单付款支付验证失败", "111");
                }
            }
        }
Пример #8
0
        /// <summary>
        /// 阿里支付结果
        /// </summary>
        /// <returns></returns>
        public ActionResult PayAliPayResult()
        {
            SortedDictionary <string, string> sPara = GetRequestGet();

            if (sPara.Count > 0)//判断是否有带返回参数
            {
                alipayNotify aliNotify    = new alipayNotify();
                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"]; //
                    string buyer_email  = Request.QueryString["buyer_email"];  //lgzh306%40126.com
                    string buyer_id     = Request.QueryString["buyer_id"];     //2088602184028472
                    string exterface    = Request.QueryString["exterface"];    //create_direct_pay_by_user
                    string is_success   = Request.QueryString["is_success"];   //T
                    string notify_id    = Request.QueryString["notify_id"];    //RqPnCoPT3K9%252Fvwbh3InWeOSzrvky7IAV3JJOfdsL5TFWKbTMC8BGq%252Bm99WAaYWgnOmS6
                    string notify_time  = Request.QueryString["notify_time"];  //2016-10-10+15%3A48%3A34
                    string notify_type  = Request.QueryString["notify_type"];  //trade_status_sync
                    string payment_type = Request.QueryString["payment_type"]; //1
                    string seller_email = Request.QueryString["seller_email"]; //20718505%40qq.com
                    string seller_id    = Request.QueryString["seller_id"];    //2088421564177650
                    string subject      = Request.QueryString["subject"];      //111
                    string total_fee    = Request.QueryString["total_fee"];    //0.01

                    //http://pay.ddbbqp.com/return_url.aspx?buyer_email=lgzh306%40126.com&buyer_id=2088602184028472&exterface=create_direct_pay_by_user&is_success=T&notify_id=RqPnCoPT3K9%252Fvwbh3InWeOSzrvky7IAV3JJOfdsL5TFWKbTMC8BGq%252Bm99WAaYWgnOmS6&notify_time=2016-10-10+15%3A48%3A34&notify_type=trade_status_sync&out_trade_no=test20161010092017&payment_type=1&seller_email=20718505%40qq.com&seller_id=2088421564177650&subject=111&total_fee=0.01&trade_no=2016101021001004470296721955&trade_status=TRADE_SUCCESS&sign=4d4f0c35e95f4dce7c34c1ff70e321fd&sign_type=MD5

                    if (Request.QueryString["trade_status"] == "TRADE_FINISHED" || Request.QueryString["trade_status"] == "TRADE_SUCCESS")
                    {
                        //判断该笔订单是否在商户网站中已经做过处理
                        VWPayOrderEntity payentity = PayOrderBLL.Instance.GetVWPayOrderByPayCode(out_trade_no);
                        if (payentity.Id > 0 && payentity.Status == 0)//未支付完成
                        {
                            PayAliResultEntity _entity = new PayAliResultEntity();
                            _entity.Buyeremail  = buyer_email;
                            _entity.Buyerid     = buyer_id;
                            _entity.CreateTime  = DateTime.Now;
                            _entity.HasDeal     = 0;
                            _entity.Issuccess   = is_success;
                            _entity.Notifytime  = notify_time;
                            _entity.Notifytype  = notify_type;
                            _entity.Outtradeno  = out_trade_no;
                            _entity.Paymenttype = payment_type;
                            _entity.Selleremail = seller_email;
                            _entity.Sellerid    = seller_id;
                            _entity.Subject     = subject;
                            _entity.Totalfee    = total_fee;
                            _entity.Tradeno     = trade_no;
                            _entity.Tradestatus = trade_status;

                            LogUtil.Log("订单付款回调成功:", JsonJC.ObjectToJson(_entity));
                            PayAliResultBLL.Instance.AddPayAliResult(_entity);

                            payentity.PayTime      = DateTime.Now;
                            payentity.PayPrice     = StringUtils.GetDbDecimal(total_fee);
                            payentity.ExternalCode = trade_no;
                            payentity.Status       = 1;
                            //先更新业务网站收款记录
                            int result = PayOrderBLL.Instance.RecivedPaySuccess(payentity);
                            if (payentity.SysType == (int)SystemType.B2B || payentity.SysType == (int)SystemType.B2BMobile)
                            {
                                VWOrderEntity _order = OrderBLL.Instance.GetVWOrderByCode(StringUtils.GetDbLong(payentity.SysOrderCode));
                                if (_order.Status == (int)OrderStatus.WaitPay)
                                {
                                    if (OrderBLL.Instance.PayFinishedForOrder(StringUtils.GetDbLong(payentity.SysOrderCode), payentity.PayPrice) > 0)
                                    {
                                        ///业务网站状态更新后更新支付总表
                                        EmailSendBLL.Instance.OrderRemind(out_trade_no);
                                        LogUtil.Log("订单付款成功,订单号:", out_trade_no.ToString());
                                    }
                                }
                            }
                            return(Redirect("/Pay/PaySuccess"));
                        }
                        else if (payentity.Id > 0 && payentity.Status == 1)
                        {
                            return(Redirect("/Pay/PaySuccess"));
                        }
                        else
                        {
                            return(Redirect("/Pay/PayError"));
                        }
                        //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
                        //如果有做过处理,不执行商户的业务程序
                    }
                    else
                    {
                        Response.Write("trade_status=" + Request.QueryString["trade_status"]);
                    }


                    Response.Write("支付成功<br />");
                    return(Redirect("/Pay/PayError"));

                    //打印页面

                    //——请根据您的业务逻辑来编写程序(以上代码仅作参考)——

                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////
                }
                else//验证失败
                {
                    //string out_trade_no = Request.QueryString["out_trade_no"];
                    //VWOrderEntity _order = OrderBLL.Instance.GetVWOrderByCode(StringUtils.GetDbLong(out_trade_no));
                    //if (_order.Status == (int)OrderStatus.WaitDeal|| _order.Status == (int)OrderStatus.WaitDeliver)
                    //{
                    //    return Redirect("/Pay/PaySuccess");
                    //}
                    Response.Write("支付验证失败");
                }
            }
            else
            {
                Response.Write("无返回参数");
            }
            return(View());
        }
Пример #9
0
 /// <summary>
 /// 更新一条PayAliResult记录。
 /// 该方法提供给界面等UI层调用
 /// </summary>
 /// <param name="payAliResult">待更新的实体对象</param>
 /// <param name="columns">要更新的列名,不提供任何列名时默认将更新主键之外的所有列</param>
 public int UpdatePayAliResult(PayAliResultEntity payAliResult)
 {
     return(PayAliResultDA.Instance.UpdatePayAliResult(payAliResult));
 }
Пример #10
0
 /// <summary>
 /// 插入一条记录到表PayAliResult,如果表中存在自增字段,则返回值为新记录的自增字段值,否则返回0。
 /// 该方法提供给界面等UI层调用
 /// </summary>
 /// <param name="payAliResult">要添加的PayAliResult数据实体对象</param>
 public int AddPayAliResult(PayAliResultEntity payAliResult)
 {
     return(PayAliResultDA.Instance.AddPayAliResult(payAliResult));
 }
Пример #11
0
 /// <summary>
 /// 判断对象是否存在
 /// </summary>
 /// <param name="dicEnum"></param>
 /// <returns></returns>
 public bool IsExist(PayAliResultEntity payAliResult)
 {
     return(PayAliResultDA.Instance.ExistNum(payAliResult) > 0);
 }