示例#1
0
文件: FrmDrugM.cs 项目: 1907931256/jx
        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            drugId = 0;
                operDb.InsertDrugInfo(ref drugId, tbName.Text, tbInputcode.Text, tbCommonName.Text, tbCommonInputcode.Text, cmbManufactuer.Text, tbCode.Text, tbSpec.Text, tbUnit.Text, tbPackUnit.Text, tbUnitRatio.Text);

                DataRow newRow = ((DataTable)dgv.DataSource).NewRow();
                newRow[DBConstDef.DRUG_ID]                  = drugId;
                newRow[ConstDef.TEXT_DRUG_NAME]             = tbName.Text;
                newRow[ConstDef.TEXT_DRUG_INPUTCODE]        = tbInputcode.Text;
                newRow[DBConstDef.TEXT_DRUG_PRODUCT_NAME]   = tbCommonName.Text;
                newRow[ConstDef.TEXT_DRUG_COMMON_INPUTCODE] = tbCommonInputcode.Text;
                newRow[ConstDef.TEXT_DRUG_MANUFACTUER]      = cmbManufactuer.Text;
                newRow[ConstDef.TEXT_DRUG_CODE]             = tbCode.Text;
                newRow[DBConstDef.TEXT_DRUG_SPECIFICATION]  = tbSpec.Text;
                newRow[DBConstDef.TEXT_DRUG_UNIT]           = tbUnit.Text;
                newRow[ConstDef.TEXT_DRUG_PACK_UNIT]        = tbPackUnit.Text;
                int ratio = -1;
                if (int.TryParse(tbUnitRatio.Text, out ratio))
                {
                    newRow[ConstDef.TEXT_DRUG_UNIT_RATIO] = ratio;
                }

                ((DataTable)dgv.DataSource).Rows.Add(newRow);
            }
        }
示例#2
0
文件: FrmDrugM.cs 项目: CareyGit/jx
        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 drugId = 0;
                operDb.InsertDrugInfo(ref drugId, tbName.Text, tbInputcode.Text, tbCommonName.Text, tbCommonInputcode.Text, cmbManufactuer.Text, tbCode.Text, tbSpec.Text, tbUnit.Text, tbPackUnit.Text, tbUnitRatio.Text);

                DataRow newRow = ((DataTable) dgv.DataSource).NewRow();
                newRow[DBConstDef.DRUG_ID] = drugId;
                newRow[ConstDef.TEXT_DRUG_NAME] = tbName.Text;
                newRow[ConstDef.TEXT_DRUG_INPUTCODE] = tbInputcode.Text;
                newRow[DBConstDef.TEXT_DRUG_PRODUCT_NAME] = tbCommonName.Text;
                newRow[ConstDef.TEXT_DRUG_COMMON_INPUTCODE] = tbCommonInputcode.Text;
                newRow[ConstDef.TEXT_DRUG_MANUFACTUER] = cmbManufactuer.Text;
                newRow[ConstDef.TEXT_DRUG_CODE] = tbCode.Text;
                newRow[DBConstDef.TEXT_DRUG_SPECIFICATION] = tbSpec.Text;
                newRow[DBConstDef.TEXT_DRUG_UNIT] = tbUnit.Text;
                newRow[ConstDef.TEXT_DRUG_PACK_UNIT] = tbPackUnit.Text;
                int ratio = -1;
                if (int.TryParse(tbUnitRatio.Text,out ratio))
                    newRow[ConstDef.TEXT_DRUG_UNIT_RATIO] = ratio;

                ((DataTable) dgv.DataSource).Rows.Add(newRow);
            }
        }