Ejemplo n.º 1
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>");
        }
        protected string Add(string codes, int id, string nodeid)
        {
            M_Permission perMod = perbll.SelReturnModel(id);

            perMod.Auth_OA = codes;
            perbll.GetUpdate(perMod);
            return("1");
        }
Ejemplo n.º 3
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"));
        }