Exemple #1
0
        /// <summary>
        /// 获取客户信息
        /// </summary>
        /// <returns></returns>
        public string GetCustomerList()
        {
            RequestCustomerBasicrInfo basicInfo = new RequestCustomerBasicrInfo();
            ResponseData res = new ResponseData();

            basicInfo.loadInfo = GetCustomerLoadInfo();
            try
            {
                //客户信息
                var     customerBasicSettingBLL = new CustomerBasicSettingBLL(this.CurrentUserInfo);
                DataSet ds = customerBasicSettingBLL.GetCustomerBasicSettingByKey(this.CurrentUserInfo.ClientID);
                List <CustomerBasicCodeInfo> list = new List <CustomerBasicCodeInfo>();
                if (ds != null && ds.Tables.Count > 0 && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow item in ds.Tables[0].Rows)
                    {
                        CustomerBasicCodeInfo codeinfo = new CustomerBasicCodeInfo();

                        codeinfo.SettingCode  = item["SettingCode"].ToString();
                        codeinfo.SettingValue = item["SettingValue"].ToString();
                        list.Add(codeinfo);
                    }
                }
                #region 获取配送策略
                var deliveryStrategyBll = new CustomerDeliveryStrategyBLL(this.CurrentUserInfo);
                //查询是否已设置
                var deliverStrategayList = deliveryStrategyBll.Query(new IWhereCondition[] {
                    new EqualsCondition()
                    {
                        FieldName = "CustomerID", Value = this.CurrentUserInfo.ClientID
                    }
                }, null);

                if (deliverStrategayList.Count() > 0)//已设置执行修改
                {
                    CustomerBasicCodeInfo codeinfo = new CustomerBasicCodeInfo()
                    {
                        SettingCode  = "AmountEnd", //满多少免配送费
                        SettingValue = deliverStrategayList[0].AmountEnd.ToString()
                    };
                    CustomerBasicCodeInfo codeinfo1 = new CustomerBasicCodeInfo()
                    {
                        SettingCode  = "DeliveryAmount", //配送费
                        SettingValue = deliverStrategayList[0].DeliveryAmount.ToString()
                    };
                    list.Add(codeinfo);
                    list.Add(codeinfo1);
                }
                #endregion
                basicInfo.requset = list;
                res.success       = true;
                basicInfo.resdata = res;
                return(string.Format("{{\"data\":{0}}}", basicInfo.ToJSON()));
            }
            catch (Exception)
            {
                //basicInfo.resdata.msg = "加载失败";
                //basicInfo.resdata.success = false;

                throw;
            }



            return("");
        }