Exemple #1
0
        private void execute <Object>(Object obj)
        {
            string st = obj as string;

            switch (st)
            {
            case "PageBefore":
            {
                PageThis--;
                Search();
            }
            break;

            case "PageNext":
            {
                PageThis++;
                Search();
            }
            break;

            case "Add":
            {
                Search();
            }
            break;

            case "Edit":
            {
                Search();
            }
            break;

            case "Delete":
            {
                Search();
            }
            break;

            case "MouseDoubleClick":
            {
                if (DataGridSelectedItem != null)
                {
                    int invoice_id = F_File.GetPropertyInt(DataGridSelectedItem, "ID");
                    if (ReceiverFrom == KeyStatic.class_.InvoiceSellViewModel)
                    {
                        InvoiceSellViewModel.Send(new KeyValuePair <string, int>(KeyStatic.view_.invoice_id, invoice_id));
                        ReceiverFrom = "";
                    }
                    else
                    {
                        //MessageBox.Show("ReceiverFrom: error: "+ ReceiverFrom);
                    }
                }
            }
            break;

            default: break;
            }
        }
Exemple #2
0
        private void execute <Object>(Object obj)
        {
            string st = obj as string;

            switch (st)
            {
            case "PageBefore":
            {
                PageThis--;
                Search();
            }
            break;

            case "PageNext":
            {
                PageThis++;
                Search();
            }
            break;

            case "Add":
            {
                VisibilityTableEdit_Visible();
                TableProductsEditViewModel.Send(null);
            }
            break;

            case "Edit":
            {
                VisibilityTableEdit_Visible();
                if (DataGridSelectedItem != null)
                {
                    TableProductsEditViewModel.Send(DataGridSelectedItem);
                }
            }
            break;

            case "Delete":
            {
                try
                {
                    var delete = DialogAlert.Delete();
                    if (delete == MessageBoxResult.OK)
                    {
                        if (DataGridSelectedItem != null)
                        {
                            T_Helper.product.Delete(F_File.GetPropertyInt(DataGridSelectedItem, "ID"));
                        }
                    }
                }
                catch (Exception e)
                {
                    F_File.LogError(e);
                    DialogError.Error();
                }
                Search();
            }
            break;

            case "MouseDoubleClick":
            {
                if (_DataGridSelectedItem != null)
                {
                    int product_id = F_File.GetPropertyInt(_DataGridSelectedItem, "ID");
                    if (ReceiverFrom == KeyStatic.class_.InvoiceSellViewModel)
                    {
                        InvoiceSellViewModel.Send(new KeyValuePair <string, int>(KeyStatic.view_.product_id, product_id));
                        ReceiverFrom = "";
                    }
                    else if (ReceiverFrom == KeyStatic.class_.InvoicePurchaseViewModel)
                    {
                        InvoicePurchaseViewModel.Send(new KeyValuePair <string, int>(KeyStatic.view_.product_id, product_id));
                        ReceiverFrom = "";
                    }
                    else
                    {
                        //MessageBox.Show("canot return value");
                    }
                }
            }
            break;

            //********************************************************************
            case "OverlayGridCancel":
            {
                Visibility_Collapsed();
            }
            break;

            default: break;
            }
        }