Пример #1
0
        /// <summary>
        /// 栏目URL
        public string Url(int category_id)
        {
            string _url = string.Empty;

            BLL.contents.article_category bll = new BLL.contents.article_category();
            DataTable dt = bll.GetList(0, "class_list like '%," + category_id + ",%'", "class_layer desc, sort_id asc,id desc").Tables[0];

            if (dt.Rows.Count > 0 && dt.Rows != null)
            {
                if (!string.IsNullOrEmpty(dt.Rows[0]["link_url"].ToString()))
                {
                    _url = dt.Rows[0]["link_url"].ToString();
                }
                else
                {
                    if (bll.GetModel(category_id).model_id != 0)
                    {
                        string _key1 = BasePage.pageUrl(bll.GetModel(category_id).model_id);
                        _url = new BasePage().linkurl(_key1, category_id);
                    }
                    else
                    {
                        string _key         = BasePage.pageUrl(Convert.ToInt32(dt.Rows[0]["model_id"]));
                        string _category_id = dt.Rows[0]["id"].ToString();
                        _url = new BasePage().linkurl(_key, _category_id);
                    }
                }
            }
            return(_url.ToString());
        }
Пример #2
0
        private void edit_category(HttpContext context)
        {
            //取得管理员登录信息
            Model.managers.manager adminInfo = new Web.UI.ManagePage().GetAdminInfo();
            if (adminInfo == null)
            {
                context.Response.Write("{\"status\": 0, \"msg\": \"未登录或已超时,请重新登录!\"}");
                return;
            }

            int category1 = OSRequest.GetFormInt("Category1");
            int category2 = OSRequest.GetFormInt("Category2");

            if (category1 == category2)
            {
                context.Response.Write("{\"status\": 0, \"msg\": \"移动目录跟目的目录不能相同!\"}");
                return;
            }

            BLL.contents.article_category   bll   = new BLL.contents.article_category();
            Model.contents.article_category model = bll.GetModel(category2);

            if (model.class_list.IndexOf("," + category1 + ",") > 0)
            {
                context.Response.Write("{\"status\": 0, \"msg\": \"父级本不能向其子级转移!\"}");
                return;
            }

            if (bll.GetModel(category1).parent_id == category2)
            {
                context.Response.Write("{\"status\": 0, \"msg\": \"移动目录已经在目的目录里!\"}");
                return;
            }

            DataTable dt = bll.GetList(0, "class_list like '%," + category1 + ",%'", "class_layer asc").Tables[0];

            if (dt.Rows != null && dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    int    id              = Convert.ToInt32(dt.Rows[i]["id"]);
                    string class_list      = dt.Rows[i]["class_list"].ToString();
                    int    new_channel_id  = model.channel_id;
                    string new_class_list  = model.class_list + class_list.Substring(class_list.IndexOf("," + category1 + ",")).TrimStart(',');
                    string new_class_layer = new_class_list.Trim(',').Split(',').Length.ToString();
                    if (i == 0)
                    {
                        bll.UpdateField(id, "channel_id=" + new_channel_id + ", parent_id=" + category2 + ", class_list='" + new_class_list + "',class_layer=" + new_class_layer);
                    }
                    else
                    {
                        bll.UpdateField(id, "channel_id=" + new_channel_id + ", class_list='" + new_class_list + "',class_layer=" + new_class_layer);
                    }
                }
            }

            new BLL.managers.manager_log().Add(adminInfo.id, adminInfo.user_name, OSEnums.ActionEnum.Edit.ToString(), "移动栏目:" + bll.GetModel(category1).title); //记录日志
            context.Response.Write("{\"status\": 1, \"msg\": \"栏目转移成功!\"}");
        }
