Exemplo n.º 1
0
        private void Save_Click(object sender, RoutedEventArgs e)
        {
            MainWindow wnd = Application.Current.MainWindow as MainWindow;

            if (basePage != null)
            {
                WorkOrderMessage msg = new WorkOrderMessage();
                msg.CustomerContainer = CustomerContainer;
                basePage.LoadWorkOrderData(msg);
                wnd.OnBackClick(this);
            }
        }
Exemplo n.º 2
0
        private void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            MainWindow wnd = Application.Current.MainWindow as MainWindow;

            if (wnd.PageIsOnStack(typeof(CustomerPage)))
            {
                if (basePage != null)
                {
                    basePage.LoadWorkOrderData(new WorkOrderMessage());
                }

                wnd.OnBackClick(this);
            }
        }
        private void ArrangementInventoryList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ArrangementInventoryFilteredItem item = (sender as ListView).SelectedValue as ArrangementInventoryFilteredItem;

            if (item != null)
            {
                if (basePage != null)
                {
                    WorkOrderMessage msg = new WorkOrderMessage();

                    msg.Inventory = new WorkOrderInventoryMapDTO()
                    {
                        InventoryId   = item.Id,
                        InventoryName = item.Name,
                        Quantity      = 1,
                        Size          = item.Size
                    };

                    basePage.LoadWorkOrderData(msg);
                }
            }
            this.Close();
        }
Exemplo n.º 4
0
        private void ListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            //they selected a person - close the dialog and populate the edit fields on the parent form

            PersonDTO item = (sender as ListView).SelectedValue as PersonDTO;

            if (basePage != null)
            {
                WorkOrderMessage msg = new WorkOrderMessage();
                msg.Person = item;

                basePage.LoadWorkOrderData(msg);
            }

            this.Close();
        }
Exemplo n.º 5
0
        //load the other combos as their "bosses" are loaded

        private void InventorySelected_Click(object sender, RoutedEventArgs e)
        {
            //send selection back to caller - this filter is used when creating a work order or an arrangement
            //either way, in either of these two modes, use the Navigation Stack

            WorkOrderMessage msg = new WorkOrderMessage();

            msg.Inventory = (WorkOrderInventoryMapDTO)((ListView)sender).SelectedItem;

            if (page != null)
            {
                page.LoadWorkOrderData(msg);
            }

            MainWindow wnd = Application.Current.MainWindow as MainWindow;

            wnd.OnBackClick(this);
        }
Exemplo n.º 6
0
        private async void Pay_Click(object sender, RoutedEventArgs e)
        {
            //send record for payment

            //success? show message - go back to Work Order page

            //failure? show message stay on this page

            Pay.IsEnabled = false;

            bool proceedWithSave = true;

            string ccConfirm = String.Empty;

            if (PaymentTypeComboBox.SelectedIndex == 2)
            {
                CreditCard cc = new CreditCard()
                {
                    Cvc        = CVVTextBox.Text,
                    HolderName = NameOnCardTextBox.Text,
                    Numbers    = CardNumberTextBox.Text,
                    Month      = ExpMonthTextBox.Text,
                    Year       = ExpYearTextBox.Text
                };

                List <string> msgs = cc.VerifyCreditCardInfo();

                if (msgs.Count == 0)
                {
                    PaymentResponse paymentResponse = await PayWithCC(cc);

                    ccConfirm = paymentResponse.ccConfirm;

                    proceedWithSave = paymentResponse.success;

                    if (paymentResponse.Messages.Count > 0)
                    {
                        MessageBox.Show(Application.Current.MainWindow, MessageFormatter(paymentResponse.Messages["Stripe"]), "Error", MessageBoxButton.OK);
                    }
                }
                else
                {
                    proceedWithSave = false;
                    MessageBox.Show("Error", MessageFormatter(msgs), MessageBoxButton.OK);
                }
            }

            if (proceedWithSave)
            {
                bool paymentSaved = await SavePaymentRecord(ccConfirm);

                if (paymentSaved)
                {
                    MessageBox.Show(Application.Current.MainWindow, "Payment Successful", "Success", MessageBoxButton.OK);
                    MainWindow wnd = Application.Current.MainWindow as MainWindow;
                    if (wnd.PageIsOnStack(typeof(WorkOrderPage)))
                    {
                        EOStackPage parentPage = wnd.GetEOStackPage(typeof(WorkOrderPage));

                        if (parentPage != null)
                        {
                            WorkOrderMessage msg = new WorkOrderMessage();
                            msg.WorkOrderPaid = true;
                            parentPage.LoadWorkOrderData(msg);
                        }
                    }

                    wnd.OnBackClick(this);
                }
                else
                {
                    MessageBox.Show(Application.Current.MainWindow, "There was a problem saving the payment record", "Error", MessageBoxButton.OK);
                }
            }

            Pay.IsEnabled = true;
        }