Esempio n. 1
0
 //批量删除
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("manager_role", DTEnums.ActionEnum.Delete.ToString()); //检查权限
     int sucCount = 0; //成功数量
     int errorCount = 0; //失败数量
     BLL.manager_role bll = new BLL.manager_role();
     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.Delete(id))
             {
                 sucCount++;
             }
             else
             {
                 errorCount++;
             }
         }
     }
     AddAdminLog(DTEnums.ActionEnum.Delete.ToString(), "删除管理角色" + sucCount + "条,失败" + errorCount + "条"); //记录日志
     JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("role_list.aspx", "keywords={0}", this.keywords), "Success");
 }
Esempio n. 2
0
        private void get_navigation_list(HttpContext context)
        {
            string navtype = DTRequest.GetQueryString("navtype").ToLower();

            switch (navtype)
            {
            case "users": navtype = DTEnums.NavigationEnum.Users.ToString(); break;

            case "website": navtype = DTEnums.NavigationEnum.WebSite.ToString(); break;

            case "oa": navtype = DTEnums.NavigationEnum.OA.ToString(); break;

            case "dingtalk": navtype = DTEnums.NavigationEnum.DingTalk.ToString(); break;

            default: navtype = DTEnums.NavigationEnum.System.ToString(); break;
            }
            Model.manager adminModel = new ManagePage().GetAdminInfo();//获得当前登录管理员信息
            if (adminModel == null)
            {
                return;
            }
            Model.manager_role roleModel = new BLL.manager_role().GetModel(adminModel.role_id);//获得管理角色信息
            if (roleModel == null)
            {
                return;
            }
            DataTable dt = new BLL.navigation().GetList(0, navtype);

            this.get_navigation_childs(context, dt, 0, roleModel.role_type, roleModel.manager_role_values);
        }
Esempio n. 3
0
 private void RptBind(string _strWhere)
 {
     this.txtKeywords.Text = this.keywords;
     BLL.manager_role bll = new BLL.manager_role();
     this.rptList.DataSource = bll.GetList(_strWhere);
     this.rptList.DataBind();
 }
Esempio n. 4
0
 private void RptBind(string _strWhere)
 {
     this.txtKeywords.Text = this.keywords;
     BLL.manager_role bll = new BLL.manager_role();
     this.rptList.DataSource = bll.GetList(_strWhere);
     this.rptList.DataBind();
 }
Esempio n. 5
0
        private void RoleBind(DropDownList ddl, int role_type)
        {
            BLL.manager_role bll = new BLL.manager_role();
            DataTable        dt  = bll.GetList("").Tables[0];

            ddl.Items.Clear();
            ddl.Items.Add(new ListItem("请选择角色...", ""));
            foreach (DataRow dr in dt.Rows)
            {
                if (Convert.ToInt32(dr["role_type"]) >= role_type)
                {
                    ddl.Items.Add(new ListItem(dr["role_name"].ToString(), dr["id"].ToString()));
                }
            }

            BLL.village villageBll = new BLL.village();
            DataTable   dtVillage  = villageBll.GetParentList(0);

            ddlTown.Items.Clear();
            ddlTown.Items.Add(new ListItem("请选择所属乡镇", "0"));
            foreach (DataRow dr in dtVillage.Rows)
            {
                string Id    = dr["id"].ToString();
                string Title = dr["name"].ToString().Trim();
                ddlTown.Items.Add(new ListItem(Title, Id));
            }
        }
Esempio n. 6
0
 private void ShowInfo(int _id)
 {
     BLL.manager_role   bll   = new BLL.manager_role();
     Model.manager_role model = bll.GetModel(_id);
     txtRoleName.Text          = model.role_name;
     ddlRoleType.SelectedValue = model.role_type.ToString();
     //管理菜单
     if (model.manager_role_values != null)
     {
         for (int i = 0; i < rptList.Items.Count; i++)
         {
             string       navName       = ((HiddenField)rptList.Items[i].FindControl("hidName")).Value;
             CheckBoxList cblActionType = (CheckBoxList)rptList.Items[i].FindControl("cblActionType");
             for (int n = 0; n < cblActionType.Items.Count; n++)
             {
                 Model.manager_role_value modelt = model.manager_role_values.Find(p => p.nav_name == navName && p.action_type == cblActionType.Items[n].Value);
                 if (modelt != null)
                 {
                     cblActionType.Items[n].Selected = true;
                 }
             }
         }
     }
     //管理权限
     if (model.RolePemissionList != null)
     {
         hCodeStr.Value           = "," + string.Join(",", model.RolePemissionList.ConvertAll(u => u.urp_code).ToArray()) + ",";
         rptPermission.DataSource = model.RolePemissionList;
         rptPermission.DataBind();
     }
 }
