public HelpClassWebServices GetByIDPermisions(long id) { DataClasses1DataContext classes1DataContext = new DataClasses1DataContext(); try { WEBSERVICE ws = Queryable.Single <WEBSERVICE>((IQueryable <WEBSERVICE>)classes1DataContext.WEBSERVICEs, (Expression <Func <WEBSERVICE, bool> >)(p => p.ID == id)); HelpClassWebServices classWebServices = new HelpClassWebServices(); List <PERMISSION> permisionsByWs = new PermissionsDAL().GetPermisionsByWS(ws); classWebServices.ID = ws.ID; classWebServices.Tittle = ws.Tittle; classWebServices.Description = ws.Description; classWebServices.Note = ws.Note; classWebServices.URL = ws.URL; classWebServices.Active = ws.Active; classWebServices.CreatedOn = ws.CreatedOn; classWebServices.WSObj = ws; classWebServices.IDInstitution = 0L; classWebServices.InstitutionName = "x"; if (permisionsByWs.Count != 0) { classWebServices.IDInstitution = permisionsByWs[0].INSTITUTION.ID; classWebServices.InstitutionName = permisionsByWs[0].INSTITUTION.Tittle; } classWebServices.PermissionList = permisionsByWs; return(classWebServices); } catch { return((HelpClassWebServices)null); } }
public List <HelpClassWebServices> GetUsersWebServicesPermissions(bool active, USER user, INSTITUTION inst) { DataClasses1DataContext classes1DataContext = new DataClasses1DataContext(); List <HelpClassWebServices> list = new List <HelpClassWebServices>(); try { foreach (PERMISSION permission in new PermissionsDAL().GetPermisionsByUser(user)) { if (permission.WEBSERVICE.Active == active && permission.Active) { HelpClassWebServices classWebServices = new HelpClassWebServices(); List <PERMISSION> permisionsByWs = new PermissionsDAL().GetPermisionsByWS(permission.WEBSERVICE); classWebServices.ID = permission.WEBSERVICE.ID; classWebServices.Tittle = permission.WEBSERVICE.Tittle; classWebServices.Description = permission.WEBSERVICE.Description; classWebServices.Note = permission.WEBSERVICE.Note; classWebServices.URL = permission.WEBSERVICE.URL; classWebServices.Active = permission.WEBSERVICE.Active; classWebServices.CreatedOn = permission.WEBSERVICE.CreatedOn; classWebServices.WSObj = permission.WEBSERVICE; classWebServices.IDInstitution = 0L; classWebServices.InstitutionName = "x"; classWebServices.PermissionList = permisionsByWs; if (permisionsByWs.Count != 0) { classWebServices.IDInstitution = permisionsByWs[0].INSTITUTION.ID; classWebServices.InstitutionName = permisionsByWs[0].INSTITUTION.Tittle; if (classWebServices.IDInstitution == inst.ID) { list.Add(classWebServices); } } } } return(list); } catch { return(list); } }
public List <HelpClassWebServices> GetWebServicesInstitutionsPermissions(bool active) { DataClasses1DataContext classes1DataContext = new DataClasses1DataContext(); List <HelpClassWebServices> list = new List <HelpClassWebServices>(); try { foreach (WEBSERVICE ws in this.GetAllActiveDeleted(active)) { HelpClassWebServices classWebServices = new HelpClassWebServices(); List <PERMISSION> permisionsByWs = new PermissionsDAL().GetPermisionsByWS(ws); classWebServices.ID = ws.ID; classWebServices.Tittle = ws.Tittle; classWebServices.Description = ws.Description; classWebServices.Note = ws.Note; classWebServices.URL = ws.URL; classWebServices.Active = ws.Active; classWebServices.CreatedOn = ws.CreatedOn; classWebServices.WSObj = ws; classWebServices.IDInstitution = 0L; classWebServices.InstitutionName = "x"; if (permisionsByWs.Count != 0) { classWebServices.IDInstitution = permisionsByWs[0].INSTITUTION.ID; classWebServices.InstitutionName = permisionsByWs[0].INSTITUTION.Tittle; } classWebServices.PermissionList = permisionsByWs; list.Add(classWebServices); } return(list); } catch { return(list); } }