Пример #1
0
        /* Context menu override */
        protected override void OnEditClick(object sender, RoutedEventArgs e)
        {
            if (SelectedItems.Count != 1)
            {
                return;
            }

            PharmacyOrders pharmacyOrders = (PharmacyOrders)SelectedItem;

            if (!pharmacyOrdersData.SelectWhereID(pharmacyOrders.ID, out pharmacyOrders))
            {
                MessageBoxes.ShowError(MessageBoxes.EditErrorMessage);
                return;
            }

            PharmacyOrdersDialog phramacyDialog = new PharmacyOrdersDialog(pharmacyOrders, pharmacy, DialogModes.Edit, this);
            bool?dialogResult = phramacyDialog.ShowDialog();

            if (dialogResult == false)
            {
                return;
            }

            pharmacyOrders = phramacyDialog.pharmacyOrders;
            if (!pharmacyOrdersData.UpdateWhereID(pharmacyOrders.ID, pharmacyOrders))
            {
                MessageBoxes.ShowError(MessageBoxes.EditErrorMessage);
                return;
            }

            itemsSource[SelectedIndex] = pharmacyOrders;
        }
Пример #2
0
        /* Context menu override */
        protected override void OnPreviewClick(object sender, RoutedEventArgs e)
        {
            if (SelectedItems.Count != 1)
            {
                return;
            }

            PharmacyOrders pharmacyOrder = ((PharmacyOrders)SelectedItem);

            if (!pharmacyOrdersData.SelectWhereID(pharmacyOrder.ID, out pharmacyOrder))
            {
                MessageBoxes.ShowError(MessageBoxes.PreviewErrorMessage);
                return;
            }

            PharmacyOrdersDialog pharmacyOrderDialog = new PharmacyOrdersDialog(pharmacyOrder, pharmacy, DialogModes.Preview, this);

            pharmacyOrderDialog.ShowDialog();
        }
Пример #3
0
        /* Context menu override */
        protected override void OnAddClick(object sender, RoutedEventArgs e)
        {
            PharmacyOrdersDialog pharmacyOrderDialog = new PharmacyOrdersDialog(new PharmacyOrders(), pharmacy, DialogModes.Add, this);
            bool?dialogResult = pharmacyOrderDialog.ShowDialog();

            if (dialogResult == false)
            {
                return;
            }

            PharmacyOrders pharmacyOrders = pharmacyOrderDialog.pharmacyOrders;

            if (!pharmacyOrdersData.Insert(pharmacyOrders))
            {
                MessageBoxes.ShowError(MessageBoxes.AddErrorMessage);
                return;
            }

            itemsSource.Add(pharmacyOrders);
        }