コード例 #1
0
        private OrganizationMaintenanceJobData[] a(Guid A_0, int A_1, bool A_2 = false)
        {
            OrganizationMaintenanceJobData[] array;
            Guid scaleGroupId = LocatorService.Instance.GetScaleGroupId();
            Guid a0           = A_0;
            List <OrganizationMaintenanceJobData> organizationMaintenanceJobDatas = new List <OrganizationMaintenanceJobData>();
            PropertyBag           propertyBag           = null;
            PropertyBagCollection propertyBagCollection = null;

            using (ConfigurationDatabaseService configurationDatabaseService = new ConfigurationDatabaseService(scaleGroupId))
            {
                propertyBag = new PropertyBag();
                propertyBag.SetValue("OrganizationId", a0);
                if (!A_2)
                {
                    propertyBag.SetValue("OperationType", A_1);
                }
                propertyBagCollection = configurationDatabaseService.Retrieve((string)this.rscMgrTypeResources.GetObject("tblScaleGrp"), null, new PropertyBag[] { propertyBag });
                if (propertyBagCollection != null)
                {
                    SortedDictionary <object, PropertyBag> .Enumerator enumerator = propertyBagCollection.GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        OrganizationMaintenanceJobData organizationMaintenanceJobDatum = new OrganizationMaintenanceJobData(enumerator.Current.Value);
                        if (!organizationMaintenanceJobDatum.Enabled)
                        {
                            continue;
                        }
                        organizationMaintenanceJobDatas.Add(organizationMaintenanceJobDatum);
                    }
                }
                array = organizationMaintenanceJobDatas.ToArray();
            }
            return(array);
        }
コード例 #2
0
        protected override OrganizationBackupRuntimeData ExecuteInternal(OrganizationBackupRuntimeData runtimeData, Guid orgId, Guid backupId, Guid queueItemId)
        {
            Exceptions.ThrowIfNullOrEmpty(runtimeData.RestoreSqlServerName, "runtimeData.RestoreSqlServerName");
            Exceptions.ThrowIfNullOrEmpty(runtimeData.RestoredDBName, "runtimeData.RestoredDBName");

            string orgUniqueName = LocatorService.Instance.GetOrganizationName(orgId);

            // Get the path to the file share from ServerSettingProperties table DataFilePath row
            string fileSharePath = (string)LocatorService.Instance.GetSiteSetting("DataFilePath");

            // compression backup
            CrmOrganizationBackupData backupData = SqlBackupRestoreUtility.ExecuteBackupSqlCommandByOrg(SqlBackupRestoreUtility.DatabaseBackupType.Compression, fileSharePath, runtimeData.RestoreSqlServerName, runtimeData.RestoredDBName, orgUniqueName);

            // update backup path, completion time and expiration time
            PropertyBag updateBag = new PropertyBag();

            updateBag["BackupPath"]     = backupData.BackupPathOnShare;
            updateBag["CompletionDate"] = DateTime.UtcNow;
            updateBag["ExpirationDate"] = ((DateTime)updateBag["CompletionDate"]).AddDays(GetExpirationDays(orgId));

            PropertyBag condition = new PropertyBag();

            condition["Id"] = backupId;
            using (IDatabaseService service = ConfigurationDatabaseService.NewService())
            {
                service.Update("OrganizationBackupData", updateBag, new PropertyBag[] { condition });
            }

            return(runtimeData);
        }
コード例 #3
0
        //public frmMain()
        //{
        //    this.a() ;
        //}

        private void a(string A_0, OrganizationMaintenanceJobData A_1)
        {
            try
            {
                this.flag = false;

                if (A_1.OperationType == 41)
                {
                    A_1.RecurrencePattern = ((string)this.rscMgrTypeResources.GetObject("OverrideSchedule"));
                }

                Guid scaleGroupId = LocatorService.Instance.GetScaleGroupId();

                (new PropertyBag()).SetValue("Id", A_1.Id);

                using (ConfigurationDatabaseService configurationDatabaseService = new ConfigurationDatabaseService(scaleGroupId))
                {
                    configurationDatabaseService.Update((string)this.rscMgrTypeResources.GetObject("tblScaleGrp"), A_1.Id, A_1.InternalPropertyBag);
                }

                this.label6.Text = (string)this.rscMgrTypeResources.GetObject("StatusUpdateCompleted");
            }
            catch (Exception exception1)
            {
                Exception exception = exception1;
                throw new Exception(string.Concat((string)this.rscMgrTypeResources.GetObject("StatusUpdateFailed"), exception.Message.ToString()));
            }
        }
コード例 #4
0
        private static void UpdateStatus(Guid backupId, OrganizationBackupStatus statusCode)
        {
            // update status code in the table
            PropertyBag updateBag = new PropertyBag();

            updateBag["StatusCode"] = (int)statusCode;
            PropertyBag condition = new PropertyBag();

            condition["Id"] = backupId;
            using (IDatabaseService service = ConfigurationDatabaseService.NewService())
            {
                service.Update("OrganizationBackupData", updateBag, new PropertyBag[] { condition });
            }
        }