/// <summary>
        /// 查询
        /// </summary>
        public string GetCustomerPayAssignListData()
        {
            var form = Request("form").DeserializeJSONTo <VipQueryEntity>();

            var    service = new CustomerPayAssignBLL(CurrentUserInfo);
            string content = string.Empty;

            CustomerPayAssignEntity queryEntity = new CustomerPayAssignEntity();

            queryEntity.CustomerId            = CurrentUserInfo.CurrentUser.customer_id;
            queryEntity.PaymentTypeId         = FormatParamValue(form.PaymentTypeId);
            queryEntity.CustomerAccountNumber = FormatParamValue(form.CustomerAccountNumber);
            int pageIndex = Utils.GetIntVal(FormatParamValue(Request("page")));

            var listObj    = service.GetList(queryEntity, pageIndex, PageSize);
            var totalCount = service.GetListCount(queryEntity);

            var jsonData = new JsonData();

            jsonData.totalCount = totalCount.ToString();
            jsonData.data       = listObj;

            content = string.Format("{{\"totalCount\":{1},\"topics\":{0}}}",
                                    jsonData.data.ToJSON(),
                                    jsonData.totalCount);
            return(content);
        }
        /// <summary>
        /// 获取Vip信息
        /// </summary>
        public string GetCustomerPayAssignInfoById()
        {
            var service = new CustomerPayAssignBLL(CurrentUserInfo);
            CustomerPayAssignEntity obj = null;
            string content = string.Empty;

            string key = string.Empty;

            if (Request("AssignId") != null && Request("AssignId") != string.Empty)
            {
                key = Request("AssignId").ToString().Trim();
            }

            CustomerPayAssignEntity queryEntity = new CustomerPayAssignEntity();

            queryEntity.AssignId = key;
            var tmpList = service.GetList(queryEntity, 1, 1);

            if (tmpList != null && tmpList.Count > 0)
            {
                obj = tmpList[0];
            }

            var jsonData = new JsonData();

            jsonData.totalCount = obj == null ? "0" : "1";
            jsonData.data       = obj;

            content = jsonData.ToJSON();
            return(content);
        }
        /// <summary>
        ///
        /// </summary>
        public string SaveCustomerPayAssign()
        {
            var service = new CustomerPayAssignBLL(this.CurrentUserInfo);

            string content      = string.Empty;
            string error        = "";
            var    responseData = new ResponseData();

            string key      = string.Empty;
            string AssignId = string.Empty;
            var    item     = Request("item");

            if (FormatParamValue(item) != null && FormatParamValue(item) != string.Empty)
            {
                key = FormatParamValue(item).ToString().Trim();
            }
            if (FormatParamValue(Request("AssignId")) != null && FormatParamValue(Request("AssignId")) != string.Empty)
            {
                AssignId = FormatParamValue(Request("AssignId")).ToString().Trim();
            }

            var obj = key.DeserializeJSONTo <CustomerPayAssignEntity>();

            if (Convert.ToInt32(obj.CustomerProportion) + Convert.ToInt32(obj.JITProportion) > 100)
            {
                responseData.success = false;
                responseData.msg     = "分成比例合计不能大于100";
                return(responseData.ToJSON());
            }

            if (AssignId == null || AssignId.Trim().Length == 0)
            {
                obj.AssignId       = Utils.NewGuid();
                obj.CustomerId     = CurrentUserInfo.CurrentUser.customer_id;
                obj.CreateBy       = CurrentUserInfo.CurrentUser.User_Id;
                obj.CreateTime     = DateTime.Now;
                obj.LastUpdateBy   = CurrentUserInfo.CurrentUser.User_Id;
                obj.LastUpdateTime = DateTime.Now;
                service.Create(obj);
            }
            else
            {
                obj.AssignId       = AssignId;
                obj.LastUpdateBy   = CurrentUserInfo.CurrentUser.User_Id;
                obj.LastUpdateTime = DateTime.Now;
                service.Update(obj, false);
            }

            responseData.success = true;
            responseData.msg     = error;

            content = responseData.ToJSON();
            return(content);
        }
        /// <summary>
        ///
        /// </summary>
        public string GetData()
        {
            var service = new CustomerPayAssignBLL(new SessionManager().CurrentUserLoginInfo);
            IList <PaymentTypeInfo> list = new List <PaymentTypeInfo>();

            list = service.GetPaymentTypeList();

            string content = string.Empty;

            var jsonData = new JsonData();

            jsonData.totalCount = list.Count.ToString();
            jsonData.data       = list;

            content = jsonData.ToJSON();
            return(content);
        }
