Example #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            string errMsg = string.Empty;

            if (!CheckInfoValid(ref errMsg, true))
            {
                BaseMessageBox.ShowCustomerMessage(MessageBoxIcon.Error, "", errMsg);
            }
            else
            {
                //insert a new row,db and datatable
                DbMaintainment operDb = new DbMaintainment();
                int            id     = 0;
                operDb.InsertDrugManufacturersInfo(ref id, tbName.Text, tbInputcode.Text);

                DataRow newRow = ((DataTable)dgv.DataSource).NewRow();
                newRow[DBConstDef.PC_ID] = id;
                newRow[ConstDef.TEXT_DRUG_COMPANY_NAME] = tbName.Text;
                newRow[ConstDef.TEXT_DRUG_COMPANY_CODE] = tbInputcode.Text;
                ((DataTable)dgv.DataSource).Rows.Add(newRow);
            }
        }
Example #2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            string errMsg = string.Empty;
            if (!CheckInfoValid(ref errMsg, true))
            {
                BaseMessageBox.ShowCustomerMessage(MessageBoxIcon.Error, "", errMsg);
            }
            else
            {
                //insert a new row,db and datatable
                DbMaintainment operDb = new DbMaintainment();
                int id = 0;
                operDb.InsertDrugManufacturersInfo(ref id, tbName.Text, tbInputcode.Text);

                DataRow newRow = ((DataTable) dgv.DataSource).NewRow();
                newRow[DBConstDef.PC_ID] = id;
                newRow[ConstDef.TEXT_DRUG_COMPANY_NAME] = tbName.Text;
                newRow[ConstDef.TEXT_DRUG_COMPANY_CODE] = tbInputcode.Text;
                ((DataTable) dgv.DataSource).Rows.Add(newRow);
            }
        }