Exemplo n.º 1
0
 public virtual bool Fill(RebuilderData dataClass)
 {
     try {
         this.ScriptFileName = dataClass.ScriptFileName;
         this.ScriptId       = dataClass.ScriptId;
         this.Sequence       = dataClass.Sequence;
         this.ScriptText     = dataClass.ScriptText;
         this.Database       = dataClass.Database;
         this.Tag            = dataClass.Tag;
         return(true);
     }
     catch (System.Exception ex) {
         throw new System.ApplicationException("Error in the Auto-Generated: RebuilderData.Fill(RebuilderData) Method", ex);
     }
 }
Exemplo n.º 2
0
        private List <RebuilderData> RetreiveBuildData()
        {
            string startinDb = connData.DatabaseName;
            string sql       = @"SELECT ScriptFileName, ScriptId, Sequence,ScriptText, '' as [database], Tag FROM SqlBuild_Logging 
                    WHERE BuildFileName = @BuildFileName AND CommitDate = @CommitDate
                    ORDER BY Sequence ";

            List <RebuilderData> data = new List <RebuilderData>();

            string[] dbs = this.commitData.Database.Split(';');
            for (int i = 0; i < dbs.Length; i++)
            {
                this.connData.DatabaseName = dbs[i];
                SqlConnection conn = SqlSync.Connection.ConnectionHelper.GetConnection(this.connData);
                SqlCommand    cmd  = new SqlCommand(sql, conn);
                cmd.Parameters.AddWithValue("@BuildFileName", this.commitData.BuildFileName);
                cmd.Parameters.AddWithValue("@CommitDate", this.commitData.CommitDate);
                conn.Open();
                using (SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection))
                {
                    bool filled;
                    while (!reader.IsClosed)
                    {
                        RebuilderData dat = new RebuilderData();
                        filled = dat.Fill(reader, false);
                        if (filled)
                        {
                            dat.Database = dbs[i];
                            data.Add(dat);
                        }
                    }
                    conn.Close();
                }
            }
            this.connData.DatabaseName = startinDb;

            return(data);
        }
Exemplo n.º 3
0
        internal static List <RebuilderData> RetreiveBuildData(ConnectionData dbConnData, string buildFileHash,
                                                               DateTime commitDate)
        {
            ;
            string sql =
                @"SELECT ScriptFileName, ScriptId, Sequence,ScriptText, '' as [database], Tag FROM SqlBuild_Logging 
                    WHERE BuildProjectHash = @BuildFileHash AND CommitDate = @CommitDate
                    ORDER BY Sequence ";

            List <RebuilderData> data = new List <RebuilderData>();

            SqlConnection conn = SqlSync.Connection.ConnectionHelper.GetConnection(dbConnData);
            SqlCommand    cmd  = new SqlCommand(sql, conn);

            cmd.Parameters.AddWithValue("@BuildFileHash", buildFileHash);
            cmd.Parameters.AddWithValue("@CommitDate", commitDate.ToString("yyyy-MM-dd HH:mm:ss.FFF"));
            conn.Open();
            using (SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection))
            {
                bool filled;
                while (!reader.IsClosed)
                {
                    RebuilderData dat = new RebuilderData();
                    filled = dat.Fill(reader, false);
                    if (filled)
                    {
                        dat.Database = dbConnData.DatabaseName;
                        data.Add(dat);
                    }
                }
                conn.Close();
            }



            return(data);
        }