Exemplo n.º 1
0
 public MainWindow()
 {
     InitializeComponent();
     MainView = new wndMain(viewNavigationController);
     viewNavigationController.CurrentViewChanged += ViewNavigationController_CurrentViewChanged;
     DataContext = this;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a new invoice and updates the invoice label to show TBD
        /// </summary>
        public static clsInvoice newInvoice(wndMain wndMain)
        {
            try
            {
                //Clear DataGrid & fields

                //Instantiate Invoice, set date and total to 0
                clsInvoice newInvoice = new clsInvoice();

                //Edit Invoice Mode Activated
                wndMain.editInvoiceMode = true;

                // Set Labels
                wndMain.invoiceLbl.Content              = "Invoice Number: TBD";
                wndMain.invoiceTotalLbl.Content         = "0";
                wndMain.invoiceItemDataGrid.ItemsSource = newInvoice.InvoiceItems;

                return(newInvoice);
            }
            catch (Exception ex)
            {
                throw new Exception(MethodInfo.GetCurrentMethod().DeclaringType.Name + "." +
                                    MethodInfo.GetCurrentMethod().Name + "->" + ex.Message);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Retrieve item list for combo box dropdown
        /// </summary>
        /// <param name="wndMain"></param>
        /// <returns></returns>
        public static BindingList <clsItem> GetItemsList(wndMain wndMain)
        {
            try
            {
                BindingList <clsItem> ItemList = new BindingList <clsItem>();

                //Make Connection
                clsSQL  dataAccess = new clsSQL();
                DataSet ds         = new DataSet();
                int     iRet       = 0;

                //store query result in data set
                ds = dataAccess.ExecuteSQLStatement(clsMainSQL.queryItems(), ref iRet);

                //Loop through items creating item object and add to a bound list
                for (int i = 0; i < iRet; i++)
                {
                    clsItem item = new clsItem();
                    item.ItemCode        = ds.Tables[0].Rows[i][0].ToString();
                    item.ItemDescription = ds.Tables[0].Rows[i][1].ToString();
                    item.ItemCost        = Convert.ToDecimal(ds.Tables[0].Rows[i][2].ToString());
                    ItemList.Add(item);
                }

                return(ItemList);
            }
            catch (Exception ex)
            {
                throw new Exception(MethodInfo.GetCurrentMethod().DeclaringType.Name + "." +
                                    MethodInfo.GetCurrentMethod().Name + "->" + ex.Message);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Deletes the current invoice from the database
        /// </summary>
        public static void deleteInvoice(int InvoiceNumber, wndMain wndMain)
        {
            try
            {
                clsSQL  dataAccess = new clsSQL();
                DataSet ds         = new DataSet();
                int     iRet       = 0;

                if (wndMain.currentInvoice != null)
                {
                    // Will delete current invoice
                    dataAccess.ExecuteNonQuery(clsMainSQL.deleteInvoiceLine(InvoiceNumber));

                    // Clear Screen & Refresh Screen
                    wndMain.invoiceItemDataGrid.ItemsSource = null;
                    wndMain.invoiceItemDataGrid.Items.Refresh();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(MethodInfo.GetCurrentMethod().DeclaringType.Name + "." +
                                    MethodInfo.GetCurrentMethod().Name + "->" + ex.Message);
            }
        }