Ejemplo n.º 1
0
        private SupplierListItem GetSupplierDetail(string userId, int supplierId)
        {
            SupplierListItem data = null;

            int intUserId = 0;

            Member member = GetMember(userId.ToSeesionId());

            if (member != null)
            {
                intUserId = member.UserId;
            }

            AppSupplierInfo info = SupplierHelper.GetAppSupplier(supplierId, intUserId);

            if (info != null)
            {
                data = new SupplierListItem();
                data.CollectCount = info.CollectCount;
                data.IsCollect    = info.IsCollect;
                data.SupplierId   = info.SupplierId;
                data.ShopOwner    = info.ShopOwner;
                data.Image        = Util.AppendImageHost(info.Logo);
                data.Background   = Util.AppendImageHost(info.MobileImage);
                data.SupplierName = info.ShopName;
                if (info.CreateDate.HasValue)
                {
                    data.CreateDate = info.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss");
                }

                if (info.County > 0)
                {
                    data.Location = RegionHelper.GetFullRegion(info.County, ",").Split(',')[0];
                }
            }

            return(data);
        }
Ejemplo n.º 2
0
        public IHttpActionResult GetSupplierList(string userId, string accessToken, int channel, int platform, string ver, int pageIndex, int pageSize, string supplierName)
        {
            Logger.WriterLogger("Supplier.GetSupplierList, Params: " + string.Format("userId={0}&accessToken={1}&channel={2}&platform={3}&ver={4}&pageIndex={5}&pageSize={6}&supplierName={7}", userId, accessToken, channel, platform, ver, pageIndex, pageSize, supplierName), LoggerType.Info);

            // 保存访问信息
            base.SaveVisitInfo(userId, channel, platform, ver);

            // 验证令牌
            int accessTookenCode = VerifyAccessToken(accessToken);

            if (accessTookenCode > 0)
            {
                return(base.JsonFaultResult(new CommonException(accessTookenCode).GetMessage(), "Supplier.GetRecommendSupplier"));
            }

            Member member = GetMember(userId.ToSeesionId());

            int referUserId;

            if (member != null)
            {
                referUserId = member.UserId;
            }

            else
            {
                referUserId = 0;
            }
            List <SupplierListItem> items = new List <SupplierListItem>();


            SupplierQuery query = new SupplierQuery();

            query.UserId       = referUserId;
            query.SupplierName = supplierName;
            query.PageIndex    = pageIndex;
            query.PageSize     = pageSize;
            DbQueryResult dr = SupplierHelper.GetAppSupplier(query);

            DataTable dt = dr.Data as DataTable;

            if (dt != null)
            {
                SupplierListItem item = null;

                foreach (DataRow current in dt.Rows)
                {
                    item = new SupplierListItem();


                    if (current["SupplierId"] != DBNull.Value)
                    {
                        item.SupplierId = (int)current["SupplierId"];
                    }

                    if (current["ShopName"] != DBNull.Value)
                    {
                        item.SupplierName = (string)current["ShopName"];
                    }

                    if (current["ShopOwner"] != DBNull.Value)
                    {
                        item.ShopOwner = (string)current["ShopOwner"];
                    }

                    item.CreateDate = "";
                    if (current["CreateDate"] != DBNull.Value)
                    {
                        item.CreateDate = ((DateTime)current["CreateDate"]).ToString("yyyy-MM-dd HH:mm:ss");
                    }

                    if (current["County"] != DBNull.Value)
                    {
                        int countyId = (int)current["County"];
                        if (countyId > 0)
                        {
                            item.Location = RegionHelper.GetFullRegion(countyId, ",").Split(',')[0];
                        }
                    }

                    if (current["Logo"] != DBNull.Value)
                    {
                        item.Image = Util.AppendImageHost((string)current["Logo"]);
                    }

                    if (current["MobileImage"] != DBNull.Value)
                    {
                        item.Background = Util.AppendImageHost((string)current["MobileImage"]);
                    }


                    if (current["CollectCount"] != DBNull.Value)
                    {
                        item.CollectCount = (int)current["CollectCount"];
                    }

                    if (current["IsCollect"] != DBNull.Value)
                    {
                        item.IsCollect = (int)current["IsCollect"];
                    }

                    items.Add(item);
                }
            }

            ListResult <SupplierListItem> data = new ListResult <SupplierListItem>();

            data.TotalNumOfRecords = dr.TotalRecords;
            data.Results           = items;

            return(base.JsonActionResult(new StandardResult <ListResult <SupplierListItem> >()
            {
                code = 0,
                msg = "商家列表",
                data = data
            }));
        }