Esempio n. 7
0
        //批量删除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("manager_role", DTEnums.ActionEnum.Delete.ToString()); //检查权限
            int sucCount   = 0;                                                  //成功数量
            int errorCount = 0;                                                  //失败数量

            BLL.manager_role bll = new BLL.manager_role();
            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.Delete(id))
                    {
                        sucCount++;
                    }
                    else
                    {
                        errorCount++;
                    }
                }
            }
            AddAdminLog(DTEnums.ActionEnum.Delete.ToString(), "删除管理角色" + sucCount + "条,失败" + errorCount + "条"); //记录日志
            JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("role_list.aspx", "keywords={0}", this.keywords));
        }
        private bool DoAdd()
        {
            bool result = true;
            Model.manager_role model = new Model.manager_role();
            BLL.manager_role bll = new BLL.manager_role();

            model.role_name = txtRoleName.Text.Trim();
            model.role_type = int.Parse(ddlRoleType.SelectedValue);

            List<Model.manager_role_value> ls = new List<Model.manager_role_value>();
            //基本设置
            for (int i = 0; i < rptList1.Items.Count; i++)
            {
                HiddenField hidNavName = rptList1.Items[i].FindControl("hidName") as HiddenField;
                HtmlInputCheckBox hcbNavValue = rptList1.Items[i].FindControl("cblNavName") as HtmlInputCheckBox;
                if (hidNavName != null && hcbNavValue!=null)
                {
                    if (hcbNavValue.Checked == true)
                    {
                        ls.Add(new Model.manager_role_value { channel_id = 0, channel_name = hidNavName.Value, action_type = hcbNavValue.Value });
                    }
                }
            }
            //频道设置
            for (int i = 0; i < rptList3.Items.Count; i++)
            {
                int channelId = Convert.ToInt32(((HiddenField)rptList3.Items[i].FindControl("hidChannelId")).Value);
                HtmlInputCheckBox hcbView = rptList3.Items[i].FindControl("cbView") as HtmlInputCheckBox;
                HtmlInputCheckBox hcbAdd = rptList3.Items[i].FindControl("cbAdd") as HtmlInputCheckBox;
                HtmlInputCheckBox hcbEdit = rptList3.Items[i].FindControl("cbEdit") as HtmlInputCheckBox;
                HtmlInputCheckBox hcbDelete = rptList3.Items[i].FindControl("cbDelete") as HtmlInputCheckBox;
                if (hcbView != null && hcbView.Checked == true)
                {
                    ls.Add(new Model.manager_role_value { channel_id = channelId, channel_name = "channel", action_type = ActionEnum.View.ToString() });
                }
                if (hcbAdd != null && hcbAdd.Checked == true)
                {
                    ls.Add(new Model.manager_role_value { channel_id = channelId, channel_name = "channel", action_type = ActionEnum.Add.ToString() });
                }
                if (hcbEdit != null && hcbEdit.Checked == true)
                {
                    ls.Add(new Model.manager_role_value { channel_id = channelId, channel_name = "channel", action_type = ActionEnum.Edit.ToString() });
                }
                if (hcbDelete != null && hcbDelete.Checked == true)
                {
                    ls.Add(new Model.manager_role_value { channel_id = channelId, channel_name = "channel", action_type = ActionEnum.Delete.ToString() });
                }
            }

            model.manager_role_values = ls;
            if (bll.Add(model) < 1)
            {
                result = false;
            }
            return result;
        }
 private void ShowInfo(int _id)
 {
     BLL.manager_role   bll   = new BLL.manager_role();
     Model.manager_role model = bll.GetModel(_id);
     txtRoleName.Text          = model.role_name;
     ddlRoleType.SelectedValue = model.role_type.ToString();
     //基本设置
     for (int i = 0; i < rptList1.Items.Count; i++)
     {
         string navName  = ((HiddenField)rptList1.Items[i].FindControl("hidName")).Value;
         string navValue = ((HtmlInputCheckBox)rptList1.Items[i].FindControl("cblNavName")).Value;
         if (model.manager_role_values != null)
         {
             Model.manager_role_value modelt = model.manager_role_values.Find(p => p.channel_name == navName && p.action_type == navValue);
             if (modelt != null)
             {
                 ((HiddenField)rptList1.Items[i].FindControl("hidId")).Value = modelt.id.ToString();
                 ((HtmlInputCheckBox)rptList1.Items[i].FindControl("cblNavName")).Checked = true;
             }
         }
     }
     //频道设置
     for (int i = 0; i < rptList3.Items.Count; i++)
     {
         int channelId = Convert.ToInt32(((HiddenField)rptList3.Items[i].FindControl("hidChannelId")).Value);
         if (model.manager_role_values != null)
         {
             Model.manager_role_value modelt1 = model.manager_role_values.Find(p => p.channel_id == channelId && p.action_type == ActionEnum.View.ToString());
             if (modelt1 != null)
             {
                 ((HiddenField)rptList3.Items[i].FindControl("hidViewId")).Value      = modelt1.id.ToString();
                 ((HtmlInputCheckBox)rptList3.Items[i].FindControl("cbView")).Checked = true;
             }
             Model.manager_role_value modelt2 = model.manager_role_values.Find(p => p.channel_id == channelId && p.action_type == ActionEnum.Add.ToString());
             if (modelt2 != null)
             {
                 ((HiddenField)rptList3.Items[i].FindControl("hidAddId")).Value      = modelt2.id.ToString();
                 ((HtmlInputCheckBox)rptList3.Items[i].FindControl("cbAdd")).Checked = true;
             }
             Model.manager_role_value modelt3 = model.manager_role_values.Find(p => p.channel_id == channelId && p.action_type == ActionEnum.Edit.ToString());
             if (modelt3 != null)
             {
                 ((HiddenField)rptList3.Items[i].FindControl("hidEditId")).Value      = modelt3.id.ToString();
                 ((HtmlInputCheckBox)rptList3.Items[i].FindControl("cbEdit")).Checked = true;
             }
             Model.manager_role_value modelt4 = model.manager_role_values.Find(p => p.channel_id == channelId && p.action_type == ActionEnum.Delete.ToString());
             if (modelt4 != null)
             {
                 ((HiddenField)rptList3.Items[i].FindControl("hidDeleteId")).Value      = modelt4.id.ToString();
                 ((HtmlInputCheckBox)rptList3.Items[i].FindControl("cbDelete")).Checked = true;
             }
         }
     }
 }
Esempio n. 10
0
        private string DoAdd()
        {
            Model.manager_role model = new Model.manager_role();
            BLL.manager_role   bll   = new BLL.manager_role();

            model.role_name = txtRoleName.Text.Trim();
            model.role_type = int.Parse(ddlRoleType.SelectedValue);

            //管理权限
            if (!string.IsNullOrEmpty(hCodeStr.Value))
            {
                string[] codelist = hCodeStr.Value.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                List <Model.userRolePemission> ps = new List <Model.userRolePemission>();
                foreach (string item in codelist)
                {
                    ps.Add(new Model.userRolePemission()
                    {
                        urp_type = 2, urp_code = item
                    });
                }
                model.RolePemissionList = ps;
                if (model.RolePemissionList.FindAll(p => p.urp_code == "0603" || p.urp_code == "0402" || p.urp_code == "0601").Count > 1)
                {
                    return("同一个角色不能同时开通区域审批权(0603)、财务部审批(0402)、总经理审批(0601)中的两个权限");
                }
            }

            //管理菜单
            List <Model.manager_role_value> ls = new List <Model.manager_role_value>();

            for (int i = 0; i < rptList.Items.Count; i++)
            {
                string       navName       = ((HiddenField)rptList.Items[i].FindControl("hidName")).Value;
                CheckBoxList cblActionType = (CheckBoxList)rptList.Items[i].FindControl("cblActionType");
                for (int n = 0; n < cblActionType.Items.Count; n++)
                {
                    if (cblActionType.Items[n].Selected == true)
                    {
                        ls.Add(new Model.manager_role_value {
                            nav_name = navName, action_type = cblActionType.Items[n].Value
                        });
                    }
                }
            }
            model.manager_role_values = ls;

            if (bll.Add(model) > 0)
            {
                AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加管理角色:" + model.role_name); //记录日志
                return("");
            }
            return("添加失败");
        }
Esempio n. 11
0
        public bool ChkAuthority(string nav_name, string action_type)
        {
            Model.manager    model  = GetAdminInfo();
            BLL.manager_role bll    = new BLL.manager_role();
            bool             result = bll.Exists(model.role_id, nav_name, action_type);

            if (result)
            {
                return(true);
            }
            return(false);
        }
Esempio n. 12
0
        private void RoleBind()
        {
            BLL.manager_role bll = new BLL.manager_role();
            DataTable dt = new DataTable();
            dt = bll.GetList("id in(21,22) ").Tables[0];

            ddlRoleId.Items.Clear();
            ddlRoleId.Items.Add(new ListItem("请选择角色...", ""));
            foreach (DataRow dr in dt.Rows)
            {
                ddlRoleId.Items.Add(new ListItem(dr["role_name"].ToString(), dr["id"].ToString()));
            }
        }
Esempio n. 13
0
        /// <summary>
        /// 检查管理员权限
        /// </summary>
        /// <param name="nav_name">菜单名称</param>
        /// <param name="action_type">操作类型</param>
        public void ChkAdminLevel(string nav_name, string action_type)
        {
            Model.xiehui     model  = GetAdminInfo();
            BLL.manager_role bll    = new BLL.manager_role();
            bool             result = bll.Exists(model.role_id, nav_name, action_type);

            if (!result)
            {
                string msgbox = "parent.jsdialog(\"错误提示\", \"您没有管理该页面的权限,请勿非法进入!\", \"back\")";
                Response.Write("<script type=\"text/javascript\">" + msgbox + "</script>");
                Response.End();
            }
        }
Esempio n. 14
0
 /// <summary>
 /// 检查管理员权限
 /// </summary>
 /// <param name="channel_name">栏目名称</param>
 /// <param name="action_type">操作类型</param>
 public void ChkAdminLevel(string channel_name, string action_type)
 {
     Model.manager model = GetAdminInfo();
     BLL.manager_role bll = new BLL.manager_role();
     bool result = bll.Exists(model.role_id, channel_name, action_type);
     if (!result)
     {
         string msbox = "parent.f_errorTab(\"错误提示\", \"您没有管理该页面的权限,请勿尝试非法进入!\")";
         //ClientScript.RegisterClientScriptBlock(Page.GetType(), "JsPrint", msbox.ToString(), true);  //修正BUG
         Response.Write("<script type=\"text/javascript\">" + msbox + "</script>");
         Response.End();
     }
 }
