Пример #1
0
 public Role(Management.Compute.Models.Role role)
 {
     RoleName = role.RoleName;
     OsVersion = role.OSVersion;
     RoleType = role.RoleType;
     configurationSets.AddRange(role.ConfigurationSets.Select(cs => new ConfigurationSet(cs)));
 }
        /// <summary>
        /// Construct AzureSqlServerRecommendedActionModel from Management.Sql.Models.Recommended Action object
        /// </summary>
        /// <param name="resourceGroupName">Resource group</param>
        /// <param name="serverName">Server name</param>
        /// <param name="advisorName">Advisor name</param>
        /// <param name="recommendedAction">Recommended Action object</param>
        public AzureSqlServerRecommendedActionModel(string resourceGroupName, string serverName, string advisorName, Management.Sql.Models.RecommendedAction recommendedAction) 
        {
            ResourceGroupName = resourceGroupName;
            ServerName = serverName;
            AdvisorName = advisorName;

            RecommendedActionName = recommendedAction.Name;
            RecommendationReason = recommendedAction.Properties.RecommendationReason;
            ValidSince = recommendedAction.Properties.ValidSince;
            LastRefresh = recommendedAction.Properties.LastRefresh;
            State = recommendedAction.Properties.State;
            IsExecutableAction = recommendedAction.Properties.IsExecutableAction;
            IsRevertableAction = recommendedAction.Properties.IsRevertableAction;
            IsArchivedAction = recommendedAction.Properties.IsArchivedAction;
            ExecuteActionStartTime = recommendedAction.Properties.ExecuteActionStartTime;
            ExecuteActionDuration = recommendedAction.Properties.ExecuteActionDuration;
            RevertActionStartTime = recommendedAction.Properties.RevertActionStartTime;
            RevertActionDuration = recommendedAction.Properties.RevertActionDuration;
            ExecuteActionInitiatedBy = recommendedAction.Properties.ExecuteActionInitiatedBy;
            ExecuteActionInitiatedTime = recommendedAction.Properties.ExecuteActionInitiatedTime;
            RevertActionInitiatedBy = recommendedAction.Properties.RevertActionInitiatedBy;
            RevertActionInitiatedTime = recommendedAction.Properties.RevertActionInitiatedTime;
            Score = recommendedAction.Properties.Score;
            ImplementationDetails = recommendedAction.Properties.ImplementationDetails;
            ErrorDetails = recommendedAction.Properties.ErrorDetails;
            EstimatedImpact = recommendedAction.Properties.EstimatedImpact;
            ObservedImpact = recommendedAction.Properties.ObservedImpact;
            TimeSeries = recommendedAction.Properties.TimeSeries;
            LinkedObjects = recommendedAction.Properties.LinkedObjects;
            Details = recommendedAction.Properties.Details;
        }
 /// <summary>
 /// Construct AzureSqlDatabaseModelExpanded from Management.Sql.Models.Database object
 /// </summary>
 /// <param name="resourceGroup">Resource group</param>
 /// <param name="serverName">Server name</param>
 /// <param name="database">Database object</param>
 public AzureSqlDatabaseModelExpanded(string resourceGroup, string serverName, Management.Sql.Models.Database database) : base(resourceGroup, serverName, database)
 {
     if (database.Properties.ServiceTierAdvisors != null 
         && database.Properties.ServiceTierAdvisors.Count > 0)
     {
         ServiceTierAdvisor = database.Properties.ServiceTierAdvisors[0].Properties;
     }
 }
 /// <summary>
 /// Converts from an API object to a PowerShell object
 /// </summary>
 /// <param name="resp">The object to transform</param>
 /// <returns>The converted location capability model</returns>
 private LocationCapabilityModel CreateLocationCapabilityModel(Management.Sql.Models.LocationCapability resp)
 {
     LocationCapabilityModel model = new LocationCapabilityModel();
     model.LocationName = resp.Name;
     model.Status = resp.Status;
     model.SupportedServerVersions = resp.SupportedServerVersions.Select(v => { return CreateSupportedVersionsModel(v); }).ToList();
     return model;
 }
 /// <summary>
 /// Converts from an API object to a PowerShell object
 /// </summary>
 /// <param name="v">The object to transform</param>
 /// <returns>The converted server version capability model</returns>
 private ServerVersionCapabilityModel CreateSupportedVersionsModel(Management.Sql.Models.ServerVersionCapability v)
 {
     ServerVersionCapabilityModel version = new ServerVersionCapabilityModel();
     version.ServerVersionName = v.Name;
     version.Status = v.Status;
     version.SupportedEditions = v.SupportedEditions.Select(e => { return CreateSupportedEditionModel(e); }).ToList();
     return version;
 }
        public PSExpressRouteCircuit ToPsExpressRouteCircuit(Management.Network.Models.ExpressRouteCircuit circuit)
        {
            var psCircuit = Mapper.Map<PSExpressRouteCircuit>(circuit);

            psCircuit.Tag = TagsConversionHelper.CreateTagHashtable(circuit.Tags);

            return psCircuit;
        }
 public InstanceEndpoint(Management.Compute.Models.InstanceEndpoint endpoint)
 {
     Name = endpoint.Name;
     Vip = endpoint.VirtualIPAddress.ToString();
     PublicPort = endpoint.Port;
     LocalPort = endpoint.LocalPort.GetValueOrDefault(0);
     Protocol = endpoint.Protocol;
 }
 public DnsSettings(Management.Compute.Models.DnsSettings settings)
     : this()
 {
     foreach (var server in settings.DnsServers)
     {
         DnsServers[server.Name] = IPAddress.Parse(server.Address);
     }
 }
        private int GetEventId(Management.Network.Models.GatewayEvent gatewayEvent)
        {
            int val = -1;
            if (gatewayEvent != null)
            {
                int.TryParse(gatewayEvent.Id, out val);
            }

            return val;
        }
Пример #10
0
    public master ()
    {
        Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.RealTime;

        Management wsrv = new Management();
        isDaysLeft = wsrv.IsDaysLeft();

        //Uncomment the following line if using designed components 
        //InitializeComponent(); 
    }
