コード例 #1
0
ファイル: SourceTarget.cs プロジェクト: dhrobbins/DataPump
        public void DeleteSourceTarget(int sourceTargetId)
        {
            var sourceTarget = new SourceTarget();
            sourceTarget.SourceTargetId = sourceTargetId;

            string procedure = ConfigurationManager.AppSettings["DeleteSourceTarget"].ToString();
            ExecuteProcedure(procedure, sourceTarget);
        }
コード例 #2
0
ファイル: SourceTarget.cs プロジェクト: dhrobbins/DataPump
 public void UpdateSourceTarget(SourceTarget sourceTarget)
 {
     string procedure = ConfigurationManager.AppSettings["UpdateSourceTarget"].ToString();
     ExecuteProcedure(procedure, sourceTarget);
 }
コード例 #3
0
ファイル: SourceTarget.cs プロジェクト: dhrobbins/DataPump
 private void ExecuteProcedure(string procedure, SourceTarget sourceTarget)
 {
     var dataProvider = new DataProvider(this.connection, procedure);
     dataProvider.SetParameters(sourceTarget.ConvertToParameters())
                     .ExecuteStoredProcedure();
 }
コード例 #4
0
ファイル: SourceTarget.cs プロジェクト: dhrobbins/DataPump
        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;
        }