Esempio n. 1
0
        private void OnButtonAddClick(object sender, EventArgs e)
        {
            var item   = new DeliveryItems();
            var dialog = new FormDeliveryItemDialog(item, _unitOfWork);

            DialogResult result = dialog.ShowDialog();

            if (result != DialogResult.OK)
            {
                return;
            }

            _delivery.DeliveryItems.Add(item);

            UpdateListView(item, ListViewAction.Add, Constant.IndexNone);

            //item.Products.DeliveryPrice = ((item.Products.DeliveryPrice * item.Products.Amount) + (item.DeliveryPrice * item.Amount))
            //                             / (item.Products.Amount + item.Amount);

            //item.Products.Amount = item.Amount + item.Products.Amount;
        }
Esempio n. 2
0
        private void OnButtonEditClick(object sender, EventArgs e)
        {
            if (lvDeliveryItems.SelectedItems.Count != 1)
            {
                MessageBox.Show("Please select one delivery item.", Constant.StoreAppName);
                return;
            }

            DeliveryItems item = (DeliveryItems)lvDeliveryItems.SelectedItems[0].Tag;

            var dialog = new FormDeliveryItemDialog(item, _unitOfWork);

            DialogResult result = dialog.ShowDialog();

            if (result != DialogResult.OK)
            {
                return;
            }

            UpdateListView(item, ListViewAction.Update, lvDeliveryItems.SelectedItems[0].Index);
        }