Exemplo n.º 5
0
        private void SetPaymentInfo()
        {
            // 创建一个新的 WebClient 实例.
            WebClient myWebClient = new WebClient();

            try
            {
                string strError          = string.Empty;
                string OrderCustomerInfo = Request["order_id"];
                Loggers.Debug(new DebugLogInfo()
                {
                    Message = string.Format("支付跳转--order_id: {0}", OrderCustomerInfo)
                });
                Loggers.Debug(new DebugLogInfo()
                {
                    Message = string.Format("支付跳转--merchant_url: {0}", Request["merchant_url"].ToString())
                });
                if (OrderCustomerInfo == null || OrderCustomerInfo.Trim().Equals(""))
                {
                    strError = "订单标识为空";
                    Loggers.Debug(new DebugLogInfo()
                    {
                        Message = string.Format("支付跳转--单据: {0}", strError)
                    });
                }
                else
                {
                    #region 处理业务
                    var infos = OrderCustomerInfo.Split(',');
                    if (infos.Length != 2)
                    {
                        Loggers.Debug(new DebugLogInfo()
                        {
                            Message = string.Format("支付跳转: {0}", "长度错误")
                        });
                        return;
                    }
                    string customerId         = infos[0].ToString().Trim();
                    string orderCode          = infos[1].ToString().Trim();
                    var    loggingSessionInfo = Default.GetBSLoggingSession(customerId, "1");

                    InoutService service   = new InoutService(loggingSessionInfo);
                    InoutInfo    inoutInfo = new InoutInfo();
                    inoutInfo = service.GetInoutInfoByOrderCode(orderCode);
                    if (inoutInfo == null)
                    {
                        strError = "没有获取合法的订单信息";
                        Loggers.Debug(new DebugLogInfo()
                        {
                            Message = string.Format("支付跳转 {0}", "没有获取合法的订单信息")
                        });
                    }
                    else
                    {
                        #region Jermyn20131011 处理订单支付时订单信息
                        InoutInfo inoutModel = new InoutInfo();
                        string    phone      = string.Empty;
                        string    address    = string.Empty;
                        string    userName   = string.Empty;
                        inoutModel.order_id    = inoutInfo.order_id;
                        inoutModel.modify_time = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                        #region
                        if (Request["phone"] != null)
                        {
                            inoutModel.Field6 = Request["phone"].Trim();
                            Loggers.Debug(new DebugLogInfo()
                            {
                                Message = string.Format("手机号码: {0}", inoutModel.Field6)
                            });
                        }
                        //else {
                        //    Loggers.Debug(new DebugLogInfo()
                        //    {
                        //        Message = string.Format("支付跳转--手机号码 {0}", "为空")
                        //    });
                        //}
                        if (Request["address"] != null)
                        {
                            inoutModel.Field4 = Request["address"].Trim();
                            Loggers.Debug(new DebugLogInfo()
                            {
                                Message = string.Format("地址: {0}", inoutModel.Field4)
                            });
                        }
                        if (Request["userName"] != null)
                        {
                            inoutModel.Field14 = Request["userName"].Trim();
                            Loggers.Debug(new DebugLogInfo()
                            {
                                Message = string.Format("用户名: {0}", inoutModel.Field14)
                            });
                        }
                        #endregion
                        bool bReturn = service.Update(inoutModel, out strError);
                        Loggers.Debug(new DebugLogInfo()
                        {
                            Message = string.Format("更新订单用户信息是否成功: {0}", strError)
                        });
                        #endregion
                        //请求参数:
                        //order_id:  订单号
                        //prod_name:  产品名称
                        //prod_price:  产品价格
                        //merchant_url:  用户付款中途退出或者付款成功后返回URL http://xxxx:9004/OnlineClothing/detail.html?itemId=C5BBD04EEE1643F381A522AD68D58828&back=list&customerId=f6a7da3d28f74f2abedfc3ea0cf65c01
                        //call_back_url:  交易结果返回URL(最终将会以POST方式推送交易结果到该地址)
                        string uriString = ConfigurationManager.AppSettings["PaypalUrl"].Trim();
                        string webUrl    = ConfigurationManager.AppSettings["website_url"];
                        var    postData  = "order_id=" + OrderCustomerInfo
                                           + "&prod_name=" + inoutInfo.InoutDetailList[0].item_name
                                           + "&prod_price=" + Convert.ToString(double.Parse(Convert.ToString(inoutInfo.actual_amount)).ToString("f2"))
                                           + "&merchant_url=" + Request["merchant_url"]
                                           + "&call_back_url=" + webUrl + "OnlineShopping/data/OnlinePayAfter.aspx";
                        CustomerPayAssignBLL    customerPayServer = new CustomerPayAssignBLL(loggingSessionInfo);
                        CustomerPayAssignEntity customerPayInfo   = new CustomerPayAssignEntity();
                        var list = customerPayServer.QueryByEntity(new CustomerPayAssignEntity
                        {
                            CustomerId      = loggingSessionInfo.CurrentUser.customer_id
                            , IsDelete      = 0
                            , PaymentTypeId = "BB04817882B149838B19DE2BDDA5E91B"
                        }, null);
                        if (list != null && list.Length > 0)
                        {
                            customerPayInfo = list[0];
                            if (customerPayInfo != null && customerPayInfo.AssignId != null && !customerPayInfo.AssignId.Equals(""))
                            {
                                string strFLAmount = (double.Parse(Convert.ToString(Convert.ToDecimal(customerPayInfo.CustomerProportion) * Convert.ToDecimal(inoutInfo.actual_amount) / Convert.ToDecimal(100)))).ToString("f2");
                                postData += "&params=" + customerPayInfo.CustomerAccountNumber + "^" + strFLAmount + "^";
                            }
                        }

                        //order_id=1234
                        //&prod_name=test8
                        //&prod_price=0.02
                        //&merchant_url=http://xxxx
                        //&call_back_url=http://180.153.154.21:9004/AlipayWapTrade/PaySuccess.aspx
                        //&[email protected]^0.02^
                        Loggers.Debug(new DebugLogInfo()
                        {
                            Message = string.Format("支付跳转-链接字符串: {0}", postData)
                        });
                        // 注意这种拼字符串的ContentType
                        myWebClient.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
                        // 转化成二进制数组
                        byte[] byteArray = Encoding.UTF8.GetBytes(postData);
                        // 上传数据,并获取返回的二进制数据.
                        byte[] responseArray = myWebClient.UploadData(uriString, "POST", byteArray);
                        var    data          = System.Text.Encoding.UTF8.GetString(responseArray);
                        Response.Write(data);
                        strError = "ok";
                    }
                    #endregion
                }

                Loggers.Debug(new DebugLogInfo()
                {
                    Message = string.Format("支付跳转--完成: {0}", strError)
                });
                //myWebClient.UploadData(Request["merchant_url"].ToString(), "POST",Encoding.ASCII.GetBytes("&strError="+strError+""));
            }
            catch (Exception ex) {
                Loggers.Debug(new DebugLogInfo()
                {
                    Message = string.Format("支付跳转--出错: {0}", ex.ToString())
                });
                // myWebClient.UploadData(Request["merchant_url"].ToString(), "POST", Encoding.ASCII.GetBytes("&strError=" + ex.ToString() + ""));
            }
        }