Esempio n. 1
0
        private void SetSupplierCfg(int id)
        {
            SupplierConfigInfo info = SupplierConfigHelper.GetSupplierCfgById(this.id);

            this.ddlSupplier.SelectedValue = info.SupplierId.ToString();

            this.txtDesc.Text = info.ShortDesc;

            this.littlepic.Src = info.ImageUrl;
            this.fmSrc.Value   = info.ImageUrl;
        }
Esempio n. 2
0
        protected override void AttachChildControls()
        {
            PageTitle.AddSiteNameTitle("店铺列表");

            this.rptHotSupplierList = (VshopTemplatedRepeater)this.FindControl("rptHotSupplierList");
            this.rptRecSupplierList = (VshopTemplatedRepeater)this.FindControl("rptRecSupplierList");
            this.rpthistorysearch   = (VshopTemplatedRepeater)this.FindControl("rpthistorysearch");
            this.rptAllSupplierList = (VshopTemplatedRepeater)this.FindControl("rptAllSupplierList");

            int    referUserId;
            Member member = HiContext.Current.User as Member;

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

            //热卖
            DataTable hotdt = SupplierConfigHelper.GetConfigSupplier(ClientType.App, SupplierCfgType.Hot, referUserId);

            this.rptHotSupplierList.DataSource = hotdt;
            this.rptHotSupplierList.DataBind();
            //推荐
            DataTable recdt = SupplierConfigHelper.GetConfigSupplier(ClientType.App, SupplierCfgType.Recommend, referUserId);

            this.rptRecSupplierList.DataSource = recdt;
            this.rptRecSupplierList.DataBind();
            //所有
            DataTable recdtAll = SupplierConfigHelper.GetConfigSupplier(ClientType.App, 0, referUserId);

            if (recdtAll != null && recdtAll.Rows.Count > 0)
            {
                rptAllSupplierList.DataSource = recdtAll;
                rptAllSupplierList.DataBind();
            }

            int userId = HiContext.Current.User.UserId;

            if (userId > 0 && this.rpthistorysearch != null)
            {
                this.rpthistorysearch.DataSource = HistorySearchHelp.GetSearchHistory(userId, ClientType.VShop, 6);
                this.rpthistorysearch.DataBind();
            }
        }
Esempio n. 3
0
        protected void btnAddSupplier_Click(object sender, System.EventArgs e)
        {
            if (this.id == 0)
            {
                SupplierConfigInfo info = new SupplierConfigInfo();
                info.IsDisable  = false;
                info.ImageUrl   = this.fmSrc.Value;
                info.ShortDesc  = this.txtDesc.Text;
                info.Client     = (int)ClientType.App;
                info.Type       = (int)SupplierCfgType.Hot;
                info.SupplierId = int.Parse(this.ddlSupplier.SelectedValue);
                if (string.IsNullOrWhiteSpace(info.ImageUrl))
                {
                    this.ShowMsg("请上传图片!", false);
                    return;
                }
                if (SupplierConfigHelper.SaveSupplierCfg(info) > 0)
                {
                    this.CloseWindow();
                    return;
                }
                this.ShowMsg("添加错误!", false);
            }

            else
            {
                SupplierConfigInfo info = SupplierConfigHelper.GetSupplierCfgById(this.id);
                info.IsDisable  = false;
                info.ImageUrl   = this.fmSrc.Value;
                info.ShortDesc  = this.txtDesc.Text;
                info.SupplierId = int.Parse(this.ddlSupplier.SelectedValue);
                if (SupplierConfigHelper.UpdateSupplierCfg(info))
                {
                    this.CloseWindow();
                    return;
                }
                this.ShowMsg("修改失败!", false);
            }
        }
        protected void grdSupplier_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e)
        {
            int rowIndex = ((System.Web.UI.WebControls.GridViewRow)((System.Web.UI.Control)e.CommandSource).NamingContainer).RowIndex;
            int num      = (int)this.grdSupplier.DataKeys[rowIndex].Value;
            int num2     = 0;

            if (e.CommandName == "Fall")
            {
                if (rowIndex < this.grdSupplier.Rows.Count - 1)
                {
                    num2 = (int)this.grdSupplier.DataKeys[rowIndex + 1].Value;
                }
            }
            else
            {
                if (e.CommandName == "Rise" && rowIndex > 0)
                {
                    num2 = (int)this.grdSupplier.DataKeys[rowIndex - 1].Value;
                }
            }
            if (num2 > 0)
            {
                SupplierConfigHelper.SwapSupplierCfgSequence(num, num2);
                base.ReloadPage(null);
            }
            if (e.CommandName == "Delete")
            {
                if (SupplierConfigHelper.DelSupplierCfg(num))
                {
                    this.ShowMsg("删除成功!", true);
                    base.ReloadPage(null);
                    return;
                }
                this.ShowMsg("删除失败!", false);
            }
        }
 private void BindData()
 {
     this.grdSupplier.DataSource = SupplierConfigHelper.GetSupplierCfgByType(ClientType.App, SupplierCfgType.Recommend);
     this.grdSupplier.DataBind();
 }
Esempio n. 6
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);
        }
Esempio n. 7
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
            }));
        }