Пример #3
0
        public void ProcessRequest(HttpContext context)
        {
            BLL.contents.article_category   bll   = new BLL.contents.article_category();
            Model.contents.article_category model = new Model.contents.article_category();
            int id   = OSRequest.GetQueryInt("id", -2);
            int type = OSRequest.GetQueryInt("type", -2);   //0上 ;1下

            model = bll.GetModel(id);
            DataTable dt_sx = bll.GetList(0, "parent_id=" + model.parent_id, "sort_id asc,id desc").Tables[0];

            if (dt_sx.Rows != null && dt_sx.Rows.Count > 0)
            {
                for (int i = 0; i < dt_sx.Rows.Count; i++)
                {
                    if (Convert.ToInt32(dt_sx.Rows[i]["ID"]) == id)
                    {
                        if (type == 1)
                        {
                            if ((i + 1) < dt_sx.Rows.Count)
                            {
                                int newId = Convert.ToInt32(dt_sx.Rows[i + 1]["ID"]);
                                //位置互换
                                bll.UpdateField(newId, "sort_id=" + model.sort_id + "");
                                bll.UpdateField(id, "sort_id=" + (bll.GetModel(newId).sort_id + 1) + "");
                                context.Response.Write("OK");
                            }
                            else
                            {
                                context.Response.Write("down");
                            }
                        }
                        else if (type == 0)
                        {
                            if ((i - 1) >= 0)
                            {
                                int newId = Convert.ToInt32(dt_sx.Rows[i - 1]["ID"]);
                                //位置互换
                                bll.UpdateField(newId, "sort_id=" + model.sort_id + "");
                                bll.UpdateField(id, "sort_id=" + (bll.GetModel(newId).sort_id - 1) + "");
                                context.Response.Write("OK");
                            }
                            else
                            {
                                context.Response.Write("up");
                            }
                        }
                        else
                        {
                            context.Response.Write("参数错误");
                        }
                    }
                }
            }
        }
Пример #4
0
 public void ProcessRequest(HttpContext context)
 {
     BLL.contents.article_category bll = new BLL.contents.article_category();
     Model.contents.article_category model = new Model.contents.article_category();
     int id = OSRequest.GetQueryInt("id", -2);
     int type = OSRequest.GetQueryInt("type", -2);   //0上 ;1下
     model = bll.GetModel(id);
     DataTable dt_sx = bll.GetList(0, "parent_id=" + model.parent_id, "sort_id asc,id desc").Tables[0];
     if (dt_sx.Rows != null && dt_sx.Rows.Count > 0)
     {
         for (int i = 0; i < dt_sx.Rows.Count; i++)
         {
             if (Convert.ToInt32(dt_sx.Rows[i]["ID"]) == id)
             {
                 if (type == 1)
                 {
                     if ((i + 1) < dt_sx.Rows.Count)
                     {
                         int newId = Convert.ToInt32(dt_sx.Rows[i + 1]["ID"]);
                         //位置互换
                         bll.UpdateField(newId, "sort_id=" + model.sort_id + "");
                         bll.UpdateField(id, "sort_id=" + (bll.GetModel(newId).sort_id + 1) + "");
                         context.Response.Write("OK");
                     }
                     else
                     {
                         context.Response.Write("down");
                     }
                 }
                 else if (type == 0)
                 {
                     if ((i - 1) >= 0)
                     {
                         int newId = Convert.ToInt32(dt_sx.Rows[i - 1]["ID"]);
                         //位置互换
                         bll.UpdateField(newId, "sort_id=" + model.sort_id + "");
                         bll.UpdateField(id, "sort_id=" + (bll.GetModel(newId).sort_id - 1) + "");
                         context.Response.Write("OK");
                     }
                     else
                     {
                         context.Response.Write("up");
                     }
                 }
                 else
                 {
                     context.Response.Write("参数错误");
                 }
             }
         }
     }
 }
Пример #5
0
        public string GetColumn(int Id)
        {
            StringBuilder sb    = new StringBuilder();
            int           count = new BLL.contents.article().GetCount("category_id=" + Id + "") > 0 ? new BLL.contents.article().GetCount("category_id=" + Id + "") : 0;

            model = bll.GetModel(Id);
            switch (model.model_id)
            {
            case 1:
                sb.Append("<a href=\"article/article_list.aspx?category_id=" + Id + "\" target=\"mainFrame\" >" + model.title + "</a>" + "<span class=\"column\">(" + count + ")</span>");
                break;

            case 2:
                sb.Append("<a href=\"article/article_list.aspx?category_id=" + Id + "\" target=\"mainFrame\">" + model.title + "</a>" + "<span class=\"column\">(" + count + ")</span>");
                break;

            case 3:
                sb.Append("<a href=\"article/article_list.aspx?category_id=" + Id + "\" target=\"mainFrame\" >" + model.title + "</a>" + "<span class=\"column\">(" + count + ")</span>");
                break;

            case 4:
                sb.Append("<a href=\"article/article_list.aspx?category_id=" + Id + "\" target=\"mainFrame\" >" + model.title + "</a>" + "<span class=\"column\">(" + count + ")</span>");
                break;

            case 0:
                sb.Append(model.title);
                break;
            }
            return(sb.ToString());
        }
