public void AddItem(AjusteItem item, bool addToGridAlone)
        {
            int rowIndex = m_currentRowIndex;

            if (!addToGridAlone)
            {
                m_items.Add(item);
            }

            if (!(InvoiceGrid.RowDefinitions.Count > m_currentRowIndex))
            {
                InvoiceGrid.RowDefinitions.Add(CreateRowDefinition(m_rowHeight));
            }
            DrawBorder(rowIndex);


            SetCell(rowIndex, 0, item.Codigo.ToString());
            SetCell(rowIndex, 1, item.Descripcion.ToString());
            SetCell(rowIndex, 2, item.Unidad.ToString());
            SetCell(rowIndex, 3, item.Cantidad.ToString());



            m_totalCant += Convert.ToDouble(item.Cantidad);

            m_currentRowIndex++;
            m_selectedIndex = m_items.Count;

            UpdateCantidad();
        }
        public AjusteDialog(AjusteItem newItem, string title)
        {
            InitializeComponent();


            dataGrid1.ShowGroupPanel = false;
            llenargrid();

            if (newItem == null)
            {
                rate.Value = 0.00;

                newItem = new AjusteItem();
            }

            item.Text = newItem.Codigo;

            item_Copy.Text = newItem.Descripcion;

            rate.Value     = 00.00;
            m_invoiceItem  = newItem;
            Cantidad.Value = newItem.Cantidad;



            if (newItem.Cantidad == 0)
            {
                newItem.Cantidad    = GetQuantityAsInt();
                this.Cantidad.Value = 1;
                CalculateTax();
            }

            this.DataContext = m_invoiceItem;
        }
        void myDialog_UpdateRequested(object sender, EventArgs e)
        {
            AjusteItem item = (e as FieldsUpdateEventArgs).UpdatedFields;

            AddItem(item, false);

            agreItem(item);
            m_fieldsPopup.Close();
        }
        private void agreItem(AjusteItem item)
        {
            //m_cliente = new Cliente();
            //item.Marca = m_cliente.Marci;

            //item.Numero_De_Documento = GlobalId.Identificador;
            item.Numero_De_Documento = osomaloso.ToString();
            item.Renglon             = estrella;

            // item.Renglon = tabla.Rows.Count;
            tabla.Rows.Add(item.Numero_De_Documento, item.Renglon, item.Codigo, item.Descripcion, item.Unidad, item.Cantidad);
            estrella = estrella + 1;
        }
        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);
            }
            AjusteItem invoiceItem = m_items[m_selectedIndex];

            //esta no estaba comentada int selectedProductIndex = m_productList.IndexOf(m_productList[invoiceItem.Descripcion]);
            m_fieldsPopup = new AjusteDialog(invoiceItem, "Edit the Fields");
            m_fieldsPopup.UpdateRequested += EditDialog_UpdateRequested;
            m_fieldsPopup.CloseRequested  += EditDialog_CloseRequested;
            m_fieldsPopup.lblTitle.Content = "Editar Articulos";
            RootGrid.Opacity      = 0.2;
            m_fieldsPopup.Opacity = 1;
            m_fieldsPopup.ShowDialog();
            RootGrid.Opacity = 1;
        }