public WlDealResponseBody SelectonegetWlProDealData(string wlDealId, int comid)
 {
     using (var helper = new SqlHelper())
     {
         WlDealResponseBody r = new InternalWlGetProInfoDealRequest(helper).SelectonegetWlProDeal(wlDealId, comid);
         return(r);
     }
 }
 public wl_order_model getWlOrderidData(string wlorderId)
 {
     using (var helper = new SqlHelper())
     {
         wl_order_model r = new InternalWlGetProInfoDealRequest(helper).getWlOrderidData(wlorderId);
         return(r);
     }
 }
 public List <wl_use_log_model> InterfaceUsePageList(int comid, int pageindex, int pagesize, out int totalcount, string key, string startime, string endtime)
 {
     using (var helper = new SqlHelper())
     {
         List <wl_use_log_model> r = new InternalWlGetProInfoDealRequest(helper).InterfaceUsePageList(comid, pageindex, pagesize, out totalcount, key, startime, endtime);
         return(r);
     }
 }
 public List <WlDealResponseBody> SelectallgetWlProDealData(string proID, int comid, out int totalcount)
 {
     using (var helper = new SqlHelper())
     {
         List <WlDealResponseBody> r = new InternalWlGetProInfoDealRequest(helper).SelectallgetWlProDeal(proID, comid, out totalcount);
         return(r);
     }
 }
 public int InsertWlUseLog(int comid, string wlorderid, int usedQuantity = 0, int partnerId = 0, int quantity = 0, int orderid = 0, int proid = 0)
 {
     using (var helper = new SqlHelper())
     {
         var r = new InternalWlGetProInfoDealRequest(helper).InsertWlUseLog(comid, wlorderid, usedQuantity, partnerId, quantity, orderid, proid);
         return(r);
     }
 }
 public int UpdateWlOrderPaySC(wl_order_model m)
 {
     using (var helper = new SqlHelper())
     {
         var r = new InternalWlGetProInfoDealRequest(helper).UpdateWlOrderPaySC(m);
         return(r);
     }
 }
 public wl_order_model SearchWlOrderData(int comid, int id, string wlorderid, int orderid)
 {
     using (var helper = new SqlHelper())
     {
         var r = new InternalWlGetProInfoDealRequest(helper).SearchWlOrder(comid, id, wlorderid, orderid);
         return(r);
     }
 }
        public List <WlDealResponseBody> WLProPageList(string comid, int pageindex, int pagesize, int prostate, out int totalcount, string key = "")
        {
            using (var helper = new SqlHelper())
            {
                var list = new InternalWlGetProInfoDealRequest(helper).WLProPageList(comid, pageindex, pagesize, prostate, out totalcount, key);

                return(list);
            }
        }
        public ReturnResult wlOrderRefundRequest_data(wlOrderRefundRequest requestData, int comid, int orderStatus)
        {
            string url = wl_url + "wl.trip.order.refund";

            #region  记入日志表
            string    reqip = CommonFunc.GetRealIP();
            WL_reqlog mlog  = new WL_reqlog
            {
                id                  = 0,
                reqstr              = JsonConvert.SerializeObject(requestData),
                subtime             = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                respstr             = "",
                resptime            = "",
                code                = "",
                describe            = "",
                req_type            = "",
                orderid             = requestData.body.partnerOrderId,
                sendip              = reqip,
                stockagentcompanyid = comid
            };
            int logid = new WL_reqlogData().EditReqlog(mlog);
            mlog.id = logid;
            #endregion

            ReturnResult result = new ReturnResult
            {
                IsSuccess = false,
            };
            try
            {
                var responseStr = DoRequest(url, JsonConvert.SerializeObject(requestData));
                if (string.IsNullOrEmpty(responseStr))
                {
                    result.Message = "返回数据为空";
                }
                else
                {
                    mlog.req_type = "wl.trip.order.refund";
                    mlog.respstr  = responseStr;
                    mlog.resptime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    new WL_reqlogData().EditReqlog(mlog);

                    wlOrderRefundResponse wlOrderRefundResponse = (wlOrderRefundResponse)JsonConvert.DeserializeObject(responseStr, typeof(wlOrderRefundResponse));
                    if (wlOrderRefundResponse.code == 200)
                    {
                        result.IsSuccess = true;
                        result.Message   = "退款返回";

                        //完成支付
                        using (var sql = new SqlHelper())
                        {
                            try
                            {
                                var internalData = new InternalWlGetProInfoDealRequest(sql);
                                int wl_id        = internalData.UpdateWlOrderBack(wlOrderRefundResponse, orderStatus, requestData);//一次性插入万龙id
                            }
                            catch
                            {
                                throw;
                            }
                        }
                    }
                    else
                    {
                        result.IsSuccess = false;
                        result.Message   = wlOrderRefundResponse.describe;
                    }

                    //记录在日志表
                    mlog.code      = wlOrderRefundResponse.code.ToString();
                    mlog.describe  = wlOrderRefundResponse.describe;
                    mlog.mtorderid = wlOrderRefundResponse.body.wlOrderId;
                }
            }
            catch (Exception ex)
            {
                result.Message = "异常" + ex.Message;
            }

            #region  记录在日志表
            //mlog.req_type = "wl.trip.order.get";
            //mlog.respstr = result.Message;
            //mlog.resptime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            new WL_reqlogData().EditReqlog(mlog);
            #endregion

            return(result);
        }
        public ReturnResult ProductChangedNotify(WlGetProInfoDealRequest requestData, int comid)
        {
            string url = wl_url + "wl.trip.order.get";

            #region  记入日志表
            string    reqip = CommonFunc.GetRealIP();
            WL_reqlog mlog  = new WL_reqlog
            {
                id                  = 0,
                reqstr              = JsonConvert.SerializeObject(requestData),
                subtime             = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                respstr             = "",
                resptime            = "",
                code                = "",
                describe            = "",
                req_type            = "",
                sendip              = reqip,
                orderid             = "0",
                stockagentcompanyid = comid
            };
            int logid = new WL_reqlogData().EditReqlog(mlog);
            mlog.id = logid;
            #endregion

            ReturnResult result = new ReturnResult
            {
                IsSuccess = false,
            };
            try
            {
                var responseStr = DoRequest(url, JsonConvert.SerializeObject(requestData));
                if (string.IsNullOrEmpty(responseStr))
                {
                    result.Message = "返回数据为空";
                }
                else
                {
                    mlog.req_type = "wl.trip.order.get";
                    mlog.respstr  = responseStr;
                    mlog.resptime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    new WL_reqlogData().EditReqlog(mlog);



                    WlDealResponse responseBody = (WlDealResponse)JsonConvert.DeserializeObject(responseStr, typeof(WlDealResponse));
                    if (responseBody.code == 200)
                    {
                        result.IsSuccess = true;
                        result.Message   = JsonConvert.SerializeObject(responseBody);

                        //写入产品数据
                        using (var sql = new SqlHelper())
                        {
                            try
                            {
                                var internalData = new InternalWlGetProInfoDealRequest(sql);

                                //更新返回后先对所有产品线进行下线,对上线的产品进行标注
                                var closewlpro = internalData.UPCloseWlProDeal(comid);

                                ////循环对所有下载的数据依次插入
                                for (int i = 0; i < responseBody.body.Count; i++)
                                {
                                    responseBody.body[i].id    = 0;     //临时都做为新的记录进行插入
                                    responseBody.body[i].comid = comid; //商户id
                                    responseBody.body[i].state = 1;     //商户id
                                    //对已拉取过的产品进行更新而不是插入
                                    var pro_temp = internalData.SelectproidgetWlProDeal(responseBody.body[i].proID, responseBody.body[i].comid);
                                    if (pro_temp != null)
                                    {
                                        responseBody.body[i].id = pro_temp.id;
                                    }


                                    int wlpro_id = internalData.InsertorUpdateWlProDeal(responseBody.body[i]);//插入只插入主要数据,后期更新
                                }
                            }
                            catch
                            {
                                throw;
                            }
                        }
                    }
                    else
                    {
                        result.IsSuccess = false;
                        result.Message   = responseBody.describe;
                    }

                    //记录在日志表
                    mlog.code     = responseBody.code.ToString();
                    mlog.describe = responseBody.describe;
                }
            }
            catch (Exception ex)
            {
                result.Message = "异常" + ex.Message;
            }

            #region  记录在日志表
            //mlog.req_type = "wl.trip.order.get";
            //mlog.respstr = result.Message;
            //mlog.resptime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            new WL_reqlogData().EditReqlog(mlog);
            #endregion

            return(result);
        }