示例#1
0
        public static void Restore(Trash m_Trash)
        {
            SqlConnection conn = DB.DbConnect();
            conn.Open();

            string queryString = "UPDATE " + m_Trash.ObjectTable + " SET pageWorkFlowState = 1 WHERE " + m_Trash.ObjectColumn + " = @objectId";
            SqlCommand updateObject = new SqlCommand(queryString, conn);
            updateObject.Parameters.AddWithValue("objectId", m_Trash.ObjectId);
            updateObject.ExecuteNonQuery();

            queryString = "DELETE FROM CMS_Trash WHERE id = @id";
            SqlCommand delTrash = new SqlCommand(queryString, conn);
            delTrash.Parameters.AddWithValue("id", m_Trash.Id);
            delTrash.ExecuteNonQuery();

            conn.Close();
        }
示例#2
0
        public static void Create(Trash m_Trash)
        {
            SqlConnection conn = DB.DbConnect();
            conn.Open();

            string queryString = "INSERT INTO CMS_Trash(objectId, objectTable, objectName, deleteDate, deletedBy, objectColumn) VALUES(@objectId, @objectTable, @objectName, @deleteDate, @deletedBy, @objectColumn)";
            SqlCommand insertTrash = new SqlCommand(queryString, conn);
            insertTrash.Parameters.AddWithValue("objectId", m_Trash.ObjectId);
            insertTrash.Parameters.AddWithValue("objectTable", m_Trash.ObjectTable);
            insertTrash.Parameters.AddWithValue("objectName", m_Trash.ObjectName);
            insertTrash.Parameters.AddWithValue("deleteDate", m_Trash.DeleteDate);
            insertTrash.Parameters.AddWithValue("deletedBy", m_Trash.DeletedBy);
            insertTrash.Parameters.AddWithValue("objectColumn", m_Trash.ObjectColumn);

            insertTrash.ExecuteNonQuery();

            conn.Close();
        }
 public Trash RetrieveOne(int id)
 {
     Trash m_Trash = new Trash();
     return m_Trash;
 }
 public void Create(Trash m_Trash)
 {
 }
示例#5
0
        public static Trash RetrieveOne(int id)
        {
            SqlConnection conn = DB.DbConnect();
            conn.Open();

            string queryString = "SELECT * FROM CMS_Trash WHERE id = @id";
            SqlCommand getTrash = new SqlCommand(queryString, conn);
            getTrash.Parameters.AddWithValue("id", id);
            SqlDataReader trashDataReader = getTrash.ExecuteReader();

            Trash m_Trash = new Trash();

            if(trashDataReader.Read())
            {
                m_Trash.Id = trashDataReader.GetInt32(0);
                m_Trash.ObjectId = trashDataReader.GetInt32(1);
                m_Trash.ObjectTable = trashDataReader.GetString(2);
                m_Trash.ObjectName = trashDataReader.GetString(3);
                m_Trash.DeleteDate = trashDataReader.GetDateTime(4);
                m_Trash.DeletedBy = trashDataReader.GetInt32(5);
                m_Trash.ObjectColumn = trashDataReader.GetString(6);
                m_Trash.ObjectType = trashDataReader.GetString(7);

                User m_User = DBUser.GetOne(m_Trash.DeletedBy);

                m_Trash.DeletedByName = m_User.FirstName + " " + m_User.LastName;
            }

            conn.Close();

            return m_Trash;
        }
示例#6
0
        public static List<Trash> RetrieveAll()
        {
            SqlConnection conn = DB.DbConnect();
            conn.Open();

            string queryString = "SELECT * FROM CMS_Trash ORDER BY deleteDate DESC";
            SqlCommand getTrash = new SqlCommand(queryString, conn);
            SqlDataReader trashDataReader = getTrash.ExecuteReader();

            List<Trash> m_Trash = new List<Trash>();

            while (trashDataReader.Read())
            {
                Trash tempTrash = new Trash();

                tempTrash.Id = trashDataReader.GetInt32(0);
                tempTrash.ObjectId = trashDataReader.GetInt32(1);
                tempTrash.ObjectTable = trashDataReader.GetString(2);
                tempTrash.ObjectName = trashDataReader.GetString(3);
                tempTrash.DeleteDate = trashDataReader.GetDateTime(4);
                tempTrash.DeletedBy = trashDataReader.GetInt32(5);
                tempTrash.ObjectColumn = trashDataReader.GetString(6);
                tempTrash.ObjectType = trashDataReader.GetString(7);

                User m_User = DBUser.GetOne(tempTrash.DeletedBy);

                tempTrash.DeletedByName = m_User.FirstName + " " + m_User.LastName;

                m_Trash.Add(tempTrash);
            }

            conn.Close();

            return m_Trash;
        }