Exemplo n.º 1
0
        /// <summary>
        /// 获取经销商统计、等级列表
        /// </summary>
        /// <param name="pRequest"></param>
        /// <returns></returns>
        public string GetMultiLevelSalerQuery(string pRequest)
        {
            var RD  = new MultiLevelSalerQueryRD();
            var rsp = new SuccessResponse <IAPIResponseData>(RD);
            var rp  = pRequest.DeserializeJSONTo <APIRequest <MultiLevelSalerQueryRP> >();
            var loggingSessionInfo = Default.GetBSLoggingSession(rp.CustomerID, rp.UserID);
            var RetailTraderBLL    = new RetailTraderBLL(loggingSessionInfo);

            DataSet ds = RetailTraderBLL.GetMultiLevelSalerQuery(rp.UserID);

            if (ds != null)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    RD.RetailerList = new List <Retailer>();

                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        #region 请求参数赋值
                        var Data = new Retailer();
                        if (ds.Tables[0].Rows[i]["RetailTraderID"] != DBNull.Value)
                        {
                            Data.RetailTraderID = ds.Tables[0].Rows[i]["RetailTraderID"].ToString();
                        }
                        if (ds.Tables[0].Rows[i]["HigheRetailTraderID"] != DBNull.Value)
                        {
                            Data.HigheRetailTraderID = ds.Tables[0].Rows[i]["HigheRetailTraderID"].ToString();
                        }
                        if (ds.Tables[0].Rows[i]["RetailTraderName"] != DBNull.Value)
                        {
                            Data.RetailTraderName = ds.Tables[0].Rows[i]["RetailTraderName"].ToString();
                        }
                        if (ds.Tables[0].Rows[i]["Parentname"] != DBNull.Value)
                        {
                            Data.Parentname = ds.Tables[0].Rows[i]["Parentname"].ToString();
                        }
                        if (ds.Tables[0].Rows[i]["Hierarchy"] != DBNull.Value)
                        {
                            Data.Hierarchy = ds.Tables[0].Rows[i]["Hierarchy"].ToString();
                        }
                        if (ds.Tables[0].Rows[i]["CreateTime"] != DBNull.Value)
                        {
                            Data.CreateTime = ds.Tables[0].Rows[i]["CreateTime"].ToString();
                        }
                        if (ds.Tables[0].Rows[i]["Idx"] != DBNull.Value)
                        {
                            Data.Idx = Convert.ToInt32(ds.Tables[0].Rows[i]["Idx"]);
                        }
                        if (ds.Tables[0].Rows[i]["LV"] != DBNull.Value)
                        {
                            Data.LV = Convert.ToInt32(ds.Tables[0].Rows[i]["LV"]);
                        }
                        if (ds.Tables[0].Rows[i]["Tree"] != DBNull.Value)
                        {
                            Data.Tree = Convert.ToInt32(ds.Tables[0].Rows[i]["Tree"]);
                        }
                        if (ds.Tables[0].Rows[i]["processed"] != DBNull.Value)
                        {
                            Data.processed = Convert.ToInt32(ds.Tables[0].Rows[i]["processed"]);
                        }

                        Data.HeadImage = RetailTraderBLL.GetRetailHeadImage(Data.RetailTraderID);

                        RD.RetailerList.Add(Data);
                        #endregion
                    }
                }
                if (ds.Tables[1].Rows.Count > 0)
                {
                    #region 请求参数赋值
                    RD.RetailerCount = new RetailerCountInfo();
                    if (ds.Tables[1].Rows[0]["ToadyAddRetailNum"] != DBNull.Value)
                    {
                        RD.RetailerCount.ToadyAddRetailNum = Convert.ToInt32(ds.Tables[1].Rows[0]["ToadyAddRetailNum"]);
                    }
                    else
                    {
                        RD.RetailerCount.ToadyAddRetailNum = 0;
                    }

                    if (ds.Tables[1].Rows[0]["MonthAddRetailNum"] != DBNull.Value)
                    {
                        RD.RetailerCount.MonthAddRetailNum = Convert.ToInt32(ds.Tables[1].Rows[0]["MonthAddRetailNum"]);
                    }
                    else
                    {
                        RD.RetailerCount.MonthAddRetailNum = 0;
                    }

                    if (ds.Tables[1].Rows[0]["RetailNum"] != DBNull.Value)
                    {
                        RD.RetailerCount.RetailNum = Convert.ToInt32(ds.Tables[1].Rows[0]["RetailNum"]);
                    }
                    else
                    {
                        RD.RetailerCount.RetailNum = 0;
                    }
                    #endregion
                }
            }

            return(rsp.ToJSON());
        }