protected async Task Delete(int categoryId)
        {
            await CategoryDataService.Delete(categoryId);

            StatusClass = "alert-success";
            Message     = "Deleted successfully";
        }
Exemple #2
0
        public CategoryDboTest()
        {
            productRepository = new ProductRepository(DbContextFactory);

            repository = new CategoryRepository(DbContextFactory);
            dataService = new CategoryDataService(repository, UnitOfWork);
        }
Exemple #3
0
 public ItemAddFormActivity()
 {
     mInventoryDataService = new InventoryDataService();
     mProductDataService   = new ProductDataService();
     mCategoryDataService  = new CategoryDataService();
     mStorageDataService   = new StorageDataService();
 }
        protected async Task HandleValidSubmit()
        {
            if (Category.CategoryId == 0)
            {
                var response = await CategoryDataService.Add(Category);

                if (response.Errors.Any())
                {
                    ShowError   = true;
                    Errors      = response.Errors;
                    StatusClass = "alert-danger";
                }
                else
                {
                    StatusClass = "alert-success";
                    Message     = "New category added successfully.";
                }
            }
            else
            {
                await CategoryDataService.Update(Category);

                StatusClass = "alert-success";
                Message     = "Category updated successfully.";
            }
        }
Exemple #5
0
        /// <summary>
        /// 进行数据库的适配
        /// </summary>
        /// <param name="dbType"></param>
        /// <returns></returns>
        private ICategroyService SwitchBasicDataSource(string dbType)
        {
            ICategroyService cs = null;

            //当前数据库
            switch (dbType)
            {
            case DBType.MySQL:
                break;

            case DBType.SQLite:
                cs = new CategorySQLiteService("TecentDA_Write");
                break;

            case DBType.SQLServer:
                cs = new CategoryDataService(new ConfigurationItems().TecentDA_Read);
                break;

            case DBType.Redis:
                cs = new RedisService(string.Format("IP={0};Port={1};Psw={2}", SystemConfig.RedisIp, SystemConfig.RedisPort, SystemConfig.RedisPsw));
                break;

            case DBType.IOFile:
                cs = new CategoryDataServiceInIOFile();
                break;
            }
            return(cs);
        }
Exemple #6
0
        public CategoryDboTest()
        {
            productRepository = new ProductRepository(DbContextFactory);

            repository  = new CategoryRepository(DbContextFactory);
            dataService = new CategoryDataService(repository, UnitOfWork);
        }
Exemple #7
0
        protected async override Task OnInitializedAsync()
        {
            listCtgr = await CategoryDataService.GetAllCategories();

            listCurr = await CurrencyDataService.GetAllCurrencies();

            Categories = new ObservableCollection <CategoryViewModel>(listCtgr);
            Currencies = new ObservableCollection <CurrencyViewModel>(listCurr);

            if (SelectedExpenseClaimId != 0)
            {
                ronly = true;
                Items = await ItemDataService.GetAllItems(SelectedExpenseClaimId);

                foreach (var it in Items)
                {
                    it.CategoryName = listCtgr.Find(x => x.Id == it.CategoryId).Name;
                    it.CurrencyName = listCurr.Find(x => x.Id == it.CurrencyId).Name;
                    if (it.ItemId == 0)
                    {
                        it.CategoryName = listCtgr[0].Name;
                        it.CurrencyName = listCurr[0].Name;
                    }
                }
            }
        }
Exemple #8
0
        /// <summary>
        /// Load an Employee based on id, as as source for the component UI
        /// </summary>
        /// <returns></returns>
        protected async override Task OnInitializedAsync()
        {
            //Employee = (await EmployeeDataService.GetEmployeeDetails(int.Parse(EmployeeId)));
            Countries     = (await CountryDataService.GetAllCountries()).ToList();
            JobCategories = (await CategoryDataService.GetAllJobCategories()).ToList();

            int.TryParse(EmployeeId, out var employeeId);

            if (employeeId == 0)//New employee is created.
            {
                //Fill in some defaults for the new employee
                Employee = new Employee {
                    CountryId = 1, JobCategoryId = 1, BirthDate = DateTime.Now, JoinedDate = DateTime.Now
                };
            }
            else
            {
                Employee = (await EmployeeDataService.GetEmployeeDetails(int.Parse(EmployeeId)));
            }
            //To make two way binding work on the Countries SelectList, in order to show the Employees country as the selecte value,
            //we need to convert the Employee.CountryId to a string, and put it in a helper field (CountryId), that can then be used by the SelectList.
            //Basically, when binding to a ddl etc. using an Id from a model, it needs to be converted to string.
            CountryId     = Employee.CountryId.ToString();
            JobCategoryId = Employee.JobCategoryId.ToString();
        }
