public void addDataSource(DIDataSource source) { string strQuery = "INSERT INTO [DI].[DATA_SOURCE]([DataID],[ConnectionString],[Type]) VALUES (@DataID,@ConnectionString,@Type)"; Dictionary<string, object> parameters = new Dictionary<string, object>(); parameters.Add("@DataID", source.DataID); parameters.Add("@ConnectionString", source.ConnectionString); parameters.Add("@Type", source.Type); executeNonQuery(strQuery, parameters); }
public void addNewSource(DIDataSource datasource, List<DITableSource> tables) { DI_DAO dao = null; try { dao = new DI_DAO(); dao.beginTransaction(); dao.addDataSource(datasource); foreach (DITableSource table in tables) { dao.addTableSource(table); } dao.commitTransaction(); } catch (Exception ex) { dao.rollbackTransaction(); throw ex; } }
public List<DIDataSource> getDataSource() { string strSelect = "SELECT [DataID],[ConnectionString],[Type] FROM [DI].[DATA_SOURCE]"; SqlDataReader dr = executeReader(strSelect); List<DIDataSource> list = new List<DIDataSource>(); while (dr.Read()) { DIDataSource obj = new DIDataSource(); obj.DataID = dr.GetString(dr.GetOrdinal("DataID")); obj.ConnectionString = dr.GetString(dr.GetOrdinal("ConnectionString")); obj.Type = dr.GetString(dr.GetOrdinal("Type")); list.Add(obj); } dr.Close(); return list; }
public void updateDataSouce(DIDataSource datasouce) { string strQuery = "UPDATE [DI].[DATA_SOURCE] SET [ConnectionString] = @ConnectionString,[Type] = @Type WHERE [DataID] = @DataID"; Dictionary<string, object> parameters = new Dictionary<string, object>(); parameters.Add("@DataID", datasouce.DataID); parameters.Add("@ConnectionString", datasouce.ConnectionString); parameters.Add("@Type", datasouce.Type); executeNonQuery(strQuery, parameters); }
public void updateSource(DIDataSource datasouce) { DI_DAO dao = null; try { dao = new DI_DAO(); dao.beginTransaction(); dao.updateDataSouce(datasouce); dao.commitTransaction(); } catch (Exception ex) { dao.rollbackTransaction(); throw ex; } }