コード例 #1
0
        /// <summary>
        /// Function to fill the DtaGridview With Batch While Updating
        /// </summary>
        public void OpeningStockGridWithBathFill()
        {

            try
            {
                DataTable dtbl = new DataTable();
                ProductSP spProduct = new ProductSP();
                BatchSP spBatch = new BatchSP();
                cmbAllowBatch.SelectedIndex = 1;
                isBatchForUpdate = true;

                dtbl = spProduct.ProductViewGridFillFromBatch(decProductIdForEdit);

                for (int i = 0; i < dtbl.Rows.Count; i++)
                {
                    dgvProductCreation.Rows[i].Cells["dgvtxtbatchId"].Value = Convert.ToDecimal(dtbl.Rows[i]["batchId"]);
                    dgvProductCreation.Rows[i].Cells["dgvtxtExpDate"].Value = dtbl.Rows[i]["expiryDate"];
                    dgvProductCreation.Rows[i].Cells["dgvtxManfDate"].Value = dtbl.Rows[i]["manufacturingDate"];
                    dgvProductCreation.Rows[i].Cells["dgvtxtbatch"].Value = dtbl.Rows[i]["batchNo"];
                }

                foreach (DataGridViewRow dgvRowObj in dgvProductCreation.Rows)
                {
                    if (!dgvRowObj.IsNewRow)
                    {

                        DataGridViewCellEventArgs dgvArg = new DataGridViewCellEventArgs(0, dgvRowObj.Index);
                        CheckingForIncompleteRowInGrid(dgvArg);
                    }
                }
                dgvProductCreation.Focus();
                dgvProductCreation.CurrentCell = dgvProductCreation.Rows[0].Cells[1];
            }
            catch (Exception ex)
            {
                MessageBox.Show("PC:4" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }