Example #1
0
        public List<ServicesLibrary.Entities.SiteMap> GetAll()
        {
            TCRepositoryDataContext context = DataBaseUtils.GetContext();
            List<tbl_SiteMap> dbListSiteMap = context.tbl_SiteMap.ToList();

            List<ServicesLibrary.Entities.SiteMap> entList = new List<ServicesLibrary.Entities.SiteMap>();

            foreach (var drItem in dbListSiteMap)
            {
                ServicesLibrary.Entities.SiteMap entItem = new ServicesLibrary.Entities.SiteMap();
                AssignDataObjectToEntity(drItem, ref entItem);
                entList.Add(entItem);
            }

            return entList;
        }
Example #2
0
        public List<SiteMap> GetMenuByIdRole(int ID)
        {
            TCRepositoryDataContext context = DataBaseUtils.GetContext();
            List<tbl_SiteMap> dbListSiteMap = (from s in context.tbl_SiteMap
                                               join rs in context.tbl_Roles_SiteMap on s.IdSiteMap equals rs.IdSiteMap
                                               where rs.IdRole == ID
                                               && s.IsBrowsable == true
                                               select s).ToList();

            List<ServicesLibrary.Entities.SiteMap> entList = new List<ServicesLibrary.Entities.SiteMap>();

            foreach (var drItem in dbListSiteMap)
                {
                    ServicesLibrary.Entities.SiteMap entItem = new ServicesLibrary.Entities.SiteMap();
                    AssignDataObjectToEntity(drItem, ref entItem);
                    entList.Add(entItem);
                }

            return entList;
        }
Example #3
0
        public string GetRoleCodeByURL(string slURL)
        {
            TCRepositoryDataContext context = DataBaseUtils.GetContext();

            if (!slURL.Contains("~"))
            {
                //slURL = slURL.Replace("/","\\");
                slURL = String.Format("~{0}", slURL);
            }
            tbl_SiteMap dbSiteMap = context.tbl_SiteMap.Where(sm => sm.URL == slURL).FirstOrDefault();

            ServicesLibrary.Entities.SiteMap entItem= new ServicesLibrary.Entities.SiteMap();
            string code;
            if (dbSiteMap!= null)
            {
                AssignDataObjectToEntity(dbSiteMap, ref entItem);
                code = entItem.RoleCode;
            }
            else
            {
                code = "Not Permission or URL not exists";
            }

            return code;
        }
Example #4
0
        public List<string> GetRolesByUserName(string UserName)
        {
            TCRepositoryDataContext context = DataBaseUtils.GetContext();
            List<tbl_SiteMap> tblListSiteMap = (from sm in context.tbl_SiteMap
                                                join rs in context.tbl_Roles_SiteMap on sm.IdSiteMap equals rs.IdSiteMap
                                                join r in context.tbl_Roles on rs.IdRole equals r.IdRole
                                                join u in context.tbl_Users on r.IdRole equals u.IdRole
                                                where u.UserName == UserName
                                                select sm).ToList();
            //DataSet dsRole = mscConnector.GetDataFromQuery(rqQuery.SelectRoleCodesByUserName(UserName));
            List<ServicesLibrary.Entities.SiteMap> entList = new List<ServicesLibrary.Entities.SiteMap>();

            foreach (var drItem in tblListSiteMap)
            {
                ServicesLibrary.Entities.SiteMap entItem = new ServicesLibrary.Entities.SiteMap();
                AssignDataObjectToEntity(drItem, ref entItem);
                entList.Add(entItem);
            }

            return entList.Select(c => c.RoleCode).ToList();
        }