private void FrmHL7DBComparison_Load(object sender, EventArgs e) { _dbTableCollection = _genericRepo.GetDatabaseTables(null); _triggerEvents = _repo.GetAllTriggerEvents(); CreateMenuItems(); LoadDropDownControls(); EnableDisableControl(Enable_Disable_Control.ENABLE); }
/// <summary> /// Get list of DB tables based on the segment name. /// </summary> /// <param name="segmentString">String of formated segments ('MSH','EVN')</param> /// <returns></returns> public DBTableCollection GetDatabaseTables(string segmentString) { // retrieve the table names and add them to the collection // in the correct order. DBTableCollection collection = new DBTableCollection(); string sql = string.Empty; if (string.IsNullOrEmpty(segmentString)) { sql = this.GetDBSpecificQuery(DB_Schema_Query.ALL_TABLES); } else { sql = this.GetDBSpecificQuery(DB_Schema_Query.TABLE); } if (!string.IsNullOrEmpty(sql)) { string[] orderList; if (!string.IsNullOrEmpty(segmentString)) { orderList = segmentString.Split(','); } sql = string.Format(sql, segmentString); DataTable dt = _dbProvider.ExecuteDataSetQuery(sql, null).Tables[0]; foreach (DataRow dr in dt.Rows) { collection.Add(new DBTable(dr["TableId"].Parse <long>(), dr["TableName"].ToString())); } } return(collection); }