Esempio n. 15
0
        public void ChkAdminLevelEdit(string nav_name, string action_type)
        {
            Model.manager    model  = GetAdminInfo();
            BLL.manager_role bll    = new BLL.manager_role();
            bool             result = bll.Exists(model.role_id, nav_name, action_type);

            if (!result)
            {
                string msgbox = "parent.jsdialog(\"錯誤提示\", \"您沒有管理該頁面的操作許可權,無法操作!\", \"back\")";
                Response.Write("<script type=\"text/javascript\">" + msgbox + "</script>");
                Response.End();
            }
        }
Esempio n. 16
0
        /// <summary>
        /// 检查管理员权限
        /// </summary>
        /// <param name="nav_name">菜单名称</param>
        /// <param name="action_type">操作类型</param>
        public void ChkAdminLevel(string nav_name, string action_type)
        {
            Model.manager model = GetAdminInfo();
            BLL.manager_role bll = new BLL.manager_role();
            bool result = bll.Exists(model.role_id, nav_name, action_type);

            if (!result)
            {
                string msgbox = "parent.jsdialog(\"错误提示\", \"您没有管理该页面的权限,请勿非法进入!\", \"back\", \"Error\")";
                Response.Write("<script type=\"text/javascript\">" + msgbox + "</script>");
                Response.End();
            }
        }
Esempio n. 17
0
        /// <summary>
        /// 检查管理员权限
        /// </summary>
        /// <param name="channel_id">频道ID</param>
        /// <param name="action_type">操作类型</param>
        public void ChkAdminLevel(int channel_id, string action_type)
        {
            Model.manager    model  = GetAdminInfo();
            BLL.manager_role bll    = new BLL.manager_role();
            bool             result = bll.Exists(model.role_id, channel_id, action_type);

            if (!result)
            {
                string msbox = "parent.f_errorTab(\"错误提示\", \"您没有管理该页面的权限,请勿尝试非法进入!\")";
                //ClientScript.RegisterClientScriptBlock(Page.GetType(), "JsPrint", msbox.ToString(), true);  //修正BUG
                Response.Write("<script type=\"text/javascript\">" + msbox + "</script>");
                Response.End();
            }
        }
Esempio n. 18
0
        /// <summary>
        /// 檢查管理員許可權
        /// </summary>
        /// <param name="nav_name">菜單名稱</param>
        /// <param name="action_type">操作類型</param>
        public bool ChkAdminLevel(string nav_name, string action_type)
        {
            Model.manager    model  = GetAdminInfo();
            BLL.manager_role bll    = new BLL.manager_role();
            bool             result = bll.Exists(model.role_id, nav_name, action_type);

            return(result);
            //if (!result)
            //{
            //    string msgbox = "parent.jsdialog(\"錯誤提示\", \"您沒有管理該頁面的許可權,無法進入!\", \"back\")";
            //    Response.Write("<script type=\"text/javascript\">" + msgbox + "</script>");
            //    Response.End();
            //}
        }
Esempio n. 19
0
        private void RoleBind()
        {
            BLL.manager_role bll = new BLL.manager_role();
            DataTable        dt  = new DataTable();

            dt = bll.GetList("id in(21,22) ").Tables[0];

            ddlRoleId.Items.Clear();
            ddlRoleId.Items.Add(new ListItem("请选择角色...", ""));
            foreach (DataRow dr in dt.Rows)
            {
                ddlRoleId.Items.Add(new ListItem(dr["role_name"].ToString(), dr["id"].ToString()));
            }
        }
Esempio n. 20
0
        private void RoleBind(DropDownList ddl, int role_type)
        {
            BLL.manager_role bll = new BLL.manager_role();
            DataTable dt = bll.GetList("").Tables[0];

            ddl.Items.Clear();
            ddl.Items.Add(new ListItem("请选择角色...", ""));
            foreach (DataRow dr in dt.Rows)
            {
                if (Convert.ToInt32(dr["role_type"]) >= role_type)
                {
                    ddl.Items.Add(new ListItem(dr["role_name"].ToString(), dr["id"].ToString()));
                }
            }
        }
Esempio n. 21
0
        private void RoleBind(DropDownList ddl, int role_type)
        {
            BLL.manager_role bll = new BLL.manager_role();
            DataTable        dt  = bll.GetList("").Tables[0];

            ddl.Items.Clear();
            ddl.Items.Add(new ListItem("请选择角色...", ""));
            foreach (DataRow dr in dt.Rows)
            {
                if (Convert.ToInt32(dr["role_type"]) >= role_type)
                {
                    ddl.Items.Add(new ListItem(dr["role_name"].ToString(), dr["id"].ToString()));
                }
            }
        }
Esempio n. 22
0
 //删除操作
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("sys_role", DTEnums.ActionEnum.Delete.ToString()); //检查权限
     BLL.manager_role bll = new BLL.manager_role();
     //批量删除
     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)
         {
             bll.Delete(id);
         }
     }
     JscriptMsg("批量删除成功啦!", Utils.CombUrlTxt("role_list.aspx", "keywords={0}", this.keywords), "Success");
 }
Esempio n. 23
0
 //删除操作
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("sys_role", DTEnums.ActionEnum.Delete.ToString()); //检查权限
     BLL.manager_role bll = new BLL.manager_role();
     //批量删除
     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)
         {
             bll.Delete(id);
         }
     }
     JscriptMsg("批量删除成功啦!", Utils.CombUrlTxt("role_list.aspx", "keywords={0}", this.keywords), "Success");
 }
Esempio n. 24
0
        private void get_navigation_list(HttpContext context)
        {
            Model.dt_manager adminModel = new ManagePage().GetAdminInfo(); //获得当前登录管理员信息
            if (adminModel == null)
            {
                return;
            }
            Model.manager_role roleModel = new BLL.manager_role().GetModel(adminModel.role_id); //获得管理角色信息
            if (roleModel == null)
            {
                return;
            }
            DataTable dt = new BLL.navigation().GetDataList(0, MXEnums.NavigationEnum.System.ToString());

            this.get_navigation_childs(context, dt, 0, "", roleModel.role_type, roleModel.manager_role_values);
        }
Esempio n. 25
0
        /// <summary>
        /// 检查管理员权限
        /// </summary>
        /// <param name="nav_name">菜单名称</param>
        /// <param name="action_type">操作类型</param>
        public void ChkAdminLevel(string nav_name, string action_type)
        {
            int i;

            if (Int32.TryParse(action_type, out i))
            {
                action_type = Enum.GetName(typeof(DTEnums.ActionEnum), i);
            }
            Model.manager    model  = GetAdminInfo();
            BLL.manager_role bll    = new BLL.manager_role();
            bool             result = bll.Exists(model.role_id, nav_name, action_type);

            if (!result)
            {
                string msgbox = "parent.jsdialog(\"错误提示\", \"您没有管理该页面的权限,请勿非法进入!\", \"back\")";
                Response.Write("<script type=\"text/javascript\">" + msgbox + "</script>");
                Response.End();
            }
        }
Esempio n. 26
0
        private void RoleBind(DropDownList ddl, int managerId)
        {
            BLL.manager_role bll = new BLL.manager_role();
            //   DataTable dt = bll.GetList("agentId=" + managerId).Tables[0];
            DataTable dt = new DataTable();

            if (isAgent)
            {
                dt = bll.GetList("id!=1 and id!=3 ").Tables[0];
            }
            else
            {
                dt = bll.GetList("agentId=" + managerId).Tables[0];
            }

            ddl.Items.Clear();
            ddl.Items.Add(new ListItem("请选择角色...", ""));
            foreach (DataRow dr in dt.Rows)
            {
                ddl.Items.Add(new ListItem(dr["role_name"].ToString(), dr["id"].ToString()));
            }
        }
