コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void InvoiceGrid_DoubleTapped(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            FrameworkElement element = null;

            if ((element = e.OriginalSource as FrameworkElement) != null)
            {
                m_selectedIndex = Grid.GetRow(element);
            }
            InvoiceItem invoiceItem          = m_items[m_selectedIndex];
            int         selectedProductIndex = m_productList.IndexOf(m_productList[invoiceItem.ItemName]);

            m_fieldsPopup = new Dialog(invoiceItem, "Edit the Fields", m_productList, selectedProductIndex);
            m_fieldsPopup.UpdateRequested += EditDialog_UpdateRequested;
            m_fieldsPopup.CloseRequested  += EditDialog_CloseRequested;
            m_fieldsPopup.lblTitle.Content = "Edit the Fields";
            RootGrid.Opacity      = 0.2;
            m_fieldsPopup.Opacity = 1;
            m_fieldsPopup.ShowDialog();
            RootGrid.Opacity = 1;
        }
コード例 #2
0
ファイル: MainPage.xaml.cs プロジェクト: WangHengXu/uwp-demos
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void InvoiceGrid_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
        {
            FrameworkElement element = null;

            if ((element = e.OriginalSource as FrameworkElement) != null)
            {
                m_selectedIndex = Grid.GetRow(element);
            }
            InvoiceItem invoiceItem          = m_items[m_selectedIndex];
            int         selectedProductIndex = m_productList.IndexOf(m_productList[invoiceItem.ItemName]);
            Dialog      EditDialog           = new Dialog(invoiceItem, "Edit the Fields", m_productList, selectedProductIndex);

            EditDialog.UpdateRequested += EditDialog_UpdateRequested;
            EditDialog.CloseRequested  += EditDialog_CloseRequested;
            EditDialog.Width            = this.ActualWidth;
            double verticalOff = this.ActualHeight - EditDialog.Height;

            m_fieldsPopup.VerticalOffset = verticalOff / 2;
            m_fieldsPopup.Child          = EditDialog;
            m_fieldsPopup.IsOpen         = true;
        }
コード例 #3
0
        /// <summary>
        /// Updates InvoiceItems collection
        /// </summary>
        /// <param name="item"></param>
        /// <param name="addToGridAlone"></param>
        public void UpdateInvoiceItems(InvoiceItem invoiceItem, bool IsAddNew)
        {
            m_totalDue = 0;
            InvoiceItem defaultItem;

            if (invoiceItem == null)
            {
                defaultItem = new InvoiceItem()
                {
                    ItemName = m_productList[0].Name,
                    Quantity = 1,
                    Rate     = m_productList[0].Rate
                };
                defaultItem.Taxes = m_productList[0].Rate * 0.07;
            }
            else
            {
                defaultItem = new InvoiceItem()
                {
                    ItemName    = invoiceItem.ItemName,
                    Quantity    = invoiceItem.Quantity,
                    Rate        = invoiceItem.Rate,
                    Taxes       = invoiceItem.Taxes,
                    TotalAmount = invoiceItem.TotalAmount
                };
            }

            if (IsAddNew)
            {
                m_items.Add(defaultItem);
            }
            foreach (InvoiceItem item in m_items)
            {
                m_totalDue += Convert.ToDouble(item.TotalAmount);
            }
            m_currentRowIndex++;
            m_selectedIndex = m_items.Count;
            UpdateGrid();
        }
コード例 #4
0
        /// <summary>
        /// Updates the invoice grid
        /// </summary>
        private void UpdateGrid()
        {
            //dgvItems.Rows.Clear();



            for (int index = dgvItems.Rows.Count; index < m_items.Count; index++)
            {
                InvoiceItem item = m_items[index];

                int row = this.dgvItems.Rows.Add();

                this.dgvItems.Rows[row].Cells[0].Value = item.ItemName;
                this.dgvItems.Rows[row].Cells[1].Value = item.Quantity.ToString();
                this.dgvItems.Rows[row].Cells[2].Value = "$" + item.Rate.ToString("#,###.00", CultureInfo.InvariantCulture);
                this.dgvItems.Rows[row].Cells[3].Value = "$" + item.Taxes.ToString("#,###.00", CultureInfo.InvariantCulture);
                this.dgvItems.Rows[row].Cells[4].Value = "$" + item.TotalAmount.ToString("#,###.00", CultureInfo.InvariantCulture);
            }

            dgvItems.Refresh();

            UpdateTotal();
        }
コード例 #5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="newItem"></param>
 /// <param name="title"></param>
 /// <param name="productList"></param>
 public Dialog(InvoiceItem newItem, string title, ProductList productList)
     : this(newItem, title, productList, 0)
 {
 }
コード例 #6
0
 public FrmEdit(InvoiceItem newItem, string title, ProductList productList)
     : this(newItem, title, productList, 0)
 {
 }
コード例 #7
0
 public void Dispose()
 {
     m_invoiceItem = null;
 }