Ejemplo n.º 3
0
        private ListResult <SupplierListItem> GetRecommendSupplier(int userid)
        {
            List <SupplierListItem> items = new List <SupplierListItem>();



            DataTable dt = SupplierConfigHelper.GetConfigSupplier(ClientType.App, SupplierCfgType.Recommend, userid);

            if (dt != null)
            {
                SupplierListItem item = null;

                foreach (DataRow current in dt.Rows)
                {
                    item = new SupplierListItem();


                    if (current["SupplierId"] != DBNull.Value)
                    {
                        item.SupplierId = (int)current["SupplierId"];
                    }

                    if (current["ShopName"] != DBNull.Value)
                    {
                        item.SupplierName = (string)current["ShopName"];
                    }

                    if (current["ShopOwner"] != DBNull.Value)
                    {
                        item.ShopOwner = (string)current["ShopOwner"];
                    }

                    item.CreateDate = "";
                    if (current["CreateDate"] != DBNull.Value)
                    {
                        item.CreateDate = ((DateTime)current["CreateDate"]).ToString("yyyy-MM-dd HH:mm:ss");
                    }

                    if (current["County"] != DBNull.Value)
                    {
                        int countyId = (int)current["County"];
                        if (countyId > 0)
                        {
                            item.Location = RegionHelper.GetFullRegion(countyId, ",").Split(',')[0];
                        }
                    }

                    if (current["Logo"] != DBNull.Value)
                    {
                        item.Image = Util.AppendImageHost((string)current["Logo"]);
                    }

                    if (current["MobileImage"] != DBNull.Value)
                    {
                        item.Background = Util.AppendImageHost((string)current["MobileImage"]);
                    }


                    if (current["CollectCount"] != DBNull.Value)
                    {
                        item.CollectCount = (int)current["CollectCount"];
                    }

                    if (current["IsCollect"] != DBNull.Value)
                    {
                        item.IsCollect = (int)current["IsCollect"];
                    }

                    items.Add(item);
                }
            }

            ListResult <SupplierListItem> data = new ListResult <SupplierListItem>();

            data.TotalNumOfRecords = items.Count;;
            data.Results           = items;

            return(data);
        }
Ejemplo n.º 4
0
        public IHttpActionResult GetRecommendSupplier(string userId, string accessToken, int channel, int platform, string ver)
        {
            Logger.WriterLogger("Supplier.GetRecommendSupplier, Params: " + string.Format("userId={0}&accessToken={1}&channel={2}&platform={3}&ver={4}", userId, accessToken, channel, platform, ver), LoggerType.Info);

            // 保存访问信息
            base.SaveVisitInfo(userId, channel, platform, ver);

            // 验证令牌
            int accessTookenCode = VerifyAccessToken(accessToken);

            if (accessTookenCode > 0)
            {
                return(base.JsonFaultResult(new CommonException(accessTookenCode).GetMessage(), "Supplier.GetRecommendSupplier"));
            }

            Member member = GetMember(userId.ToSeesionId());

            int referUserId;

            if (member != null)
            {
                referUserId = member.UserId;
            }

            else
            {
                referUserId = 0;
            }
            List <SupplierListItem> items = new List <SupplierListItem>();



            DataTable dt = SupplierConfigHelper.GetConfigSupplier(ClientType.App, SupplierCfgType.Recommend, referUserId);

            if (dt != null)
            {
                SupplierListItem item = null;

                foreach (DataRow current in dt.Rows)
                {
                    item = new SupplierListItem();


                    if (current["SupplierId"] != DBNull.Value)
                    {
                        item.SupplierId = (int)current["SupplierId"];
                    }

                    if (current["ShopName"] != DBNull.Value)
                    {
                        item.SupplierName = (string)current["ShopName"];
                    }

                    if (current["ShopOwner"] != DBNull.Value)
                    {
                        item.ShopOwner = (string)current["ShopOwner"];
                    }

                    item.CreateDate = "";
                    if (current["CreateDate"] != DBNull.Value)
                    {
                        item.CreateDate = ((DateTime)current["CreateDate"]).ToString("yyyy-MM-dd HH:mm:ss");
                    }

                    if (current["County"] != DBNull.Value)
                    {
                        int countyId = (int)current["County"];
                        if (countyId > 0)
                        {
                            item.Location = RegionHelper.GetFullRegion(countyId, ",").Split(',')[0];
                        }
                    }

                    if (current["Logo"] != DBNull.Value)
                    {
                        item.Image = Util.AppendImageHost((string)current["Logo"]);
                    }

                    if (current["MobileImage"] != DBNull.Value)
                    {
                        item.Background = Util.AppendImageHost((string)current["MobileImage"]);
                    }


                    if (current["CollectCount"] != DBNull.Value)
                    {
                        item.CollectCount = (int)current["CollectCount"];
                    }

                    if (current["IsCollect"] != DBNull.Value)
                    {
                        item.IsCollect = (int)current["IsCollect"];
                    }

                    items.Add(item);
                }
            }

            return(base.JsonActionResult(new StandardResult <List <SupplierListItem> >()
            {
                code = 0,
                msg = "推荐商家列表",
                data = items
            }));
        }