Пример #11
0
 public void ItReturnsProfiles()
 {
     var json = Resources.ManagementProfilesJson;
       var connection = Substitute.For<IConnection>();
       connection.GetStringAsync(Arg.Any<Uri>(), Arg.Any<string>())
     .Returns(Task.FromResult(json));
       var management = new Management(connection, null);
       var profiles = management.GetProfilesAsync().Result;
       Assert.NotNull(profiles);
       Assert.IsAssignableFrom<IEnumerable<Profile>>(profiles);
 }
        /// <summary>
        /// Construct AzureSqlDatabaseAdvisorModel from Management.Sql.Models.Advisor object
        /// </summary>
        /// <param name="resourceGroupName">Resource group</param>
        /// <param name="serverName">Server name</param>
        /// <param name="advisor">Advisor object</param>
        public AzureSqlServerAdvisorModel(string resourceGroupName, string serverName, Management.Sql.Models.Advisor advisor) 
        {
            ResourceGroupName = resourceGroupName;
            ServerName = serverName;

            AdvisorName = advisor.Name;
            AdvisorStatus = advisor.Properties.AdvisorStatus;
            RecommendationsStatus = advisor.Properties.RecommendationsStatus;
            AutoExecuteStatus = advisor.Properties.AutoExecuteStatus;
            AutoExecuteStatusInheritedFrom = advisor.Properties.AutoExecuteStatusInheritedFrom;
            LastChecked = advisor.Properties.LastChecked;
            RecommendedActions = advisor.Properties.RecommendedActions;
        }
        /// <summary>
        /// Convert a Management.Sql.Models.ServiceObjective to AzureSqlDatabaseServerServiceObjectiveModel
        /// </summary>
        /// <param name="resourceGroupName">The resource group the server is in</param>
        /// <param name="serverName">The name of the server</param>
        /// <param name="resp">The management client ServiceObjective response to convert</param>
        /// <returns>The converted ServiceObjective model</returns>
        private static AzureSqlServerServiceObjectiveModel CreateServiceObjectiveModelFromResponse(string resourceGroupName, string serverName, Management.Sql.Models.ServiceObjective resp)
        {
            AzureSqlServerServiceObjectiveModel slo = new AzureSqlServerServiceObjectiveModel();

            slo.ResourceGroupName = resourceGroupName;
            slo.ServerName = serverName;
            slo.ServiceObjectiveName = resp.Properties.ServiceObjectiveName;
            slo.IsDefault = resp.Properties.IsDefault;
            slo.IsSystem = resp.Properties.IsSystem;
            slo.Description = resp.Properties.Description;
            slo.Enabled = resp.Properties.Enabled;

            return slo;
        }
Пример #14
0
 public RoleInstance(Management.Compute.Models.RoleInstance roleInstance)
     : this()
 {
     RoleName = roleInstance.RoleName;
     InstanceName = roleInstance.InstanceName;
     InstanceStatus = roleInstance.InstanceStatus;
     InstanceUpgradeDomain = roleInstance.InstanceUpgradeDomain.ToString();
     InstanceFaultDomain = roleInstance.InstanceFaultDomain.ToString();
     InstanceSize = roleInstance.InstanceSize.ToString();
     InstanceStateDetails = roleInstance.InstanceStateDetails;
     InstanceErrorCode = roleInstance.InstanceErrorCode;
     IPAddress = IPAddress.Parse(roleInstance.IPAddress);
     InstanceEndpoints = new List<InstanceEndpoint>(roleInstance.InstanceEndpoints.Select(ep => new InstanceEndpoint(ep)));
     PowerState = roleInstance.PowerState.ToString();
     HostName = roleInstance.HostName;
     RemoteAccessCertificateThumbprint = roleInstance.RemoteAccessCertificateThumbprint;
 }
 /// <summary>
 /// Construct AzureSqlServerDisasterRecoveryConfigurationModel from Management.Sql.Models.ServerDisasterRecoveryConfiguration object
 /// </summary>
 /// <param name="resourceGroup">Resource group</param>
 /// <param name="serverName">Server name</param>
 /// <param name="serverDisasterRecoveryConfiguration">ServerDisasterRecoveryConfiguration object</param>
 public AzureSqlServerDisasterRecoveryConfigurationModel(string resourceGroup, string serverName, Management.Sql.Models.ServerDisasterRecoveryConfiguration serverDisasterRecoveryConfiguration)
 {
     ResourceGroupName = resourceGroup;
     ServerName = serverName;
     
     // Short-term workaround for missing sdrc. Will remove once upstream issues are resolved.
     if (serverDisasterRecoveryConfiguration != null)
     {
         ServerDisasterRecoveryConfigurationName = serverDisasterRecoveryConfiguration.Name;
         VirtualEndpointName = serverDisasterRecoveryConfiguration.Name;
         Location = serverDisasterRecoveryConfiguration.Location;
         PartnerServerName = serverDisasterRecoveryConfiguration.Properties.PartnerLogicalServerName;
         AutoFailover = serverDisasterRecoveryConfiguration.Properties.AutoFailover;
         FailoverPolicy = serverDisasterRecoveryConfiguration.Properties.FailoverPolicy;
         Role = serverDisasterRecoveryConfiguration.Properties.Role;
     }
     
 }
Пример #16
0
    public static void Main()
    {
        // Instantiate the component and start it.
        Management cmpt = new Management(126, 1, 160);
	
        // Start the component and the services
        cmpt.startComponent();
	    
        // Wait until signaled to exit
	   Console.CancelKeyPress += delegate(object sender, ConsoleCancelEventArgs e)
	   {
			e.Cancel = true;
			MainClass.run = false;
	   };
	   
	   while(run)
	   {
			Thread.Sleep(100);
	   }
    
        // Shutdown the component and threads
        cmpt.shutdownComponent();
    }