Пример #6
0
        private void ShowInfo(int _id)
        {
            BLL.contents.article_category   bll   = new BLL.contents.article_category();
            Model.contents.article_category model = bll.GetModel(_id);

            ddlParentId.SelectedValue = model.parent_id.ToString();
            txtCallIndex.Text         = model.call_index;
            txtCallIndex.Attributes.Add("ajaxurl", "../../ashx/admin_ajax.ashx?action=navigation_validate&old_name=" + Utils.UrlEncode(model.call_index));
            txtCallIndex.Focus(); //设置焦点,防止JS无法提交
            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;
            txtContent.Value        = model.content;
            rblStatus.SelectedValue = model.model_id.ToString();
            if (model.is_add_category == 1)
            {
                cblItem.Items[0].Selected = true;
            }
            if (model.is_add_content == 1)
            {
                cblItem.Items[1].Selected = true;
            }
            if (model.is_show_top == 1)
            {
                cblItem.Items[2].Selected = true;
            }
            if (model.is_show_foot == 1)
            {
                cblItem.Items[3].Selected = true;
            }
            if (model.is_albums == 1)
            {
                cbIsAlbums.Checked = true;
            }
            if (model.is_attach == 1)
            {
                cbIsAttach.Checked = true;
            }
            txtPageSize.Text = model.page_size.ToString();
            //赋值扩展字段
            if (model.category_fields != null)
            {
                for (int i = 0; i < cblAttributeField.Items.Count; i++)
                {
                    Model.contents.category_field modelt = model.category_fields.Find(p => p.field_id == int.Parse(cblAttributeField.Items[i].Value)); //查找对应的字段ID
                    if (modelt != null)
                    {
                        cblAttributeField.Items[i].Selected = true;
                    }
                }
            }
        }
Пример #7
0
 /// <summary>
 /// 加载栏目简介
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public static string GetCategoryZhaiYao(int id)
 {
     string rStr = string.Empty;
     BLL.contents.article_category bll = new BLL.contents.article_category();
     Model.contents.article_category model = bll.GetModel(id);
     if (model != null) {
         rStr = model.content;
     }
     return rStr;
 }
Пример #8
0
        /// <summary>
        /// 加载名称+Url
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static string GetPageNameUrl(int id)
        {
            string rStr = string.Empty;

            BLL.contents.article_category   bll   = new BLL.contents.article_category();
            Model.contents.article_category model = bll.GetModel(id);
            if (model != null)
            {
                rStr = "<a href=\"" + model.link_url + "\">" + model.title + "</a>";
            }
            return(rStr);
        }
Пример #9
0
        /// <summary>
        /// 加载栏目简介
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static string GetCategoryZhaiYao(int id)
        {
            string rStr = string.Empty;

            BLL.contents.article_category   bll   = new BLL.contents.article_category();
            Model.contents.article_category model = bll.GetModel(id);
            if (model != null)
            {
                rStr = model.content;
            }
            return(rStr);
        }
