private void DisplayShop(Shop shop)
        {
            if (!string.IsNullOrEmpty(shop.LogoUrl))
            {
                imgShop.Visible  = true;
                imgShop.ImageUrl = string.Format(ShopLogUrlFormat, shop.LogoUrl);
            }
            else
            {
                imgShop.Visible = false;
            }
            lblNick.Text      = shop.SellerNick;
            lblShopTitle.Text = shop.Title;

            ITopClient      client   = GetProductTopClient();
            ItemsGetRequest reqItems = new ItemsGetRequest();

            reqItems.Fields   = TopFieldsHelper.GetItemFields_OnlyId();
            reqItems.Nicks    = shop.SellerNick;
            reqItems.PageNo   = 1;
            reqItems.PageSize = 1;
            ResponseList <Item> rsp = client.Execute(reqItems, new ItemListJsonParser());

            lblItemCount.Text   = rsp.TotalResults.ToString();
            lblImportCount.Text = (rsp.TotalResults - IgnoreList.Count).ToString();
        }
示例#2
0
 private ITopRequest GetTopRequest(string query, bool?discount, bool?showCase, string type, string filter, int pageIndex, int pageSize)
 {
     if (type.Equals("onsale", StringComparison.OrdinalIgnoreCase))
     {
         ItemsOnsaleGetRequest req = new ItemsOnsaleGetRequest();
         req.Fields      = TopFieldsHelper.GetItemFields_InList();// "iid,title,nick,type,cid,num,props,price";
         req.Query       = query;
         req.HasDiscount = discount;
         req.HasShowcase = showCase;
         req.PageNo      = pageIndex;
         req.PageSize    = pageSize;
         if (!string.IsNullOrEmpty(filter) && !filter.Trim().Equals("all", StringComparison.OrdinalIgnoreCase))
         {
             req.SellerCids = filter;
         }
         return(req);
     }
     else if (type.Equals("inventory", StringComparison.OrdinalIgnoreCase))
     {
         ItemsInventoryGetRequest req = new ItemsInventoryGetRequest();
         req.Fields = TopFieldsHelper.GetItemFields_InList();// "iid,title,nick,type,cid,num,props,price";
         req.Query  = query;
         if (!string.IsNullOrEmpty(filter) && !filter.Trim().Equals("all", StringComparison.OrdinalIgnoreCase))
         {
             req.Banner = filter;
         }
         req.PageNo   = pageIndex;
         req.PageSize = pageSize;
         return(req);
     }
     else
     {
         return(null);
     }
 }
        private int GetTotalImportCount(string nick)
        {
            ITopClient      client   = GetProductTopClient();
            ItemsGetRequest reqItems = new ItemsGetRequest();

            reqItems.Fields   = TopFieldsHelper.GetItemFields_OnlyId();
            reqItems.Nicks    = nick;
            reqItems.PageNo   = 1;
            reqItems.PageSize = 1;
            ResponseList <Item> rsp = client.Execute(reqItems, new ItemListJsonParser());

            return((int)rsp.TotalResults);
        }
        private List <Item> GetItemList(string nick, int pageIndex, int pageSize)
        {
            ITopClient      client   = GetProductTopClient();
            ItemsGetRequest reqItems = new ItemsGetRequest();

            reqItems.Fields   = TopFieldsHelper.GetItemFields_InList();
            reqItems.Nicks    = nick;
            reqItems.PageNo   = pageIndex;
            reqItems.PageSize = pageSize;
            ResponseList <Item> rsp = client.Execute(reqItems, new ItemListJsonParser());

            return(rsp.Content);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //if (string.IsNullOrEmpty(TOP_SessionKey))
            //{
            //    ucCtrlSessionGetter.Parameters.Add("ReturnUrl", Request.Url.AbsoluteUri);
            //    ucCtrlSessionGetter.Visible = true;
            //    ucCtrlSearchItemsMulti.Visible = false;
            //    ucCtrlShopCategoryTree.Visible = false;

            //    hlnkOk.Enabled = false;
            //    hlnkCancel.Enabled = false;
            //}
            //else
            //{
            //    ucCtrlSessionGetter.Visible = false;
            //    ucCtrlSearchItemsMulti.Visible = true;
            //    ucCtrlShopCategoryTree.Visible = true;

            //    hlnkOk.Enabled = true;
            //    hlnkCancel.Enabled = true;

            //    ucCtrlShopCategoryTree.Nick = SellerNick;

            //    ITopClient client = GetProductTopClient();
            //    ItemsOnsaleGetRequest req = new ItemsOnsaleGetRequest();
            //    req.Fields = TopFieldsHelper.GetItemFields_InList();// "iid,title,nick,type,cid,num,props,price";
            //    req.PageNo = ucCtrlPager.PageIndex + 1;
            //    req.PageSize = ucCtrlPager.PageSize;
            //    ITopRequest proxy = new TopSessionRequestProxy(req, TOP_SessionKey);
            //    ResponseList<Item> rsp = client.Execute(proxy, new ItemListJsonParser());
            //    ucCtrlPager.TotalCount = (int)rsp.TotalResults;
            //    ucCtrlSearchItemsMulti.ItemSource = rsp.Content;
            //}
            ITopClient      client = GetProductTopClient();
            ItemsGetRequest req    = new ItemsGetRequest();

            req.Fields   = TopFieldsHelper.GetItemFields_InList();// "iid,title,nick,type,cid,num,props,price";
            req.Nicks    = "zhongjy001";
            req.PageNo   = ucCtrlPager.PageIndex + 1;
            req.PageSize = ucCtrlPager.PageSize;
            ResponseList <Item> rsp = client.Execute(req, new ItemListJsonParser());

            ucCtrlPager.TotalCount            = (int)rsp.TotalResults;
            ucCtrlSearchItemsMulti.ItemSource = rsp.Content;
        }
 private Item ImportItem(ImportItemInfo item)
 {
     try
     {
         ITopClient     client = GetProductTopClient();
         ItemGetRequest req    = new ItemGetRequest();
         req.Fields = TopFieldsHelper.GetItemFields_All();
         req.Iid    = item.ImportFormItemIid;
         req.Nick   = item.ImportFormSellerNick;
         Item topItem = client.Execute <Item>(req, new ItemJsonParser());
         ImportItem(topItem);
         return(topItem);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        private void DisplayShop(Shop shop)
        {
            lblTitle.Text = "导入店铺 - " + shop.Title;
            if (!string.IsNullOrEmpty(shop.LogoUrl))
            {
                imgShop.Visible  = true;
                imgShop.ImageUrl = string.Format(ShopLogUrlFormat, shop.LogoUrl);
            }
            else
            {
                imgShop.Visible = false;
            }
            lblNick.Text       = shop.SellerNick;
            lblShopTitle.Text  = shop.Title;
            lblCreateDate.Text = shop.Created;
            lblUpdateDate.Text = shop.Modified;

            ITopClient     client = GetProductTopClient();
            UserGetRequest req    = new UserGetRequest();

            req.Fields = TopFieldsHelper.GetUserFields_All();
            req.Nick   = shop.SellerNick;
            User user = client.Execute(req, new UserJsonParser());

            if (user != null)
            {
                ucCtrlCreditBuyer.CreditNum  = user.BuyerCredit.GoodNum;
                ucCtrlCreditSeller.CreditNum = user.SellerCredit.GoodNum;
            }

            ItemsGetRequest reqItems = new ItemsGetRequest();

            reqItems.Fields   = TopFieldsHelper.GetItemFields_InList();
            reqItems.Nicks    = shop.SellerNick;
            reqItems.PageNo   = ucCtrlPager.PageIndex + 1;
            reqItems.PageSize = ucCtrlPager.PageSize;
            ResponseList <Item> rsp = client.Execute(reqItems, new ItemListJsonParser());

            ucCtrlPager.TotalCount = (int)rsp.TotalResults;
            rptItems.DataSource    = rsp.Content;
            rptItems.DataBind();

            lblItemCount.Text = rsp.TotalResults.ToString();
        }
示例#8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string key       = Request["v"];
            string type      = Request["t"];
            int?   page_no   = null;
            int?   page_size = null;

            if (!string.IsNullOrEmpty(Request["page_no"]))
            {
                page_no = int.Parse(Request["page_no"]);
            }
            if (!string.IsNullOrEmpty(Request["page_size"]))
            {
                page_size = int.Parse(Request["page_size"]);
            }
            if (!string.IsNullOrEmpty(key) && !string.IsNullOrEmpty(type))
            {
                ITopClient client = GetProductTopClient();
                switch (type.ToLower())
                {
                case "item":
                    ItemsSearchRequest req = new ItemsSearchRequest();
                    req.Fields      = TopFieldsHelper.GetItemFields_InList();
                    req.Query       = key;
                    req.PageNo      = page_no;
                    req.PageSize    = page_size;
                    DataSource_Item = client.Execute(req, new ItemSearchListJsonParser());
                    Server.Transfer("ImportItem_Step1_SelectItems_Item.aspx");
                    break;

                //case "shop":
                //    ShopFacade shopFacade = new ShopFacade(AppKey, AppSecret);
                //    DataSource_Shop = shopFacade.GetShopByNick(key);
                //    Server.Transfer("QueryResult_Shop.aspx");
                //    break;
                default:
                    throw new ArgumentException("参数类型不支持 - " + type);
                }
            }
        }
        protected void lbtnSearch_Click(object sender, EventArgs e)
        {
            ITopClient     client = GetProductTopClient();
            ShopGetRequest req    = new ShopGetRequest();

            req.Fields = TopFieldsHelper.GetShopFields_Common();
            req.Nick   = txtKey.Text;
            try
            {
                Shop shop = client.Execute(req, new ShopJsonParser());
                JavaScriptSerializer ser = new JavaScriptSerializer();
                string json = ser.Serialize(shop); //JObject.FromObject(shop).ToString();
                string arg  = CompressionHelper.Compress(json);
                string url  = "ImportShop2.aspx?Nick=" + Server.UrlEncode(txtKey.Text) + "&Shop=" + Server.UrlEncode(arg);
                Response.Redirect(url, false);
            }
            catch (Exception ex)
            {
                string msg = ex.Message;
                string arg = CompressionHelper.Compress(msg);
                string url = "ImportShop1.aspx?Nick=" + Server.UrlEncode(txtKey.Text) + "&ErrorMsg=" + Server.UrlEncode(arg);
                Response.Redirect(url, true);
            }
        }