//private BaseRecordObservableCollection itemsSource;

        public PharmacyOrdersDialog(PharmacyOrders _pharmacyOrders, Pharmacies.Pharmacies _pharmacy, DialogModes _dialogMode, DependencyObject parent = null) : base(_dialogMode, parent)
        {
            pharmacyOrders = _pharmacyOrders;
            pharmacy       = _pharmacy;

            InitializeComponent();
        }
Ejemplo n.º 2
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;
        }
Ejemplo n.º 3
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();
        }
Ejemplo n.º 4
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);
        }
Ejemplo n.º 5
0
        /* Context menu override */
        protected override void OnDeleteClick(object sender, RoutedEventArgs e)
        {
            if (SelectedItems.Count != 1)
            {
                return;
            }

            MessageBoxResult result = MessageBoxes.MessageBoxShowDeleteMessage();

            if (result == MessageBoxResult.No)
            {
                return;
            }

            PharmacyOrders phramacy = (PharmacyOrders)SelectedItem;

            if (!pharmacyOrdersData.DeleteWhereID(phramacy.ID))
            {
                MessageBoxes.ShowError(MessageBoxes.DeleteErrorMessage);
                return;
            }

            itemsSource.RemoveAt(SelectedIndex);
        }
Ejemplo n.º 6
0
 public bool Insert(PharmacyOrders pharmacyOrder)
 {
     return(pharmacyOrdersTable.InsertRecord(pharmacyOrder));
 }
Ejemplo n.º 7
0
 public bool UpdateWhereID(int ID, PharmacyOrders pharmacyOrders)
 {
     return(pharmacyOrdersTable.EditRecord(ID, pharmacyOrders));
 }
Ejemplo n.º 8
0
 public bool SelectWhereID(int ID, out PharmacyOrders pharmacyOrders)
 {
     return(pharmacyOrdersTable.SelectRecord(ID, out pharmacyOrders));
 }