Пример #17
0
        public static void archiveFolder(
            String rCloneDirectory,
            String localDropStream,
            String localArchiverBuffer,
            String remoteDropStreamTarget,
            String remoteArchive,
            String fileFormatNameRegex,
            String fileExtenstion,
            String thesholdInGigabytes)
        {
            Stopwatch watch = Stopwatch.StartNew();

            String localTempFolder     = String.Empty;
            String localZipDestination = String.Empty;


            try
            {
                ///Timer for diagnosing

                ///Let's get a temperary name for the temperary folder
                Logger.Info("Getting Temparary Folder... ");
                localTempFolder = Organizer.getTempFolderPath(localDropStream, localArchiverBuffer);
                Logger.Info(String.Format("{0} - {1}", "Temparary Folder Retrieved!", localTempFolder));

                ///Where will this zip file be located locally
                Logger.Info("Creating Time-Stamped folders...");
                localZipDestination = Organizer.createTimestampFolders(localDropStream, localArchiverBuffer, fileFormatNameRegex, fileExtenstion);
                Logger.Info(String.Format("{0}: {1}", "Time-Stamped folders created! Local Zip Destination", localZipDestination));

                ///Compress / Remove the folder to be archived
                Logger.Info(String.Format("{0}: {1}", "Compress and removing target folder to the following location", localTempFolder));
                Organizer.compressAndRemoveTargetFolder(localZipDestination);
                Logger.Info("Successfully compressed and removed folder!");


                ///To make the threshold process a little easier, we need to rename any duplicated file names
                Logger.Info(String.Format("{0}: {1}", "Renaming any duplicated files for removal", localTempFolder));
                CDirectory.renameDuplicatedFiles(rCloneDirectory, remoteArchive);
                Logger.Info("Duplicates renamed / removed!");

                ///Serialize localzipdesitination file for parsing
                FileInfo info = new FileInfo(localZipDestination);
                ///Get a list of all of the existing files in target archive
                var existingFiles = CloudDirectory.serializeDirectory(CDirectory.getFilesStatsInDirectory(rCloneDirectory, remoteArchive));
                ///Delete any files in cloud over threshold
                Logger.Info(String.Format("Removing any files over: {0} (GB) At remote Location: {1} Utilizing: {2}", thesholdInGigabytes, remoteArchive, info.Name));
                List <FileCloudInfo> filesToRemove = Containment.getFIlesInDirectoryOverThreshold(existingFiles, info, Double.Parse(thesholdInGigabytes));
                Logger.Info("Now removing a total of {0} files from cloud directory: {1}", filesToRemove.Count(), remoteArchive);
                Logger.Debug("Target Files: {0}", String.Concat(filesToRemove.Select(o => String.Format("\n{0} ", o.FilePath)))); //Print out all of the files to remove

                ///Run Command to Delete *any* target files
                filesToRemove.ForEach(i => CDelete.deleteDirectory(rCloneDirectory, String.Format(@"{0}/{1}", remoteArchive, i.FilePath)));
                ///Lots of logging, information regarding deleting items
                Logger.Info("Ran command to removed files over threshold! Files *removed*: {0} | Memory *Free'd up*: {1} (GB) ", filesToRemove.Count,
                            ByteSizeLib.ByteSize.FromBytes(filesToRemove.Sum(i => i.Length)).GigaBytes, (filesToRemove.Sum(i => i.Length)));

                ///Moving Zipped file to the cloud storage
                Logger.Info(String.Format("{0} - Local Temp Folder: {1} RemoteArchive: {2}", "Moving the compressed file to cloud storage!", localTempFolder, remoteArchive));
                CMove.moveFile(rCloneDirectory, localTempFolder, remoteArchive, Config.compressionFormat, Config.connectionAttempts);
                Logger.Info(String.Format("{0}", "Successfully deleted Contents!"));

                ///Delete the local folder
                Logger.Info(String.Format("{0}: {1}", "Deleting the following local 'Temp Folder' ", localTempFolder));
                System.IO.Directory.Delete(localTempFolder, true);
                Logger.Info("Successfully deleted the local temp folder!");

                ///TODO: Remove this to a later process...
                Logger.Info(String.Format("{0} - rCloneLocation: {1} gDriveName: {2}", "Deleting requested remote folders", rCloneDirectory, remoteDropStreamTarget));
                CDelete.deleteDirectory(rCloneDirectory, remoteDropStreamTarget);
                Logger.Info(String.Format("{0}", "Deletion of contents command has been ran!"));


                ///Due to a bug, the cloud software may not "release" files. Resetting it will fix this.

                Logger.Info(String.Format("{0} - cloudProcessName: {1} cloudProcessPath: {2}", "Restarting Process", Config.cloudProcessName, Config.cloudProcessPath));
                Management.restartProcess(Config.cloudProcessName, Config.cloudProcessPath);
                Logger.Info("Process successully restarted!");



                ///Delete the cloud folder
                Logger.Info(String.Format("{0} - rCloneLocation: {1} gDriveName: {2}", "Emptying Cloud Folder", rCloneDirectory, Config.driveProfileName));
                CDelete.emptyTrashFolder(rCloneDirectory, Config.driveProfileName);
                Logger.Info("Successfully emptied cloud recycle bin");

                Logger.Info(String.Format("{0} - Elasped time:{1}", "Archiver has successully been ran!", watch.Elapsed.ToString()));
            }

            catch (OrganizerException e)
            {
                Logger.Error(e, String.Format("{0} - {1} (Elapsed time before error: {2} ", "Error while prepping files before transfer", e.Message, watch.Elapsed.ToString()));
                Logger.Trace(e.StackTrace);
            }
            catch (Rclone_Move_Exception e)
            {
                Logger.Error(e, String.Format("{0} - {1} (Elapsed time before error: {2}", "Error while transfering file to the cloud", e.Message, watch.Elapsed.ToString()));
                Logger.Trace(e.StackTrace);
            }

            catch (Exception e)
            {
                Logger.Error(e, String.Format("{0} - {1} (Elapsed time before error: {2} ", "Error while Archiving", e.Message, watch.Elapsed.ToString()));
                Logger.Trace(e.StackTrace);
            }

            finally
            {
                ///If the process fails, remove the temperary directory!
                if (Directory.Exists(localTempFolder))
                {
                    Directory.Delete(localTempFolder, true);
                }
            }
        }
Пример #18
0
 public CustomerRepository(Emergency common, IConfiguration config, ILogger <CustomerRepository> ilogger, IHttpContextAccessor httpContextAccessor, AccountDbContext accountDbContext, Management management, DataDbContext datadbContext, UserManager <ApplicationUser> userManager)
     : base(config, ilogger, httpContextAccessor, management, datadbContext, accountDbContext, userManager)
 {
     _config = config;
     _common = common;
 }
