Beispiel #1
0
        public List <M_Permission> getCheckState(int UTID)
        {
            List <M_Permission> d = new List <M_Permission>();

            try
            {
                string        sql    = "select MID,UTID from M_Permission  where UTID=" + UTID + "";
                SqlDataReader reader = SqlHelper.ExecuteReader(CommandType.Text, sql, null);
                while (reader.Read())
                {
                    M_Permission mp = new M_Permission();
                    //mp.PID = (int)reader["PID"];
                    U_UserType ut = new U_UserType();
                    ut.UTID = (int)reader["UTID"];
                    mp.UTID = ut;
                    M_MeauInfo mm = new M_MeauInfo();
                    mm.MID = (int)reader["MID"];
                    mp.MID = mm;
                    d.Add(mp);
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(d);
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (function.isAjax())
     {
         string codes  = Request.Form["Codes"];
         string nodeid = Request.Form["NodeID"];
         string str    = "";
         int    id     = DataConverter.CLng(Request.Form["ID"]);
         if (codes != "")
         {
             str = Add(codes, id, nodeid);
         }
         else
         {
             str = Del(id);
         }
         Response.Write(str);
         Response.End();
     }
     if (!IsPostBack)
     {
         M_Permission structMod = perbll.SelReturnModel(Mid);
         OATopNodeID_T.Text  = bup.GetNodeIDs(Mid, "OATop");
         OADelNodeID_T.Text  = bup.GetNodeIDs(Mid, "OADel");
         OAEditNodeID_T.Text = bup.GetNodeIDs(Mid, "OAEdit");
         RoleName.Text       = structMod.RoleName;
         RoleInfo.Text       = structMod.Info;
         Call.SetBreadCrumb(Master, "<li><a href='" + CustomerPageAction.customPath2 + "I/Main.aspx'>工作台</a></li><li><a href='UserManage.aspx'>用户管理</a></li><li><a href='../Addon/StructList.aspx'>组织结构</a></li><li class='active'><a href='" + Request.RawUrl + "'>权限设置</a></li>");
     }
 }
        /// <summary>
        /// 列举模型字段
        /// </summary>
        protected void Modellistload()
        {
            int          id              = DataConverter.CLng(Request.QueryString["id"]);
            M_Permission pinfo           = pll.GetSelect(id);
            string       fieldlistvalues = "";// pinfo.Fieldlist;
            string       tempfield       = "," + fieldlistvalues + ",";
            DataTable    mtable          = mll.GetList();

            for (int i = 0; i < mtable.Rows.Count; i++)
            {
                DataList_LB.Items.Add(new ListItem(mtable.Rows[i]["ModelName"].ToString(), mtable.Rows[i]["ModelID"].ToString()));
            }
            string    fields  = "";
            DataTable mtables = mll.GetList();

            for (int i = 0; i < mtables.Rows.Count; i++)
            {
                fields += "<optgroup label=\"" + mtable.Rows[i]["ModelName"].ToString() + "\">";
                DataTable modefields = fll.GetModelFieldList(DataConverter.CLng(mtable.Rows[i]["ModelID"].ToString()));
                for (int ii = 0; ii < modefields.Rows.Count; ii++)
                {
                    //字段默认选中
                    string selecttxt = "";
                    if (tempfield.IndexOf("," + modefields.Rows[ii]["FieldID"].ToString() + ",") > -1)
                    {
                        selecttxt = "selected=\"selected\"";
                    }
                    fields += "<option " + selecttxt + " value=\"" + modefields.Rows[ii]["FieldID"].ToString() + "\">" + modefields.Rows[ii]["FieldAlias"].ToString() + "</option>";
                }
            }
            fields      = "<select multiple=\"multiple\"  class=\"tdbg\" name=\"Fieldlist\" size=\"4\" style=\"height:284px;width:216px;\">" + fields + "</select>";
            Label2.Text = fields;
        }
        protected string Add(string codes, int id, string nodeid)
        {
            M_Permission perMod = perbll.SelReturnModel(id);

            perMod.Auth_OA = codes;
            perbll.GetUpdate(perMod);
            return("1");
        }
Beispiel #5
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            int id = DataConverter.CLng(Request.QueryString["id"]);

            if (id > 0)
            {
                string Item = Request.Form["Item"] == null ? "" : Request.Form["Item"];
                if (Item != "")
                {
                    if (Item.IndexOf(",") > -1)
                    {
                        string[] str = Item.Split(new string[] { "," }, StringSplitOptions.None);
                        for (int i = 0; i < str.Length; i++)
                        {
                            int          spid   = DataConverter.CLng(str[i]);
                            M_Permission pinfo  = pll.GetSelect(spid);
                            string       Ugroup = pinfo.UserGroup;
                            if (Ugroup != "")//不为空
                            {
                                //判断是否存在
                                string newgroup = Ugroup;
                                if (newgroup.IndexOf("," + id + ",") < 0)
                                {
                                    Ugroup = Ugroup + "," + id + ",";
                                }
                            }
                            else //为空
                            {
                                Ugroup = "," + id.ToString() + ",";
                            }
                            pinfo.UserGroup = Ugroup;
                            pll.GetUpdate(pinfo);
                        }
                    }
                    else
                    {
                        int          spid   = DataConverter.CLng(Item);
                        M_Permission pinfo  = pll.GetSelect(spid);
                        string       Ugroup = pinfo.UserGroup;
                        if (Ugroup != "")//不为空
                        {
                            string newgroup = Ugroup;
                            if (newgroup.IndexOf("," + id + ",") < 0)
                            {
                                Ugroup = Ugroup + "," + id + ",";
                            }
                        }
                        else //为空
                        {
                            Ugroup = "," + id.ToString() + ",";
                        }
                        pinfo.UserGroup = Ugroup;
                        pll.GetUpdate(pinfo);
                    }
                }
            }
            Response.Write("<script language=javascript>window.close();opener.location.reload();</script>");
        }
Beispiel #6
0
        public IActionResult UserRoleAdd()
        {
            M_Permission model = new M_Permission();

            if (Mid > 0)
            {
                model = urBll.SelReturnModel(Mid);
            }
            return(View(model));
        }
Beispiel #7
0
 public bool InsertUpdate(M_Permission model)
 {
     if (model.ID > 0)
     {
         GetUpdate(model);
     }
     else
     {
         GetInsert(model);
     }
     return(true);
 }
Beispiel #8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Mid < 1)
         {
             function.WriteErrMsg("未指定角色");
         }
         M_Permission perMod = perBll.SelReturnModel(Mid);
         MyBind();
         Call.SetBreadCrumb(Master, "<li><a href='" + CustomerPageAction.customPath2 + "Main.aspx'>工作台</a></li><li><a href='AdminManage.aspx'>用户管理</a></li><li><a href='PermissionInfo.aspx'>角色管理</a></li><li class='active'>" + perMod.RoleName + "</li>  [<a href='javascript:;' id='selUsers'>新增会员</a>]");
     }
 }
