public IList <PTMK> GetChildren(string userCode, string dm) { PTYHMCPrivilegeService service = new PTYHMCPrivilegeService(); return((from m in this join p in service on m.C_MKDM equals p.C_MKDM where p.V_YHDM == userCode && m.C_MKDM.Substring(0, dm.Length) == dm orderby m.I_XH, m.C_MKDM select m).ToList <PTMK>()); }
public IList <PTMK> GetFirstMenu(string userCode) { PTYHMCPrivilegeService service = new PTYHMCPrivilegeService(); List <string> first = (from p in service where (p.V_YHDM == userCode) && (p.C_MKDM.Length == 2) select p.C_MKDM).ToList <string>(); PrivUserRoleService service2 = new PrivUserRoleService(); PrivBusiDataRoleService service3 = new PrivBusiDataRoleService(); List <string> second = (from bdr in service3 join ur in service2 on bdr.RoleId equals ur.RoleId where ((bdr.TableName == "PT_MK") && (ur.UserCode == userCode)) && (bdr.BusiDataId.Length == 2) select bdr.BusiDataId).ToList <string>(); List <string> allMkList = first.Union <string>(second).Distinct <string>().ToList <string>(); return((from m in this where allMkList.Contains(m.C_MKDM) orderby m.I_XH, m.C_MKDM select m).ToList <PTMK>()); }
public IList <PTMK> GetAll(string userCode, string dm) { PTYHMCPrivilegeService service = new PTYHMCPrivilegeService(); List <string> first = (from p in service where p.V_YHDM == userCode select p.C_MKDM).ToList <string>(); PrivUserRoleService service2 = new PrivUserRoleService(); PrivBusiDataRoleService service3 = new PrivBusiDataRoleService(); List <string> second = (from bdr in service3 join ur in service2 on bdr.RoleId equals ur.RoleId where (bdr.TableName == "PT_MK") && (ur.UserCode == userCode) select bdr.BusiDataId).ToList <string>(); List <string> allMkList = first.Union <string>(second).Distinct <string>().ToList <string>(); List <PTMK> allLst = (from m in this where allMkList.Contains(m.C_MKDM) && (m.Isdisplay == "1") orderby m.I_XH, m.C_MKDM select m).ToList <PTMK>(); List <PTMK> list4 = new List <PTMK>(); if (dm == "0") { list4 = (from m in allLst where m.C_MKDM.Length == 2 select m).ToList <PTMK>(); } else { list4 = (from m in allLst where (m.C_MKDM.Length == (dm.Length + 2)) && m.C_MKDM.StartsWith(dm) select m).ToList <PTMK>(); } for (int i = 0; i < list4.Count; i++) { this.AddChildren(list4[i], allLst); } return(list4); }