Пример #10
0
        private bool DoEdit(int _id)
        {
            try
            {
                BLL.contents.article_category   bll   = new BLL.contents.article_category();
                Model.contents.article_category model = bll.GetModel(_id);

                model.title      = txtTitle.Text.Trim();
                model.sort_id    = int.Parse(txtSortId.Text.Trim());
                model.is_lock    = 0;
                model.call_index = txtName.Text.Trim();
                if (cbIsLock.Checked == true)
                {
                    model.is_lock = 1;
                }

                if (model.is_sys == 0)
                {
                    int parentId = int.Parse(ddlParentId.SelectedValue);
                    //如果选择的父ID不是自己,则更改
                    if (parentId != model.id)
                    {
                        model.parent_id = parentId;
                    }
                }
                model.link_url = txtLinkUrl.Text.Trim();
                model.content  = txtRemark.Text;
                //添加操作权限类型
                string action_type_str = string.Empty;
                for (int i = 0; i < cblActionType.Items.Count; i++)
                {
                    if (cblActionType.Items[i].Selected && Utils.ActionType().ContainsKey(cblActionType.Items[i].Value))
                    {
                        action_type_str += cblActionType.Items[i].Value + ",";
                    }
                }
                model.action_type = Utils.DelLastComma(action_type_str);

                if (bll.Update(model))
                {
                    AddAdminLog(OSEnums.ActionEnum.Add.ToString(), "修改导航信息:" + model.title); //记录日志
                    return(true);
                }
            }
            catch
            {
                return(false);
            }
            return(false);
        }
Пример #11
0
 public string Column_Access(int Id)
 {
     if (Id != -1)
     {
         model = bll.GetModel(Id);
         //允许添加子类
         string is_zilei = model.is_add_category == 1 ? " <a style=\"padding-left:30px;\" href=\"category_edit.aspx?action=" + OSEnums.ActionEnum.Add + "&channel_id=" + model.channel_id + "&id=" + Id + "\"/>添加子类</a>" : "";
         //默认最多只能添加三级("model.class_layer == 3"深度)
         string is_zilei_there = model.class_layer == 4 ? "" : is_zilei;
         string style          = is_zilei_there == "" ? "style=\"padding-left:20px;\"" : "style=\"padding-left:10px;\"";
         return(is_zilei_there + "<a " + style + " href=\"category_edit.aspx?action=" + OSEnums.ActionEnum.Edit + "&channel_id=" + model.channel_id + "&id=" + Id + "\"/>编辑</a>   <a style=\"padding-left:10px;\"  href=\"javascript:del(" + Id + ")\" class=\"del\">删除</a>   <a  style=\"padding-left:10px;\" href=\"javascript:categoey(" + Id + ")\" >移动</a>");
     }
     return("");
 }
Пример #12
0
        private void ShowInfo(int _id)
        {
            BLL.contents.article_category   bll   = new BLL.contents.article_category();
            Model.contents.article_category model = bll.GetModel(_id);

            ddlParentId.SelectedValue = model.parent_id.ToString();
            txtSortId.Text            = model.sort_id.ToString();
            if (model.is_lock == 1)
            {
                cbIsLock.Checked = true;
            }
            ddlParentId.Enabled = false;
            if (model.nav_type.Trim() == "WebSite")
            {
                txtTitle.Enabled = false;
                style            = " style=\"display:none\"";
            }

            txtTitle.Text = model.title;
            txtName.Text  = model.call_index;
            txtName.Attributes.Add("ajaxurl", "../../ashx/admin_ajax.ashx?action=navigation_validate&old_name=" + Utils.UrlEncode(model.call_index));
            txtName.Focus(); //设置焦点,防止JS无法提交
            txtLinkUrl.Text = model.link_url;
            txtRemark.Text  = model.content;
            //赋值操作权限类型
            string[] actionTypeArr = model.action_type.Split(',');
            for (int i = 0; i < cblActionType.Items.Count; i++)
            {
                for (int n = 0; n < actionTypeArr.Length; n++)
                {
                    if (actionTypeArr[n].ToLower() == cblActionType.Items[i].Value.ToLower())
                    {
                        cblActionType.Items[i].Selected = true;
                    }
                }
            }
        }
