Ejemplo n.º 1
0
        public void AddUser(IList <string> idList, IList <string> userList, string tableName)
        {
            PTYHMCPrivilegeService service  = new PTYHMCPrivilegeService();
            PTMKService            service2 = new PTMKService();
            List <string>          first    = new List <string>();

            first = first.Union <string>(idList).Distinct <string>().ToList <string>();
            foreach (string str in idList)
            {
                IList <string> childrenAndSelf = service2.GetChildrenAndSelf(str);
                first = first.Union <string>(childrenAndSelf).Distinct <string>().ToList <string>();
            }
            IList <string> parentAll = service2.GetParentAll(idList[0]);

            first = first.Union <string>(parentAll).ToList <string>();
            foreach (string str2 in userList)
            {
                foreach (string str3 in first)
                {
                    PTYHMCPrivilege yp = new PTYHMCPrivilege {
                        Id     = Guid.NewGuid().ToString(),
                        V_YHDM = str2,
                        C_MKDM = str3
                    };
                    if (!service.Exists(yp))
                    {
                        service.Add(yp);
                    }
                }
            }
        }
Ejemplo n.º 2
0
 protected void btnSave_Click(object sender, System.EventArgs e)
 {
     System.Collections.Generic.List <string> listFromJson = JsonHelper.GetListFromJson(this.hfldRoleId.Value);
     if (this.tableName == "PT_MK")
     {
         this.dataSer.DeleteByRes(this.dataIdList[0]);
         PTMKService pTMKService = new PTMKService();
         this.dataIdList = pTMKService.GetParentAndChildren(this.dataIdList[0]);
     }
     if (this.dataIdList.Count == 1)
     {
         this.dataSer.DeleteByRes(this.dataIdList[0]);
     }
     foreach (string current in listFromJson)
     {
         foreach (string current2 in this.dataIdList)
         {
             PrivBusiDataRole privBusiDataRole = new PrivBusiDataRole();
             privBusiDataRole.Id         = System.Guid.NewGuid().ToString();
             privBusiDataRole.RoleId     = current;
             privBusiDataRole.TableName  = this.tableName;
             privBusiDataRole.BusiDataId = current2;
             if (!this.dataSer.Exists(privBusiDataRole))
             {
                 this.dataSer.Add(privBusiDataRole);
             }
         }
     }
     base.RegisterScript("succeed();");
 }
Ejemplo n.º 3
0
    private string GetMenuJson()
    {
        PTMKService pTMKService = new PTMKService();

        PTMK[] t = pTMKService.GetFirstMenu(this.userCode).ToArray <PTMK>();
        return(JsonHelper.JsonSerializer <PTMK[]>(t));
    }
Ejemplo n.º 4
0
        public void DeleteExistsUser(string id, string tableName)
        {
            PTYHMCPrivilegeService service  = new PTYHMCPrivilegeService();
            PTMKService            service2 = new PTMKService();

            foreach (string str in service2.GetChildrenAndSelf(id))
            {
                service.DeleteByMk(str);
            }
        }
Ejemplo n.º 5
0
    private void InitChildMenu(PTMK[] ptmkArr)
    {
        PTMKService pTMKService      = new PTMKService();
        Dictionary <int, string> obj = new Dictionary <int, string>();
        int num = 0;

        if (num >= ptmkArr.Length)
        {
            this.hfldChildMk.Value = JsonNetWrap.SerializeObject(obj);
        }
        else
        {
            PTMK         pTMK  = ptmkArr[num];
            IList <PTMK> all   = pTMKService.GetAll(this.userCode, pTMK.C_MKDM);
            string       value = JsonHelper.JsonSerializer <PTMK[]>(all.ToArray <PTMK>());
            this.hfldChildMk.Value = value;
        }
    }