Exemple #1
0
        public App(string pushNotifParameter = null)
        {
            //INITIALIZATION
            if (AppContext == null)
            {
                IGeolocator                 geoLocator              = CrossGeolocator.Current;
                IRepository                 repository              = new AzureRepository("http://xdevmessaging.azurewebsites.net/");
                IPositionUpdater            positionUpdater         = new PositionUpdater(repository);
                IDisplayNameProvider <User> userDisplayNameProvider = new UserDisplayNameProvider();
                MeetupRepository            meetupRepository        = new MeetupRepository();
                AppContext = new AppContext(repository, geoLocator, positionUpdater, userDisplayNameProvider, meetupRepository);
            }

            //Check stored data
            //if (AppContext.IsUserStored)
            //{
            //    AppContext.LoginFromStorageAsync().Wait();
            //    var mapPage = new NavigationPage(new MapPage(AppContext));
            //    MainPage = mapPage;
            //}
            //else
            //{
            var loginPage = new NavigationPage(new LoginPage(AppContext));

            MainPage = loginPage;
            //}
        }
        /// <summary>
        /// Creates a controller.
        /// </summary>
        /// <param name="requestContext"> HTTP request context. </param>
        /// <param name="controllerName"> Controller name. </param>
        /// <returns> A controller. </returns>
        public IController CreateController(RequestContext requestContext, string controllerName)
        {
            Trace.TraceInformation("Entering CustomControllerFactory.CreateController.");

            AzureRepository repository = new AzureRepository();
            var             controller = new BalanceSheetController(repository);

            Trace.TraceInformation("Exiting CustomControllerFactory.CreateController.");
            return(controller);
        }
        public static void Startup_Enums()
        {
            Task.Run(async() =>
            {
                var account = CloudConfiguration.GetStorageAccount("DataConnectionString");
                AzureRepository <AzureCurrencyType, CurrencyType> valueTypeRepo = new AzureRepository <AzureCurrencyType, CurrencyType>(account);
                AzureRepository <AzureEventRelationType, EventRelationType> eventRelationTypeRepo = new AzureRepository <AzureEventRelationType, EventRelationType>(account);
                AzureRepository <AzureAlgorithmType, AlgorithmType> algorithmTypeRepo             = new AzureRepository <AzureAlgorithmType, AlgorithmType>(account);
                AzureRepository <AzureOutcomesType, OutcomesType> outcomesTypeRepo = new AzureRepository <AzureOutcomesType, OutcomesType>(account);

                Entity enums = await valueTypeRepo.GetBy(v => v.Name == CurrencyType.Reputation);
                if (enums == null)
                {
                    await valueTypeRepo.Add(new CurrencyType {
                        Name = CurrencyType.Reputation
                    });
                }

                enums = await eventRelationTypeRepo.GetBy(v => v.Name == EventRelationType.OneVsOne);
                if (enums == null)
                {
                    await eventRelationTypeRepo.Add(new EventRelationType {
                        Name = EventRelationType.OneVsOne
                    });
                    await eventRelationTypeRepo.Add(new EventRelationType {
                        Name = EventRelationType.OneVsMeny
                    });
                    await eventRelationTypeRepo.Add(new EventRelationType {
                        Name = EventRelationType.MenyVsMeny
                    });
                }

                enums = await algorithmTypeRepo.GetBy(v => v.Name == AlgorithmType.Exponential);
                if (enums == null)
                {
                    await algorithmTypeRepo.Add(new AlgorithmType {
                        Name = AlgorithmType.Exponential
                    });
                    await algorithmTypeRepo.Add(new AlgorithmType {
                        Name = AlgorithmType.Linear
                    });
                }

                enums = await algorithmTypeRepo.GetBy(v => v.Name == OutcomesType.Happen);
                if (enums == null)
                {
                    await outcomesTypeRepo.Add(new OutcomesType {
                        Name = OutcomesType.Happen
                    });
                    await outcomesTypeRepo.Add(new OutcomesType {
                        Name = OutcomesType.NotHappen
                    });
                }
            });
        }
