Exemplo n.º 1
0
 public void IssueUpdateRepository(GitRepoStatus repoStatus, string[] paths)
 {
     if (UpdateRepository != null)
     {
         UpdateRepository.Invoke(repoStatus, paths);
     }
 }
Exemplo n.º 2
0
        public static async System.Threading.Tasks.Task <IEnumerable <Bag> > UpdateBagsAsync(DocumentClient client, IImageRepository imageservice)
        {
            var bagsRepository       = new SearchRepository <Bag>(client, DocumentDBConstants.DatabaseId, DocumentDBConstants.Collections.Bags);
            var updateBagsRepository = new UpdateRepository <Bag>(client, DocumentDBConstants.DatabaseId, DocumentDBConstants.Collections.Bags);
            var bags = await bagsRepository.SearchItemsAsync(bag => bag.ImageId == null && bag.MainID != 165 && bag.MainID != 1193, 50);

            System.Console.WriteLine($"Fetched {bags.Count()} bags");
            var images = await ImportImages2Async(client, bags, imageservice);

            bags.ToList().ForEach(bag => {
                bag.ImageId = images.FirstOrDefault(image => image.Filename == $"{bag.MainID}.jpg")?.Id;
            });

            System.Console.WriteLine($"Attempting to update {bags.Count()} bags");
            var insertCounter = 0;
            await bags.ToList().ForEachAsync(async bag => {
                var bagid = await updateBagsRepository.UpdateItemAsync(bag.Id, bag);
                insertCounter++;
                System.Console.WriteLine($"Update bag: {insertCounter} - {bag.MainID}");
            });

            System.Console.WriteLine($"Completed updateing {insertCounter} bags");

            return(bags);
        }
Exemplo n.º 3
0
        public UpdateViewModel()
        {
            UpdataOrg = new RelayCommand(UpdateOrganization);
            Clean     = new RelayCommand(Clear);
            SelectOrg = new RelayCommand(SelectForUpdate);
            DelOrg    = new RelayCommand(DeleteOrg);

            updateModel = new UpdateOrgModel();
            upsateRepo  = new UpdateRepository();

            _countryRepository = new CountryRepository();                            //создаем экземпляр класса CountryRepository, который унаследован от интрефейса ICountryRepository
            List <CountryModel> countries = _countryRepository.GetCountries();       // создаем список объектов с типом CountryModel при помощи метода обязательного (Интрерфес) методом GetCountries из репы
            var countryVM = CountryMapper.CountryModelToCountryViewModel(countries); // при помощи статического метода CountryModelToCountryViewModel из класса CountryMapper приводим тип из Модели во Вью модель, чтобы наша вью модель могла работать с данными

            _sectionRepository = new SectionRepository();
            List <SectionModel> sections = _sectionRepository.GetSections();
            var sectionVM = SectionMappers.SectionModelToSectionViewModel(sections);

            Countries = countryVM;
            Section   = sectionVM;

            Person = new UpdatePersViewModel(countryVM)
            {
            };

            Organization = new UpdateOrgViewModel(countryVM, sectionVM)
            {
                CreateDateOrg = new DateTime()
            };
        }
