/// <summary> /// Work on dgvProductCreation CellEndEdit event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgvProductCreation_CellEndEdit(object sender, DataGridViewCellEventArgs e) { try { if (dgvProductCreation.Columns[e.ColumnIndex].Name == "dgvtxtbatch") { string strBatch = dgvProductCreation.Rows[e.RowIndex].Cells[e.ColumnIndex].Value == null ? "" : dgvProductCreation.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(); if (strBatch != "") { BatchBll BllBatch = new BatchBll(); List<DataTable> listBatch = new List<DataTable>(); listBatch = BllBatch.BatchViewByName(strBatch, decId); if (listBatch[0].Rows.Count != 0) { dgvProductCreation.Rows[e.RowIndex].Cells["dgvtxtExpDate"].Value = listBatch[0].Rows[0]["expiryDate"]; dgvProductCreation.Rows[e.RowIndex].Cells["dgvtxManfDate"].Value = listBatch[0].Rows[0]["manufacturingDate"]; } } else { dgvProductCreation.Rows[e.RowIndex].Cells["dgvtxtExpDate"].Value = string.Empty; dgvProductCreation.Rows[e.RowIndex].Cells["dgvtxManfDate"].Value = string.Empty; } } if (dgvProductCreation.Columns[e.ColumnIndex].Name == "dgvcmbtgodown") { RackBll BllRack = new RackBll(); RackInfo infoRack = new RackInfo(); List<DataTable> listObjRack = new List<DataTable>(); decimal decGodownId = Convert.ToDecimal(dgvProductCreation.Rows[e.RowIndex].Cells["dgvcmbtgodown"].Value); listObjRack = BllRack.RackNamesCorrespondingToGodownId(decGodownId); DataRow drow = listObjRack[0].NewRow(); drow["rackName"] = string.Empty; drow["rackId"] = 0; listObjRack[0].Rows.InsertAt(drow, 0); DataGridViewComboBoxCell cell = (DataGridViewComboBoxCell)(dgvProductCreation.Rows[e.RowIndex].Cells["dgvcmbrack"]); cell.DataSource = listObjRack[0]; cell.ValueMember = "rackId"; cell.DisplayMember = "rackName"; } } catch (Exception ex) { MessageBox.Show("PC:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }