public void DeleteSourceTarget(int sourceTargetId) { var sourceTarget = new SourceTarget(); sourceTarget.SourceTargetId = sourceTargetId; string procedure = ConfigurationManager.AppSettings["DeleteSourceTarget"].ToString(); ExecuteProcedure(procedure, sourceTarget); }
public void UpdateSourceTarget(SourceTarget sourceTarget) { string procedure = ConfigurationManager.AppSettings["UpdateSourceTarget"].ToString(); ExecuteProcedure(procedure, sourceTarget); }
private void ExecuteProcedure(string procedure, SourceTarget sourceTarget) { var dataProvider = new DataProvider(this.connection, procedure); dataProvider.SetParameters(sourceTarget.ConvertToParameters()) .ExecuteStoredProcedure(); }
public List<SourceTarget> GetSourceTargets() { var sourceTargets = new List<SourceTarget>(); var sqlConnection = new SqlConnection(this.connection); sqlConnection.Open(); var sqlCmd = new SqlCommand(this.procedure, sqlConnection); sqlCmd.CommandType = CommandType.StoredProcedure; var dataReader = sqlCmd.ExecuteReader(CommandBehavior.CloseConnection); while (dataReader.Read()) { var sourceTarget = new SourceTarget(); sourceTarget.SourceTargetId = Convert.ToInt32(dataReader["SourceTargetId"]); sourceTarget.ConnectionName = dataReader["ConnectionName"].ToString(); sourceTarget.ConnectionString = dataReader["ConnectionString"].ToString(); sourceTarget.ListId = dataReader["ListId"].ToString(); sourceTarget.SharePointTarget = dataReader["SharePointTarget"].ToString(); sourceTarget.SQLSource = dataReader["SQLSource"].ToString(); sourceTarget.ImageRef = string.Empty; sourceTargets.Add(sourceTarget); } dataReader.Close(); return sourceTargets; }