示例#1
0
        private void AddArticleWithQuantity()
        {
            var storageName = FindViewById <EditText>(Resource.Id.StorageItemQuantity_StorageText).Text;

            StorageItemQuantityResult storageItemQuantity = new StorageItemQuantityResult();

            storageItemQuantity.ArticleId   = this.articleId;
            storageItemQuantity.Quantity    = (decimal)this.quantity;
            storageItemQuantity.BestBefore  = DateTime.Today;
            storageItemQuantity.StorageName = storageName;
            storageItemQuantity.IsChanged   = true;

            StorageItemQuantityListView itemView = new StorageItemQuantityListView(storageItemQuantity);

            ListView listView = FindViewById <ListView>(Resource.Id.ArticleList);
            var      adapter  = (StorageItemQuantityListViewAdapter)listView.Adapter;

            adapter.Add(itemView);
            listView.InvalidateViews();

            if (this.durableInfinity)
            {
                storageItemQuantity.BestBefore = null;

                if (this.quantity > 0)
                {
                    this.ChangeQuantity(storageItemQuantity, adapter);
                }
                return;
            }

            this.ChangeBestBeforeDate(storageItemQuantity, adapter);
        }
示例#2
0
        private void ShowStorageListForArticle(int articleId)
        {
            StorageItemQuantityActivity.liste = new List <StorageItemQuantityListView>();

            var storageItemQuantityList = Database.GetStorageItemQuantityList(articleId);

            foreach (StorageItemQuantityResult storegeItem in storageItemQuantityList)
            {
                StorageItemQuantityListView item = new StorageItemQuantityListView(storegeItem);

                StorageItemQuantityActivity.liste.Add(item);
            }

            StorageItemQuantityListViewAdapter listAdapter = new StorageItemQuantityListViewAdapter(this, StorageItemQuantityActivity.liste);
            ListView listView = FindViewById <ListView>(Resource.Id.ArticleList);

            listView.Adapter = listAdapter;

            listAdapter.ItemClicked += ListAdapter_ItemClicked;
        }
示例#3
0
        private void AddArticle_Click(object sender, EventArgs e)
        {
            var storageName = FindViewById <EditText>(Resource.Id.StorageItemQuantity_StorageText).Text;

            StorageItemQuantityResult storageItemQuantity = new StorageItemQuantityResult();

            storageItemQuantity.ArticleId   = this.articleId;
            storageItemQuantity.Quantity    = 1;
            storageItemQuantity.BestBefore  = DateTime.Today;
            storageItemQuantity.StorageName = storageName;
            storageItemQuantity.IsChanged   = true;

            if (this.quantity > 1)
            {
                storageItemQuantity.Quantity = (decimal)this.quantity;
            }

            StorageItemQuantityListView itemView = new StorageItemQuantityListView(storageItemQuantity);

            ListView listView = FindViewById <ListView>(Resource.Id.ArticleList);
            var      adapter  = (StorageItemQuantityListViewAdapter)listView.Adapter;

            adapter.Add(itemView);
            listView.InvalidateViews();

            if (!this.durableInfinity)
            {
                // Haltbarkeitsdatum erfassen (kann aber auch weggelassen werden)
                listView.InvalidateViews();
                if (!UseAltDatePicker)
                {
                    DatePickerFragment frag = DatePickerFragment.NewInstance(delegate(DateTime? time)
                    {
                        if (time.HasValue)
                        {
                            storageItemQuantity.BestBefore = time.Value;
                        }
                        else
                        {
                            storageItemQuantity.BestBefore = null;
                        }

                        listView.InvalidateViews();

                        if (this.quantity > 0)
                        {
                            this.ChangeQuantity(storageItemQuantity, adapter);
                        }
                    }, DateTime.Today);
                    frag.ShowsDialog = true;
                    frag.Show(FragmentManager, DatePickerFragment.TAG);
                }
                else
                {
                    AltDatePickerFragment frag = AltDatePickerFragment.NewInstance(delegate(DateTime? time)
                    {
                        if (time.HasValue)
                        {
                            storageItemQuantity.BestBefore = time.Value;
                        }
                        else
                        {
                            storageItemQuantity.BestBefore = null;
                        }

                        listView.InvalidateViews();

                        if (this.quantity > 0)
                        {
                            this.ChangeQuantity(storageItemQuantity, adapter);
                        }
                    }, DateTime.Today);
                    frag.ShowsDialog = true;
                    frag.Show(FragmentManager, AltDatePickerFragment.TAG);
                }
            }
            else
            {
                // Ist ohne Haltbarkeitsdatum (unendlich haltbar)
                // Datum muss nicht erfasst werden.
                storageItemQuantity.BestBefore = null;
                listView.InvalidateViews();
            }
        }