예제 #1
0
        private void ShowInfo(int _id)
        {
            BLL.wx_shop_category   bll   = new BLL.wx_shop_category();
            Model.wx_shop_category model = bll.GetModel(_id);

            ddlParentId.SelectedValue = model.parent_id.ToString();

            txtTitle.Text          = model.title;
            txtSortId.Text         = model.sort_id.ToString();
            txtSeoTitle.Text       = model.seo_title;
            txtSeoKeywords.Text    = model.seo_keywords;
            txtSeoDescription.Text = model.seo_description;
            txtLinkUrl.Text        = model.link_url;
            txtImgUrl.Text         = model.img_url;
            if (model.img_url != null && model.img_url.Trim() != "")
            {
                // imgUrl.ImageUrl = model.img_url;
            }
            txtContent.Text = model.class_content;
            txtImgICO.Text  = model.ico_url;
            if (model.ico_url != null && model.ico_url.Trim() != "")
            {
                if (model.ico_url.Contains("/"))
                {
                    imgIco.ImageUrl = model.ico_url;
                }
                else
                {
                    imgIco.Style.Add("display", "none");
                    litImgIco.Text = "<span class=\"" + model.ico_url + "\"></span>";
                }
            }
        }
예제 #2
0
        /// <summary>
        /// 绑定商品分类
        /// </summary>
        private void TreeBind()
        {
            Model.wx_userweixin weixin = GetWeiXinCode();

            BLL.wx_shop_category bll = new BLL.wx_shop_category();
            DataTable            dt  = bll.GetWCodeList(weixin.id, 0);

            this.ddlCategoryId.Items.Clear();
            this.ddlCategoryId.Items.Add(new ListItem("请选择类别...", ""));
            foreach (DataRow dr in dt.Rows)
            {
                string Id         = dr["id"].ToString();
                int    ClassLayer = int.Parse(dr["class_layer"].ToString());
                string Title      = dr["title"].ToString().Trim();

                if (ClassLayer == 1)
                {
                    this.ddlCategoryId.Items.Add(new ListItem(Title, Id));
                }
                else
                {
                    Title = "├ " + Title;
                    Title = Utils.StringOfChar(ClassLayer - 1, " ") + Title;
                    this.ddlCategoryId.Items.Add(new ListItem(Title, Id));
                }
            }
        }
예제 #3
0
        private bool DoAdd()
        {
            try
            {
                Model.wx_shop_category model = new Model.wx_shop_category();
                BLL.wx_shop_category   bll   = new BLL.wx_shop_category();


                model.title           = txtTitle.Text.Trim();
                model.parent_id       = int.Parse(ddlParentId.SelectedValue);
                model.sort_id         = int.Parse(txtSortId.Text.Trim());
                model.seo_title       = txtSeoTitle.Text;
                model.seo_keywords    = txtSeoKeywords.Text;
                model.seo_description = txtSeoDescription.Text;
                model.link_url        = txtLinkUrl.Text.Trim();
                model.img_url         = txtImgUrl.Text.Trim();
                model.class_content   = txtContent.Text.Trim();
                model.ico_url         = Request.Form["txtImgICO"].Trim();// txtImgICO.Text;
                Model.wx_userweixin weixin = GetWeiXinCode();
                model.wid = weixin.id;

                if (bll.Add(model) > 0)
                {
                    AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加商品分类:" + model.title); //记录日志
                    return(true);
                }
            }
            catch
            {
                return(false);
            }
            return(false);
        }
예제 #4
0
        private bool DoEdit(int _id)
        {
            try
            {
                BLL.wx_shop_category   bll   = new BLL.wx_shop_category();
                Model.wx_shop_category model = bll.GetModel(_id);

                int parentId = int.Parse(ddlParentId.SelectedValue);

                model.title = txtTitle.Text.Trim();
                //如果选择的父ID不是自己,则更改
                if (parentId != model.id)
                {
                    model.parent_id = parentId;
                }
                model.sort_id         = int.Parse(txtSortId.Text.Trim());
                model.seo_title       = txtSeoTitle.Text;
                model.seo_keywords    = txtSeoKeywords.Text;
                model.seo_description = txtSeoDescription.Text;
                model.link_url        = txtLinkUrl.Text.Trim();
                model.img_url         = txtImgUrl.Text.Trim();
                model.class_content   = txtContent.Text.Trim();
                model.ico_url         = Request.Form["txtImgICO"].Trim();// txtImgICO.Text;
                if (bll.Update(model))
                {
                    AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "修改商品目分类:" + model.title); //记录日志
                    return(true);
                }
            }
            catch
            {
                return(false);
            }
            return(false);
        }