Esempio n. 27
0
        private bool DoAdd()
        {
            bool result = false;

            Model.manager_role model = new Model.manager_role();
            BLL.manager_role   bll   = new BLL.manager_role();

            model.role_name = txtRoleName.Text.Trim();
            model.role_type = int.Parse(ddlRoleType.SelectedValue);

            //管理許可權
            List <Model.manager_role_value> ls = new List <Model.manager_role_value>();

            for (int i = 0; i < rptList.Items.Count; i++)
            {
                string       navName       = ((HiddenField)rptList.Items[i].FindControl("hidName")).Value;
                CheckBoxList cblActionType = (CheckBoxList)rptList.Items[i].FindControl("cblActionType");
                for (int n = 0; n < cblActionType.Items.Count; n++)
                {
                    if (cblActionType.Items[n].Selected == true)
                    {
                        ls.Add(new Model.manager_role_value {
                            nav_name = navName, action_type = cblActionType.Items[n].Value
                        });
                    }
                }
            }
            model.manager_role_values = ls;

            if (bll.Add(model) > 0)
            {
                AddAdminLog(TWEnums.ActionEnum.Add.ToString(), "添加管理角色:" + model.role_name); //記錄日誌
                result = true;
            }
            return(result);
        }
Esempio n. 28
0
 private void ShowInfo(int _id)
 {
     BLL.manager_role bll = new BLL.manager_role();
     Model.manager_role model = bll.GetModel(_id);
     txtRoleName.Text = model.role_name;
     ddlRoleType.SelectedValue = model.role_type.ToString();
     //管理权限
     if (model.manager_role_values != null)
     {
         for (int i = 0; i < rptList.Items.Count; i++)
         {
             string navName = ((HiddenField)rptList.Items[i].FindControl("hidName")).Value;
             CheckBoxList cblActionType = (CheckBoxList)rptList.Items[i].FindControl("cblActionType");
             for (int n = 0; n < cblActionType.Items.Count; n++)
             {
                 Model.manager_role_value modelt = model.manager_role_values.Find(p => p.nav_name == navName && p.action_type == cblActionType.Items[n].Value);
                 if (modelt != null)
                 {
                     cblActionType.Items[n].Selected = true;
                 }
             }
         }
     }
 }
Esempio n. 29
0
        private bool DoEdit(int _id)
        {
            bool result = false;

            BLL.manager_role   bll   = new BLL.manager_role();
            Model.manager_role model = bll.GetModel(_id);

            model.role_name = txtRoleName.Text.Trim();
            model.role_type = int.Parse(ddlRoleType.SelectedValue);

            //管理权限
            List <Model.manager_role_value> ls = new List <Model.manager_role_value>();

            for (int i = 0; i < rptList.Items.Count; i++)
            {
                string       navName       = ((HiddenField)rptList.Items[i].FindControl("hidName")).Value;
                CheckBoxList cblActionType = (CheckBoxList)rptList.Items[i].FindControl("cblActionType");
                for (int n = 0; n < cblActionType.Items.Count; n++)
                {
                    if (cblActionType.Items[n].Selected == true)
                    {
                        ls.Add(new Model.manager_role_value {
                            role_id = _id, nav_name = navName, action_type = cblActionType.Items[n].Value
                        });
                    }
                }
            }
            model.manager_role_values = ls;

            if (bll.Update(model))
            {
                AddAdminLog(AXEnums.ActionEnum.Edit.ToString(), "修改管理角色:" + model.role_name); //记录日志
                result = true;
            }
            return(result);
        }
Esempio n. 30
0
 private void ShowInfo(int _id)
 {
     BLL.manager_role   bll   = new BLL.manager_role();
     Model.manager_role model = bll.GetModel(_id);
     txtRoleName.Text          = model.role_name;
     ddlRoleType.SelectedValue = model.role_type.ToString();
     //管理权限
     if (model.manager_role_values != null)
     {
         for (int i = 0; i < rptList.Items.Count; i++)
         {
             string       navName       = ((HiddenField)rptList.Items[i].FindControl("hidName")).Value;
             CheckBoxList cblActionType = (CheckBoxList)rptList.Items[i].FindControl("cblActionType");
             for (int n = 0; n < cblActionType.Items.Count; n++)
             {
                 Model.manager_role_value modelt = model.manager_role_values.Find(p => p.nav_name == navName && p.action_type == cblActionType.Items[n].Value);
                 if (modelt != null)
                 {
                     cblActionType.Items[n].Selected = true;
                 }
             }
         }
     }
 }
Esempio n. 31
0
 private void ShowInfo(int _id)
 {
     BLL.manager_role bll = new BLL.manager_role();
     Model.manager_role model = bll.GetModel(_id);
     txtRoleName.Text = model.role_name;
     ddlRoleType.SelectedValue = model.role_type.ToString();
     //基本设置
     for (int i = 0; i < rptList1.Items.Count; i++)
     {
         string navName = ((HiddenField)rptList1.Items[i].FindControl("hidName")).Value;
         string navValue = ((HtmlInputCheckBox)rptList1.Items[i].FindControl("cblNavName")).Value;
         if (model.manager_role_values != null)
         {
             Model.manager_role_value modelt = model.manager_role_values.Find(p => p.channel_name == navName && p.action_type == navValue);
             if (modelt != null)
             {
                 ((HiddenField)rptList1.Items[i].FindControl("hidId")).Value = modelt.id.ToString();
                 ((HtmlInputCheckBox)rptList1.Items[i].FindControl("cblNavName")).Checked = true;
             }
         }
     }
     //会员设置
     for (int i = 0; i < rptList2.Items.Count; i++)
     {
         string navName = ((HiddenField)rptList2.Items[i].FindControl("hidName")).Value;
         string navValue = ((HtmlInputCheckBox)rptList2.Items[i].FindControl("cblNavName")).Value;
         if (model.manager_role_values != null)
         {
             Model.manager_role_value modelt = model.manager_role_values.Find(p => p.channel_name == navName && p.action_type == navValue);
             if (modelt != null)
             {
                 ((HiddenField)rptList2.Items[i].FindControl("hidId")).Value = modelt.id.ToString();
                 ((HtmlInputCheckBox)rptList2.Items[i].FindControl("cblNavName")).Checked = true;
             }
         }
     }
     //销售设置
     for (int i = 0; i < rptList21.Items.Count; i++)
     {
         string navName = ((HiddenField)rptList21.Items[i].FindControl("hidName")).Value;
         string navValue = ((HtmlInputCheckBox)rptList21.Items[i].FindControl("cblNavName")).Value;
         if (model.manager_role_values != null)
         {
             Model.manager_role_value modelt = model.manager_role_values.Find(p => p.channel_name == navName && p.action_type == navValue);
             if (modelt != null)
             {
                 ((HiddenField)rptList21.Items[i].FindControl("hidId")).Value = modelt.id.ToString();
                 ((HtmlInputCheckBox)rptList21.Items[i].FindControl("cblNavName")).Checked = true;
             }
         }
     }
     //频道设置
     for (int i = 0; i < rptList3.Items.Count; i++)
     {
         int channelId = Convert.ToInt32(((HiddenField)rptList3.Items[i].FindControl("hidChannelId")).Value);
         if (model.manager_role_values != null)
         {
             Model.manager_role_value modelt1 = model.manager_role_values.Find(p => p.channel_id == channelId && p.action_type == DTEnums.ActionEnum.View.ToString());
             if (modelt1 != null)
             {
                 ((HiddenField)rptList3.Items[i].FindControl("hidViewId")).Value = modelt1.id.ToString();
                 ((HtmlInputCheckBox)rptList3.Items[i].FindControl("cbView")).Checked = true;
             }
             Model.manager_role_value modelt2 = model.manager_role_values.Find(p => p.channel_id == channelId && p.action_type == DTEnums.ActionEnum.Add.ToString());
             if (modelt2 != null)
             {
                 ((HiddenField)rptList3.Items[i].FindControl("hidAddId")).Value = modelt2.id.ToString();
                 ((HtmlInputCheckBox)rptList3.Items[i].FindControl("cbAdd")).Checked = true;
             }
             Model.manager_role_value modelt3 = model.manager_role_values.Find(p => p.channel_id == channelId && p.action_type == DTEnums.ActionEnum.Edit.ToString());
             if (modelt3 != null)
             {
                 ((HiddenField)rptList3.Items[i].FindControl("hidEditId")).Value = modelt3.id.ToString();
                 ((HtmlInputCheckBox)rptList3.Items[i].FindControl("cbEdit")).Checked = true;
             }
             Model.manager_role_value modelt4 = model.manager_role_values.Find(p => p.channel_id == channelId && p.action_type == DTEnums.ActionEnum.Delete.ToString());
             if (modelt4 != null)
             {
                 ((HiddenField)rptList3.Items[i].FindControl("hidDeleteId")).Value = modelt4.id.ToString();
                 ((HtmlInputCheckBox)rptList3.Items[i].FindControl("cbDelete")).Checked = true;
             }
         }
     }
 }