Exemplo n.º 4
0
 public static int UpdateOrderData(UpdateViewModel Model)
 {
     try
     {
         return(UpdateRepository.UpdateData(Model));
     }catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 5
0
 public static UpdateViewModel GetOrderData(int OrderID)
 {
     try
     {
         return(UpdateRepository.GetData(OrderID));
     }catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 6
0
        public MainWindow()
        {
            InitializeComponent();

            IContainer countainer = Container.ConfigureContainer();

            brendRepository     = countainer.Resolve <BrendRepository>();
            equipmentRepository = countainer.Resolve <EquipmentRepository>();
            toolTypeRepository  = countainer.Resolve <ToolTypeRepository>();
            updateRepository    = countainer.Resolve <UpdateRepository>();

            catalogRepository = new CatalogRepository(brendRepository, equipmentRepository, toolTypeRepository, updateRepository);
        }
Exemplo n.º 7
0
        public void Updated_Set_CallsDataStore()
        {
            // arrange
            var dataStoreMock = new Mock <IDataStore>(MockBehavior.Loose);

            var repository = new UpdateRepository(
                dataStoreMock.Object
                );

            // act
            repository.Updated = DateTime.MinValue;

            // assert
            dataStoreMock.Verify(mock => mock.InsertAll(It.Is <IEnumerable <UpdateModel> >(item => item.First().Updated == DateTime.MinValue)), Times.Once());
        }
Exemplo n.º 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.Header.DataBind();
            login.loginpanelno = 2;
            if (!Page.IsPostBack)
            {
                UpdateRepository UpdateList = new UpdateRepository();
                ExtendedCollection<Update> UC = UpdateList.GetUpdateList(PAGEID.ToString());
                //UC.Contains(
                Update[] updates = new Update[UC.Count];
                UC.CopyTo(updates, 0);
                RepeaterID.DataSource = updates;
                RepeaterID.DataBind();

            }
        }
Exemplo n.º 9
0
        public RssUpdateJob()
        {
            var itanDatabaseContext        = new ItanDatabaseContext();
            var updateRepository           = new UpdateRepository(itanDatabaseContext);
            var rssEntriesRepository       = new RssEntriesRepository(itanDatabaseContext);
            var rssChannelsRepository      = new RssChannelsRepository(itanDatabaseContext);
            var rssChannelUpdateRepository = new RssChannelUpdateRepository(itanDatabaseContext);

            var configureMapper = IsThereAnyNewsAutomapper.ConfigureMapper();
            ISyndicationFeedAdapter syndicationFeedAdapter = new SyndicationFeedAdapter(configureMapper);

            this.updateService = new UpdateService(
                updateRepository,
                rssEntriesRepository,
                rssChannelsRepository,
                rssChannelUpdateRepository,
                syndicationFeedAdapter);
        }
        public async Task <ICommandResult> ExecuteAsync(UpdateCommand <TViewModel> command)
        {
            var activity = await ActivityRepository.SearchItemsAsync(x => x.Name == $"{typeof(TViewModel)}{nameof(UpdateCommandHandler<UpdateCommand<TViewModel>, TEntity>)}");

            if (await Authorizer.IsAuthorized(activity.FirstOrDefault()))
            {
                return(new ForbidResult());
            }

            if (command.Data == null)
            {
                return(new ErrorResult("Update item cannot be null"));
            }

            var entity = Translator.Translate(command.Data);
            await UpdateRepository.UpdateItemAsync(command.Id, entity);

            return(new OkResult());
        }
Exemplo n.º 11
0
        public void Updated_Get_CallsDataStore()
        {
            // arrange
            var dataStoreMock = new Mock <IDataStore>(MockBehavior.Loose);

            dataStoreMock.Setup(mock => mock.FirstOrDefault(It.IsAny <Expression <Func <UpdateModel, bool> > >()))
            .Returns(new UpdateModel {
                Updated = DateTime.MaxValue
            });

            var repository = new UpdateRepository(
                dataStoreMock.Object
                );

            // act
            var updated = repository.Updated;

            // assert
            dataStoreMock.Verify(mock => mock.FirstOrDefault(It.IsAny <Expression <Func <UpdateModel, bool> > >()), Times.Once());
        }
Exemplo n.º 12
0
        public void Updated_Get_ReturnsCorrectData()
        {
            // arrange
            var dataStoreMock = new Mock <IDataStore>(MockBehavior.Loose);

            dataStoreMock.Setup(mock => mock.FirstOrDefault(It.IsAny <Expression <Func <UpdateModel, bool> > >()))
            .Returns(new UpdateModel {
                Updated = DateTime.MaxValue
            });

            var repository = new UpdateRepository(
                dataStoreMock.Object
                );

            // act
            var updated = repository.Updated;

            // assert
            Assert.AreEqual(DateTime.MaxValue, updated);
        }
Exemplo n.º 13
0
        public async Task <ICommandResult> ExecuteAsync(UpdateBagCommand command)
        {
            var activity = await ActivityRepository.SearchItemsAsync(x => x.Name == $"{nameof(UpdateBagCommandHandler)}");

            if (await Authorizer.IsAuthorized(activity.FirstOrDefault()))
            {
                return(new ForbidResult());
            }

            if (command == null)
            {
                return(new ErrorResult("Update item cannot be null"));
            }

            var previousEntity = await GetRepository.GetItemAsync(command.Id);

            var entity = Translator.Translate(command.Data, previousEntity);
            await UpdateRepository.UpdateItemAsync(command.Id, entity);

            return(new OkResult());
        }
Exemplo n.º 14
0
        public SettingViewModel()
        {
            App.AppSetting.OnPropertyChangeSet(OnPropertyChanged);

            UpdateButtonCmd = new Command(async() =>
            {
                UpdateButtonEnabled            = false;
                UpdateRepository updateService = new UpdateRepository();
                var checkStatus     = await updateService.CheckUpdate();
                UpdateButtonEnabled = true;
                if (!checkStatus)
                {
                    await Application.Current.MainPage.DisplayAlert(App.AppSetting.AppNameVersion,
                                                                    "Wystąpił nieoczekiwany błąd podczas sprawdzania istniejącej wersji", "OK");
                    return;
                }

                if (!updateService.IsNewVersion())
                {
                    await Application.Current.MainPage.DisplayAlert(App.AppSetting.AppNameVersion,
                                                                    "Posiadasz już najaktualniejszą wersje aplikacji", "OK");
                    return;
                }

                var response = await Application.Current.MainPage.DisplayAlert(App.AppSetting.AppNameVersion,
                                                                               $"Znaleziono nową wersje aplikacji: " + String.Format("{0:0.#}", updateService.versionServer) + "\nCzy chcesz przejść do strony aktualizacji aplikacji?",
                                                                               "Otwórz strone", "Anuluj");

                if (response)
                {
                    try
                    {
                        Device.OpenUri(new Uri(updateService.versionUpdateUrl));
                    }
                    catch (Exception) { }
                }
            });
        }
 /// <summary>
 /// Update a single object in database.
 /// </summary>
 /// <param name="entity"></param>
 public async Task <bool> Update(T entity)
 {
     return(await UpdateRepository.Update(entity));
 }
 public string TestService(IWebService inputValues)
 {
     return(UpdateRepository != null?UpdateRepository.TestWebService(inputValues) : "Error");
 }
        public async Task <List <ListDictionary> > ExecuteQuery(string connectionString, string sqlCommand)
        {
            List <ListDictionary> queryResult = new List <ListDictionary>();

            while (_keepRunning)
            {
                var afterWhere = sqlCommand.ToLower().After("where");
                if (afterWhere.ToLower().Contains("select"))
                {
                    Console.WriteLine("This application is unable to process statements that have a select in their where clause");
                }

                try
                {
                    if (sqlCommand.ToLower().Contains("select"))
                    {
                        IRepository repo = new SelectRepository();
                        return(queryResult = await repo.Command(connectionString, sqlCommand));
                    }
                    else if (sqlCommand.ToLower().Contains("insert"))
                    {
                        IRepository repo = new InsertRepository();
                        return(queryResult = await repo.Command(connectionString, sqlCommand));
                    }
                    else if (sqlCommand.ToLower().Contains("delete"))
                    {
                        IRepository repo = new DeleteRepository();
                        return(queryResult = await repo.Command(connectionString, sqlCommand));
                    }
                    else if (sqlCommand.ToLower().Contains("update"))
                    {
                        IRepository repo = new UpdateRepository();
                        return(queryResult = await repo.Command(connectionString, sqlCommand));
                    }
                    else if (sqlCommand.ToLower().Contains("q"))
                    {
                        Console.WriteLine("Are you sure you want to quit?");
                        var quitter = Console.ReadLine();
                        if (quitter.ToLower().Contains("y") || quitter.ToLower().Contains("yes"))
                        {
                            _keepRunning = false;
                        }
                        return(new List <ListDictionary>());
                    }
                    else
                    {
                        return(new List <ListDictionary>());
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine("There may be an error with your SQL Query." + System.Environment.NewLine + "The error reads: " + ex.Message);
                    if (ex.Message.Contains("No such host is known") || ex.Message.Contains("Couldn't set port (Parameter 'port')"))
                    {
                        _keepRunning = false;
                        var ConnString = UserInteractions.AskUserForAuthenticationInformation();
                        await ExecuteQuery(ConnString, sqlCommand);
                    }
                }
            }
            return(queryResult);
        }
 /// <summary>
 /// Update a list of object in database.
 /// </summary>
 /// <param name="entityList"></param>
 public async Task <bool> Update(List <T> entityList)
 {
     return(await UpdateRepository.Update(entityList));
 }