예제 #5
0
        //删除类别
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            // ChkAdminLevel("channel_" + this.channel_name + "_category", MXEnums.ActionEnum.Delete.ToString()); //检查权限
            BLL.wx_shop_category bll = new BLL.wx_shop_category();
            int sucCount             = 0;
            int errorCount           = 0;

            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int      id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                if (cb.Checked)
                {
                    if (bll.DeleteCategory(id))
                    {
                        sucCount += 1;
                    }
                    else
                    {
                        errorCount += 1;
                    }
                }
            }
            AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "删除商品分类数据"); //记录日志

            if (errorCount > 0)
            {
                JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条! 分类被商品使用,则无法删除!", Utils.CombUrlTxt("category_list.aspx", ""), "Error");
            }
            else
            {
                JscriptMsg("删除成功" + sucCount + "条!", Utils.CombUrlTxt("category_list.aspx", ""), "Success");
            }
        }
예제 #6
0
        /// <summary>
        /// 绑定商品分类
        /// </summary>
        private void TreeBind()
        {
            Model.wx_userweixin weixin = GetWeiXinCode();

            BLL.wx_shop_category bll = new BLL.wx_shop_category();
            DataTable dt = bll.GetWCodeList(weixin.id,0);

            this.ddlCategoryId.Items.Clear();
            this.ddlCategoryId.Items.Add(new ListItem("请选择类别...", ""));
            foreach (DataRow dr in dt.Rows)
            {
                string Id = dr["id"].ToString();
                int ClassLayer = int.Parse(dr["class_layer"].ToString());
                string Title = dr["title"].ToString().Trim();

                if (ClassLayer == 1)
                {
                    this.ddlCategoryId.Items.Add(new ListItem(Title, Id));
                }
                else
                {
                    Title = "├ " + Title;
                    Title = Utils.StringOfChar(ClassLayer - 1, " ") + Title;
                    this.ddlCategoryId.Items.Add(new ListItem(Title, Id));
                }
            }
        }
예제 #7
0
 //保存排序
 protected void btnSave_Click(object sender, EventArgs e)
 {
     BLL.wx_shop_category bll = new BLL.wx_shop_category();
     for (int i = 0; i < rptList.Items.Count; i++)
     {
         int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
         int sortId;
         if (!int.TryParse(((TextBox)rptList.Items[i].FindControl("txtSortId")).Text.Trim(), out sortId))
         {
             sortId = 99;
         }
         bll.UpdateField(id, "sort_id=" + sortId.ToString());
     }
     AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "保存商品分类排序"); //记录日志
     JscriptMsg("保存排序成功!", Utils.CombUrlTxt("category_bottomMenu_list.aspx", "channel_id={0}"), "Success");
 }
예제 #8
0
 //保存排序
 protected void btnSave_Click(object sender, EventArgs e)
 {
     BLL.wx_shop_category bll = new BLL.wx_shop_category();
     for (int i = 0; i < rptList.Items.Count; i++)
     {
         int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
         int sortId;
         if (!int.TryParse(((TextBox)rptList.Items[i].FindControl("txtSortId")).Text.Trim(), out sortId))
         {
             sortId = 99;
         }
         bll.UpdateField(id, "sort_id=" + sortId.ToString());
     }
     AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "保存商品分类排序"); //记录日志
     JscriptMsg("保存排序成功!", Utils.CombUrlTxt("category_bottomMenu_list.aspx", "channel_id={0}"), "Success");
 }
        //数据绑定
        private void RptBind()
        {
            Model.wx_userweixin weixin = GetWeiXinCode();

            BLL.wx_shop_category bll = new BLL.wx_shop_category();
            DataTable dt = bll.GetWCodeList(weixin.id, 0);

            if (dt != null)
            {
                DataRow dr;
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    dr = dt.Rows[i];
                    if (dr["ico_url"] != null && dr["ico_url"].ToString().Trim() != "")
                    {
                        if (dr["ico_url"].ToString().Contains("."))
                        {
                            dr["ico_url"] = "<img  src=\"" + dr["ico_url"].ToString() + "\" class=\"imgico\" />";
                        }
                        else
                        {
                            dr["ico_url"] = "<span  class=\"" + dr["ico_url"].ToString() + "\" />";
                        }
                    }
                    //链接处理,待做
                    if (dr["link_url"] != null && dr["link_url"].ToString().Trim() != "")
                    {

                    }
                    else
                    {

                    }

                }
            }

            this.rptList.DataSource = dt;
            this.rptList.DataBind();
        }
예제 #10
0
        //数据绑定
        private void RptBind()
        {
            Model.wx_userweixin weixin = GetWeiXinCode();

            BLL.wx_shop_category bll = new BLL.wx_shop_category();
            DataTable            dt  = bll.GetWCodeList(weixin.id, 0, 0);

            if (dt != null)
            {
                DataRow dr;
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    dr = dt.Rows[i];
                    if (dr["ico_url"] != null && dr["ico_url"].ToString().Trim() != "")
                    {
                        if (dr["ico_url"].ToString().Contains("."))
                        {
                            dr["ico_url"] = "<img  src=\"" + dr["ico_url"].ToString() + "\" class=\"imgico\" />";
                        }
                        else
                        {
                            dr["ico_url"] = "<span  class=\"" + dr["ico_url"].ToString() + "\" />";
                        }
                    }
                    //链接处理,待做
                    if (dr["link_url"] != null && dr["link_url"].ToString().Trim() != "")
                    {
                    }
                    else
                    {
                    }
                }
            }

            this.rptList.DataSource = dt;
            this.rptList.DataBind();
        }
