예제 #1
0
 //删除导航
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     ChkAdminLevel(LevelName, MXEnums.ActionEnum.Delete.ToString()); //检查权限
     BLL.Section   bll   = new BLL.Section();
     Model.Section model = new Model.Section();
     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)
         {
             model.Id       = id;
             model.IsDelete = 1;
             bll.Update(model);
         }
     }
     AddAdminLog(MXEnums.ActionEnum.Delete.ToString(), "删除部门信息"); //记录日志
     JscriptMsg("删除数据成功!", backUrl, "Success", "parent.loadMenuTree");
 }
예제 #2
0
 //保存排序
 protected void btnSave_Click(object sender, EventArgs e)
 {
     ChkAdminLevel(LevelName, MXEnums.ActionEnum.Edit.ToString()); //检查权限
     Model.Section model = new Model.Section();
     BLL.Section   bll   = new BLL.Section();
     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;
         }
         model.Id   = id;
         model.Sort = sortId;
         bll.Update(model);
     }
     AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "保存区域排序"); //记录日志
     JscriptMsg("保存排序成功!", ThisUrl, "Success");
 }
예제 #3
0
        private bool DoEdit(int _id)
        {
            try
            {
                BLL.Section   bll   = new BLL.Section();
                Model.Section model = new Model.Section();
                model.Id   = _id;
                model.Name = txtName.Text.Trim();
                model.Sort = int.Parse(txtSortId.Text.Trim());

                model.Ext1 = txtRemark.Text.Trim();

                int parentId = int.Parse(ddlParentId.SelectedValue);
                //如果选择的父ID不是自己,则更改
                if (parentId != model.Id)
                {
                    model.ParentId = parentId;
                    model.LevelNum = 1;
                    if (parentId != 0)
                    {
                        Model.Section ParModel = bll.GetModel(parentId);
                        if (ParModel != null)
                        {
                            model.LevelNum = ParModel.LevelNum + 1;
                        }
                    }
                }
                if (bll.Update(model))
                {
                    AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "修改部门信息:" + model.Name); //记录日志
                    return(true);
                }
            }
            catch
            {
                return(false);
            }
            return(false);
        }