예제 #1
0
        private Account SetAccount(string serviceUri)
        {
            IAccountProvider accountFactory =
                ClientCore.Factory.SignalingFactory.Singleton.CreateIAccountProvider();

            AccountProvider accountProvider = (AccountProvider)accountFactory;

            return((Account)accountProvider.GetAccount(serviceUri, _signaler.LocalPeer.Name, _signaler));
        }
        public static CloudStorageAccount GetStorageAccount(this FunctionInstanceArgument functionInstanceArgument)
        {
            if (functionInstanceArgument == null)
            {
                throw new ArgumentNullException("functionInstanceArgument");
            }

            string storageAccountName = functionInstanceArgument.AccountName;

            if (storageAccountName != null)
            {
                // Try to find specific connection string
                CloudStorageAccount specificAccount = AccountProvider.GetAccount(storageAccountName);
                if (specificAccount != null)
                {
                    return(specificAccount);
                }
            }

            // If not found, try the dashboard connection string
            CloudStorageAccount storageAccount = AccountProvider.GetAccount(ConnectionStringNames.Dashboard);

            if (AccountProvider.AccountNameMatches(storageAccountName, storageAccount))
            {
                return(storageAccount);
            }

            // If still not found, try the default storage connection string
            storageAccount = AccountProvider.GetAccount(ConnectionStringNames.Storage);
            if (AccountProvider.AccountNameMatches(storageAccountName, storageAccount))
            {
                return(storageAccount);
            }

            // If still not found, try a final search through all known accounts
            // matching on account name
            var accountMap = AccountProvider.GetAccounts();

            foreach (var currAccount in accountMap.Values)
            {
                if (AccountProvider.AccountNameMatches(storageAccountName, currAccount))
                {
                    return(currAccount);
                }
            }

            return(null);
        }
예제 #3
0
 public ActionResult ValidateCreateEdit(DocModelApiPoco form)
 {
     if (form.IDModel == 0)
     {
         DocModelProvider.CreateModel(AccountProvider.GetAccount(form.IDAccount),
                                      CampaignProvider.getCampagne(form.IDCampaign.Value), form.Title);
     }
     else
     {
         DocModel model = new DocModel();
         model.FromObject(form);
         //Problème avec FromObject à voir
         model.IDModel    = form.IDModel;
         model.IDCampaign = form.IDCampaign;
         DocModelProvider.UpdateModel(model);
     }
     return(RedirectToAction("Index", new { form = new DataInvoice.Core.SOLUTIONS.INVOICES.DOCMODEL.FORM.DocModelApiPoco() }));
 }
        public static CloudStorageAccount GetStorageAccount(this FunctionInstanceArgument functionInstanceArgument)
        {
            if (functionInstanceArgument == null)
            {
                throw new ArgumentNullException("functionInstanceArgument");
            }

            string storageAccountName = functionInstanceArgument.AccountName;

            if (storageAccountName != null)
            {
                // Try to find specific connection string
                CloudStorageAccount specificAccount = AccountProvider.GetAccount(storageAccountName);

                if (specificAccount != null)
                {
                    return(specificAccount);
                }
            }

            // If not found, try the dashboard connection string
            CloudStorageAccount dashboardAccount = AccountProvider.GetAccount(ConnectionStringNames.Dashboard);

            if (AccountNameMatches(storageAccountName, dashboardAccount))
            {
                return(dashboardAccount);
            }

            // If still not found, try the default storage connection string
            CloudStorageAccount storageAccount = AccountProvider.GetAccount(ConnectionStringNames.Storage);

            if (AccountNameMatches(storageAccountName, storageAccount))
            {
                return(storageAccount);
            }

            return(null);
        }