public void ChangedEverything()
 {
     RaisePropertyChanged("Details");
     RaisePropertyChanged("Amount");
     RaisePropertyChanged("PaymentType");
     CategoryAdapter.ReloadCategories();
 }
Beispiel #2
0
        public BonViewModel(IReceipt bon, DBConnector dbConnection)
        {
            _DBConnection    = dbConnection;
            _bon             = bon;
            _user            = _bon.User;
            _payDate         = _bon.PayDate;
            _details         = _bon.Details;
            _amount          = bon.Amount;
            _settlementDate  = _bon.SettlementDate;
            _id              = _bon.ID;
            _settled         = _bon.Settled;
            _paymentType     = _bon.PaymentType;
            _payments        = _bon.Payments;
            _categoryAdapter = new CategoryAdapter(bon.Categories, dbConnection);

            Balance = false;
            LoadPaymentViewModels();

            NewPaymentCommand    = new ActionCommand(NewPayment, null);
            SaveBonCommand       = new ActionCommand(SaveBon, CanSaveBon);
            EditBonCommand       = new ActionCommand(EditBon, CanEditBon);
            LiftPayDateCommand   = new ActionCommand(LiftPayDate, null);
            ReducePayDateCommand = new ActionCommand(ReducePayDate, null);
            CanBeEdited          = false;
        }
