/// <summary>
 /// grid CellValueChanged for do the basic calculation and unit selection
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dgvProductBOM_CellValueChanged(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         CheckInvalidEntries(e);
         ProductCreationBll BllProductCreation = new ProductCreationBll();
         TransactionsGeneralFillBll trstGnFill = new TransactionsGeneralFillBll();
         if (e.RowIndex > -1)
         {
             if (e.ColumnIndex == dgvProductBOM.Columns["dgvcmbRawMaterial"].Index)
             {
                 if (dgvProductBOM.Rows[e.RowIndex].Cells["dgvcmbRawMaterial"] != null)
                 {
                     dgvProductBOM.Rows[e.RowIndex].Cells["dgvtxtUnit"].Value = BllProductCreation.ProductUnit(Convert.ToDecimal(dgvProductBOM.Rows[e.RowIndex].Cells[1].Value));
                     List<DataTable> listObj = new List<DataTable>();
                     decimal decProductId = Convert.ToDecimal(dgvProductBOM.Rows[e.RowIndex].Cells["dgvcmbRawMaterial"].Value);
                     listObj = trstGnFill.UnitViewAllByProductId(dgvProductBOM, decProductId.ToString(), e.RowIndex);
                     DataRow drow = listObj[0].NewRow();
                     drow["unitName"] = string.Empty;
                     drow["unitId"] = 0;
                     listObj[0].Rows.InsertAt(drow, 0);
                     DataGridViewComboBoxCell cell = (DataGridViewComboBoxCell)(dgvProductBOM.Rows[e.RowIndex].Cells["dgvcmbUnit"]);
                     cell.DataSource = listObj[0];
                     cell.ValueMember = "unitId";
                     cell.DisplayMember = "unitName";
                     if (listObj[0].Rows[0][4] != null && listObj[0].Rows[0][4] != DBNull.Value)
                     {
                         dgvProductBOM.Rows[e.RowIndex].Cells["dgvcmbUnit"].Value = Convert.ToDecimal(listObj[0].Rows[0][4].ToString());
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PB:21" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }