public static Dictionary <string, bool> GetEffectiveEntityRecordPermissions(int userUID, EntityTypeGUIDRecordUIDPair eTypeUIDPair, List <int> groupUIDList) { //Create initial dictionary Dictionary <string, bool> effPerms = new Dictionary <string, bool>(); DataAccessAdapter da = new DataAccessAdapter(true); da.CloseConnection(); //Get Datatable of entitytype permissions for user DataTable userPerms = RetrievalProcedures.SelectUserRecordPermissions(eTypeUIDPair.EntityTypeGUID, eTypeUIDPair.RecordUID, userUID); assignAllowFromDataView(effPerms, userPerms.DefaultView); foreach (int gGUID in groupUIDList) { //Get Datatable of entitytype permissions for group gm DataTable groupPerms = RetrievalProcedures.SelectGroupRecordPermissions(eTypeUIDPair.EntityTypeGUID, eTypeUIDPair.RecordUID, gGUID); //If no prmissions for the EntityType, ignore and continue if (groupPerms.DefaultView.Count == 0) { continue; } assignAllowFromDataView(effPerms, groupPerms.DefaultView); } return(effPerms); }
public IList <CountEmployeesByClassificationResultRow> CountEmployeesByClassification() { // Use the generated calls to the procedure and pass in a generated projection to a poco to project the resultset // to a set of poco instances. The Fetch... method creates a new adapter instance. We could also pass one in. return(RetrievalProcedures.FetchCountEmployeesByClassificationResultTypedView( new QueryFactory().GetCountEmployeesByClassificationResultTypedViewProjection())); }
public ActionResult ReportsPhoneSupportRead([DataSourceRequest] DataSourceRequest request, ReportsPhoneSupportSearchVM model) { ReportPhoneSupportResultTypedView results = new ReportPhoneSupportResultTypedView(); string[] userIds = model.UserId.Split(','); foreach (string userId in userIds) { int iUserId = 0; if (Int32.TryParse(userId, out iUserId)) { RetrievalProcedures.FetchReportPhoneSupportResultTypedView(results, model.FromDate, model.ToDate, iUserId); } } var Results = from Reslt in results select new { ActivityDate = Reslt.ActivityDate, Action = Reslt.Action, Assignment = Reslt.Assignment, Description = Reslt.Description, Result = Reslt.Result, ToFrom = Reslt.ToFrom }; return(Json(Results.ToDataSourceResult(request))); //return Json(Results.ToDataSourceResult(request, ModelState), JsonRequestBehavior.AllowGet); }
internal static void GetManagerEmployees(int employeeID, TreeNode masterNode) { var managees = RetrievalProcedures.UspGetManagerEmployees(employeeID); foreach (DataRow row in managees.Rows) { FindEmployeeRecursive(Convert.ToInt32(row["ManagerID"]), masterNode.Nodes).Nodes.Add(MakeNode(row)); } }
public static Dictionary <Guid, Dictionary <string, bool> > GetEffectiveCustomPermissions(int userUID, List <int> groupUIDList) { //Create initial dictionary Dictionary <Guid, Dictionary <string, bool> > effPerms = new Dictionary <Guid, Dictionary <string, bool> >(); //Get List of all entityTypes. EntityCollection <CustomPermissionTypeEntity> customPermissionTypes = new EntityCollection <CustomPermissionTypeEntity>(); DataAccessAdapter da = new DataAccessAdapter(true); da.FetchEntityCollection(customPermissionTypes, null); da.CloseConnection(); //Get Datatable of entitytype permissions for user DataTable userPerms = RetrievalProcedures.SelectUserCustomPermissions(userUID); //Iterate through list of entity Types foreach (CustomPermissionTypeEntity cpType in customPermissionTypes) { DataView cpTypeRows = new DataView(userPerms); cpTypeRows.RowFilter = "CPUID = '" + cpType.GUID + "'"; //If no prmissions for the EntityType, ignore and continue //if(eTypeRows.Count == 0) // continue; //CReate sub-keyvalue pair Dictionary <string, bool> cpPerms = new Dictionary <string, bool>(); assignAllowFromDataView(cpPerms, cpTypeRows); foreach (int gUID in groupUIDList) { //Get Datatable of entitytype permissions for group gm DataTable groupPerms = RetrievalProcedures.SelectGroupEntityTypePermissions(gUID); DataView cpTypeGRows = new DataView(groupPerms); cpTypeGRows.RowFilter = "CPUID = '" + cpType.GUID + "'"; //If no prmissions for the EntityType, ignore and continue if (cpTypeGRows.Count == 0) { continue; } assignAllowFromDataView(cpPerms, cpTypeGRows); } //No point adding perm if no perms anyways. if (cpPerms.Count > 0) { effPerms.Add(cpType.GUID, cpPerms); } } return(effPerms); }
/// <summary> /// Gets a <see cref="List{T}"/> of <see cref="VenueDistanceResultRow"/>s, which have within a maximum distance from a given location. /// </summary> /// <param name="maxDistance">The maximum distance from the location.</param> /// <param name="longitude">The longitude of the location to use for distance calculation.</param> /// <param name="latitude">The latitude of the location to use for distance calculation.</param> /// <param name="cancellationToken"></param> /// <returns>Returns a <see cref="List{T}"/> of <see cref="VenueDistanceResultRow"/>s, which have within a maximum distance from a given location.</returns> public virtual async Task <List <VenueDistanceResultRow> > GetVenuesForDistanceAsync(double maxDistance, double longitude, double latitude, CancellationToken cancellationToken) { /* DANGER ZONE: This query returns the same result, BUT DOES NOT respect schema/catalog overwrites. * The adapter has to be passed, otherwise the default adapter will be created * see https://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=26767 * await da.FetchProjectionAsync<VenueDistanceResultRow>( * RetrievalProcedures.GetQueryForVenueDistanceResultTypedView(maxDistance, latitude, longitude), cancellationToken); */ using var da = _dbContext.GetNewAdapter(); return(await da.FetchProjectionAsync <VenueDistanceResultRow>( RetrievalProcedures.GetVenueDistanceCallAsQuery(maxDistance, latitude, longitude, da), cancellationToken)); }
public static Dictionary <Guid, Dictionary <string, bool> > GetEffectiveEntityTypePermissions(int userUID, List <int> groupUIDList) { //Create initial dictionary Dictionary <Guid, Dictionary <string, bool> > effPerms = new Dictionary <Guid, Dictionary <string, bool> >(); //Get List of all entityTypes. List <EntityDefinition> entityTypes = new List <EntityDefinition>(); //Get Datatable of entitytype permissions for user DataTable userPerms = RetrievalProcedures.SelectUserEntityTypePermissions(userUID); //Iterate through list of entity Types foreach (EntityDefinition eType in entityTypes) { DataView eTypeRows = new DataView(userPerms); eTypeRows.RowFilter = "EntityTypeGUID = '" + eType.Guid + "'"; //If no prmissions for the EntityType, ignore and continue //if(eTypeRows.Count == 0) // continue; //CReate sub-keyvalue pair Dictionary <string, bool> ePerms = new Dictionary <string, bool>(); assignAllowFromDataView(ePerms, eTypeRows); foreach (int uID in groupUIDList) { //Get Datatable of entitytype permissions for group gm DataTable groupPerms = RetrievalProcedures.SelectGroupEntityTypePermissions(uID); DataView eTypeGRows = new DataView(groupPerms); eTypeGRows.RowFilter = "EntityTypeGUID = '" + eType.Guid + "'"; //If no prmissions for the EntityType, ignore and continue if (eTypeGRows.Count == 0) { continue; } assignAllowFromDataView(ePerms, eTypeGRows); } if (ePerms.Count > 0) { effPerms.Add(eType.Guid, ePerms); } } return(effPerms); }
public int CreateEmployeeClassification(GetEmployeeClassificationsResultRow employeeClassification) { if (employeeClassification == null) { throw new ArgumentNullException(nameof(employeeClassification), $"{nameof(employeeClassification)} is null."); } // The stored procedure in question returns the created PK value as a resultset and not as an output parameter. // We therefore have to call the procedure as if it's returning a resultset. var result = RetrievalProcedures.FetchCreateEmployeeClassificationResultTypedView( new QueryFactory().GetCreateEmployeeClassificationResultTypedViewProjection(), employeeClassification.EmployeeClassificationName, employeeClassification.IsExempt, employeeClassification.IsEmployee) .FirstOrDefault(); return(result?.EmployeeClassificationKey ?? 0); }
internal static TreeNode GetEmployeeManagersNodes(int employeeID) { TreeNode MasterNode; var Managers = RetrievalProcedures.UspGetEmployeeManagers(employeeID); if (Managers.Rows.Count > 0) { var ManagersCol = new TreeNode().Nodes; CreateNode(Managers.Rows[Managers.Rows.Count - 1], ManagersCol); var CEORow = Managers.Rows[Managers.Rows.Count - 1]; var CEONode = MakeNode(CEORow["ManagerLastName"], CEORow["ManagerFirstName"], CEORow["ManagerID"]); CEONode.Nodes.Add(ManagersCol[0]); MasterNode = CEONode; } else { MasterNode = MakeNode(null, null, employeeID); MasterNode.Nodes.Add(MakeNode(null, null, employeeID)); } return(MasterNode); }
public static DataTable GetUserEntityTypePermissions(int userUID, Guid entityTypeGUID) { DataTable perms = RetrievalProcedures.SelectUserEntityTypePermissions(userUID); return(perms); }
public List <MvBranch> GetBranch(int branchId, string searchText) { return(DataAccessHelper.FetchDerivedModel <MvBranch>(RetrievalProcedures.GetSpBranchSelCallAsQuery(branchId, searchText))); }
public List <MvHotel> GetHotel(int hotelId, string searchText) { return(DataAccessHelper.FetchDerivedModel <MvHotel>(RetrievalProcedures.GetSpHotelSelCallAsQuery(hotelId, searchText))); }
public List <MvRoom> GetRoom(int roomId) { return(DataAccessHelper.FetchDerivedModel <MvRoom>(RetrievalProcedures.GetSpRoomSelCallAsQuery(roomId))); }
public static DataTable GetGroupEntityTypePermissions(int groupUID, Guid entityTypeGUID) { DataTable perms = RetrievalProcedures.SelectGroupEntityTypePermissions(groupUID); return(perms); }
public IList <GetEmployeeClassificationsResultRow> GetEmployeeClassifications() { return(RetrievalProcedures.FetchGetEmployeeClassificationsResultTypedView( new QueryFactory().GetGetEmployeeClassificationsResultTypedViewProjection(), null)); }
public List <MvReservation> GetReservation(int reservationId) { return(DataAccessHelper.FetchDerivedModel <MvReservation>(RetrievalProcedures.GetSpReservationSelCallAsQuery(reservationId))); }
public GetEmployeeClassificationsResultRow?GetEmployeeClassifications(int employeeClassificationKey) { return(RetrievalProcedures.FetchGetEmployeeClassificationsResultTypedView( new QueryFactory().GetGetEmployeeClassificationsResultTypedViewProjection(), employeeClassificationKey).FirstOrDefault()); }
public List <MvServiceCategory> GetServiceCategory(int serviceCategoryId, string searchText) { return(DataAccessHelper.FetchDerivedModel <MvServiceCategory>(RetrievalProcedures.GetSpServiceCategorySelCallAsQuery(serviceCategoryId, searchText))); }
public List <MvSeason> GetSeason(int seasonId, string searchText) { return(DataAccessHelper.FetchDerivedModel <MvSeason>(RetrievalProcedures.GetSpSeasonSelCallAsQuery(seasonId, searchText))); }
public List <MvBooking> GetBooking(int bookingId, string searchText) { return(DataAccessHelper.FetchDerivedModel <MvBooking>(RetrievalProcedures.GetSpBookingSelCallAsQuery(bookingId, searchText))); }
public List <MvCustomer> GetCustomer(int customerId, string searchText) { return(DataAccessHelper.FetchDerivedModel <MvCustomer>(RetrievalProcedures.GetSpCustomerSelCallAsQuery(customerId, searchText))); }