Beispiel #3
0
        private void SetRecyclerViewAdapters()
        {
            try
            {
                MAdapter = new VideoRowAdapter(Activity)
                {
                    VideoList = new ObservableCollection <VideoObject>()
                };
                LayoutManager = new LinearLayoutManager(Context);
                MRecycler.SetLayoutManager(LayoutManager);
                MRecycler.HasFixedSize = true;
                MRecycler.SetItemViewCacheSize(10);
                MRecycler.GetLayoutManager().ItemPrefetchEnabled = true;
                var sizeProvider = new FixedPreloadSizeProvider(10, 10);
                var preLoader    = new RecyclerViewPreloader <VideoObject>(Activity, MAdapter, sizeProvider, 10);
                MRecycler.AddOnScrollListener(preLoader);
                MRecycler.SetAdapter(MAdapter);

                RecyclerViewOnScrollListener xamarinRecyclerViewOnScrollListener = new RecyclerViewOnScrollListener(LayoutManager);
                MainScrollEvent = xamarinRecyclerViewOnScrollListener;
                MainScrollEvent.LoadMoreEvent += MainScrollEventOnLoadMoreEvent;
                MRecycler.AddOnScrollListener(xamarinRecyclerViewOnScrollListener);
                MainScrollEvent.IsLoading = false;

                //======== Category =======
                CatLayoutManager = new LinearLayoutManager(Activity);
                CatRecycler.SetLayoutManager(CatLayoutManager);
                MCatAdapter = new CategoryAdapter(Activity)
                {
                    CategoryList = new ObservableCollection <Classes.Category>()
                };
                CatRecycler.SetAdapter(MCatAdapter);

                if (MCatAdapter.CategoryList.Count == 0 && CategoriesController.ListCategories.Count > 0)
                {
                    MCatAdapter.CategoryList = CategoriesController.ListCategories;
                    MCatAdapter.NotifyDataSetChanged();

                    CatRecycler.Visibility = ViewStates.Visible;
                    MRecycler.Visibility   = ViewStates.Gone;
                }
                else
                {
                    CatRecycler.Visibility = ViewStates.Gone;
                    MRecycler.Visibility   = ViewStates.Visible;

                    Inflated = EmptyStateLayout.Inflate();
                    EmptyStateInflater x = new EmptyStateInflater();
                    x.InflateLayout(Inflated, EmptyStateInflater.Type.NoSearchResult);
                    if (!x.EmptyStateButton.HasOnClickListeners)
                    {
                        x.EmptyStateButton.Click += null;
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Beispiel #4
0
        public void Add(CategoryDto entity)
        {
            var adapter = CategoryAdapter.BuildCategory(entity);

            _repository.Add(adapter);
            entity.Code = adapter.Code;
        }
Beispiel #5
0
        private void GetByBaseCategoryId()
        {
            if (!string.IsNullOrEmpty(Request.QueryString["bc"]))
            {
                int baseCatId = Convert.ToInt32(Business.Encryption.Encryption64.Decrypt(Request.QueryString["bc"], "!#$a54?3"));
                if (baseCatId != 0)
                {
                    CategoryEntity category = new CategoryAdapter().GetCategoryById(baseCatId);
                    BaseCategoryNameLabel.Text = category.Name;
                    CategoryNameLabel.Text     = category.Name;

                    SubCategoriesRepeater.DataSource = new CategoryAdapter().GetSubCategories(baseCatId);
                    SubCategoriesRepeater.DataBind();

                    ProductListRepeater.DataSource = new ProductAdapter().GetProductsByMainCategoryId(baseCatId);
                    ProductCollection productList = (ProductCollection)ProductListRepeater.DataSource;
                    Session["ProductList"] = productList;
                    ProductListRepeater.DataBind();
                }
                else
                {
                    Response.Redirect("~/Default.aspx");
                }
            }
        }
        private void LoadData()
        {
            CategoryAdapter categoryAdapter = new CategoryAdapter();

            BaseCategoryListRepeater.DataSource = categoryAdapter.GetMainCategories();
            BaseCategoryListRepeater.DataBind();
        }
Beispiel #7
0
        private void searchCategories()
        {
            string category = searchField.Text;

            if (string.IsNullOrEmpty(category))
            {
                return;
            }

            header.Text = "Search Results";
            popularRecyclerView.Visibility = ViewStates.Gone;
            searchRecyclerView.Visibility  = ViewStates.Visible;

            //Get search results
            Task.Run(async() =>
            {
                return(await Api.DavinciApi.SearchCategory(category));
            }).ContinueWith(t =>
            {
                if (t.Status != TaskStatus.Canceled && t.Result.OK)
                {
                    var searchAdapter        = new CategoryAdapter(this.Context, t.Result.categories);
                    searchAdapter.ItemClick += (c) =>
                    {
                        var intent = new Intent(Application.Context, typeof(CategoryActivity));
                        intent.PutExtra("id", c._id);
                        intent.PutExtra("name", c.name);
                        intent.PutExtra("count", c.imagecount);
                        StartActivity(intent);
                    };
                    searchRecyclerView.SetAdapter(searchAdapter);
                }
            }, TaskScheduler.FromCurrentSynchronizationContext());
        }
Beispiel #8
0
        private async void GetCategories()
        {
            categoryList = await categoryService.RefreshDataAsync();

            categoryList = categoryList.OrderBy(x => x.DisplayOrder).ToList();

            adapter = new CategoryAdapter(this, categoryList);
            listviewCategory.Adapter = adapter;
        }
Beispiel #9
0
        private async void GetCategories()
        {
            categoryList = await categoryService.RefreshDataAsync();

            categoryList    = categoryList.OrderBy(x => x.DisplayOrder).ToList();
            categoryAdapter = new CategoryAdapter(this, categoryList);

            spinnerMenuCategoriesAdd.Adapter = categoryAdapter;
        }
Beispiel #10
0
        public CategoryViewHolder(View view, CategoryAdapter adapter) : base(view)
        {
            _parentAdapter = adapter;
            _childAdapter  = new ProductAdapter(view.Context);
            _layoutManager = new LinearLayoutManager(view.Context);
            _parent        = view;

            BindViews(_parent);
        }
 void SetUpQuizGrid(GridView categoriesView)
 {
     categoriesView.ItemClick += (sender, e) => {
         var activity = Activity;
         StartCategoryActivityWithTransition(activity, e.View.FindViewById(Resource.Id.category_title), (Category)categoryAdapter.GetItem(e.Position));
     };
     categoryAdapter        = new CategoryAdapter(Activity);
     categoriesView.Adapter = categoryAdapter;
 }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View view = inflater.Inflate(Resource.Layout.Transaction, container, false);

            ButtonSave    = view.FindViewById <Button>(Resource.Id.buttonSave);
            ButtonDelete  = view.FindViewById <Button>(Resource.Id.buttonDelete);
            EditAmount    = view.FindViewById <EditCurrency>(Resource.Id.editValue);
            ToggleType    = view.FindViewById <ToggleButton>(Resource.Id.toggleType);
            SpinCategory  = view.FindViewById <Spinner>(Resource.Id.spinCategory);
            SpinMilestone = view.FindViewById <Spinner>(Resource.Id.spinMilestone);
            DatePicker    = view.FindViewById <DatePicker>(Resource.Id.datePicker);
            EditNote      = view.FindViewById <EditText>(Resource.Id.editNote);
            ButtonShare   = view.FindViewById <Button>(Resource.Id.buttonShare);

            view.FindViewById <Spinner>(Resource.Id.spinRecurrence).Visibility  = ViewStates.Invisible;
            view.FindViewById <TextView>(Resource.Id.textRecurrence).Visibility = ViewStates.Invisible;

            ButtonSave.Click   += SaveItem;
            ButtonDelete.Click += DeleteItem;

            EditAmount.Value         = Item.Amount;
            EditAmount.ValueChanged += EditAmountOnValueChanged;

            ToggleType.Checked        = Item.Type == TransactionType.Income;
            ToggleType.CheckedChange += ToggleTypeOnCheckedChange;

            CategoryAdapter categoryAdapter = new CategoryAdapter(Activity, GetTransactionType(), true);

            SpinCategory.Adapter = categoryAdapter;
            SpinCategory.SetSelection(categoryAdapter.Categories.FindIndex(c => c?.Id == Item.CategoryId));
            SpinCategory.ItemSelected += SpinCategoryOnItemSelected;

            MilestoneAdapter milestoneAdapter = new MilestoneAdapter(Activity, true);

            SpinMilestone.Adapter = milestoneAdapter;
            SpinMilestone.SetSelection(milestoneAdapter.Milestones.FindIndex(c => c?.Id == Item.MilestoneId));
            SpinMilestone.ItemSelected += SpinMilestoneOnItemSelected;

            if (Item.Date == new DateTime())
            {
                Item.Date = DateTime.Now;
            }
            DatePicker.Date         = Item.Date;
            DatePicker.DateChanged += DatePickerOnDateChanged;

            EditNote.Text         = Item.Note;
            EditNote.TextChanged += EditNoteOnTextChanged;

            ButtonShare.Click += ButtonShareOnClick;

            UpdateUI();

            return(view);
        }
Beispiel #13
0
        }// End of Constructor function

        /// <summary>
        /// Add category
        /// </summary>
        /// <param name="category"></param>
        /// <param name="user_log"></param>
        /// <returns></returns>
        public Category addCategory(Category category, UserSystem user_log)
        {
            return(http_service.JSONHttpPettitionObject <Category>(
                       HttpMethod.POST,
                       GetType().Name.ToLower().Replace(
                           TWords.SERVICE,
                           TWords.SLASH),
                       JsonConvert.SerializeObject(
                           CategoryAdapter.ObjectToDTO(
                               category))));
        }// End of addCategory function
Beispiel #14
0
 private void SetupList()
 {
     loadingCircle.Visibility = ViewStates.Gone;
     manager = new LinearLayoutManager(this);
     recyclerView.SetLayoutManager(manager);
     adapter            = new CategoryAdapter(categoryList);
     adapter.ItemClick += OnItemClick;
     recyclerView.SetAdapter(adapter);
     manager.ScrollToPosition(Global.CategoryScrollPosition);
     bookmarksFab.Click += BookmarksFab_Click;
 }
 public PaymentViewModel(IPayment zahlung, DBConnector dbConnection)
 {
     _DBConnection    = dbConnection;
     this._zahlung    = zahlung;
     this._amount     = zahlung.Amount;
     this._details    = zahlung.Details;
     this.PaymentType = zahlung.PaymentType;
     this._id         = zahlung.ID;
     _categoryAdapter = new CategoryAdapter(zahlung.Categories, dbConnection);
     ChangedEverything();
 }
Beispiel #16
0
        private async void GetCategories()
        {
            categoryList = await categoryService.RefreshDataAsync();

            categoryList    = categoryList.OrderBy(x => x.DisplayOrder).ToList();
            categoryAdapter = new CategoryAdapter(this, categoryList);

            spinnerMenuCategoriesEdit.Adapter = categoryAdapter;

            SetCategory(Intent.GetIntExtra("CategoryId", 1));
        }
Beispiel #17
0
        }// End of getByName function

        /// <summary>
        /// Update category
        /// </summary>
        /// <param name="category"></param>
        /// <param name="user_log"></param>
        /// <returns></returns>
        public Category updateCategory(Category category, UserSystem user_log)
        {
            return(http_service.JSONHttpPettitionObject <Category>(
                       HttpMethod.PUT,
                       GetType().Name.ToLower().Replace(
                           TWords.SERVICE,
                           string.Format(
                               TWords.ONEPARAM,
                               category.id)),
                       JsonConvert.SerializeObject(
                           CategoryAdapter.ObjectToDTO(
                               category))));
        } // End of updateCategory function
Beispiel #18
0
        private void categoryCursor()
        {
            for (int i = 0; i < MyCategories.Length; i++)
            {
                CategoryData cs    = MyCategories[i];
                var          Title = cs.category_name;
                var          id    = cs.category_id;
                var          er    = "";
                items.Add(new CategoryData()
                {
                    category_name = Title, category_id = id, error = er
                });
            }


            listData.Adapter = MyAdapter = new CategoryAdapter(this, items);
        }
Beispiel #19
0
 public void ChangedEverything()
 {
     RaisePropertyChanged("AllPayments");
     RaisePropertyChanged("User");
     RaisePropertyChanged("Amount");
     RaisePropertyChanged("Payments");
     RaisePropertyChanged("PayDate");
     RaisePropertyChanged("Details");
     RaisePropertyChanged("AllShops");
     RaisePropertyChanged("CurrentShop");
     RaisePropertyChanged("PaymentType");
     RaisePropertyChanged("SumToPay");
     RaisePropertyChanged("UserToPay");
     CategoryAdapter.ReloadCategories();
     foreach (PaymentViewModel pvm in AllPayments)
     {
         pvm.CategoryAdapter.ReloadCategories();
     }
 }
Beispiel #20
0
        private void SetupCategoryScrollView()
        {
            // Bind known categories to the horizontal recycler view
            mCategoryAdapter = new CategoryAdapter();
            var categoryView = FindViewById <RecyclerView>(Resource.Id.categorial_list_view);

            categoryView.SetAdapter(mCategoryAdapter);

            var manager =
                new LinearLayoutManager(this, LinearLayoutManager.Horizontal, false);

            categoryView.SetLayoutManager(manager);

            // If a cateogry is clicked, refresh the product grid view with the latest products.
            mCategoryAdapter.ItemClick += (s, e) =>
            {
                var selectedCategory = (Category)(s as View).Tag;
                mProductAdapter.SetSelectedCategory(selectedCategory);
            };
        }
Beispiel #21
0
 private void getPopularCategories()
 {
     Task.Run(async() =>
     {
         return(await Api.DavinciApi.GetPopularCategories());
     }).ContinueWith(t =>
     {
         if (t.Status != TaskStatus.Canceled && t.Result.OK)
         {
             var popularAdapter        = new CategoryAdapter(this.Context, t.Result.categories);
             popularAdapter.ItemClick += (c) =>
             {
                 var intent = new Intent(Application.Context, typeof(CategoryActivity));
                 intent.PutExtra("id", c._id);
                 intent.PutExtra("name", c.name);
                 intent.PutExtra("count", c.imagecount);
                 StartActivity(intent);
             };
             popularRecyclerView.SetAdapter(popularAdapter);
         }
     }, TaskScheduler.FromCurrentSynchronizationContext());
 }
Beispiel #22
0
        private void GetByKeywordAndBaseCategory()
        {
            if (!string.IsNullOrEmpty(Request.QueryString["k"]) && !string.IsNullOrEmpty(Request.QueryString["bc"]))
            {
                string keyword   = Business.Encryption.Encryption64.Decrypt(Request.QueryString["k"], "12345678").Replace("+", " ");
                int    baseCatId = Convert.ToInt32(Business.Encryption.Encryption64.Decrypt(Request.QueryString["bc"], "!#$a54?3"));
                if (baseCatId != 0)
                {
                    CategoryEntity category = new CategoryAdapter().GetCategoryById(baseCatId);
                    BaseCategoryNameLabel.Text = category.Name;
                    CategoryNameLabel.Text     = keyword;

                    SubCategoriesRepeater.DataSource = new CategoryAdapter().GetSubCategories(baseCatId);
                    SubCategoriesRepeater.DataBind();

                    ProductListRepeater.DataSource = new ProductAdapter().GetProductsByKeywordAndBaseCatId(keyword, baseCatId);
                    ProductCollection productList = (ProductCollection)ProductListRepeater.DataSource;
                    Session["ProductList"] = productList;
                    ProductListRepeater.DataBind();
                }
                else
                {
                    BaseCategoryNameLabel.Text = keyword;
                    CategoryNameLabel.Text     = keyword;
                    ProductCollection products = new ProductAdapter().GetProductsByKeyword(keyword);
                    Session["ProductList"] = products;
                    //Disable CategorySlider
                    SubCategoriesRepeater.Visible = false;

                    ProductListRepeater.DataSource = products;
                    ProductListRepeater.DataBind();
                }
            }
            else
            {
                Response.Redirect("~/Default.aspx");
            }
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View view = inflater.Inflate(Resource.Layout.Budget, container, false);

            // Find UI views
            ButtonSave     = view.FindViewById <Button>(Resource.Id.buttonSave);
            ButtonDelete   = view.FindViewById <Button>(Resource.Id.buttonDelete);
            EditName       = view.FindViewById <EditText>(Resource.Id.editName);
            EditAmount     = view.FindViewById <EditCurrency>(Resource.Id.editAmount);
            SpinCategory   = view.FindViewById <Spinner>(Resource.Id.spinCategory);
            SpinRecurrence = view.FindViewById <Spinner>(Resource.Id.spinRecurrence);

            // View logic
            ButtonSave.Click   += SaveItem;
            ButtonDelete.Click += DeleteItem;

            EditName.Text         = Item.Name;
            EditName.TextChanged += EditNameOnTextChanged;

            EditAmount.Value             = Item.Amount;
            EditAmount.AfterTextChanged += EditAmountOnAfterTextChanged;

            CategoryAdapter categoryAdapter = new CategoryAdapter(Activity, TransactionType.Expense, true);

            SpinCategory.Adapter = categoryAdapter;
            SpinCategory.SetSelection(categoryAdapter.Categories.FindIndex(c => c?.Id == Item.CategoryId));
            SpinCategory.ItemSelected += SpinCategoryOnItemSelected;

            RecurrenceAdapter recurrenceAdapter = new RecurrenceAdapter(Activity, true);

            SpinRecurrence.Adapter = recurrenceAdapter;
            SpinRecurrence.SetSelection(recurrenceAdapter.Recurrences.FindIndex(c => c?.Id == Item.RecurrenceId));
            SpinRecurrence.ItemSelected += SpinRecurrenceOnItemSelected;

            return(view);
        }
Beispiel #24
0
 private void getPopularCategories()
 {
     Task.Run(async() =>
     {
         CategoryCollectionModel categoryCollection = await Api.DavinciApi.GetPopularCategories();
         return(categoryCollection);
     }).ContinueWith(t =>
     {
         var k = t.Result.categories;
         RunOnUIThread(() =>
         {
             var popularAdapter        = new CategoryAdapter(this.Context, t.Result.categories);
             popularAdapter.ItemClick += (c) =>
             {
                 var intent = new Intent(Application.Context, typeof(CategoryActivity));
                 intent.PutExtra("id", c._id);
                 intent.PutExtra("name", c.name);
                 intent.PutExtra("count", c.imagecount);
                 StartActivity(intent);
             };
             popularRecyclerView.SetAdapter(popularAdapter);
         });
     }, TaskScheduler.FromCurrentSynchronizationContext());
 }
Beispiel #25
0
 public CategoryDto Get(int id)
 {
     return(CategoryAdapter.BuildCategoryDto(_repository.Get(id)));
 }
Beispiel #26
0
 public void Edit(CategoryDto entity)
 {
     _repository.Update(CategoryAdapter.BuildCategory(entity));
 }
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activityEditCategories);

            var toolbar     = FindViewById <Toolbar>(Resource.Id.activityEditCategories_toolbar);
            var progressBar = FindViewById <ProgressBar>(Resource.Id.activityEditCategories_progressBar);

            SetSupportActionBar(toolbar);

            SupportActionBar.SetTitle(Resource.String.editCategories);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetDisplayShowHomeEnabled(true);
            SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_action_arrow_back);

            _addButton        = FindViewById <FloatingActionButton>(Resource.Id.activityEditCategories_buttonAdd);
            _addButton.Click += OnAddClick;

            _connection = await Database.Connect(this);

            _categorySource               = new CategorySource(_connection);
            _categoryAdapter              = new CategoryAdapter(_categorySource);
            _categoryAdapter.RenameClick += OnRenameClick;
            _categoryAdapter.DeleteClick += OnDeleteClick;

            _categoryList = FindViewById <RecyclerView>(Resource.Id.activityEditCategories_list);
            _emptyState   = FindViewById <LinearLayout>(Resource.Id.activityEditCategories_emptyState);

            _categoryList.SetAdapter(_categoryAdapter);
            _categoryList.HasFixedSize = true;
            _categoryList.SetItemViewCacheSize(20);

            var callback    = new AuthListTouchHelperCallback(_categoryAdapter);
            var touchHelper = new ItemTouchHelper(callback);

            touchHelper.AttachToRecyclerView(_categoryList);

            var layout     = new LinearLayoutManager(this);
            var decoration = new DividerItemDecoration(this, layout.Orientation);

            _categoryList.AddItemDecoration(decoration);
            _categoryList.SetLayoutManager(layout);

            var layoutAnimation =
                AnimationUtils.LoadLayoutAnimation(this, Resource.Animation.layout_animation_fade_in);

            _categoryList.LayoutAnimation = layoutAnimation;

            await _categorySource.UpdateTask;

            CheckEmptyState();
            _categoryAdapter.NotifyDataSetChanged();
            _categoryList.ScheduleLayoutAnimation();

            var alphaAnimation = new AlphaAnimation(1.0f, 0.0f)
            {
                Duration = 200
            };

            alphaAnimation.AnimationEnd += (sender, e) => { progressBar.Visibility = ViewStates.Gone; };
            progressBar.StartAnimation(alphaAnimation);
        }