예제 #1
0
        //删除类别
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            // ChkAdminLevel("channel_" + this.channel_name + "_category", MXEnums.ActionEnum.Delete.ToString()); //检查权限
            BLL.wx_book_category bll = new BLL.wx_book_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");
            }
        }
예제 #2
0
        private void TreeBind()
        {
            Model.wx_userweixin weixin = GetWeiXinCode();

            BLL.wx_book_category bll = new BLL.wx_book_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
 //保存排序
 protected void btnSave_Click(object sender, EventArgs e)
 {
     BLL.wx_book_category bll = new BLL.wx_book_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");
 }
예제 #4
0
        //数据绑定
        private void RptBind()
        {
            Model.wx_userweixin weixin = GetWeiXinCode();

            BLL.wx_book_category bll = new BLL.wx_book_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();
        }
예제 #5
0
        private void ShowInfo(int _id)
        {
            BLL.wx_book_category   bll   = new BLL.wx_book_category();
            Model.wx_book_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>";
                }
            }

            model.albums            = new wx_book_albums().GetModelList("classId=" + model.id);
            rptAlbumList.DataSource = model.albums;
            rptAlbumList.DataBind();
        }
예제 #6
0
        private bool DoEdit(int _id)
        {
            try
            {
                BLL.wx_book_category   bll   = new BLL.wx_book_category();
                Model.wx_book_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;


                #region 保存相册====================
                //检查是否有自定义图片
                if (model.albums != null)
                {
                    model.albums.Clear();
                }
                string[] albumArr  = Request.Form.GetValues("hid_photo_name");
                string[] remarkArr = Request.Form.GetValues("hid_photo_remark");
                if (albumArr != null)
                {
                    List <Model.wx_book_albums> ls = new List <Model.wx_book_albums>();
                    for (int i = 0; i < albumArr.Length; i++)
                    {
                        string[] imgArr = albumArr[i].Split('|');
                        int      img_id = Utils.StrToInt(imgArr[0], 0);
                        if (imgArr.Length == 3)
                        {
                            if (!string.IsNullOrEmpty(remarkArr[i]))
                            {
                                ls.Add(new Model.wx_book_albums {
                                    id = img_id, productId = id, original_path = imgArr[1], thumb_path = imgArr[2], remark = remarkArr[i]
                                });
                            }
                            else
                            {
                                ls.Add(new Model.wx_book_albums {
                                    id = img_id, productId = id, original_path = imgArr[1], thumb_path = imgArr[2]
                                });
                            }
                        }
                    }
                    model.albums = ls;
                }

                #endregion
                if (bll.Update(model))
                {
                    AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "修改预订目分类:" + model.title); //记录日志
                    return(true);
                }
            }
            catch
            {
                return(false);
            }
            return(false);
        }
예제 #7
0
        private bool DoAdd()
        {
            try
            {
                Model.wx_book_category model = new Model.wx_book_category();
                BLL.wx_book_category   bll   = new BLL.wx_book_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;



                #region 保存相册====================
                //检查是否有自定义图片
                string[] albumArr  = Request.Form.GetValues("hid_photo_name");
                string[] remarkArr = Request.Form.GetValues("hid_photo_remark");
                if (albumArr != null && albumArr.Length > 0)
                {
                    List <Model.wx_book_albums> ls = new List <Model.wx_book_albums>();
                    for (int i = 0; i < albumArr.Length; i++)
                    {
                        string[] imgArr = albumArr[i].Split('|');
                        if (imgArr.Length == 3)
                        {
                            if (!string.IsNullOrEmpty(remarkArr[i]))
                            {
                                ls.Add(new Model.wx_book_albums {
                                    original_path = imgArr[1], thumb_path = imgArr[2], remark = remarkArr[i]
                                });
                            }
                            else
                            {
                                ls.Add(new Model.wx_book_albums {
                                    original_path = imgArr[1], thumb_path = imgArr[2]
                                });
                            }
                        }
                    }
                    model.albums = ls;
                }
                #endregion
                if (bll.Add(model) > 0)
                {
                    AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加预订分类:" + model.title); //记录日志
                    return(true);
                }
            }
            catch
            {
                return(false);
            }
            return(false);
        }