protected void btnSave_Click(object sender, EventArgs e) { if (FieldValidation() == false) { return; } IDiseases DiseaseManager; try { if (Request.QueryString["name"] == "Add") { DiseaseManager = (IDiseases)ObjectFactory.CreateInstance("BusinessProcess.Administration.BDiseases, BusinessProcess.Administration"); int DiseaseId = DiseaseManager.SaveNewDisease(txtDiseaseName.Text, 1, Convert.ToInt32(txtSeq.Text)); if (DiseaseId == 0) { IQCareMsgBox.Show("DiseaseExists", this); return; } else { IQCareMsgBox.Show("DiseaseSave", this); clear_fields(); } } else if (Request.QueryString["name"] == "Edit") { DiseaseManager = (IDiseases)ObjectFactory.CreateInstance("BusinessProcess.Administration.BDiseases, BusinessProcess.Administration"); int DiseaseId = DiseaseManager.UpdateDisease(Convert.ToInt32(Request.QueryString["diseaseid"]), txtDiseaseName.Text.ToUpper(), 1, Convert.ToInt32(this.ddStatus.SelectedValue), Convert.ToInt32(txtSeq.Text)); IQCareMsgBox.Show("DiseaseUpdate", this); } } catch (Exception err) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = err.Message.ToString(); IQCareMsgBox.Show("#C1", this); return; } finally { DiseaseManager = null; } }