Esempio n. 1
0
        public void addNewRowFromBarcode(string productID, string productName, int rowIndex = -1)
        {
            int  i                = 0;
            bool found            = false;
            bool foundEmptyRow    = false;
            int  emptyRowIndex    = 0;
            int  rowSelectedIndex = 0;

            ProductBCGridView.AllowUserToAddRows = false;
            ProductBCGridView.Focus();

            //if (rowIndex >= 0)
            //{
            //    rowSelectedIndex = rowIndex;
            //}
            //else
            //{
            //    // CHECK FOR EXISTING SELECTED ITEM
            //    for (i = 0; i < ProductBCGridView.Rows.Count && !found && !foundEmptyRow; i++)
            //    {
            //        if (null != ProductBCGridView.Rows[i].Cells["productName"].Value && null != ProductBCGridView.Rows[i].Cells["productID"].Value && productIDValid(ProductBCGridView.Rows[i].Cells["productID"].Value.ToString()))
            //        {
            //            if (ProductBCGridView.Rows[i].Cells["productName"].Value.ToString() == productName)
            //            {
            //                found = true;
            //                rowSelectedIndex = i;
            //            }
            //        }
            //        else
            //        {
            //            foundEmptyRow = true;
            //            emptyRowIndex = i;
            //        }
            //    }
            //    if (!found)
            //    {
            //        if (!foundEmptyRow)
            //        {
            //            //addNewRow(false);
            //            rowSelectedIndex = rowIndex + 1;
            //        }
            //        else
            //        {
            //            rowSelectedIndex = emptyRowIndex;
            //        }
            //    }
            //}
            if (rowIndex >= 0)
            {
                rowSelectedIndex = rowIndex;
            }
            else
            {
                rowSelectedIndex = ProductBCGridView.SelectedCells[0].RowIndex;
            }

            DataGridViewRow selectedRow = ProductBCGridView.Rows[rowSelectedIndex];

            updateSomeRowContents(selectedRow, rowSelectedIndex, productID);
        }
Esempio n. 2
0
 private void ProductBCGridView_CurrentCellDirtyStateChanged(object sender, EventArgs e)
 {
     if (ProductBCGridView.IsCurrentCellDirty)
     {
         ProductBCGridView.CommitEdit(DataGridViewDataErrorContexts.Commit);
     }
 }
Esempio n. 3
0
        private void addFixRow()
        {
            int newRowIndex = 0;

            for (int a = 0; a < numberProduct; a = a + 1)
            {
                ProductBCGridView.Rows.Add();
            }

            //newRowIndex = ProductBCGridView.Rows.Count - 1;
            ProductBCGridView.Focus();
            ProductBCGridView.CurrentCell = ProductBCGridView.Rows[newRowIndex].Cells["productID"];
        }