Пример #19
0
 public ServiceResult <IList <PageDto> > GetPublicPages()
 {
     return(Management.GetPublicPages());
 }
        /// <summary>
        /// Converts the response from the service to a powershell database object
        /// </summary>
        /// <param name="resourceGroupName">The resource group the server is in</param>
        /// <param name="serverName">The name of the Azure Sql Database Server</param>
        /// <param name="link">The service response</param>
        /// <returns>The converted model</returns>
        private AzureSqlServerCommunicationLinkModel CreateServerCommunicationLinkModelFromResponse(string resourceGroup, string serverName, Management.Sql.Models.ServerCommunicationLink link)
        {
            AzureSqlServerCommunicationLinkModel model = new AzureSqlServerCommunicationLinkModel();

            model.ResourceGroupName = resourceGroup;
            model.ServerName = serverName;
            model.Name = link.Name;
            model.PartnerServer = link.Properties.PartnerServer;
            model.State = link.Properties.State;
            model.Location = link.Location;

            return model;
        }
        /// <summary>
        /// Converts the response from the service to a powershell database object
        /// </summary>
        /// <param name="resourceGroupName">The resource group the server is in</param>
        /// <param name="serverName">The name of the Azure Sql Database Server</param>
        /// <param name="pool">The service response</param>
        /// <returns>The converted model</returns>
        private AzureSqlElasticPoolModel CreateElasticPoolModelFromResponse(string resourceGroup, string serverName, Management.Sql.Models.ElasticPool pool)
        {
            AzureSqlElasticPoolModel model = new AzureSqlElasticPoolModel();

            model.ResourceId = pool.Id;
            model.ResourceGroupName = resourceGroup;
            model.ServerName = serverName;
            model.ElasticPoolName = pool.Name;
            model.CreationDate = pool.Properties.CreationDate ?? DateTime.MinValue;
            model.DatabaseDtuMax = (int)pool.Properties.DatabaseDtuMax;
            model.DatabaseDtuMin = (int)pool.Properties.DatabaseDtuMin;
            model.Dtu = (int)pool.Properties.Dtu;
            model.State = pool.Properties.State;
            model.StorageMB = pool.Properties.StorageMB;
            model.Tags = pool.Tags as Dictionary<string, string>;
            model.Location = pool.Location;

            DatabaseEdition edition = DatabaseEdition.None;
            Enum.TryParse<DatabaseEdition>(pool.Properties.Edition, out edition);
            model.Edition = edition;

            return model;
        }
 /// <summary>
 /// Creates UpgradeDatabaseHint from database object by using same edition and SLO from upgrade hint.
 /// </summary>
 /// <param name="database">Database object</param>
 /// <returns>Returns UpgradeDatabaseHint</returns>
 private RecommendedDatabaseProperties CreateUpgradeDatabaseHint(Management.Sql.Models.Database database)
 {
     return new RecommendedDatabaseProperties()
     {
         Name = database.Name,
         TargetEdition = SloToEdition(database.Properties.UpgradeHint.TargetServiceLevelObjective),
         TargetServiceLevelObjective = database.Properties.UpgradeHint.TargetServiceLevelObjective
     };
 }
        /// <summary>
        /// Converts the response from the service to a powershell Secondary Link object
        /// </summary>
        /// <param name="resourceGroupName">The name of the Resource Group containing the primary database</param>
        /// <param name="serverName">The name of the Azure SQL Server containing the primary database</param>
        /// <param name="databaseName">The name of primary database</param>
        /// <param name="partnerResourceGroupName">The name of the Resource Group containing the secondary database</param>
        /// <param name="linkId">The linkId of the replication link to the secondary</param>
        /// <param name="response">The replication link response</param>
        /// <returns>The Azure SQL Database ReplicationLink object</returns>
        private AzureReplicationLinkModel CreateReplicationLinkModelFromReplicationLinkResponse(string resourceGroupName,
            string serverName, string databaseName, string partnerResourceGroupName, Management.Sql.Models.ReplicationLink resp)
        {
            // partnerResourceGroupName is required because it is not exposed in any reponse from the service.
            // AllowConnections.ReadOnly is not yet supported
            AllowConnections allowConnections = (resp.Properties.Role.Equals(Management.Sql.Models.DatabaseCreateMode.Secondary)
                || resp.Properties.PartnerRole.Equals(Management.Sql.Models.DatabaseCreateMode.Secondary)) ? AllowConnections.All : AllowConnections.No;

            AzureReplicationLinkModel model = new AzureReplicationLinkModel();

            model.LinkId = new Guid(resp.Name);
            model.PartnerResourceGroupName = partnerResourceGroupName;
            model.PartnerServerName = resp.Properties.PartnerServer;
            model.ResourceGroupName = resourceGroupName;
            model.ServerName = serverName;
            model.DatabaseName = databaseName;
            model.AllowConnections = allowConnections;
            model.Location = resp.Location;
            model.PartnerLocation = resp.Properties.PartnerLocation;
            model.PercentComplete = resp.Properties.PercentComplete;
            model.ReplicationState = resp.Properties.ReplicationState;
            model.PartnerRole = resp.Properties.PartnerRole;
            model.Role = resp.Properties.Role;
            model.StartTime = resp.Properties.StartTime.ToString();

            return model;
        }
 /// <summary>
 /// Converts the response from the service to a powershell Server Disaster Recovery Configuration object
 /// </summary>
 /// <param name="resourceGroup">The resource group the server is in</param>
 /// <param name="serverName">The name of the Azure Sql Server</param>
 /// <param name="serverDisasterRecoveryConfiguration">The service response</param>
 /// <returns>The converted model</returns>
 public static AzureSqlServerDisasterRecoveryConfigurationModel CreateServerDisasterRecoveryConfigurationModelFromResponse(string resourceGroup, string serverName, Management.Sql.Models.ServerDisasterRecoveryConfiguration serverDisasterRecoveryConfiguration)
 {
     return new AzureSqlServerDisasterRecoveryConfigurationModel(resourceGroup, serverName, serverDisasterRecoveryConfiguration);
 }
 public ShowPage()
 {
     this.InitializeComponent();
     Management.Display(contactslist);          //获取联系人列表,此方法在页面构造方法中直接生成完整的页面
 }
