Пример #1
0
        /// 功能描述    :  添加[tblOrdertable]表的记录
        /// 创建者      :  zhowuq
        /// 创建日期    :  2019-03-22
        /// 修改者      :
        /// 修改日期    :
        /// 修改原因    :
        /// </summary>
        /// <param name="objInsert">需要添加的实体类</param>
        /// <returns>返回新增记录的PK主键的值</returns>
        public int Insert(tblOrdertable objInsert)
        {
            try
            {
                usp_tblOrdertable_Insert uspInsert = new usp_tblOrdertable_Insert();
                uspInsert.ReceiveParameter(objInsert);
                uspInsert.ExecNoQuery();

                if (uspInsert.fldAutoID > 0)
                {
                    return(uspInsert.fldAutoID);
                }
                else
                {
                    throw new Exception("插入新记录失败");
                }
            }
            catch (DBOpenException e)
            {
                throw new InsertException("打开数据库连接失败", "RuletblEQI_Query_Group", "Insert", objInsert.ToString());
            }
            catch (DBPKException e)
            {
                throw new InsertPKException("相同的记录已经存在,违反表的唯一键约束", "RuletblOrdertable", "Insert", objInsert.ToString());
            }
            catch (DBQueryException e)
            {
                throw new InsertException("执行Sql语句失败", "RuletblEQI_Query_Group", "Insert", objInsert.ToString());
            }
            catch (Exception e)
            {
                throw new InsertException(e.Message, "RuletblEQI_Query_Group", "Insert", objInsert.ToString());
            }
        }
Пример #2
0
        public HttpResponseMessage SGState(tblOrdertable ordertables)
        {
            string result = string.Empty;
            string orid   = "";

            try
            {
                RuleOldOrdertable ruleOldOrdertable = new RuleOldOrdertable();
                bool      IsSuccess = false;
                DataTable dataTable = ruleOldOrdertable.updatestate(ordertables.fldMerchID, ordertables.fldChannelnum, "支付成功", out IsSuccess, ordertables.fldOrderAmount);
                if (IsSuccess)
                {
                    //获得商户的Key
                    RuleCommon rule     = new RuleCommon();
                    DataTable  Merchant = rule.getdt("select *  from tbleMerchant where fldMerchID='" + ordertables.fldMerchID + "'");

                    //获得异步通知地址
                    AsynParameterPay asynParameter = new AsynParameterPay();
                    asynParameter.Amount      = ordertables.fldOrderAmount.ToString();
                    asynParameter.MerchantId  = ordertables.fldMerchID;
                    asynParameter.OrderID     = ordertables.fldOrdernum;
                    asynParameter.OrderTime   = ordertables.fldchangstautetime.ToString();
                    asynParameter.Paystate    = "支付成功";
                    asynParameter.Paytype     = ordertables.fldRateName.ToString();
                    asynParameter.ProductName = ordertables.fldOrederdetailed.ToString();

                    string getpram = JsonHelper.SerializeObject(asynParameter);
                    //json 转换成Dictionary
                    Dictionary <string, string> valuePairs = JsonHelper.DeserializeStringToDictionary <string, string>(getpram);
                    //排序
                    RulePayBehavior behavior = new RulePayBehavior();
                    string          pxrams   = behavior.AsciiDesc(valuePairs);
                    //添加key值
                    pxrams += "key=" + Merchant.Rows[0]["fldSecretKey"].ToString();
                    //md5加密
                    string signkey = behavior.EncryptionMd5(pxrams);

                    asynParameter.Sign = signkey;

                    //转换成json 格式
                    string prams = JsonHelper.SerializeObject(asynParameter);

                    //请求  通知
                    RulePayRequest rulePayRequest = new RulePayRequest();
                    string         rest           = rulePayRequest.PostUrl(ordertables.fldNotice.ToString(), prams);
                    result = rule.JsonStr("ok", "成功", "");
                }
            }
            catch (Exception e)
            {
                //错误保存日志
                throw new InsertException(e.Message, " Ordertable", "Reissuenotice", "补发通知失败,失败订单号:" + orid);
            }
            return(new HttpResponseMessage {
                Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json")
            });
        }