Exemple #4
0
        private async Task <bool> UploadToBlob(string filename, int itemId, byte[] imageBuffer = null, Stream stream = null)
        {
            AzureRepository azure = new AzureRepository();
            var             uri   = await azure.AddBlobToStorage(filename, imageBuffer, stream);

            Item toChange = await repository.GetItemByIdAsync(itemId);

            toChange.CoverGuid = uri;
            repository.UpdateItem(toChange);
            await repository.SaveAsync();

            return(true);
        }
        private async void ExecuteGravarCommand(object obj)
        {
            Profissional.ValorGanhoMes          = ValorGanhoMes;
            Profissional.HorasTrabalhadasPorDia = HorasTrabalhadasPorDia;
            Profissional.DiasTrabalhadosPorMes  = DiasTrabalhadosPorMes;
            Profissional.DiasFeriasPorAno       = DiasFeriasPorAno;
            Profissional.ValorPorHora           = ValorDaHora;

            var profissionalAzureClient = new AzureRepository();

            profissionalAzureClient.Insert(Profissional);

            await App.Current.MainPage.DisplayAlert("Sucesso", "Valor por hora gravado!", "Ok");
        }
Exemple #6
0
        private async void Gravar(double valorHora)
        {
            var profissionalAzureClient = new AzureRepository();

            profissionalAzureClient.Insert(new Models.Profissional()
            {
                ValorGanhoMes          = double.Parse(ValorGanhoMes.Text),
                HorasTrabalhadasPorDia = int.Parse(HorasTrabalhadasPorDia.Text),
                DiasTrabalhadosPorMes  = int.Parse(DiasTrabalhadosPorMes.Text),
                DiasFeriasPorAno       = int.Parse(DiasFeriasPorAno.Text),
                ValorPorHora           = valorHora
            });

            await App.Current.MainPage.DisplayAlert("Sucesso", "Valor por hora gravado!", "Ok");
        }
Exemple #7
0
        // ReSharper disable once UnusedMember.Global
        public static void ProcessTartOrder([QueueInput("tartorders")] Order order)
        {
            var repository = new AzureRepository(connectionString);

            Product product = repository.GetProductById(order.ProductId);

            // Takes a while - WITH retries!
            repository.CreateOrder(order);

            // Takes a while 2
            var webMail         = new WebMail();
            var tartMailService = new TartMailService();
            var emailBody       = tartMailService.CreateMailBodyFor(order, product);

            webMail.Send(smtpServer, port, enableSsl, userName, passWord, fromEmail, fromName, order.Email, subject, emailBody);
        }
Exemple #8
0
        public async Task AzureRepositoryAddAccount()
        {
            var account = CloudConfiguration.GetStorageAccount("DataConnectionString");

            var repository = new AzureRepository <AzureAccount, Account>(account);

            var acc = new Account {
                Name = "misha", Email = "*****@*****.**"
            };

            await repository.Add(acc);

            var acc2 = await repository.Get(acc.Id);

            Assert.AreEqual(acc.Id, acc2.Id);
            Assert.AreEqual(acc.Name, acc2.Name);
            Assert.AreEqual(acc.Email, acc2.Email);

            await repository.Remove(acc);

            acc2 = await repository.Get(acc.Id);

            Assert.IsNull(acc2);
        }
 public ProfissionalService()
 {
     ProfissionalRepository = new AzureRepository();
 }
Exemple #10
0
        private void button1_Click(object sender, EventArgs e)
        {
            var repo = new AzureRepository();

            Importer.Import(repo);
        }
Exemple #11
0
        //private readonly lListalRepository ListalRepository;

        public ListaService()
        {
            ListalRepository = new AzureRepository();
        }
 public ServersController()
 {
     this.azureRepository        = new AzureRepository();
     this.subscriptionRepository = new SubscriptionRepository();
     this.enrichService          = new EnrichService();
 }
 static Program()
 {
     azureRepository        = new AzureRepository();
     subscriptionRepository = new SubscriptionRepository();
 }
 public DocumentsController(IHostingEnvironment hostingEnv, IConfiguration _config)
 {
     this._hostingEnv = hostingEnv;
     _azureRepo       = new AzureRepository(_hostingEnv, _config);
 }