Esempio n. 32
0
 /// <summary>
 /// 检查管理员权限
 /// </summary>
 /// <param name="channel_name">栏目名称</param>
 /// <param name="action_type">操作类型</param>
 /// <returns>bool</returns>
 public bool IsAdminLevel(string channel_name, string action_type)
 {
     Model.manager model = GetAdminInfo();
     BLL.manager_role bll = new BLL.manager_role();
     return bll.Exists(model.role_id, channel_name, action_type);
 }
Esempio n. 33
0
        private void save_Order(HttpContext context)
        {
            string oID           = DTRequest.GetFormString("orderID");
            int    cid           = DTRequest.GetFormInt("hCusId", 0);
            int    coid          = DTRequest.GetFormInt("ddlcontact", 0);
            string contractPrice = DTRequest.GetFormString("ddlcontractPrice");
            string sdate         = DTRequest.GetFormString("txtsDate");
            string edate         = DTRequest.GetFormString("txteDate");
            string address       = DTRequest.GetFormString("txtAddress");
            string content       = DTRequest.GetFormString("txtContent");
            string contract      = DTRequest.GetFormString("txtContract");
            string remark        = DTRequest.GetFormString("txtRemark");
            string place         = DTRequest.GetFormString("hide_place");
            int    fstatus       = DTRequest.GetFormInt("ddlfStatus", 0);
            string employee0     = DTRequest.GetFormString("hide_employee0");
            string employee1     = DTRequest.GetFormString("hide_employee1");
            string employee2     = DTRequest.GetFormString("hide_employee2");
            string employee3     = DTRequest.GetFormString("hide_employee3");
            string employee4     = DTRequest.GetFormString("hide_employee4");
            string pushStatus    = DTRequest.GetFormString("ddlpushStatus");

            Model.Order order = new Model.Order();
            order.o_id              = oID;
            order.o_cid             = cid;
            order.o_coid            = coid;
            order.o_content         = content;
            order.o_address         = address;
            order.o_contractPrice   = contractPrice;
            order.o_contractContent = contract;
            order.o_sdate           = ConvertHelper.toDate(sdate);
            order.o_edate           = ConvertHelper.toDate(edate);
            order.o_place           = place;
            order.o_status          = (byte)fstatus;
            order.o_isPush          = pushStatus == "True" ? true : false;
            order.o_remarks         = remark;
            string[] list = new string[] { }, pli = new string[] { };
            #region  单人
            if (!string.IsNullOrEmpty(employee0))
            {
                pli = employee0.Split('|');
                order.personlist.Add(new Model.OrderPerson()
                {
                    op_type = 1, op_name = pli[0], op_number = pli[1], op_area = pli[2], op_addTime = DateTime.Now
                });
            }
            #endregion
            #region 业务报账员
            if (!string.IsNullOrEmpty(employee1))
            {
                pli = new string[] { };
                pli = employee1.Split('|');
                order.personlist.Add(new Model.OrderPerson()
                {
                    op_type = 2, op_name = pli[0], op_number = pli[1], op_area = pli[2], op_addTime = DateTime.Now
                });
            }
            #endregion
            #region 业务策划人员
            if (!string.IsNullOrEmpty(employee2))
            {
                pli  = new string[] { };
                list = employee2.Split(',');
                foreach (string item in list)
                {
                    pli = item.Split('|');
                    order.personlist.Add(new Model.OrderPerson()
                    {
                        op_type = 3, op_name = pli[0], op_number = pli[1], op_area = pli[2], op_dstatus = Utils.ObjToByte(pli[3]), op_addTime = DateTime.Now
                    });
                }
            }
            #endregion
            #region 业务执行人员
            if (!string.IsNullOrEmpty(employee3))
            {
                list = new string[] { };
                pli  = new string[] { };
                list = employee3.Split(',');
                foreach (string item in list)
                {
                    pli = item.Split('|');
                    order.personlist.Add(new Model.OrderPerson()
                    {
                        op_type = 4, op_name = pli[0], op_number = pli[1], op_area = pli[2], op_addTime = DateTime.Now
                    });
                }
            }
            #endregion
            #region 业务设计人员
            if (!string.IsNullOrEmpty(employee4))
            {
                pli  = new string[] { };
                list = employee4.Split(',');
                foreach (string item in list)
                {
                    pli = item.Split('|');
                    order.personlist.Add(new Model.OrderPerson()
                    {
                        op_type = 5, op_name = pli[0], op_number = pli[1], op_area = pli[2], op_dstatus = Utils.ObjToByte(pli[3]), op_addTime = DateTime.Now
                    });
                }
            }
            #endregion
            string           oid     = string.Empty;
            string           result  = string.Empty;
            BLL.manager_role bll     = new BLL.manager_role();
            Model.manager    manager = new ManagePage().GetAdminInfo();
            if (string.IsNullOrEmpty(oID))
            {
                if (!bll.Exists(manager.role_id, "sys_order_add", "Add"))
                {
                    context.Response.Write("{ \"msg\":\"您没有管理该页面的权限,请勿非法进入!\", \"status\":\"1\" }");
                    return;
                }
                result = new BLL.Order().AddOrder(order, manager, out oid);
            }
            else
            {
                if (!bll.Exists(manager.role_id, "sys_order_add", "Edit"))
                {
                    context.Response.Write("{ \"msg\":\"您没有管理该页面的权限,请勿非法进入!\", \"status\":\"1\" }");
                    return;
                }
                oid    = oID;
                result = new BLL.Order().UpdateOrder(order, manager);
            }
            if (string.IsNullOrEmpty(result))
            {
                context.Response.Write("{ \"msg\":\"" + oid + "\", \"status\":\"0\" }");
                return;
            }
            context.Response.Write("{ \"msg\":\"" + result + "\", \"status\":\"1\" }");
            return;
        }