Пример #26
0
        public Editor(Management management)
        {
            this.management = management;

            InitializeComponent();
        }
Пример #27
0
 public ServiceResult <IList <PageDto> > GetPagesByIds(IList <long> ids)
 {
     return(Management.GetPagesByIds(ids));
 }
Пример #28
0
 public ServiceResult <IList <TModel> > GetPagesByIds <TModel>(IList <long> ids)
 {
     return(Management.GetPagesByIds <TModel>(ids));
 }
Пример #29
0
 public AddressRepository(IConfiguration config, ILogger <Repository.Repository <Address, DataDbContext> > ilogger, IHttpContextAccessor httpContextAccessor, AccountDbContext accountDbContext, Management management, DataDbContext datadbContext, UserManager <ApplicationUser> userManager) : base(config, ilogger, httpContextAccessor, management, datadbContext, accountDbContext, userManager)
 {
 }
Пример #30
0
        private void MineDataSimple_Load(object sender, EventArgs e)
        {
            DataBindUtil.LoadTeam(cboTeamName);
            DataBindUtil.LoadTeamMemberByTeamName(cboSubmitter, cboTeamName.Text);
            DataBindUtil.LoadWorkTime(cboWorkTime,
                                      rbtn38.Checked ? Const_MS.WORK_GROUP_ID_38 : Const_MS.WORK_GROUP_ID_46);

            if (WorkingTimeDefault.FindFirst().DefaultWorkTimeGroupId == Const_MS.WORK_GROUP_ID_38)
            {
                rbtn38.Checked = true;
            }
            else
            {
                rbtn46.Checked = true;
            }
            // 设置班次名称
            SetWorkTimeName();

            //窗体绑定到Panel中
            _ventilationInfo.MdiParent   = this;
            _ventilationInfo.Parent      = panel2;
            _coalExistenceInfo.MdiParent = this;
            _coalExistenceInfo.Parent    = panel2;
            _gasData.MdiParent           = this;
            _gasData.Parent              = panel2;
            _management.MdiParent        = this;
            _management.Parent           = panel2;
            _geologicStructure.MdiParent = this;
            _geologicStructure.Parent    = panel2;

            //panel2绑定窗体
            panel2.Controls.Add(_coalExistenceInfo);
            panel2.Controls.Add(_ventilationInfo);
            panel2.Controls.Add(_gasData);
            panel2.Controls.Add(_management);
            panel2.Controls.Add(_geologicStructure);

            if (Tunnel != null)
            {
                selectTunnelSimple1.SetTunnel(Tunnel);
            }
            if (Team != null)
            {
                cboTeamName.SelectedText = Team.TeamName;
            }
            if (MineData != null)
            {
                selectTunnelSimple1.SetTunnel(MineData.Tunnel);
                txtCoordinateX.Text = MineData.Tunnel.WorkingFace.CoordinateX.ToString(CultureInfo.InvariantCulture);
                txtCoordinateY.Text = MineData.Tunnel.WorkingFace.CoordinateY.ToString(CultureInfo.InvariantCulture);
                txtCoordinateZ.Text = MineData.Tunnel.WorkingFace.CoordinateZ.ToString(CultureInfo.InvariantCulture);

                if (MineData.WorkStyle == "三八制")
                {
                    rbtn38.Checked = true;
                    rbtn46.Checked = false;
                }
                else
                {
                    rbtn46.Checked = true;
                    rbtn38.Checked = false;
                }
                cboWorkTime.SelectedValue = MineData.WorkTime;
                cboTeamName.SelectedText  = MineData.TeamName;
                cboSubmitter.SelectedText = MineData.Submitter;

                if (MineData is CoalExistence)
                {
                    var coalexistence = (CoalExistence)MineData;
                    _coalExistenceInfo.bindDefaultValue(coalexistence);
                    Height = FormHeight + _coalExistenceInfo.Height;
                    _coalExistenceInfo.WindowState = FormWindowState.Maximized;
                    _coalExistenceInfo.Show();
                    _coalExistenceInfo.Activate();
                }
                else if (MineData is GasData)
                {
                    var gasData = (GasData)MineData;
                    _gasData.bindDefaultValue(gasData);
                    Height = FormHeight + _gasData.Height;
                    _gasData.WindowState = FormWindowState.Maximized;
                    _gasData.Show();
                    _gasData.Activate();
                }
                else if (MineData is GeologicStructure)
                {
                    var geologicStructure = (GeologicStructure)MineData;
                    _geologicStructure.bindDefaultValue(geologicStructure);
                    Height = FormHeight + _geologicStructure.Height;
                    _geologicStructure.WindowState = FormWindowState.Maximized;
                    _geologicStructure.Show();
                    _geologicStructure.Activate();
                }
                else if (MineData is Ventilation)
                {
                    var ventilation = (Ventilation)MineData;
                    _ventilationInfo.bindDefaultValue(ventilation);
                    Height = FormHeight + _ventilationInfo.Height;
                    _ventilationInfo.WindowState = FormWindowState.Maximized;
                    _ventilationInfo.Show();
                    _ventilationInfo.Activate();
                }
                else if (MineData is Management)
                {
                    var management = (Management)MineData;
                    _management.bindDefaultValue(management);
                    Height = FormHeight + _management.Height;
                    _management.WindowState = FormWindowState.Maximized;
                    _management.Show();
                    _management.Activate();
                }
            }
            else
            {
                if (!String.IsNullOrWhiteSpace(Submitter))
                {
                    cboSubmitter.Text = Submitter;
                }

                if (Text == new LibPanels(MineDataPanelName.Ventilation_Change).panelFormName)
                {
                    _viEntity = (Ventilation)_obj;
                }
                if (Text == new LibPanels(MineDataPanelName.CoalExistence_Change).panelFormName)
                {
                    _ceEntity = (CoalExistence)_obj;
                }
                if (Text == new LibPanels(MineDataPanelName.GasData_Change).panelFormName)
                {
                    _gdEntity = (GasData)_obj;
                }
                if (Text == new LibPanels(MineDataPanelName.Management_Change).panelFormName)
                {
                    _mEntity = (Management)_obj;
                }
                if (Text == new LibPanels(MineDataPanelName.GeologicStructure_Change).panelFormName)
                {
                    _geologicStructureEntity = (GeologicStructure)_obj;
                }

                //所有小窗体最小化
                //AllMin();
                //通风
                if (Text == new LibPanels(MineDataPanelName.Ventilation).panelFormName)
                {
                    Height = FormHeight + _ventilationInfo.Height;
                    _ventilationInfo.WindowState = FormWindowState.Maximized;
                    _ventilationInfo.Show();
                    _ventilationInfo.Activate();
                }
                //煤层赋存
                if (Text == new LibPanels(MineDataPanelName.CoalExistence).panelFormName)
                {
                    Height = FormHeight + _coalExistenceInfo.Height;
                    _coalExistenceInfo.WindowState = FormWindowState.Maximized;
                    _coalExistenceInfo.Show();
                    _coalExistenceInfo.Activate();
                }
                //瓦斯
                if (Text == new LibPanels(MineDataPanelName.GasData).panelFormName)
                {
                    Height = FormHeight + _gasData.Height;
                    _gasData.WindowState = FormWindowState.Maximized;
                    _gasData.Show();
                    _gasData.Activate();
                }
                //管理
                if (Text == new LibPanels(MineDataPanelName.Management).panelFormName)
                {
                    Height = FormHeight + _management.Height;
                    _management.WindowState = FormWindowState.Maximized;
                    _management.Show();
                    _management.Activate();
                }
                //地质构造
                if (Text == new LibPanels(MineDataPanelName.GeologicStructure).panelFormName)
                {
                    Height = FormHeight + _geologicStructure.Height;
                    _geologicStructure.WindowState = FormWindowState.Maximized;
                    _geologicStructure.Show();
                    _geologicStructure.Activate();
                }

                //绑定通风修改初始信息
                if (Text == new LibPanels(MineDataPanelName.Ventilation_Change).panelFormName)
                {
                    Height = FormHeight + _ventilationInfo.Height;
                    ChangeMineCommonValue(_viEntity);

                    _ventilationInfo.VentilationEntity = _viEntity;

                    _ventilationInfo.bindDefaultValue(_viEntity);

                    _ventilationInfo.WindowState = FormWindowState.Maximized;
                    _ventilationInfo.Show();
                    _ventilationInfo.Activate();
                }

                //绑定煤层赋存修改初始信息
                if (Text == new LibPanels(MineDataPanelName.CoalExistence_Change).panelFormName)
                {
                    Height = FormHeight + _coalExistenceInfo.Height;
                    ChangeMineCommonValue(_ceEntity);

                    _coalExistenceInfo.coalExistenceEntity = _ceEntity;

                    _coalExistenceInfo.bindDefaultValue(_ceEntity);

                    _coalExistenceInfo.WindowState = FormWindowState.Maximized;
                    _coalExistenceInfo.Show();
                    _coalExistenceInfo.Activate();
                }

                //绑定瓦斯修改初始信息
                if (Text == new LibPanels(MineDataPanelName.GasData_Change).panelFormName)
                {
                    Height = FormHeight + _gasData.Height;
                    ChangeMineCommonValue(_gdEntity);

                    _gasData.GasDataEntity = _gdEntity;
                    _gasData.bindDefaultValue(_gdEntity);

                    _gasData.WindowState = FormWindowState.Maximized;
                    _gasData.Show();
                    _gasData.Activate();
                }
                //绑定管理修改初始信息
                if (Text == new LibPanels(MineDataPanelName.Management_Change).panelFormName)
                {
                    Height = FormHeight + _management.Height;
                    ChangeMineCommonValue(_mEntity);

                    _management.managementEntity = _mEntity;

                    _management.bindDefaultValue(_mEntity);

                    _management.WindowState = FormWindowState.Maximized;
                    _management.Show();
                    _management.Activate();
                }
                //绑定地质构造修改初始数据
                if (Text == new LibPanels(MineDataPanelName.GeologicStructure_Change).panelFormName)
                {
                    Height = FormHeight + _management.Height;
                    ChangeMineCommonValue(_geologicStructureEntity);

                    _geologicStructure.geoligicStructureEntity = _geologicStructureEntity;
                    _geologicStructure.bindDefaultValue(_geologicStructureEntity);

                    _geologicStructure.WindowState = FormWindowState.Maximized;
                    _geologicStructure.Show();
                    _geologicStructure.Activate();
                }
            }
        }
