Exemplo n.º 1
0
 public AzureStoreSubscription[] GetAzureStoreSubscriptionsByEmail(string email)
 {
     using (AccountDataContext context = new AccountDataContext(ConfigurationDataProvider.AccountDataProviderConnectionString))
     {
         return(AccountDataProvider.RetryPolicy.ExecuteAction <AzureStoreSubscription[]>(() =>
         {
             return context.AzureStoreSubscriptions.Where(subscription => subscription.nvc_Email == email).ToArray();
         }));
     }
 }
Exemplo n.º 2
0
 public AzureStoreSubscription GetAzureStoreSubscriptionBySubscriptionId(string subscriptionId)
 {
     using (AccountDataContext context = new AccountDataContext(ConfigurationDataProvider.AccountDataProviderConnectionString))
     {
         return(AccountDataProvider.RetryPolicy.ExecuteAction <AzureStoreSubscription>(() =>
         {
             return context.AzureStoreSubscriptions.FirstOrDefault(subscription => subscription.nvc_SubscriptionId == subscriptionId);
         }));
     }
 }
Exemplo n.º 3
0
        public void DeleteAzureStoreResource(AzureStoreResource resource)
        {
            using (AccountDataContext context = new AccountDataContext(ConfigurationDataProvider.AccountDataProviderConnectionString))
            {
                context.AzureStoreResources.Attach(resource);
                context.AzureStoreResources.Remove(resource);

                AccountDataProvider.RetryPolicy.ExecuteAction(() =>
                {
                    context.SaveChanges();
                });
            }
        }
Exemplo n.º 4
0
 public AzureStoreResource[] GetAzureStoreResources(string subscriptionId, string cloudServiceName)
 {
     using (AccountDataContext context = new AccountDataContext(ConfigurationDataProvider.AccountDataProviderConnectionString))
     {
         return(AccountDataProvider.RetryPolicy.ExecuteAction <AzureStoreResource[]>(() =>
         {
             return context.AzureStoreResources.Where(subscription =>
                                                      subscription.nvc_SubscriptionId == subscriptionId &&
                                                      subscription.nvc_CloudServiceName == cloudServiceName
                                                      ).ToArray();
         }));
     }
 }
Exemplo n.º 5
0
 public AzureStoreResource GetAzureStoreResource(string subscriptionId, string cloudServiceName, string resourceType, string resourceName)
 {
     using (AccountDataContext context = new AccountDataContext(ConfigurationDataProvider.AccountDataProviderConnectionString))
     {
         return(AccountDataProvider.RetryPolicy.ExecuteAction <AzureStoreResource>(() =>
         {
             return context.AzureStoreResources.FirstOrDefault(subscription =>
                                                               subscription.nvc_SubscriptionId == subscriptionId &&
                                                               subscription.nvc_CloudServiceName == cloudServiceName &&
                                                               subscription.nvc_ResourceType == resourceType &&
                                                               subscription.nvc_ResourceName == resourceName
                                                               );
         }));
     }
 }
Exemplo n.º 6
0
        public void CreateOrUpdateAzureStoreResource(AzureStoreResource resource)
        {
            using (AccountDataContext context = new AccountDataContext(ConfigurationDataProvider.AccountDataProviderConnectionString))
            {
                if (resource.id_AzureStoreResourceId == Guid.Empty)
                {
                    context.Entry(resource).State = EntityState.Added;
                    resource.dt_CreatedTime = DateTime.UtcNow;
                    resource.dt_ChangedTime = DateTime.UtcNow;
                }
                else
                {
                    context.Entry(resource).State = EntityState.Modified;
                    resource.dt_ChangedTime = DateTime.UtcNow;
                }

                AccountDataProvider.RetryPolicy.ExecuteAction(() =>
                {
                    context.SaveChanges();
                });
            }
        }
Exemplo n.º 7
0
        public void CreateOrUpdateAzureStoreSubscription(AzureStoreSubscription subscription)
        {
            using (AccountDataContext context = new AccountDataContext(ConfigurationDataProvider.AccountDataProviderConnectionString))
            {
                if (subscription.id_AzureStoreSubscriptionId == Guid.Empty)
                {
                    context.Entry(subscription).State = EntityState.Added;
                    subscription.dt_CreatedTime       = DateTime.UtcNow;
                    subscription.dt_ChangedTime       = DateTime.UtcNow;
                }
                else
                {
                    context.Entry(subscription).State = EntityState.Modified;
                    subscription.dt_ChangedTime       = DateTime.UtcNow;
                }

                AccountDataProvider.RetryPolicy.ExecuteAction(() =>
                {
                    context.SaveChanges();
                });
            }
        }
Exemplo n.º 8
0
 public AzureStoreSubscription[] GetAzureStoreSubscriptionsByEmail(string email)
 {
     using (AccountDataContext context = new AccountDataContext(ConfigurationDataProvider.AccountDataProviderConnectionString))
     {
         return AccountDataProvider.RetryPolicy.ExecuteAction<AzureStoreSubscription[]>(() =>
         {
             return context.AzureStoreSubscriptions.Where(subscription => subscription.nvc_Email == email).ToArray();
         });
     }
 }
Exemplo n.º 9
0
 public AzureStoreSubscription GetAzureStoreSubscriptionBySubscriptionId(string subscriptionId)
 {
     using (AccountDataContext context = new AccountDataContext(ConfigurationDataProvider.AccountDataProviderConnectionString))
     {
         return AccountDataProvider.RetryPolicy.ExecuteAction<AzureStoreSubscription>(() =>
         {
             return context.AzureStoreSubscriptions.FirstOrDefault(subscription => subscription.nvc_SubscriptionId == subscriptionId);
         });
     }
 }
Exemplo n.º 10
0
 public AzureStoreResource[] GetAzureStoreResources(string subscriptionId, string cloudServiceName)
 {
     using (AccountDataContext context = new AccountDataContext(ConfigurationDataProvider.AccountDataProviderConnectionString))
     {
         return AccountDataProvider.RetryPolicy.ExecuteAction<AzureStoreResource[]>(() =>
         {
             return context.AzureStoreResources.Where(subscription =>
                 subscription.nvc_SubscriptionId     == subscriptionId   &&
                 subscription.nvc_CloudServiceName   == cloudServiceName
             ).ToArray();
         });
     }
 }
Exemplo n.º 11
0
 public AzureStoreResource GetAzureStoreResource(string subscriptionId, string cloudServiceName, string resourceType, string resourceName)
 {
     using (AccountDataContext context = new AccountDataContext(ConfigurationDataProvider.AccountDataProviderConnectionString))
     {
         return AccountDataProvider.RetryPolicy.ExecuteAction<AzureStoreResource>(() =>
         {
             return context.AzureStoreResources.FirstOrDefault(subscription =>
                 subscription.nvc_SubscriptionId     == subscriptionId   &&
                 subscription.nvc_CloudServiceName   == cloudServiceName &&
                 subscription.nvc_ResourceType       == resourceType     &&
                 subscription.nvc_ResourceName       == resourceName
             );
         });
     }
 }
Exemplo n.º 12
0
        public void DeleteAzureStoreResource(AzureStoreResource resource)
        {
            using (AccountDataContext context = new AccountDataContext(ConfigurationDataProvider.AccountDataProviderConnectionString))
            {
                context.AzureStoreResources.Attach(resource);
                context.AzureStoreResources.Remove(resource);

                AccountDataProvider.RetryPolicy.ExecuteAction(() =>
                {
                    context.SaveChanges();
                });
            }
        }