Пример #13
0
        private void ShowInfo(int _id)
        {
            BLL.contents.article_category bll = new BLL.contents.article_category();
            Model.contents.article_category model = bll.GetModel(_id);

            ddlParentId.SelectedValue = model.parent_id.ToString();
            txtSortId.Text = model.sort_id.ToString();
            if (model.is_lock == 1)
            {
                cbIsLock.Checked = true;
            }     ddlParentId.Enabled = false;
            if (model.nav_type.Trim() == "WebSite")
            {
                txtTitle.Enabled = false;
                style = " style=\"display:none\"";

            }

            txtTitle.Text = model.title;
            txtName.Text = model.call_index;
            txtName.Attributes.Add("ajaxurl", "../../ashx/admin_ajax.ashx?action=navigation_validate&old_name=" + Utils.UrlEncode(model.call_index));
            txtName.Focus(); //设置焦点,防止JS无法提交
            txtLinkUrl.Text = model.link_url;
            txtRemark.Text = model.content;
            //赋值操作权限类型
            string[] actionTypeArr = model.action_type.Split(',');
            for (int i = 0; i < cblActionType.Items.Count; i++)
            {
                for (int n = 0; n < actionTypeArr.Length; n++)
                {
                    if (actionTypeArr[n].ToLower() == cblActionType.Items[i].Value.ToLower())
                    {
                        cblActionType.Items[i].Selected = true;
                    }
                }
            }
        }
Пример #14
0
        private bool DoEdit(int _id)
        {
            try
            {
                BLL.contents.article_category bll = new BLL.contents.article_category();
                Model.contents.article_category model = bll.GetModel(_id);

                int parentId = int.Parse(ddlParentId.SelectedValue);
                model.channel_id = this.channel_id;
                model.call_index = txtCallIndex.Text.Trim();
                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.content = txtContent.Value;
                model.model_id = int.Parse(rblStatus.SelectedValue);
                model.is_add_category = 0;
                model.is_add_content = 0;
                model.is_show_top = 0;
                model.is_show_foot = 0;
                if (cblItem.Items[0].Selected == true)
                {
                    model.is_add_category = 1;
                }
                if (cblItem.Items[1].Selected == true)
                {
                    model.is_add_content = 1;
                }
                if (cblItem.Items[2].Selected == true)
                {
                    model.is_show_top = 1;
                }
                if (cblItem.Items[3].Selected == true)
                {
                    model.is_show_foot = 1;
                }
                if (cbIsAlbums.Checked == true)
                {
                    model.is_albums = 1;
                }
                if (cbIsAttach.Checked == true)
                {
                    model.is_attach = 1;
                }
                model.page_size = Utils.StrToInt(txtPageSize.Text.Trim(), 10);
                //添加频道扩展字段
                List<Model.contents.category_field> ls = new List<Model.contents.category_field>();
                for (int i = 0; i < cblAttributeField.Items.Count; i++)
                {
                    if (cblAttributeField.Items[i].Selected)
                    {
                        ls.Add(new Model.contents.category_field { category_id = model.id, field_id = Utils.StrToInt(cblAttributeField.Items[i].Value, 0) });
                    }
                }
                model.category_fields = ls;
                if (bll.Update(model))
                {
                    AddAdminLog(OSEnums.ActionEnum.Edit.ToString(), "修改" + this.channel_name + "频道栏目分类:" + model.title); //记录日志
                    return true;
                }
            }
            catch
            {
                return false;
            }
            return false;
        }
Пример #15
0
        private void ShowInfo(int _id)
        {
            BLL.contents.article_category bll = new BLL.contents.article_category();
            Model.contents.article_category model = bll.GetModel(_id);

            ddlParentId.SelectedValue = model.parent_id.ToString();
            txtCallIndex.Text = model.call_index;
            txtCallIndex.Attributes.Add("ajaxurl", "../../ashx/admin_ajax.ashx?action=navigation_validate&old_name=" + Utils.UrlEncode(model.call_index));
            txtCallIndex.Focus(); //设置焦点,防止JS无法提交
            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;
            txtContent.Value = model.content;
            rblStatus.SelectedValue = model.model_id.ToString();
            if (model.is_add_category == 1)
            {
                cblItem.Items[0].Selected = true;
            }
            if (model.is_add_content == 1)
            {
                cblItem.Items[1].Selected = true;
            }
            if (model.is_show_top == 1)
            {
                cblItem.Items[2].Selected = true;
            }
            if (model.is_show_foot == 1)
            {
                cblItem.Items[3].Selected = true;
            }
            if (model.is_albums == 1)
            {
                cbIsAlbums.Checked = true;
            }
            if (model.is_attach == 1)
            {
                cbIsAttach.Checked = true;
            }
            txtPageSize.Text = model.page_size.ToString();
            //赋值扩展字段
            if (model.category_fields != null)
            {
                for (int i = 0; i < cblAttributeField.Items.Count; i++)
                {
                    Model.contents.category_field modelt = model.category_fields.Find(p => p.field_id == int.Parse(cblAttributeField.Items[i].Value)); //查找对应的字段ID
                    if (modelt != null)
                    {
                        cblAttributeField.Items[i].Selected = true;
                    }
                }
            }
        }