Пример #31
0
 public UserTaskRepository(INotificationRepository notificationRepository, IConfiguration config, ILogger <UserTaskRepository> ilogger, IHubContext <NotificationHub> hubContext, IHttpContextAccessor httpContextAccessor, AccountDbContext accountDbContext, Management management, DataDbContext datadbContext, UserManager <ApplicationUser> userManager) : base(config, ilogger, httpContextAccessor, management, datadbContext, accountDbContext, userManager)
 {
     _notificationRepository = notificationRepository;
     _accountDbContext       = accountDbContext;
     _userManager            = userManager;
     _hubContext             = hubContext;
 }
 /// <summary>
 /// Construct AzureSqlElasticPoolRecommendedActionModel from Management.Sql.Models.Advisor object
 /// </summary>
 /// <param name="resourceGroupName">Resource group</param>
 /// <param name="serverName">Server name</param>
 /// <param name="elasticPoolName">Elastic Pool name</param>
 /// <param name="advisorName">Advisor name</param>
 /// <param name="recommendedAction">Recommended Action object</param>
 public AzureSqlElasticPoolRecommendedActionModel(string resourceGroupName, string serverName, string elasticPoolName, string advisorName, Management.Sql.Models.RecommendedAction recommendedAction)
 : base(resourceGroupName, serverName, advisorName, recommendedAction)
 {
     ElasticPoolName = elasticPoolName;
 }
        /// <summary>
        /// Construct AzureSqlDatabaseModel from Management.Sql.Models.Database object
        /// </summary>
        /// <param name="resourceGroup">Resource group</param>
        /// <param name="serverName">Server name</param>
        /// <param name="database">Database object</param>
        public AzureSqlDatabaseModel(string resourceGroup, string serverName, Management.Sql.Models.Database database)
        {
            Guid id = Guid.Empty;
            DatabaseEdition edition = DatabaseEdition.None;

            ResourceGroupName = resourceGroup;
            ServerName = serverName;
            CollationName = database.Properties.Collation;
            CreationDate = database.Properties.CreationDate;
            CurrentServiceObjectiveName = database.Properties.ServiceObjective;
            MaxSizeBytes = database.Properties.MaxSizeBytes;
            DatabaseName = database.Name;
            Status = database.Properties.Status;
            Tags = database.Tags as Dictionary<string, string>;
            ElasticPoolName = database.Properties.ElasticPoolName;
            Location = database.Location;

            Guid.TryParse(database.Properties.CurrentServiceObjectiveId, out id);
            CurrentServiceObjectiveId = id;

            Guid.TryParse(database.Properties.DatabaseId, out id);
            DatabaseId = id;

            Enum.TryParse<DatabaseEdition>(database.Properties.Edition, true, out edition);
            Edition = edition;

            Guid.TryParse(database.Properties.RequestedServiceObjectiveId, out id);
            RequestedServiceObjectiveId = id;
        }
        /// <summary>
        /// Serialize to a JSON object
        /// </summary>
        public new void SerializeJson(Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true)
        {
            if (includeStartObject)
            {
                writer.WriteStartObject();
            }

            if (!string.IsNullOrEmpty(ResourceType))
            {
                writer.WriteString("resourceType", (string)ResourceType !);
            }


            ((Fhir.R4.Models.DomainResource) this).SerializeJson(writer, options, false);

            if ((Subject != null) && (Subject.Count != 0))
            {
                writer.WritePropertyName("subject");
                writer.WriteStartArray();

                foreach (Reference valSubject in Subject)
                {
                    valSubject.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (!string.IsNullOrEmpty(Description))
            {
                writer.WriteString("description", (string)Description !);
            }

            if (_Description != null)
            {
                writer.WritePropertyName("_description");
                _Description.SerializeJson(writer, options);
            }

            if ((Interactant != null) && (Interactant.Count != 0))
            {
                writer.WritePropertyName("interactant");
                writer.WriteStartArray();

                foreach (MedicinalProductInteractionInteractant valInteractant in Interactant)
                {
                    valInteractant.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (Type != null)
            {
                writer.WritePropertyName("type");
                Type.SerializeJson(writer, options);
            }

            if (Effect != null)
            {
                writer.WritePropertyName("effect");
                Effect.SerializeJson(writer, options);
            }

            if (Incidence != null)
            {
                writer.WritePropertyName("incidence");
                Incidence.SerializeJson(writer, options);
            }

            if (Management != null)
            {
                writer.WritePropertyName("management");
                Management.SerializeJson(writer, options);
            }

            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }
        /// <summary>
        /// Converts the response from the service to a powershell DatabaseCopy object
        /// </summary>
        /// <param name="copyResourceGroupName">The copy's resource group name</param>
        /// <param name="copyServerName">The copy's Azure SQL Server name</param>
        /// <param name="copyDatabaseName">The copy's database name</param>
        /// <param name="resourceGroupName">The source's resource group name</param>
        /// <param name="serverName">The source's Azure SQL Server name</param>
        /// <param name="databaseName">The source database name</param>
        /// <param name="elasticPoolName">The copy's target elastic pool</param>
        /// <param name="serviceLevelObjective">The copy's nondefault service level objective</param>
        /// <param name="response">The database create response</param>
        /// <returns>A powershell DatabaseCopy object</returns>
        private AzureSqlDatabaseCopyModel CreateDatabaseCopyModelFromDatabaseCreateOrUpdateResponse(string copyResourceGroupName, string copyServerName, string copyDatabaseName,
            string resourceGroupName, string serverName, string databaseName, Management.Sql.Models.DatabaseCreateOrUpdateResponse response)
        {
            // the response does not contain the majority of the information we wish to expose to the user, so most of the data is passed from the inputs.
            AzureSqlDatabaseCopyModel model = new AzureSqlDatabaseCopyModel();

            model.CopyResourceGroupName = copyResourceGroupName;
            model.CopyServerName = copyServerName;
            model.CopyDatabaseName = response.Database.Name;
            model.ResourceGroupName = resourceGroupName;
            model.ServerName = serverName;
            model.DatabaseName = databaseName;
            model.Location = GetServerLocation(resourceGroupName, serverName);
            model.CopyLocation = response.Database.Location;
            model.CreationDate = response.Database.Properties.CreationDate;

            return model;
        }
Пример #36
0
 public ServiceResult <IList <TModel> > GetAccessiblePagesForUser <TModel>(long userID)
 {
     return(Management.GetAccessiblePagesForUser <TModel>(userID));
 }
Пример #37
0
 public ConfigurationSet(Management.Compute.Models.ConfigurationSet configurationSet)
 {
     ConfigurationSetType = configurationSet.ConfigurationSetType;
 }
Пример #38
0
 public ServiceResult <IList <PageDto> > GetAccessiblePagesForUser(long userID)
 {
     return(Management.GetAccessiblePagesForUser(userID));
 }
 private void contactslist_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     Management.Showdetail(contactslist.SelectedItem.ToString());               //点击列表中的一项,查看详细信息
 }
Пример #40
0
 public ServiceResult <IList <TModel> > GetPublicPages <TModel>()
 {
     return(Management.GetPublicPages <TModel>());
 }
Пример #41
0
        public Client.WorkItemsInfo SearchWorkItems(Management.WorkItemQuery query, int pageIndex, int pageSize)
        {
            var criteria = DetachedCriteria.For<WorkItem>();

            var flag = false;
            //执行人 TODO:是否需要包含代理人逻辑?
            if (!string.IsNullOrWhiteSpace(query.Actioner) && (flag = true))
                criteria.Add(Expression.Eq("Actioner", this.GetUser(query.Actioner)));
            //流程类型
            if (!string.IsNullOrWhiteSpace(query.ProcessTypeName) && (flag = true))
                criteria.Add(Expression.Eq("_processTypeName", query.ProcessTypeName));
            //标题
            if (!string.IsNullOrWhiteSpace(query.ProcessTitle) && (flag = true))
                criteria.CreateCriteria("Process").Add(Expression.Like("Title", "%" + query.ProcessTitle + "%"));
            //状态
            if (query.Status != null && query.Status.Length > 0 && (flag = true))
                criteria.Add(Expression.In("Status", query.Status.Select(o => this.Parse(o)).ToArray()));
            //发起时间
            if (query.CreateFrom.HasValue && query.CreateTo.HasValue && (flag = true))
            {
                criteria.Add(Expression.Ge("CreateTime", query.CreateFrom.Value));
                criteria.Add(Expression.Le("CreateTime", query.CreateTo.Value));
            }

            long total;
            return flag
                ? new Client.WorkItemsInfo()
                {
                    WorkItems = this._workItemService
                        .GetWorkItems(criteria, pageIndex, pageSize, out total)
                        .Select(o => this.Parse(o))
                        .ToArray(),
                    Total = total
                }
                : new Client.WorkItemsInfo();
        }
Пример #42
0
 public NotificationHub(Management management, INotificationUserRepository notificationUserRepository)
 {
     _management = management;
     _notificationUserRepository = notificationUserRepository;
 }
Пример #43
0
 public VirtualIP(Management.Compute.Models.VirtualIPAddress vip)
 {
     Address = IPAddress.Parse(vip.Address);
 }
 public ServiceResult <IList <PageMenuDto> > GetMenuByPageIds(IList <long> pageList)
 {
     return(Management.GetMenuByPageIds(pageList));
 }
        /// <summary>
        /// Convert a Management.Sql.Models.FirewallRule to AzureSqlServerFirewallRuleModel
        /// </summary>
        /// <param name="resourceGroup">The resource group the server is in</param>
        /// <param name="serverName">The name of the server</param>
        /// <param name="resp">The management client server response to convert</param>
        /// <returns>The converted server model</returns>
        private static AzureSqlServerFirewallRuleModel CreateFirewallRuleModelFromResponse(string resourceGroup, string serverName, Management.Sql.Models.FirewallRule resp)
        {
            AzureSqlServerFirewallRuleModel firewallRule = new AzureSqlServerFirewallRuleModel();

            firewallRule.StartIpAddress = resp.Properties.StartIpAddress;
            firewallRule.EndIpAddress = resp.Properties.EndIpAddress;
            firewallRule.FirewallRuleName = resp.Name;
            firewallRule.ResourceGroupName = resourceGroup;
            firewallRule.ServerName = serverName;

            return firewallRule;
        }
 public ServiceResult <UserConfigDto> GetUserConfig(long userID, long branchID)
 {
     return(Management.GetUserConfig(userID, branchID));
 }
Пример #47
0
        public Client.ProcessesInfo SearchProcesses(Management.ProcessQuery query, int pageIndex, int pageSize)
        {
            var criteria = DetachedCriteria.For<Process>();
            var flag = false;
            //发起人
            if (!string.IsNullOrWhiteSpace(query.Originator) && (flag = true))
                criteria.Add(Expression.Eq("Originator", this.GetUser(query.Originator)));
            //流程类型 存在多版本问题应用ProcessTypeName对应
            if (!string.IsNullOrWhiteSpace(query.ProcessTypeName) && (flag = true))
                criteria.CreateCriteria("ProcessType").Add(Expression.Eq("Name", query.ProcessTypeName));
            //criteria.Add(Expression.Eq("ProcessType", this.GetProcessType(query.ProcessTypeName)));
            //标题
            if (!string.IsNullOrWhiteSpace(query.Title) && (flag = true))
                criteria.Add(Expression.Like("Title", "%" + query.Title + "%"));
            //状态
            if (query.Status != null && query.Status.Length > 0 && (flag = true))
                criteria.Add(Expression.In("Status", query.Status.Select(o => this.Parse(o)).ToArray()));
            //发起时间 起始
            if (query.CreateFrom.HasValue && (flag = true))
                criteria.Add(Expression.Ge("CreateTime", query.CreateFrom.Value));
            //发起时间 截止
            if (query.CreateTo.HasValue && (flag = true))
                criteria.Add(Expression.Le("CreateTime", query.CreateTo.Value));

            long total;
            return flag
                ? new Client.ProcessesInfo()
                {
                    Processes = this._processService
                        .GetProcesses(criteria, pageIndex, pageSize, out total)
                        .Select(o => this.Parse(o))
                        .ToArray(),
                    Total = total
                }
                : new Client.ProcessesInfo();
        }
 public ServiceResult <TModel> GetUserConfig <TModel>(long userID, long branchID)
 {
     return(Management.GetUserConfig <TModel>(userID, branchID));
 }
        /// <summary>
        /// Converts the response from the service to a powershell database object
        /// </summary>
        /// <param name="resourceGroupName">The resource group the server is in</param>
        /// <param name="serverName">The name of the Azure Sql Database Server</param>
        /// <param name="database">The service response</param>
        /// <returns>The converted model</returns>
        public static AzureSqlDatabaseModel CreateDatabaseModelFromResponse(string resourceGroup, string serverName, Management.Sql.Models.Database database)
        {
            AzureSqlDatabaseModel model = new AzureSqlDatabaseModel();
            Guid id = Guid.Empty;
            DatabaseEdition edition = DatabaseEdition.None;

            model.ResourceGroupName = resourceGroup;
            model.ServerName = serverName;
            model.CollationName = database.Properties.Collation;
            model.CreationDate = database.Properties.CreationDate;
            model.CurrentServiceObjectiveName = database.Properties.ServiceObjective;
            model.MaxSizeBytes = database.Properties.MaxSizeBytes;
            model.DatabaseName = database.Name;
            model.Status = database.Properties.Status;
            model.Tags = database.Tags as Dictionary<string, string>;
            model.ElasticPoolName = database.Properties.ElasticPoolName;
            model.Location = database.Location;

            Guid.TryParse(database.Properties.CurrentServiceObjectiveId, out id);
            model.CurrentServiceObjectiveId = id;

            Guid.TryParse(database.Properties.DatabaseId, out id);
            model.DatabaseId = id;

            Enum.TryParse<DatabaseEdition>(database.Properties.Edition, true, out edition);
            model.Edition = edition;

            Guid.TryParse(database.Properties.RequestedServiceObjectiveId, out id);
            model.RequestedServiceObjectiveId = id;

            return model;
        }
 public ServiceResult <UserConfigDto> SaveCashierInfo(long defaultAreaID, decimal listTableHeight)
 {
     return(Management.SaveCashierInfo(defaultAreaID, listTableHeight));
 }