Beispiel #1
0
        public void DeleteSourceTarget(int sourceTargetId)
        {
            var sourceTarget = new SourceTarget();
            sourceTarget.SourceTargetId = sourceTargetId;

            string procedure = ConfigurationManager.AppSettings["DeleteSourceTarget"].ToString();
            ExecuteProcedure(procedure, sourceTarget);
        }
Beispiel #2
0
 public void UpdateSourceTarget(SourceTarget sourceTarget)
 {
     string procedure = ConfigurationManager.AppSettings["UpdateSourceTarget"].ToString();
     ExecuteProcedure(procedure, sourceTarget);
 }
Beispiel #3
0
 private void ExecuteProcedure(string procedure, SourceTarget sourceTarget)
 {
     var dataProvider = new DataProvider(this.connection, procedure);
     dataProvider.SetParameters(sourceTarget.ConvertToParameters())
                     .ExecuteStoredProcedure();
 }
Beispiel #4
0
        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;
        }