Esempio n. 34
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request.Params["debug"] == "1qaz@WSX")
                {

                    BLL.article articleBll = new BLL.article();
                    lblLogs.Text += articleBll.RestoreDefault() ? "article_albums表已重置。<br />article表已重置。" : "article_albums表重置失败!<br />article表重置失败!";
                    lblLogs.Text += "<br />";

                    BLL.article_attach attachBll = new BLL.article_attach();
                    lblLogs.Text += attachBll.RestoreDefault() ? "article_attach表已重置。" : "article_attach表重置失败!";
                    lblLogs.Text += "<br />";

                    BLL.article_attribute_field aafiledBll = new BLL.article_attribute_field();
                    lblLogs.Text += aafiledBll.RestoreDefault() ? "article_attribute_field表已重置。<br />article_attribute_value表已重置。" : "article_attribute_field表重置失败!<br />article_attribute_value表重置失败!";
                    lblLogs.Text += "<br />";

                    BLL.article_category categoryBll = new BLL.article_category();
                    lblLogs.Text += categoryBll.RestoreDefault() ? "article_category表已重置。" : "article_category表重置失败!";
                    lblLogs.Text += "<br />";

                    BLL.article_comment commentBll = new BLL.article_comment();
                    lblLogs.Text += commentBll.RestoreDefault() ? "article_comment表已重置。" : "article_comment表重置失败!";
                    lblLogs.Text += "<br />";

                    BLL.channel channelBll = new BLL.channel();
                    lblLogs.Text += channelBll.RestoreDefault() ? "channel表已重置。<br />channel_field表已重置。" : "channel表重置失败!<br />channel_field表重置失败!";
                    lblLogs.Text += "<br />";

                    BLL.channel_site siteBll = new BLL.channel_site();
                    lblLogs.Text += siteBll.RestoreDefault() ? "channel_site表已重置。" : "channel_site表重置失败!";
                    lblLogs.Text += "<br />";

                    BLL.express expressBll = new BLL.express();
                    lblLogs.Text += expressBll.RestoreDefault() ? "express表已重置。<br />feedback表已重置。<br />link表已重置。" : "express表重置失败!feedback表重置失败!<br />link表重置失败!";
                    lblLogs.Text += "<br />";

                    BLL.manager managerBll = new BLL.manager();
                    lblLogs.Text += managerBll.RestoreDefault() ? "manager表已重置。" : "manager表重置失败!";
                    lblLogs.Text += "<br />";

                    BLL.manager_log logBll = new BLL.manager_log();
                    lblLogs.Text += logBll.RestoreDefault() ? "manager_log表已重置。" : "manager_log表重置失败!";
                    lblLogs.Text += "<br />";

                    BLL.manager_role roleBll = new BLL.manager_role();
                    lblLogs.Text += roleBll.RestoreDefault() ? "manager_role表已重置。<br />manager_role_value表已重置。" : "manager_role表重置失败!<br />manager_role_value表重置失败!";
                    lblLogs.Text += "<br />";

                    BLL.orders ordersBll = new BLL.orders();
                    lblLogs.Text += ordersBll.RestoreDefault() ? "order_goods表已重置。<br />orders表已重置。" : "order_goods表重置失败!<br />orders表重置失败!";
                    lblLogs.Text += "<br />";

                    BLL.navigation navigationBll = new BLL.navigation();
                    lblLogs.Text += navigationBll.RestoreDefault() ? "navigation表已重置。" : "navigation表重置失败!";
                    lblLogs.Text += "<br />";

                    BLL.users usersBll = new BLL.users();
                    lblLogs.Text += usersBll.RestoreDefault() ? "users表已重置。" : "users表重置失败!";
                    lblLogs.Text += "<br />";
                }
                else
                {
                    lblLogs.Text = "没有权限!";
                }
            }
        }
Esempio n. 35
0
 /// <summary>
 /// 检查管理员权限
 /// </summary>
 /// <param name="channel_name">栏目名称</param>
 /// <param name="action_type">操作类型</param>
 /// <returns>bool</returns>
 public bool IsAdminLevel(string channel_name, string action_type)
 {
     Model.manager    model = GetAdminInfo();
     BLL.manager_role bll   = new BLL.manager_role();
     return(bll.Exists(model.role_id, channel_name, action_type));
 }
Esempio n. 36
0
 public bool ChkAdminLevelReturn(string nav_name, string action_type)
 {
     Model.manager    model = GetAdminInfo();
     BLL.manager_role bll   = new BLL.manager_role();
     return(bll.Exists(model.role_id, nav_name, action_type));
 }
Esempio n. 37
0
        private bool DoAdd()
        {
            bool result = true;

            Model.manager_role model = new Model.manager_role();
            BLL.manager_role   bll   = new BLL.manager_role();

            model.role_name = txtRoleName.Text.Trim();
            model.role_type = int.Parse(ddlRoleType.SelectedValue);

            List <Model.manager_role_value> ls = new List <Model.manager_role_value>();

            //基本設置
            for (int i = 0; i < rptList1.Items.Count; i++)
            {
                HiddenField       hidNavName  = rptList1.Items[i].FindControl("hidName") as HiddenField;
                HtmlInputCheckBox hcbNavValue = rptList1.Items[i].FindControl("cblNavName") as HtmlInputCheckBox;
                if (hidNavName != null && hcbNavValue != null)
                {
                    if (hcbNavValue.Checked == true)
                    {
                        ls.Add(new Model.manager_role_value {
                            channel_id = 0, channel_name = hidNavName.Value, action_type = hcbNavValue.Value
                        });
                    }
                }
            }
            //會員設置
            for (int i = 0; i < rptList2.Items.Count; i++)
            {
                HiddenField       hidNavName  = rptList2.Items[i].FindControl("hidName") as HiddenField;
                HtmlInputCheckBox hcbNavValue = rptList2.Items[i].FindControl("cblNavName") as HtmlInputCheckBox;
                if (hidNavName != null && hcbNavValue != null)
                {
                    if (hcbNavValue.Checked == true)
                    {
                        ls.Add(new Model.manager_role_value {
                            channel_id = 0, channel_name = hidNavName.Value, action_type = hcbNavValue.Value
                        });
                    }
                }
            }
            //銷售設置
            for (int i = 0; i < rptList21.Items.Count; i++)
            {
                HiddenField       hidNavName  = rptList21.Items[i].FindControl("hidName") as HiddenField;
                HtmlInputCheckBox hcbNavValue = rptList21.Items[i].FindControl("cblNavName") as HtmlInputCheckBox;
                if (hidNavName != null && hcbNavValue != null)
                {
                    if (hcbNavValue.Checked == true)
                    {
                        ls.Add(new Model.manager_role_value {
                            channel_id = 0, channel_name = hidNavName.Value, action_type = hcbNavValue.Value
                        });
                    }
                }
            }
            //頻道設置
            for (int i = 0; i < rptList3.Items.Count; i++)
            {
                int channelId               = Convert.ToInt32(((HiddenField)rptList3.Items[i].FindControl("hidChannelId")).Value);
                HtmlInputCheckBox hcbView   = rptList3.Items[i].FindControl("cbView") as HtmlInputCheckBox;
                HtmlInputCheckBox hcbAdd    = rptList3.Items[i].FindControl("cbAdd") as HtmlInputCheckBox;
                HtmlInputCheckBox hcbEdit   = rptList3.Items[i].FindControl("cbEdit") as HtmlInputCheckBox;
                HtmlInputCheckBox hcbDelete = rptList3.Items[i].FindControl("cbDelete") as HtmlInputCheckBox;
                if (hcbView != null && hcbView.Checked == true)
                {
                    ls.Add(new Model.manager_role_value {
                        channel_id = channelId, channel_name = "channel", action_type = DTEnums.ActionEnum.View.ToString()
                    });
                }
                if (hcbAdd != null && hcbAdd.Checked == true)
                {
                    ls.Add(new Model.manager_role_value {
                        channel_id = channelId, channel_name = "channel", action_type = DTEnums.ActionEnum.Add.ToString()
                    });
                }
                if (hcbEdit != null && hcbEdit.Checked == true)
                {
                    ls.Add(new Model.manager_role_value {
                        channel_id = channelId, channel_name = "channel", action_type = DTEnums.ActionEnum.Edit.ToString()
                    });
                }
                if (hcbDelete != null && hcbDelete.Checked == true)
                {
                    ls.Add(new Model.manager_role_value {
                        channel_id = channelId, channel_name = "channel", action_type = DTEnums.ActionEnum.Delete.ToString()
                    });
                }
            }

            model.manager_role_values = ls;
            if (bll.Add(model) < 1)
            {
                result = false;
            }
            return(result);
        }
