Beispiel #1
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\": \"栏目转移成功!\"}");
        }
Beispiel #2
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("参数错误");
                        }
                    }
                }
            }
        }
Beispiel #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("参数错误");
                 }
             }
         }
     }
 }
Beispiel #4
0
 //保存排序
 protected void btnSave_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("app_navigation_list", OSEnums.ActionEnum.Edit.ToString()); //检查权限
     BLL.contents.article_category bll = new BLL.contents.article_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(OSEnums.ActionEnum.Edit.ToString(), "保存导航排序"); //记录日志
     Response.Redirect("nav_list.aspx");
 }
Beispiel #5
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\": \"栏目转移成功!\"}");
        }