예제 #11
0
        //删除类别
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            // ChkAdminLevel("channel_" + this.channel_name + "_category", MXEnums.ActionEnum.Delete.ToString()); //检查权限
            BLL.wx_shop_category bll = new BLL.wx_shop_category();
            int sucCount = 0;
            int errorCount = 0;
            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                if (cb.Checked)
                {

                    if (bll.DeleteCategory(id))
                    {
                        sucCount += 1;
                    }
                    else
                    {
                        errorCount += 1;
                    }

                }
            }
            AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "删除商品分类数据"); //记录日志

            if (errorCount > 0)
            {
                JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条! 分类被商品使用,则无法删除!", Utils.CombUrlTxt("category_list.aspx", ""), "Error");

            }
            else
            {
                JscriptMsg("删除成功" + sucCount + "条!", Utils.CombUrlTxt("category_list.aspx", ""), "Success");
            }
        }
예제 #12
0
        private bool DoAdd()
        {
            try
            {
                Model.wx_shop_category model = new Model.wx_shop_category();
                BLL.wx_shop_category bll = new BLL.wx_shop_category();

                model.title = txtTitle.Text.Trim();
                model.parent_id = int.Parse(ddlParentId.SelectedValue);
                model.sort_id = int.Parse(txtSortId.Text.Trim());
                model.seo_title = txtSeoTitle.Text;
                model.seo_keywords = txtSeoKeywords.Text;
                model.seo_description = txtSeoDescription.Text;
                model.link_url = txtLinkUrl.Text.Trim();
                model.img_url = txtImgUrl.Text.Trim();
                model.class_content = txtContent.Text.Trim();
                model.ico_url = Request.Form["txtImgICO"].Trim();// txtImgICO.Text;
                Model.wx_userweixin weixin = GetWeiXinCode();
                model.wid = weixin.id;

                if (bll.Add(model) > 0)
                {
                    AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加商品分类:" + model.title); //记录日志
                    return true;
                }
            }
            catch
            {
                return false;
            }
            return false;
        }
예제 #13
0
        private void ShowInfo(int _id)
        {
            BLL.wx_shop_category bll = new BLL.wx_shop_category();
            Model.wx_shop_category model = bll.GetModel(_id);

            ddlParentId.SelectedValue = model.parent_id.ToString();

            txtTitle.Text = model.title;
            txtSortId.Text = model.sort_id.ToString();
            txtSeoTitle.Text = model.seo_title;
            txtSeoKeywords.Text = model.seo_keywords;
            txtSeoDescription.Text = model.seo_description;
            txtLinkUrl.Text = model.link_url;
            txtImgUrl.Text = model.img_url;
            if (model.img_url != null && model.img_url.Trim() != "")
            {
                imgUrl.ImageUrl = model.img_url;
            }
            txtContent.Text = model.class_content;
            txtImgICO.Text = model.ico_url;
            if (model.ico_url != null && model.ico_url.Trim() != "")
            {
                if (model.ico_url.Contains("/"))
                {
                    imgIco.ImageUrl = model.ico_url;
                }
                else
                {
                    imgIco.Style.Add("display", "none");
                    litImgIco.Text = "<span class=\"" + model.ico_url + "\"></span>";
                }
            }
        }
예제 #14
0
        private bool DoEdit(int _id)
        {
            try
            {
                BLL.wx_shop_category bll = new BLL.wx_shop_category();
                Model.wx_shop_category model = bll.GetModel(_id);

                int parentId = int.Parse(ddlParentId.SelectedValue);

                model.title = txtTitle.Text.Trim();
                //如果选择的父ID不是自己,则更改
                if (parentId != model.id)
                {
                    model.parent_id = parentId;
                }
                model.sort_id = int.Parse(txtSortId.Text.Trim());
                model.seo_title = txtSeoTitle.Text;
                model.seo_keywords = txtSeoKeywords.Text;
                model.seo_description = txtSeoDescription.Text;
                model.link_url = txtLinkUrl.Text.Trim();
                model.img_url = txtImgUrl.Text.Trim();
                model.class_content = txtContent.Text.Trim();
                model.ico_url = Request.Form["txtImgICO"].Trim();// txtImgICO.Text;
                if (bll.Update(model))
                {
                    AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "修改商品目分类:" + model.title); //记录日志
                    return true;
                }
            }
            catch
            {
                return false;
            }
            return false;
        }