Exemple #9
0
 public UseActivity()
 {
     mInventoryDataService = new InventoryDataService();
     mProductDataService   = new ProductDataService();
     mCategoryDataService  = new CategoryDataService();
     mStorageDataService   = new StorageDataService();
     mConsumeDataService   = new ConsumeDataService();
 }
Exemple #10
0
 protected override async Task OnInitializedAsync()
 {
     QueryParameters = new ProductListParameters();
     Elements        = (await DataService.Get(QueryParameters)).ToArray();
     Categories      = (await CategoryDataService.GetAll()).ToArray();
     Warehouses      = (await WarehouseDataService.GetAll()).ToArray();
     Taxes           = (await TaxDataService.GetAll()).ToArray();
     UnitOfMeasures  = (await UnitOfMeasureDataService.GetAll()).ToArray();
 }
        protected async Task SaveForm()
        {
            var createdCategory = await CategoryDataService.AddItem(Category);

            if (createdCategory == null)
            {
                throw new ArgumentException("Could not save category");
            }
            await OnSaveCallback.InvokeAsync(createdCategory);
        }
Exemple #12
0
 public AddItemBarcodeFragment()
 {
     mInventoryDataService = new InventoryDataService();
     mProductDataService   = new ProductDataService();
     mCategoryDataService  = new CategoryDataService();
     mStorageDataService   = new StorageDataService();
     mProducts             = new List <ProductViewModel>();
     mStorages             = new List <StorageViewModel>();
     mCategories           = new List <CategoryViewModel>();
     isBarcodeFound        = false;
 }
 protected async void OnIncludeHistoryChanged(ChangeEventArgs args)
 {
     if ((bool)args.Value)
     {
         Categories = await CategoryDataService.GetAllCategoriesWithEvents(true);
     }
     else
     {
         Categories = await CategoryDataService.GetAllCategoriesWithEvents(false);
     }
 }
Exemple #14
0
 public AddItemBarcodeFragment()
 {
     mInventoryDataService = new InventoryDataService();
     mProductDataService   = new ProductDataService();
     mCategoryDataService  = new CategoryDataService();
     mStorageDataService   = new StorageDataService();
     spinnerListCategories = new List <CategoryViewModel>();
     mProducts             = LoginPageActivity.mGlobalProducts;
     mStorages             = LoginPageActivity.mGlobalStorages;
     mCategories           = LoginPageActivity.mGlobalCategories;
 }
Exemple #15
0
 public LoginPageActivity()
 {
     mAccountDataService      = new AccountDataService();
     mInventoryDataService    = new InventoryDataService();
     mProductDataService      = new ProductDataService();
     mStorageDataService      = new StorageDataService();
     mLocationDataService     = new LocationDataService();
     mCategoryDataService     = new CategoryDataService();
     mConsumeDataService      = new ConsumeDataService();
     mUserDataDataService     = new UserDataDataService();
     mUserLocationDataService = new UserLocationDataService();
 }
Exemple #16
0
        protected override async Task OnInitializedAsync()
        {
            await base.OnInitializedAsync();

            if (Item.CategoryID.HasValue)
            {
                Colour = (await CategoryDataService.LoadCategory(Item.CategoryID.Value)).Colour;
            }
            else
            {
                Colour = UIConstants.DEFAULT_CATEGORY_COLOUR;
            }
        }
        protected override async Task OnInitializedAsync()
        {
            int.TryParse(ProductId, out var productId);
            Product = await ProductDataService.Get(productId);

            CategoryId = Product.CategoryId.ToString();

            Categories = await CategoryDataService.Get();

            Categories.Insert(0, new Category {
                CategoryId = -1, Name = "Please select"
            });
        }
        protected override async Task OnInitializedAsync()
        {
            if (Guid.TryParse(EventId, out SelectedEventId))
            {
                EventDetailViewModel = await EventDataService.GetEventById(SelectedEventId);

                SelectedCategoryId = EventDetailViewModel.CategoryId.ToString();
            }

            var list = await CategoryDataService.GetAllCategories();

            Categories         = new ObservableCollection <CategoryViewModel>(list);
            SelectedCategoryId = Categories.FirstOrDefault().CategoryId.ToString();
        }