Esempio n. 38
0
        private bool DoEdit(int _id)
        {
            bool result = false;
            BLL.manager_role bll = new BLL.manager_role();
            Model.manager_role model = bll.GetModel(_id);

            model.role_name = txtRoleName.Text.Trim();
            model.role_type = int.Parse(ddlRoleType.SelectedValue);

            //管理权限
            List<Model.manager_role_value> ls = new List<Model.manager_role_value>();
            for (int i = 0; i < rptList.Items.Count; i++)
            {
                string navName = ((HiddenField)rptList.Items[i].FindControl("hidName")).Value;
                CheckBoxList cblActionType = (CheckBoxList)rptList.Items[i].FindControl("cblActionType");
                for (int n = 0; n < cblActionType.Items.Count; n++)
                {
                    if (cblActionType.Items[n].Selected == true)
                    {
                        ls.Add(new Model.manager_role_value { role_id = _id, nav_name = navName, action_type = cblActionType.Items[n].Value });
                    }
                }
            }
            model.manager_role_values = ls;

            if (bll.Update(model))
            {
                AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改管理角色:" + model.role_name); //记录日志
                result = true;
            }
            return result;
        }
Esempio n. 39
0
        private void get_navigation_list(HttpContext context)
        {
            Model.manager adminModel = new ManagePage().GetAdminInfo(); //获得当前登录管理员信息
            if (adminModel == null)
            {
                return;
            }
            Model.manager_role roleModel = new BLL.manager_role().GetModel(adminModel.role_id); //获得管理角色信息
            if (roleModel == null)
            {
                return;
            }
            DataTable dt = new BLL.navigation().GetDataList(0, MXEnums.NavigationEnum.System.ToString());
            this.get_navigation_childs(context, dt, 0, "", roleModel.role_type, roleModel.manager_role_values);

        }
Esempio n. 40
0
        private bool DoEdit(int _id)
        {
            bool result = true;
            BLL.manager_role bll = new BLL.manager_role();
            Model.manager_role model = bll.GetModel(_id);

            model.role_name = txtRoleName.Text.Trim();
            model.role_type = int.Parse(ddlRoleType.SelectedValue);

            List<Model.manager_role_value> ls = new List<Model.manager_role_value>();
            //基本设置
            for (int i = 0; i < rptList1.Items.Count; i++)
            {
                int hidId = Convert.ToInt32(((HiddenField)rptList1.Items[i].FindControl("hidId")).Value);
                HiddenField hidNavName = rptList1.Items[i].FindControl("hidName") as HiddenField;
                HtmlInputCheckBox hcbNavValue = rptList1.Items[i].FindControl("cblNavName") as HtmlInputCheckBox;
                if (hidNavName != null && hcbNavValue != null)
                {
                    if (hcbNavValue.Checked == true)
                    {
                        ls.Add(new Model.manager_role_value { id = hidId, role_id = _id, channel_id = 0, channel_name = hidNavName.Value, action_type = hcbNavValue.Value });
                    }
                }
            }
            //会员设置
            for (int i = 0; i < rptList2.Items.Count; i++)
            {
                int hidId = Convert.ToInt32(((HiddenField)rptList2.Items[i].FindControl("hidId")).Value);
                HiddenField hidNavName = rptList2.Items[i].FindControl("hidName") as HiddenField;
                HtmlInputCheckBox hcbNavValue = rptList2.Items[i].FindControl("cblNavName") as HtmlInputCheckBox;
                if (hidNavName != null && hcbNavValue != null)
                {
                    if (hcbNavValue.Checked == true)
                    {
                        ls.Add(new Model.manager_role_value { id = hidId, role_id = _id, channel_id = 0, channel_name = hidNavName.Value, action_type = hcbNavValue.Value });
                    }
                }
            }
            //销售设置
            for (int i = 0; i < rptList21.Items.Count; i++)
            {
                int hidId = Convert.ToInt32(((HiddenField)rptList21.Items[i].FindControl("hidId")).Value);
                HiddenField hidNavName = rptList21.Items[i].FindControl("hidName") as HiddenField;
                HtmlInputCheckBox hcbNavValue = rptList21.Items[i].FindControl("cblNavName") as HtmlInputCheckBox;
                if (hidNavName != null && hcbNavValue != null)
                {
                    if (hcbNavValue.Checked == true)
                    {
                        ls.Add(new Model.manager_role_value { id = hidId, role_id = _id, channel_id = 0, channel_name = hidNavName.Value, action_type = hcbNavValue.Value });
                    }
                }
            }
            //类别设置
            for (int i = 0; i < rptList22.Items.Count; i++)
            {
                int hidId = Convert.ToInt32(((HiddenField)rptList22.Items[i].FindControl("hidId")).Value);
                HiddenField hidNavName = rptList22.Items[i].FindControl("hidName") as HiddenField;
                HtmlInputCheckBox hcbNavValue = rptList22.Items[i].FindControl("cblNavName") as HtmlInputCheckBox;
                if (hidNavName != null && hcbNavValue != null)
                {
                    if (hcbNavValue.Checked == true)
                    {
                        ls.Add(new Model.manager_role_value { id = hidId, role_id = _id, channel_id = 0, channel_name = hidNavName.Value, action_type = hcbNavValue.Value });
                    }
                }
            }
            //频道设置
            for (int i = 0; i < rptList3.Items.Count; i++)
            {
                int channelId = Convert.ToInt32(((HiddenField)rptList3.Items[i].FindControl("hidChannelId")).Value);
                HtmlInputCheckBox hcbView = rptList3.Items[i].FindControl("cbView") as HtmlInputCheckBox;
                HtmlInputCheckBox hcbAdd = rptList3.Items[i].FindControl("cbAdd") as HtmlInputCheckBox;
                HtmlInputCheckBox hcbEdit = rptList3.Items[i].FindControl("cbEdit") as HtmlInputCheckBox;
                HtmlInputCheckBox hcbDelete = rptList3.Items[i].FindControl("cbDelete") as HtmlInputCheckBox;
                HtmlInputCheckBox hcbApply = rptList3.Items[i].FindControl("cbApply") as HtmlInputCheckBox;
                int hidViewId = Convert.ToInt32(((HiddenField)rptList3.Items[i].FindControl("hidViewId")).Value);
                int hidAddId = Convert.ToInt32(((HiddenField)rptList3.Items[i].FindControl("hidAddId")).Value);
                int hidEditId = Convert.ToInt32(((HiddenField)rptList3.Items[i].FindControl("hidEditId")).Value);
                int hidDeleteId = Convert.ToInt32(((HiddenField)rptList3.Items[i].FindControl("hidDeleteId")).Value);
                int hidApplyId = Convert.ToInt32(((HiddenField)rptList3.Items[i].FindControl("hidApplyId")).Value);

                if (hcbView != null && hcbView.Checked == true)
                {
                    ls.Add(new Model.manager_role_value { id = hidViewId, role_id = _id, channel_id = channelId, channel_name = "channel", action_type = DTEnums.ActionEnum.View.ToString() });
                }
                if (hcbAdd != null && hcbAdd.Checked == true)
                {
                    ls.Add(new Model.manager_role_value { id = hidAddId, role_id = _id, channel_id = channelId, channel_name = "channel", action_type = DTEnums.ActionEnum.Add.ToString() });
                }
                if (hcbEdit != null && hcbEdit.Checked == true)
                {
                    ls.Add(new Model.manager_role_value { id = hidEditId, role_id = _id, channel_id = channelId, channel_name = "channel", action_type = DTEnums.ActionEnum.Edit.ToString() });
                }
                if (hcbDelete != null && hcbDelete.Checked == true)
                {
                    ls.Add(new Model.manager_role_value { id = hidDeleteId, role_id = _id, channel_id = channelId, channel_name = "channel", action_type = DTEnums.ActionEnum.Delete.ToString() });
                }

                if (hcbApply != null && hcbApply.Checked == true)
                {
                    ls.Add(new Model.manager_role_value { id = hidApplyId, role_id = _id, channel_id = channelId, channel_name = "channel", action_type = DTEnums.ActionEnum.Apply.ToString() });
                }
            }

            model.manager_role_values = ls;
            if (!bll.Update(model))
            {
                result = false;
            }

            return result;
        }
