/// <summary> /// Load the Vehicle Codes(VMA and VMO) from Classic RMS into a Web RMS Agency. /// <remarks>TODO: This method does not support Update. This assumes the SystemCodes.UpdateAllAgencies() has run first purging all existing codes.</remarks> /// </summary> public static void ImportIntoAgency(Guid agencyId, string classicRmsConnectionString) { using (var context = new AdministrationDbContext()) { var agency = context.Find <Domain.Administration.Aggregates.Agency.Agency>(agencyId); LoadNcicCodes(classicRmsConnectionString, agency, "VMA", "Vehicle Make", "Category", "Category_desc"); LoadNcicCodes(classicRmsConnectionString, agency, "VMO", "Vehicle Model", "Property_Code", "Property_Code_desc", "VMOTTCH"); context.Commit(); } }
/// <summary> /// Create a Default Officer Role in an Agency /// </summary> public static Guid CreateInAgency(Guid agencyId) { using (var context = new AdministrationDbContext()) { var agency = context.Find <Domain.Administration.Aggregates.Agency.Agency>(agencyId); var role = agency.CreateRole(Name, "Default Officer Role"); ModuleTypeInfo.ReportModules.ForEach(x => role.SetModulePermissions(x, new ModulePermissions(false, true, false, false))); context.Commit(); return(role.Id); } }
public void ToRole(Guid roleId) { using (var context = new AdministrationDbContext()) { var agency = context.Find <Domain.Administration.Aggregates.Agency.Agency>(_agencyId); var templates = agency.Templates.ToList(); var role = agency.GetRole(roleId); // Assign the role to all available Templates templates.ForEach(t => t.AssignRole(role)); context.Commit(); } }
/// <summary> /// Create a Default Admin Role in an Agency. /// /// </summary> public static Guid CreateInAgency(Guid agencyId) { using (var context = new AdministrationDbContext()) { var agency = context.Find <Domain.Administration.Aggregates.Agency.Agency>(agencyId); var role = agency.CreateRole(Name, "Default Administrator Role"); role.SetAgencyPermissions(new AgencyPermissions(true, true, true, true)); // Assign the role to all available Templates var agencyTemplates = agency.Templates.ToList(); agencyTemplates.ForEach(t => t.AssignRole(role)); context.Commit(); return(role.Id); } }
/// <summary> /// Apply the "Default" settings to an Agency. /// </summary> public static void Apply(Guid agencyId) { using (var context = new AdministrationDbContext()) { var agency = context.Find <Domain.Administration.Aggregates.Agency.Agency>(agencyId); Log.Info("Setting default configuration for " + agency.Jurisdiction.Ori); // Get the Agency's Configuration var config = agency.Configuration; // default setting for number control behavior in incident. config.ReportNumberEqualsCaseNumber = true; context.Commit(); } }
/// <summary> /// Create the Default Workflow for the Agency /// </summary> public static void CreateInAgency(Guid agencyId) { using (var context = new AdministrationDbContext()) { // Find the Agency var agency = context.Find <Domain.Administration.Aggregates.Agency.Agency>(agencyId); // Create a New Workflow var defaultWorkflow = agency.CreateWorkflow("Default Workflow", CreateDefaultWorkflowSequence().Serialize()); // Enable the Workflow defaultWorkflow.Enable(); context.Commit(); } }
/// <summary> /// Create a Default Supervisor Role in an Agency. /// </summary> public static Guid CreateInAgency(Guid agencyId) { using (var context = new AdministrationDbContext()) { var agency = context.Find <Domain.Administration.Aggregates.Agency.Agency>(agencyId); var role = agency.CreateRole(Name, "Default Supervisor Role"); role.SetAgencyPermissions(new AgencyPermissions(true, false, true, true)); role.SetModulePermissions(ModuleType.Arrest, ModulePermissions.All); role.SetModulePermissions(ModuleType.Case, ModulePermissions.All); // Case doesn't really make sense here. role.SetModulePermissions(ModuleType.FieldInterview, ModulePermissions.All); role.SetModulePermissions(ModuleType.Incident, ModulePermissions.All); context.Commit(); return(role.Id); } }
/// <summary> /// Re-Import all "Agency Settings" from a ClassicRMS server into an Agency in WebRMS. /// </summary> public static void UpdateAgencySettings(Guid agencyId, string classicRmsConnectionString) { using (var context = new AdministrationDbContext()) { var agency = context.Find <Domain.Administration.Aggregates.Agency.Agency>(agencyId); // Remove all existing code sets from the Agency. // TODO: This is in place until we solve the problem of Web getting its codes from Classic. Log.Info("Resetting Agency Settings for jurisdiction {0}", agency.Jurisdiction.Ori); // Load Agency Settings from Classic LoadAgencySettingsFromClassicRms(agency, classicRmsConnectionString); context.Commit(); } }
/// <summary> /// Re-Import all "System Codes" from a ClassicRMS server into an Agency in WebRMS. /// </summary> public static void UpdateAgencyCodes(Guid agencyId, string classicRmsConnectionString) { using (var context = new AdministrationDbContext()) { var agency = context.Find <Domain.Administration.Aggregates.Agency.Agency>(agencyId); // Remove all existing code sets from the Agency. // TODO: This is in place until we solve the problem of Web getting its codes from Classic. var removedCodes = context.Set <CodeSet>().RemoveRange(agency.RemoveAllCodeSets()); context.Commit(); Log.Info("Purged {0} CodeSets from {1}", removedCodes.Count(), agency.Jurisdiction.Ori); // Load System Codes from Classic LoadSystemCodesFromClassicRms(agency, classicRmsConnectionString); context.Commit(); // Load Dmv Codes from Classic LoadDmvCodesFromClassicRms(agency, classicRmsConnectionString); context.Commit(); } }
/// <summary> /// Create the "Developer" user in an Agency. /// Also assign the user to all roles in the system. /// </summary> /// <param name="homeAgencyId">Id of the Agency the developer account belongs to.</param> /// <returns></returns> public static Guid CreateInAgency(Guid homeAgencyId) { Log.Info("Creating Developer User Account"); using (var context = new AdministrationDbContext()) { var rmsSystem = context.GetSystemInstance(); var agency = context.Find <Domain.Administration.Aggregates.Agency.Agency>(homeAgencyId); // Create the User Account var devUser = rmsSystem.CreateUserAccount(UniqueId, agency, Username, "developer"); devUser.FirstName = "Evolution"; devUser.LastName = "Developer"; // Find all Roles in the System except the "etl" role. var roles = context.Set <Role>() .Where(x => x.Name != ClassicIntegrationRole.Name).ToList(); // Assign the developer account to all roles in the System. roles.ForEach(role => devUser.AssignRole(role)); // Create an Officer for the developer account var devOfficer = agency.CreateOfficerFromUser(devUser); devOfficer.OfficerId = "47"; devOfficer.IncludeInOfficerDropdown = true; // Activate the user devUser.MakeActive(); // Make the user a system Administrator. devUser.MakeAdministrator(); context.Commit(); return(devUser.Id); } }