Exemple #19
0
 public SplashScreenActivity()
 {
     mAccountDataService      = new AccountDataService();
     mInventoryDataService    = new InventoryDataService();
     mProductDataService      = new ProductDataService();
     mStorageDataService      = new StorageDataService();
     mLocationDataService     = new LocationDataService();
     mCategoryDataService     = new CategoryDataService();
     mConsumeDataService      = new ConsumeDataService();
     mUserDataDataService     = new UserDataDataService();
     mUserLocationDataService = new UserLocationDataService();
     mShopListDataService     = new ShoplistDataService();
     mShopItemDataService     = new ShopItemDataService();
 }
Exemple #20
0
        protected override async Task OnInitializedAsync()
        {
            callStateChange = async() => await OnStateChange.InvokeAsync(null);

            var categories = await CategoryDataService.LoadCategories();

            CategoryFilters = categories.Select(c => new Filter <CategoryModel>
            {
                Model     = c,
                IsVisible = !CalendarService.State.HiddenCategoryIDs.Contains(c.ID)
            }).ToList();
            NoCategoryFilter = new Filter <int?>
            {
                IsVisible = !CalendarService.State.HiddenCategoryIDs.Contains(null),
                Model     = null
            };
        }
Exemple #21
0
        protected override async Task OnInitializedAsync()
        {
            Products = await ProductDataService.Get();

            Categories = await CategoryDataService.Get();

            foreach (var product in Products)
            {
                Model.ProductViewItems.Add(new ProductViewItem
                {
                    CategoryId   = product.CategoryId,
                    CategoryName = Categories.First(x => x.CategoryId == product.CategoryId).Name,
                    Image        = product.Image,
                    IsAvailable  = product.IsAvailable,
                    Name         = product.Name,
                    ProductId    = product.ProductId,
                    UnitPrice    = product.UnitPrice
                });
            }
        }
        protected override async Task OnInitializedAsync()
        {
            int.TryParse(ItemId, out SelectedItemId);
            var listCtgr = await CategoryDataService.GetAllCategories();

            var listCurr = await CurrencyDataService.GetAllCurrencies();

            Categories = new ObservableCollection <CategoryViewModel>(listCtgr);
            Currencies = new ObservableCollection <CurrencyViewModel>(listCurr);

            if (SelectedItemId > 0)
            {
                ItemDetailViewModel = await ItemDataService.GetItemById(SelectedItemId);

                SelectedExpenseClaimId = ItemDetailViewModel.ExpenseClaimId;
                SelectedCategoryId     = ItemDetailViewModel.CategoryId.ToString();
                SelectedCurrencyId     = ItemDetailViewModel.CurrencyId.ToString();
            }
            else
            {
                SelectedCategoryId = Categories.FirstOrDefault().Id.ToString();
                SelectedCurrencyId = Currencies.FirstOrDefault().Id.ToString();
            }
        }
 protected override async Task OnInitializedAsync()
 {
     int.TryParse(CategoryId, out var categoryId);
     Category = await CategoryDataService.Get(categoryId);
 }
 protected async override Task OnInitializedAsync()
 {
     Categories = await CategoryDataService.GetAllCategoriesWithEvents(false);
 }
Exemple #25
0
 protected async override Task OnInitializedAsync()
 {
     Categories = await CategoryDataService.GetAllCategories();
 }
        protected async Task HandleValidSubmit()
        {
            var response = await CategoryDataService.CreateCategory(CategoryViewModel);

            HandleResponse(response);
        }
Exemple #27
0
        protected override async Task OnInitializedAsync()
        {
            Categories = await CategoryDataService.Get();

            Products = await ProductDataService.Get();
        }
Exemple #28
0
        //private Android.Support.V7.Widget.SearchView mSearchView;

        public CategoriesFragment()
        {
            mCategoryDataService = new CategoryDataService();
        }
 public CategoryDataServiceTest()
 {
     this.sessionFactory = new TestSessionFactory(this.DocumentStore);
     this.sut            = new CategoryDataService(new Mock <ILog>().Object, this.sessionFactory, this.DocumentStore);
 }
Exemple #30
0
 protected override async Task OnInitializedAsync()
 {
     Categories = await CategoryDataService.LoadCategories();
 }
Exemple #31
0
 public CategoriesActivity()
 {
     mCategoryDataService = new CategoryDataService();
 }