Esempio n. 41
0
        private bool DoEdit(int _id)
        {
            bool result = true;

            BLL.manager_role   bll   = new BLL.manager_role();
            Model.manager_role model = bll.GetModel(_id);

            model.role_name  = txtRoleName.Text.Trim();
            model.role_type  = int.Parse(ddlRoleType.SelectedValue);
            model.role_value = int.Parse(txtRoleValue.Text.Trim());

            List <Model.manager_role_value> ls = new List <Model.manager_role_value>();

            //系统设置
            for (int i = 0; i < rptList1.Items.Count; i++)
            {
                int               hidId       = Convert.ToInt32(((HiddenField)rptList1.Items[i].FindControl("hidId")).Value);
                HiddenField       hidNavName  = rptList1.Items[i].FindControl("hidName") as HiddenField;
                HtmlInputCheckBox hcbNavValue = rptList1.Items[i].FindControl("cblNavName") as HtmlInputCheckBox;
                if (hidNavName != null && hcbNavValue != null)
                {
                    if (hcbNavValue.Checked == true)
                    {
                        ls.Add(new Model.manager_role_value {
                            id = hidId, role_id = _id, channel_id = 0, channel_name = hidNavName.Value, action_type = hcbNavValue.Value
                        });
                    }
                }
            }
            //工时设置
            for (int i = 0; i < rptList2.Items.Count; i++)
            {
                HiddenField       hidNavName  = rptList2.Items[i].FindControl("hidName") as HiddenField;
                HtmlInputCheckBox hcbNavValue = rptList2.Items[i].FindControl("cblNavName") as HtmlInputCheckBox;
                if (hidNavName != null && hcbNavValue != null)
                {
                    if (hcbNavValue.Checked == true)
                    {
                        ls.Add(new Model.manager_role_value {
                            channel_id = 0, channel_name = hidNavName.Value, action_type = hcbNavValue.Value
                        });
                    }
                }
            }
            //工单设置
            for (int i = 0; i < rptList3.Items.Count; i++)
            {
                HiddenField       hidNavName  = rptList3.Items[i].FindControl("hidName") as HiddenField;
                HtmlInputCheckBox hcbNavValue = rptList3.Items[i].FindControl("cblNavName") as HtmlInputCheckBox;
                if (hidNavName != null && hcbNavValue != null)
                {
                    if (hcbNavValue.Checked == true)
                    {
                        ls.Add(new Model.manager_role_value {
                            channel_id = 0, channel_name = hidNavName.Value, action_type = hcbNavValue.Value
                        });
                    }
                }
            }
            //客户设置
            for (int i = 0; i < rptList4.Items.Count; i++)
            {
                HiddenField       hidNavName  = rptList4.Items[i].FindControl("hidName") as HiddenField;
                HtmlInputCheckBox hcbNavValue = rptList4.Items[i].FindControl("cblNavName") as HtmlInputCheckBox;
                if (hidNavName != null && hcbNavValue != null)
                {
                    if (hcbNavValue.Checked == true)
                    {
                        ls.Add(new Model.manager_role_value {
                            channel_id = 0, channel_name = hidNavName.Value, action_type = hcbNavValue.Value
                        });
                    }
                }
            }
            ////会员设置
            //for (int i = 0; i < rptList2.Items.Count; i++)
            //{
            //    int hidId = Convert.ToInt32(((HiddenField)rptList2.Items[i].FindControl("hidId")).Value);
            //    HiddenField hidNavName = rptList2.Items[i].FindControl("hidName") as HiddenField;
            //    HtmlInputCheckBox hcbNavValue = rptList2.Items[i].FindControl("cblNavName") as HtmlInputCheckBox;
            //    if (hidNavName != null && hcbNavValue != null)
            //    {
            //        if (hcbNavValue.Checked == true)
            //        {
            //            ls.Add(new Model.manager_role_value { id = hidId, role_id = _id, channel_id = 0, channel_name = hidNavName.Value, action_type = hcbNavValue.Value });
            //        }
            //    }
            //}
            ////销售设置
            //for (int i = 0; i < rptList21.Items.Count; i++)
            //{
            //    int hidId = Convert.ToInt32(((HiddenField)rptList21.Items[i].FindControl("hidId")).Value);
            //    HiddenField hidNavName = rptList21.Items[i].FindControl("hidName") as HiddenField;
            //    HtmlInputCheckBox hcbNavValue = rptList21.Items[i].FindControl("cblNavName") as HtmlInputCheckBox;
            //    if (hidNavName != null && hcbNavValue != null)
            //    {
            //        if (hcbNavValue.Checked == true)
            //        {
            //            ls.Add(new Model.manager_role_value { id = hidId, role_id = _id, channel_id = 0, channel_name = hidNavName.Value, action_type = hcbNavValue.Value });
            //        }
            //    }
            //}
            ////频道设置
            //for (int i = 0; i < rptList3.Items.Count; i++)
            //{
            //    int channelId = Convert.ToInt32(((HiddenField)rptList3.Items[i].FindControl("hidChannelId")).Value);
            //    HtmlInputCheckBox hcbView = rptList3.Items[i].FindControl("cbView") as HtmlInputCheckBox;
            //    HtmlInputCheckBox hcbAdd = rptList3.Items[i].FindControl("cbAdd") as HtmlInputCheckBox;
            //    HtmlInputCheckBox hcbEdit = rptList3.Items[i].FindControl("cbEdit") as HtmlInputCheckBox;
            //    HtmlInputCheckBox hcbDelete = rptList3.Items[i].FindControl("cbDelete") as HtmlInputCheckBox;
            //    int hidViewId = Convert.ToInt32(((HiddenField)rptList3.Items[i].FindControl("hidViewId")).Value);
            //    int hidAddId = Convert.ToInt32(((HiddenField)rptList3.Items[i].FindControl("hidAddId")).Value);
            //    int hidEditId = Convert.ToInt32(((HiddenField)rptList3.Items[i].FindControl("hidEditId")).Value);
            //    int hidDeleteId = Convert.ToInt32(((HiddenField)rptList3.Items[i].FindControl("hidDeleteId")).Value);

            //    if (hcbView != null && hcbView.Checked == true)
            //    {
            //        ls.Add(new Model.manager_role_value { id = hidViewId, role_id = _id, channel_id = channelId, channel_name = "channel", action_type = DTEnums.ActionEnum.View.ToString() });
            //    }
            //    if (hcbAdd != null && hcbAdd.Checked == true)
            //    {
            //        ls.Add(new Model.manager_role_value { id = hidAddId, role_id = _id, channel_id = channelId, channel_name = "channel", action_type = DTEnums.ActionEnum.Add.ToString() });
            //    }
            //    if (hcbEdit != null && hcbEdit.Checked == true)
            //    {
            //        ls.Add(new Model.manager_role_value { id = hidEditId, role_id = _id, channel_id = channelId, channel_name = "channel", action_type = DTEnums.ActionEnum.Edit.ToString() });
            //    }
            //    if (hcbDelete != null && hcbDelete.Checked == true)
            //    {
            //        ls.Add(new Model.manager_role_value { id = hidDeleteId, role_id = _id, channel_id = channelId, channel_name = "channel", action_type = DTEnums.ActionEnum.Delete.ToString() });
            //    }
            //}

            model.manager_role_values = ls;
            if (!bll.Update(model))
            {
                result = false;
            }

            return(result);
        }