private void DrugNamePressEnter() { if (_drugDict.IsNullOrEmpty()) { return; } ListViewItem firstSel = ddlDrugName.GetFirstSelListItem(); if (firstSel == null) { return; } DataRow[] selRows = _drugDict.Select(String.Format("{0}='{1}'", DBConstDef.DRUG_CODE, firstSel.Text)); if (selRows.IsNullOrEmpty()) { return; } tbDrugCode.Text = Judgement.JudgeDBNullValue(selRows[0][DBConstDef.DRUG_CODE], EnumDef.ENUM_DATA_TYPE.DATA_TYPE_STRING).ToString(); ddlDrugName.Text = Judgement.JudgeDBNullValue(selRows[0][DBConstDef.DRUG_COMMON_NAME], EnumDef.ENUM_DATA_TYPE.DATA_TYPE_STRING).ToString(); tbDrugProductName.Text = Judgement.JudgeDBNullValue(selRows[0][DBConstDef.DRUG_PRODUCT_NAME], EnumDef.ENUM_DATA_TYPE.DATA_TYPE_STRING).ToString(); tbDrugSpec.Text = Judgement.JudgeDBNullValue(selRows[0][DBConstDef.DRUG_SPECIFICATION], EnumDef.ENUM_DATA_TYPE.DATA_TYPE_STRING).ToString(); tbDrugManufacture.Text = Judgement.JudgeDBNullValue(selRows[0][DBConstDef.DRUG_MANUFACTURERS], EnumDef.ENUM_DATA_TYPE.DATA_TYPE_STRING).ToString(); tbDrugUnit.Text = Judgement.JudgeDBNullValue(selRows[0][DBConstDef.DRUG_MEASUER_UNITS], EnumDef.ENUM_DATA_TYPE.DATA_TYPE_STRING).ToString(); tbDrugQuantity.Text = String.Empty; }
private void UpdateSterileAreaInfo() { int id = Convert.ToInt32(Judgement.JudgeDBNullValue(dgv.SelectedRows[0].Cells[DBConstDef.SI_ID].Value, EnumDef.ENUM_DATA_TYPE.DATA_TYPE_INTEGER)); if (id <= 0) { return; } //apply to datagridview, its datasource and db dgv.SelectedRows[0].Cells[ConstDef.TEXT_STERILE_AREA_TYPE].Value = cmbType.Text; dgv.SelectedRows[0].Cells[ConstDef.TEXT_STERILE_AREA_NAME].Value = tbName.Text; dgv.SelectedRows[0].Cells[ConstDef.TEXT_DEPT_NAME].Value = cmbDept.Text; dgv.SelectedRows[0].Cells[ConstDef.TEXT_ROOM_NAME].Value = cmbRoom.Text; int type = (int)(EnumDef.STERILE_ROOM_TYPE)(cmbType.SelectedItem.GetType().GetProperty("Key").GetValue(cmbType.SelectedItem, null)); int dept = (int)(cmbDept.SelectedItem.GetType().GetProperty("Key").GetValue(cmbDept.SelectedItem, null)); int room = -1; if (null != cmbRoom.SelectedItem) { room = (int)(cmbRoom.SelectedItem.GetType().GetProperty("Key").GetValue(cmbRoom.SelectedItem, null)); } ((DataTable)dgv.DataSource).AcceptChanges(); DbMaintainment operDb = new DbMaintainment(); operDb.UpdateSterileAreaInfo(id, tbName.Text, type, dept, cmbDept.Text, room, cmbRoom.Text); }
private void InitialControls() { //initial type cmbType.Items.Add(new { Key = EnumDef.STERILE_ROOM_TYPE.CSSD, Value = ConstDef.TEXT_CSSD_STERILEROOM }); cmbType.Items.Add(new { Key = EnumDef.STERILE_ROOM_TYPE.OP, Value = ConstDef.TEXT_OP_STERILEROOM }); cmbType.Items.Add(new { Key = EnumDef.STERILE_ROOM_TYPE.FACILITY, Value = ConstDef.TEXT_FACILITY_STERILEROOM }); cmbType.ValueMember = "Key"; cmbType.DisplayMember = "Value"; //initial dept DbMaintainment operDb = new DbMaintainment(); DataTable queryTable = new DataTable(); if (operDb.QueryDeptInfo(ref queryTable) == EnumDef.DBMEDITS_RESULT.SUCCESS) { foreach (DataRow row in queryTable.Rows) { int id = Convert.ToInt32(Judgement.JudgeDBNullValue(row[DBConstDef.DEPT_ID], EnumDef.ENUM_DATA_TYPE.DATA_TYPE_INTEGER)); string name = Judgement.JudgeDBNullValue(row[ConstDef.TEXT_DEPT_SIMPLE_NAME], EnumDef.ENUM_DATA_TYPE.DATA_TYPE_STRING).ToString(); cmbDept.Items.Add(new { Key = id, Value = name }); } cmbDept.ValueMember = "Key"; cmbDept.DisplayMember = "Value"; } }
private void btnDrugAdd_Click(object sender, EventArgs e) { string errMsg = string.Empty; if (!CheckDrugInfoValid(ref errMsg, true)) { BaseMessageBox.ShowCustomerMessage(MessageBoxIcon.Error, "", errMsg); } else { //insert a new row, db and datatable DbMaintainment operDb = new DbMaintainment(); int id = 0; string operId = Judgement.JudgeDBNullValue(dgvOperList.SelectedRows[0].Cells[DBConstDef.OPERATION_CODE].Value, EnumDef.ENUM_DATA_TYPE.DATA_TYPE_STRING).ToString(); int drugCount = 0; if (!string.IsNullOrEmpty(tbDrugQuantity.Text)) { drugCount = Convert.ToInt32(tbDrugQuantity.Text); } operDb.InsertAutoPackageDrugInfo(ref id, operId, tbDrugCode.Text, ddlDrugName.Text, tbDrugProductName.Text, tbDrugSpec.Text, tbDrugManufacture.Text, tbDrugUnit.Text, drugCount); DataRow newRow = ((DataTable)dgvDrug.DataSource).NewRow(); newRow[DBConstDef.OPDD_ID] = id; newRow[DBConstDef.TEXT_DRUG_COMMON_NAME] = ddlDrugName.Text; newRow[DBConstDef.TEXT_DRUG_PRODUCT_NAME] = tbDrugProductName.Text; newRow[DBConstDef.TEXT_DRUG_SPECIFICATION] = tbDrugSpec.Text; newRow[DBConstDef.TEXT_DRUG_FACTORY] = tbDrugManufacture.Text; newRow[DBConstDef.TEXT_DRUG_UNIT] = tbDrugUnit.Text; newRow[DBConstDef.TEXT_DRUG_AMOUNT] = tbDrugQuantity.Text; newRow[DBConstDef.TEXT_DRUG_ID] = tbDrugCode.Text; ((DataTable)dgvDrug.DataSource).Rows.Add(newRow); } }
private void BingOperTable() { string filter = tbOperFilter.Text; if (!string.IsNullOrEmpty(filter)) { filter = string.Format("{0} like '%{1}%'", ConstDef.TEXT_OPERATION_NAME, filter); } DataRow[] selectRows = _operDict.Select(filter); DataTable filterTable = new DataTable(); filterTable.Columns.Add(DBConstDef.OPERATION_CODE, typeof(string)); filterTable.Columns.Add(ConstDef.TEXT_OPERATION_NAME, typeof(string)); foreach (DataRow selrow in selectRows) { DataRow newRow = filterTable.NewRow(); newRow[DBConstDef.OPERATION_CODE] = Judgement.JudgeDBNullValue(selrow[DBConstDef.OPERATION_CODE], EnumDef.ENUM_DATA_TYPE.DATA_TYPE_STRING); newRow[ConstDef.TEXT_OPERATION_NAME] = Judgement.JudgeDBNullValue(selrow[ConstDef.TEXT_OPERATION_NAME], EnumDef.ENUM_DATA_TYPE.DATA_TYPE_STRING); filterTable.Rows.Add(newRow); } dgvOperList.DataSource = filterTable; if (null != dgvOperList.Columns[DBConstDef.OPERATION_CODE]) { dgvOperList.Columns[DBConstDef.OPERATION_CODE].Visible = false; } dgvOperList.ClearSelection(); ClearIns(); ClearDrug(); }
private void btnInsAdd_Click(object sender, EventArgs e) { string errMsg = string.Empty; if (!CheckInsInfoValid(ref errMsg, true)) { BaseMessageBox.ShowCustomerMessage(MessageBoxIcon.Error, "", errMsg); } else { //insert a new row, db and datatable DbMaintainment operDb = new DbMaintainment(); int id = 0; string operId = Judgement.JudgeDBNullValue(dgvOperList.SelectedRows[0].Cells[DBConstDef.OPERATION_CODE].Value, EnumDef.ENUM_DATA_TYPE.DATA_TYPE_STRING).ToString(); int insCount = 0; if (!string.IsNullOrEmpty(tbInsQuantity.Text)) { insCount = Convert.ToInt32(tbInsQuantity.Text); } operDb.InsertAutoPackageInsInfo(ref id, operId, tbInsCode.Text, insCount); DataRow newRow = ((DataTable)dgvIns.DataSource).NewRow(); newRow[DBConstDef.OPID_ID] = id; newRow[ConstDef.TEXT_INS_NAME] = ddlInsName.Text; newRow[DBConstDef.TEXT_INS_CODE] = tbInsCode.Text; newRow[DBConstDef.TEXT_INS_SPECIFICATION] = tbInsSpec.Text; newRow[DBConstDef.TEXT_INS_UNIT] = tbInsUnit.Text; newRow[DBConstDef.TEXT_INS_AMOUNT] = tbInsQuantity.Text; ((DataTable)dgvIns.DataSource).Rows.Add(newRow); } }
private void dgvOperList_SelectionChanged(object sender, EventArgs e) { pnlIns.Enabled = dgvOperList.SelectedRows.Count == 1; pnlDrug.Enabled = dgvOperList.SelectedRows.Count == 1; if (dgvOperList.SelectedRows.Count != 1) { return; } string id = Judgement.JudgeDBNullValue(dgvOperList.SelectedRows[0].Cells[DBConstDef.OPERATION_CODE].Value, EnumDef.ENUM_DATA_TYPE.DATA_TYPE_STRING).ToString(); LoadIns(id); LoadDrug(id); }
private void DeleteDrugManufacturersInfo() { foreach (DataGridViewRow selRow in dgv.SelectedRows) { int id = Convert.ToInt32(Judgement.JudgeDBNullValue(selRow.Cells[DBConstDef.PC_ID].Value, EnumDef.ENUM_DATA_TYPE.DATA_TYPE_INTEGER)); DbMaintainment operDb = new DbMaintainment(); operDb.DeleteDrugManufacturersInfo(id); DataRow[] selRows = ((DataTable)dgv.DataSource).Select(string.Format("{0}={1}", DBConstDef.PC_ID, id)); if (selRows.Length > 0) { ((DataTable)dgv.DataSource).Rows.Remove(selRows[0]); } } }
private void UpdateDrugManufacturersInfo() { int id = Convert.ToInt32(Judgement.JudgeDBNullValue(dgv.SelectedRows[0].Cells[DBConstDef.PC_ID].Value, EnumDef.ENUM_DATA_TYPE.DATA_TYPE_INTEGER)); if (id <= 0) { return; } //apply to datagridview, its datasource and db dgv.SelectedRows[0].Cells[ConstDef.TEXT_DRUG_COMPANY_NAME].Value = tbName.Text; dgv.SelectedRows[0].Cells[ConstDef.TEXT_DRUG_COMPANY_CODE].Value = tbInputcode.Text; ((DataTable)dgv.DataSource).AcceptChanges(); DbMaintainment operDb = new DbMaintainment(); operDb.UpdateDrugManufacturersInfo(id, tbName.Text, tbInputcode.Text); }
private void UpdateInfo() { int id = Convert.ToInt32(Judgement.JudgeDBNullValue(dgv.SelectedRows[0].Cells[DBConstDef.ID_INFO_ID].Value, EnumDef.ENUM_DATA_TYPE.DATA_TYPE_INTEGER)); if (id > 0) { //apply to datagridview, its datasource and db dgv.SelectedRows[0].Cells[DBConstDef.TEXT_ID_INFO_CATEGORY].Value = cmbType.Text; dgv.SelectedRows[0].Cells[DBConstDef.TEXT_ID_INFO_NAME].Value = tbName.Text; dgv.SelectedRows[0].Cells[DBConstDef.TEXT_ID_INFO_CODE].Value = tbCode.Text; dgv.SelectedRows[0].Cells[DBConstDef.TEXT_ID_INFO_NO].Value = tbCardNo.Text; ((DataTable)dgv.DataSource).AcceptChanges(); DbMaintainment operDb = new DbMaintainment(); operDb.UpdateIdCardInfo(id, (int)(EnumDef.TRACE_ID_CATEGORY)(cmbType.SelectedItem.GetType().GetProperty("Key").GetValue(cmbType.SelectedItem, null)), tbName.Text, tbCode.Text, tbCardNo.Text); } }
private void InitialControls() { DbMaintainment operDb = new DbMaintainment(); DataTable queryTable = new DataTable(); if (operDb.QueryDrugManufacturerInfo(ref queryTable) == EnumDef.DBMEDITS_RESULT.SUCCESS) { foreach (DataRow row in queryTable.Rows) { string name = (string)Judgement.JudgeDBNullValue(row[ConstDef.TEXT_DRUG_COMPANY_NAME], EnumDef.ENUM_DATA_TYPE.DATA_TYPE_STRING); if (!string.IsNullOrEmpty(name)) { cmbManufactuer.Items.Add(name); } } } }
private void cmbDept_SelectedIndexChanged(object sender, EventArgs e) { cmbRoom.Items.Clear(); int id = (int)(EnumDef.STERILE_ROOM_TYPE)(cmbDept.SelectedItem.GetType().GetProperty("Key").GetValue(cmbDept.SelectedItem, null)); DbMaintainment operDb = new DbMaintainment(); DataTable queryTable = new DataTable(); if (operDb.QueryRoomInfoByDeptId(ref queryTable, id) == EnumDef.DBMEDITS_RESULT.SUCCESS) { foreach (DataRow row in queryTable.Rows) { int roomId = Convert.ToInt32(Judgement.JudgeDBNullValue(row[DBConstDef.ROOM_ID], EnumDef.ENUM_DATA_TYPE.DATA_TYPE_INTEGER)); string name = Judgement.JudgeDBNullValue(row[ConstDef.TEXT_ROOM_NAME], EnumDef.ENUM_DATA_TYPE.DATA_TYPE_STRING).ToString(); cmbRoom.Items.Add(new { Key = roomId, Value = name }); } cmbRoom.ValueMember = "Key"; cmbRoom.DisplayMember = "Value"; } }
private void UpdateInsInfo() { int insId = Convert.ToInt32(Judgement.JudgeDBNullValue(dgv.SelectedRows[0].Cells[DBConstDef.INS_ID].Value, EnumDef.ENUM_DATA_TYPE.DATA_TYPE_INTEGER)); if (insId > 0) { //apply to datagridview, its datasource and db dgv.SelectedRows[0].Cells[ConstDef.TEXT_CONST_IND_KIND].Value = cmbINSType.Text; dgv.SelectedRows[0].Cells[ConstDef.TEXT_INS_NAME].Value = tbProductName.Text; dgv.SelectedRows[0].Cells[ConstDef.TEXT_INS_PRODUCT_NAME].Value = tbCommonName.Text; dgv.SelectedRows[0].Cells[DBConstDef.TEXT_INS_CODE].Value = tbCode.Text; dgv.SelectedRows[0].Cells[DBConstDef.TEXT_INS_SPECIFICATION].Value = tbSpec.Text; dgv.SelectedRows[0].Cells[DBConstDef.TEXT_INS_UNIT].Value = txtINSUnit.Text; dgv.SelectedRows[0].Cells[ConstDef.TEXT_INS_INPUTCODE].Value = tbInputcode.Text; ((DataTable)dgv.DataSource).AcceptChanges(); DbMaintainment operDb = new DbMaintainment(); operDb.UpdateInsInfo(insId, (int)(EnumDef.INS_KINDS)(cmbINSType.SelectedItem.GetType().GetProperty("Key").GetValue(cmbINSType.SelectedItem, null)), tbProductName.Text, tbCommonName.Text, tbCode.Text, tbSpec.Text, txtINSUnit.Text, tbInputcode.Text); } }
private void UpdateDrugInfo() { int drugId = Convert.ToInt32(Judgement.JudgeDBNullValue(dgv.SelectedRows[0].Cells[DBConstDef.DRUG_ID].Value, EnumDef.ENUM_DATA_TYPE.DATA_TYPE_INTEGER)); if (drugId > 0) { //apply to datagridview, its datasource and db dgv.SelectedRows[0].Cells[ConstDef.TEXT_DRUG_NAME].Value = tbName.Text; dgv.SelectedRows[0].Cells[ConstDef.TEXT_DRUG_INPUTCODE].Value = tbInputcode.Text; dgv.SelectedRows[0].Cells[DBConstDef.TEXT_DRUG_PRODUCT_NAME].Value = tbCommonName.Text; dgv.SelectedRows[0].Cells[ConstDef.TEXT_DRUG_COMMON_INPUTCODE].Value = tbCommonInputcode.Text; dgv.SelectedRows[0].Cells[ConstDef.TEXT_DRUG_MANUFACTUER].Value = cmbManufactuer.Text; dgv.SelectedRows[0].Cells[ConstDef.TEXT_DRUG_CODE].Value = tbCode.Text; dgv.SelectedRows[0].Cells[DBConstDef.TEXT_DRUG_SPECIFICATION].Value = tbSpec.Text; dgv.SelectedRows[0].Cells[DBConstDef.TEXT_DRUG_UNIT].Value = tbUnit.Text; dgv.SelectedRows[0].Cells[ConstDef.TEXT_DRUG_PACK_UNIT].Value = tbPackUnit.Text; dgv.SelectedRows[0].Cells[ConstDef.TEXT_DRUG_UNIT_RATIO].Value = tbUnitRatio.Text; ((DataTable)dgv.DataSource).AcceptChanges(); DbMaintainment operDb = new DbMaintainment(); operDb.UpdateDrugInfo(drugId, tbName.Text, tbInputcode.Text, tbCommonName.Text, tbCommonInputcode.Text, cmbManufactuer.Text, tbCode.Text, tbSpec.Text, tbUnit.Text, tbPackUnit.Text, tbUnitRatio.Text); } }
private void InitialIdCard() { DbMaintainment operDb = new DbMaintainment(); DataTable queryTable = new DataTable(); if (operDb.QueryIdCardInfo(ref queryTable) == EnumDef.DBMEDITS_RESULT.SUCCESS) { if (null != queryTable.Columns[DBConstDef.TEXT_ID_INFO_CATEGORY]) { foreach (DataRow row in queryTable.Rows) { int category = Convert.ToInt32(Judgement.JudgeDBNullValue(row[DBConstDef.TEXT_ID_INFO_CATEGORY].ToString(), EnumDef.ENUM_DATA_TYPE.DATA_TYPE_INTEGER)); row[DBConstDef.TEXT_ID_INFO_CATEGORY] = Enum.GetName(typeof(EnumDef.TRACE_ID_CATEGORY), (EnumDef.TRACE_ID_CATEGORY)category); } } dgv.DataSource = queryTable; if (null != dgv.Columns[DBConstDef.ID_INFO_ID]) { dgv.Columns[DBConstDef.ID_INFO_ID].Visible = false; } } }
private void UpdateInsInfo() { int id = Convert.ToInt32(Judgement.JudgeDBNullValue(dgvIns.SelectedRows[0].Cells[DBConstDef.OPID_ID].Value, EnumDef.ENUM_DATA_TYPE.DATA_TYPE_INTEGER)); if (id > 0) { //apply to datagridview, its datasource and db dgvIns.SelectedRows[0].Cells[ConstDef.TEXT_INS_NAME].Value = ddlInsName.Text; dgvIns.SelectedRows[0].Cells[DBConstDef.TEXT_INS_CODE].Value = tbInsCode.Text; dgvIns.SelectedRows[0].Cells[DBConstDef.TEXT_INS_SPECIFICATION].Value = tbInsSpec.Text; dgvIns.SelectedRows[0].Cells[DBConstDef.TEXT_INS_UNIT].Value = tbInsUnit.Text; dgvIns.SelectedRows[0].Cells[DBConstDef.TEXT_INS_AMOUNT].Value = tbInsQuantity.Text; ((DataTable)dgvIns.DataSource).AcceptChanges(); DbMaintainment operDb = new DbMaintainment(); int insCount = 0; if (!string.IsNullOrEmpty(tbInsQuantity.Text)) { insCount = Convert.ToInt32(tbInsQuantity.Text); } operDb.UpdateAutoPackageInsInfo(id, tbInsCode.Text, insCount); } }
private void InitialSterileArea() { DbMaintainment operDb = new DbMaintainment(); DataTable queryTable = new DataTable(); if (operDb.QuerySterileAreaInfo(ref queryTable) == EnumDef.DBMEDITS_RESULT.SUCCESS) { if (null != queryTable.Columns[ConstDef.TEXT_STERILE_AREA_TYPE]) { foreach (DataRow row in queryTable.Rows) { int type = Convert.ToInt32(Judgement.JudgeDBNullValue(row[ConstDef.TEXT_STERILE_AREA_TYPE].ToString(), EnumDef.ENUM_DATA_TYPE.DATA_TYPE_INTEGER)); row[ConstDef.TEXT_STERILE_AREA_TYPE] = TransDef.MatchSterileRoomTypeToString((EnumDef.STERILE_ROOM_TYPE)type); } } dgv.DataSource = queryTable; if (null != dgv.Columns[DBConstDef.SI_ID]) { dgv.Columns[DBConstDef.SI_ID].Visible = false; } } }
private void InitialIns() { DbMaintainment operDb = new DbMaintainment(); DataTable insTable = new DataTable(); if (operDb.QueryInsInfo(ref insTable) == EnumDef.DBMEDITS_RESULT.SUCCESS) { if (null != insTable.Columns[ConstDef.TEXT_CONST_IND_KIND]) { foreach (DataRow row in insTable.Rows) { int kind = Convert.ToInt32(Judgement.JudgeDBNullValue(row[ConstDef.TEXT_CONST_IND_KIND].ToString(), EnumDef.ENUM_DATA_TYPE.DATA_TYPE_INTEGER)); row[ConstDef.TEXT_CONST_IND_KIND] = TransDef.MatchInsKindToString((EnumDef.INS_KINDS)kind); } } dgv.DataSource = insTable; if (null != dgv.Columns[DBConstDef.INS_ID]) { dgv.Columns[DBConstDef.INS_ID].Visible = false; } } }
private void InsNamePressEnter() { if (_insDict.IsNullOrEmpty()) { return; } ListViewItem firstSel = ddlInsName.GetFirstSelListItem(); if (null == firstSel) { return; } DataRow[] selRows = _insDict.Select(String.Format("{0}='{1}'", DBConstDef.INS_CODE, firstSel.Text)); if (selRows.IsNullOrEmpty()) { return; } ddlInsName.Text = Judgement.JudgeDBNullValue(selRows[0][DBConstDef.INS_NAME], EnumDef.ENUM_DATA_TYPE.DATA_TYPE_STRING).ToString(); tbInsCode.Text = Judgement.JudgeDBNullValue(selRows[0][DBConstDef.INS_CODE], EnumDef.ENUM_DATA_TYPE.DATA_TYPE_STRING).ToString(); tbInsSpec.Text = Judgement.JudgeDBNullValue(selRows[0][DBConstDef.INS_SPEC], EnumDef.ENUM_DATA_TYPE.DATA_TYPE_STRING).ToString(); tbInsUnit.Text = Judgement.JudgeDBNullValue(selRows[0][DBConstDef.INS_UNIT], EnumDef.ENUM_DATA_TYPE.DATA_TYPE_STRING).ToString(); tbInsQuantity.Text = String.Empty; }
private void UpdateDrugInfo() { int id = Convert.ToInt32(Judgement.JudgeDBNullValue(dgvDrug.SelectedRows[0].Cells[DBConstDef.OPDD_ID].Value, EnumDef.ENUM_DATA_TYPE.DATA_TYPE_INTEGER)); if (id > 0) { //apply to datagridview, its datasource and db dgvDrug.SelectedRows[0].Cells[DBConstDef.TEXT_DRUG_COMMON_NAME].Value = ddlDrugName.Text; dgvDrug.SelectedRows[0].Cells[DBConstDef.TEXT_DRUG_PRODUCT_NAME].Value = tbDrugProductName.Text; dgvDrug.SelectedRows[0].Cells[DBConstDef.TEXT_DRUG_FACTORY].Value = tbDrugManufacture.Text; dgvDrug.SelectedRows[0].Cells[DBConstDef.TEXT_DRUG_ID].Value = tbDrugCode.Text; dgvDrug.SelectedRows[0].Cells[DBConstDef.TEXT_DRUG_SPECIFICATION].Value = tbDrugSpec.Text; dgvDrug.SelectedRows[0].Cells[DBConstDef.TEXT_DRUG_UNIT].Value = tbDrugUnit.Text; dgvDrug.SelectedRows[0].Cells[DBConstDef.TEXT_DRUG_AMOUNT].Value = tbDrugQuantity.Text; ((DataTable)dgvDrug.DataSource).AcceptChanges(); DbMaintainment operDb = new DbMaintainment(); int drugCount = 0; if (!string.IsNullOrEmpty(tbDrugQuantity.Text)) { drugCount = Convert.ToInt32(tbDrugQuantity.Text); } operDb.UpdateAutoPackageDrugInfo(id, tbDrugCode.Text, ddlDrugName.Text, tbDrugProductName.Text, tbDrugSpec.Text, tbDrugManufacture.Text, tbDrugUnit.Text, drugCount); } }