Beispiel #9
0
        public IActionResult UserRoleAdd_Submit(M_Permission model)
        {
            M_Permission urMod = new M_Permission();

            if (Mid > 0)
            {
                urMod = urBll.SelReturnModel(Mid);
            }
            urMod.RoleName = model.RoleName;
            urMod.Info     = model.Info;
            if (urMod.ID > 0)
            {
                urBll.GetUpdate(urMod);
            }
            else
            {
                urBll.GetInsert(urMod);
            }
            return(WriteOK("操作成功", "UserRole"));
        }
        public string GetCodes()
        {
            M_Permission perMod = perbll.SelReturnModel(Mid);

            return(perMod.Auth_OA);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!B_ARoleAuth.Check(ZLEnum.Auth.user, "UserManage"))
            {
                function.WriteErrMsg("没有权限进行此项操作");
            }
            string menu = Request.QueryString["menu"];
            int    id   = DataConverter.CLng(Request.QueryString["id"]);

            if (!IsPostBack)
            {
                nodelistload(0);
                tdtext.Visible = false;
                tdlist.Visible = false;
                if (menu == "edit")
                {
                    M_Permission pinfo = pll.GetSelect(id);
                    this.txtID.Value        = pinfo.ID.ToString();
                    this.txtRoleName.Text   = pinfo.RoleName.ToString();
                    this.txtInfo.Text       = pinfo.Info.ToString();
                    this.txtPrecedence.Text = pinfo.Precedence.ToString();
                    DataSet ds = function.XmlToTable(pinfo.Perlist);
                    if (ds.Tables.Count > 0)
                    {
                        #region 设置选择节点
                        string nodelistvalues = ds.Tables[0].Rows[0]["Nodelist"].ToString();
                        nodelistvalues = nodelistvalues.TrimEnd(new char[] { ',' });
                        nodelistvalues = nodelistvalues.TrimStart(new char[] { ',' });
                        //节点默认选中
                        SelectList(Nodelist_LB, nodelistvalues);
                        #endregion
                        #region 设置选择模型字段
                        fieldlistvalues = ds.Tables[0].Rows[0]["Fieldlist"].ToString();
                        fieldlistvalues = fieldlistvalues.TrimEnd(new char[] { ',' });
                        fieldlistvalues = fieldlistvalues.TrimStart(new char[] { ',' });
                        Modellistload();
                        #endregion
                        #region 设置模型表
                        string datalistvalues = ds.Tables[0].Rows[0]["DataList"].ToString();
                        datalistvalues = datalistvalues.TrimEnd(new char[] { ',' });
                        datalistvalues = datalistvalues.TrimStart(new char[] { ',' });
                        //数据库列表默认选中
                        SelectList(DataList_LB, datalistvalues);
                        #endregion
                        #region 设置时段浏览
                        if (DataConverter.CLng(ds.Tables[0].Rows[0]["Time"].ToString()) == 1)
                        {
                            rblTime.SelectedIndex = 0;
                            rblTime_SelectedIndexChanged(null, null);
                            //月份
                            string Month = ds.Tables[0].Rows[0]["Month"].ToString();
                            Month = Month.TrimEnd(new char[] { ',' });
                            Month = Month.TrimStart(new char[] { ',' });
                            SelectList(cblMonth, Month);
                            //日期
                            string Day = ds.Tables[0].Rows[0]["Day"].ToString();
                            Day = Day.TrimEnd(new char[] { ',' });
                            Day = Day.TrimStart(new char[] { ',' });
                            SelectList(cblDay, Day);
                            //小时
                            string Hour = ds.Tables[0].Rows[0]["Hour"].ToString();
                            Hour = Hour.TrimEnd(new char[] { ',' });
                            Hour = Hour.TrimStart(new char[] { ',' });
                            SelectList(cblHour, Hour);
                            //星期
                            string Weeks = ds.Tables[0].Rows[0]["Weeks"].ToString();
                            Weeks = Weeks.TrimEnd(new char[] { ',' });
                            Weeks = Weeks.TrimStart(new char[] { ',' });
                            SelectList(cblWeeks, Weeks);
                        }
                        else
                        {
                            rblTime.SelectedIndex = 1;
                            rblTime_SelectedIndexChanged(null, null);
                        }


                        #endregion
                        #region 设置内容操作
                        //允许内容浏览
                        if (ds.Tables[0].Rows[0]["ViewContent"].ToString() == "1")
                        {
                            this.ViewContent.SelectedValue = "1";
                        }
                        else
                        {
                            this.ViewContent.SelectedValue = "0";
                        }
                        //允许列表浏览
                        if (ds.Tables[0].Rows[0]["ListContent"].ToString() == "1")
                        {
                            this.ListContent.SelectedValue = "1";
                        }
                        else
                        {
                            this.ListContent.SelectedValue = "0";
                        }
                        //允许新增发布
                        if (ds.Tables[0].Rows[0]["AddContent"].ToString() == "1")
                        {
                            this.AddContent.SelectedValue = "1";
                        }
                        else
                        {
                            this.AddContent.SelectedValue = "0";
                        }
                        //允许编辑修改
                        if (ds.Tables[0].Rows[0]["ModefiyContent"].ToString() == "1")
                        {
                            this.ModefiyContent.SelectedValue = "1";
                        }
                        else
                        {
                            this.ModefiyContent.SelectedValue = "0";
                        }
                        //允许删除内容
                        if (ds.Tables[0].Rows[0]["DeleteContent"].ToString() == "1")
                        {
                            this.DeleteContent.SelectedValue = "1";
                        }
                        else
                        {
                            this.DeleteContent.SelectedValue = "0";
                        }
                        //允许评论权限
                        if (ds.Tables[0].Rows[0]["AddComm"].ToString() == "1")
                        {
                            this.AddComm.SelectedValue = "1";
                        }
                        else
                        {
                            this.AddComm.SelectedValue = "0";
                        }
                        #endregion
                    }
                    if (pinfo.IsTrue == true)
                    {
                        this.txtIsTrue.SelectedValue = "1";
                    }
                    else
                    {
                        this.txtIsTrue.SelectedValue = "0";
                    }
                    this.type         = "修改角色";
                    this.Button1.Text = "修改角色";
                }
                else
                {
                    Modellistload();
                }
                this.txtID.Value = id.ToString();
                Call.SetBreadCrumb(Master, "<li><a href='" + CustomerPageAction.customPath2 + "Main.aspx'>工作台</a></li><li><a href='UserManage.aspx'>用户管理</a></li><li><a href='PermissionInfo.aspx'>角色管理</a></li><li>添加角色</li>");
            }
        }
Beispiel #12
0
 public int GetInsert(M_Permission model)
 {
     return(DBCenter.Insert(model));
 }
Beispiel #13
0
 public bool GetUpdate(M_Permission model)
 {
     return(DBCenter.UpdateByID(model, model.ID));
 }
Beispiel #14
0
 public int GetInsert(M_Permission model)
 {
     return(Sql.insertID(TbName, model.GetParameters(), BLLCommon.GetParas(model), BLLCommon.GetFields(model)));
 }
Beispiel #15
0
 public bool GetUpdate(M_Permission model)
 {
     return(Sql.UpdateByIDs(TbName, PK, model.ID.ToString(), BLLCommon.GetFieldAndPara(model), model.GetParameters()));
 }