Пример #16
0
        private bool DoEdit(int _id)
        {
            try
            {
                BLL.contents.article_category   bll   = new BLL.contents.article_category();
                Model.contents.article_category model = bll.GetModel(_id);

                int parentId = int.Parse(ddlParentId.SelectedValue);
                model.channel_id = this.channel_id;
                model.call_index = txtCallIndex.Text.Trim();
                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.content         = txtContent.Value;
                model.model_id        = int.Parse(rblStatus.SelectedValue);
                model.is_add_category = 0;
                model.is_add_content  = 0;
                model.is_show_top     = 0;
                model.is_show_foot    = 0;
                if (cblItem.Items[0].Selected == true)
                {
                    model.is_add_category = 1;
                }
                if (cblItem.Items[1].Selected == true)
                {
                    model.is_add_content = 1;
                }
                if (cblItem.Items[2].Selected == true)
                {
                    model.is_show_top = 1;
                }
                if (cblItem.Items[3].Selected == true)
                {
                    model.is_show_foot = 1;
                }
                if (cbIsAlbums.Checked == true)
                {
                    model.is_albums = 1;
                }
                if (cbIsAttach.Checked == true)
                {
                    model.is_attach = 1;
                }
                model.page_size = Utils.StrToInt(txtPageSize.Text.Trim(), 10);
                //添加频道扩展字段
                List <Model.contents.category_field> ls = new List <Model.contents.category_field>();
                for (int i = 0; i < cblAttributeField.Items.Count; i++)
                {
                    if (cblAttributeField.Items[i].Selected)
                    {
                        ls.Add(new Model.contents.category_field {
                            category_id = model.id, field_id = Utils.StrToInt(cblAttributeField.Items[i].Value, 0)
                        });
                    }
                }
                model.category_fields = ls;
                if (bll.Update(model))
                {
                    AddAdminLog(OSEnums.ActionEnum.Edit.ToString(), "修改" + this.channel_name + "频道栏目分类:" + model.title); //记录日志
                    return(true);
                }
            }
            catch
            {
                return(false);
            }
            return(false);
        }
Пример #17
0
 /// <summary>
 /// 栏目URL
 public string Url(int category_id)
 {
     string _url = string.Empty;
     BLL.contents.article_category bll = new BLL.contents.article_category();
     DataTable dt = bll.GetList(0, "class_list like '%," + category_id + ",%'", "class_layer desc, sort_id asc,id desc").Tables[0];
     if (dt.Rows.Count > 0 && dt.Rows != null)
     {
         if (!string.IsNullOrEmpty(dt.Rows[0]["link_url"].ToString()))
         {
             _url = dt.Rows[0]["link_url"].ToString();
         }
         else
         {
             if (bll.GetModel(category_id).model_id != 0)
             {
                 string _key1 = BasePage.pageUrl(bll.GetModel(category_id).model_id);
                 _url = new BasePage().linkurl(_key1, category_id);
             }
             else
             {
                 string _key = BasePage.pageUrl(Convert.ToInt32(dt.Rows[0]["model_id"]));
                 string _category_id = dt.Rows[0]["id"].ToString();
                 _url = new BasePage().linkurl(_key, _category_id);
             }
         }
     }
     return _url.ToString();
 }
Пример #18
0
        private bool DoEdit(int _id)
        {
            try
            {
                BLL.contents.article_category bll = new BLL.contents.article_category();
                Model.contents.article_category model = bll.GetModel(_id);

                model.title = txtTitle.Text.Trim();
                model.sort_id = int.Parse(txtSortId.Text.Trim());
                model.is_lock = 0;
                model.call_index = txtName.Text.Trim();
                if (cbIsLock.Checked == true)
                {
                    model.is_lock = 1;
                }

                if (model.is_sys == 0)
                {
                    int parentId = int.Parse(ddlParentId.SelectedValue);
                    //如果选择的父ID不是自己,则更改
                    if (parentId != model.id)
                    {
                        model.parent_id = parentId;
                    }
                }
                model.link_url = txtLinkUrl.Text.Trim();
                model.content = txtRemark.Text;
                //添加操作权限类型
                string action_type_str = string.Empty;
                for (int i = 0; i < cblActionType.Items.Count; i++)
                {
                    if (cblActionType.Items[i].Selected && Utils.ActionType().ContainsKey(cblActionType.Items[i].Value))
                    {
                        action_type_str += cblActionType.Items[i].Value + ",";
                    }
                }
                model.action_type = Utils.DelLastComma(action_type_str);

                if (bll.Update(model))
                {
                    AddAdminLog(OSEnums.ActionEnum.Add.ToString(), "修改导航信息:" + model.title); //记录日志
                    return true;
                }
            }
            catch
            {
                return false;
            }
            return false;
        }
Пример #19
0
        private void edit_category(HttpContext context)
        {
            //取得管理员登录信息
            Model.managers.manager adminInfo = new Web.UI.ManagePage().GetAdminInfo();
            if (adminInfo == null)
            {
                context.Response.Write("{\"status\": 0, \"msg\": \"未登录或已超时,请重新登录!\"}");
                return;
            }

            int category1 = OSRequest.GetFormInt("Category1");
            int category2 = OSRequest.GetFormInt("Category2");
            if (category1 == category2)
            {
                context.Response.Write("{\"status\": 0, \"msg\": \"移动目录跟目的目录不能相同!\"}");
                return;
            }

            BLL.contents.article_category bll = new BLL.contents.article_category();
            Model.contents.article_category model = bll.GetModel(category2);

            if (model.class_list.IndexOf("," + category1 + ",") > 0)
            {
                context.Response.Write("{\"status\": 0, \"msg\": \"父级本不能向其子级转移!\"}");
                return;
            }

            if (bll.GetModel(category1).parent_id == category2)
            {
                context.Response.Write("{\"status\": 0, \"msg\": \"移动目录已经在目的目录里!\"}");
                return;
            }

            DataTable dt = bll.GetList(0, "class_list like '%," + category1 + ",%'", "class_layer asc").Tables[0];
            if (dt.Rows != null && dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    int id = Convert.ToInt32(dt.Rows[i]["id"]);
                    string class_list = dt.Rows[i]["class_list"].ToString();
                    int new_channel_id = model.channel_id;
                    string new_class_list = model.class_list + class_list.Substring(class_list.IndexOf("," + category1 + ",")).TrimStart(',');
                    string new_class_layer = new_class_list.Trim(',').Split(',').Length.ToString();
                    if (i == 0)
                    {
                        bll.UpdateField(id, "channel_id=" + new_channel_id + ", parent_id=" + category2 + ", class_list='" + new_class_list + "',class_layer=" + new_class_layer);
                    }
                    else
                    {
                        bll.UpdateField(id, "channel_id=" + new_channel_id + ", class_list='" + new_class_list + "',class_layer=" + new_class_layer);
                    }
                }
            }

            new BLL.managers.manager_log().Add(adminInfo.id, adminInfo.user_name, OSEnums.ActionEnum.Edit.ToString(), "移动栏目:" + bll.GetModel(category1).title); //记录日志
            context.Response.Write("{\"status\": 1, \"msg\": \"栏目转移成功!\"}");
        }
Пример #20
0
 /// <summary>
 /// 加载名称+Url
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public static string GetPageNameUrl(int id)
 {
     string rStr = string.Empty;
     BLL.contents.article_category bll = new BLL.contents.article_category();
     Model.contents.article_category model = bll.GetModel(id);
     if (model != null) {
         rStr = "<a href=\"" + model.link_url + "\">" + model.title + "</a>";
     }
     return rStr;
 }