internal void DeleteDocument(Document doc) { doc.Delete(); }
public static Document Get(int id) { string dsn = ConfigurationManager.ConnectionStrings["RJLouEntities"].ToString(); string sql = "SELECT * FROM DOCUMENT WHERE Document_ID = @ID"; using (SqlConnection conn = new SqlConnection(dsn)) { conn.Open(); SqlCommand cmd = new SqlCommand(sql, conn); cmd.CommandType = CommandType.Text; cmd.Parameters.AddWithValue("ID", id); SqlDataReader read = cmd.ExecuteReader(); if (read.Read()) { Document result = new Document() { DocumentID = Convert.ToInt32(read["Document_ID"]), CaseID = Convert.ToInt32(read["Case_ID"]), PersonWhoModified = InternalUser.Get(Convert.ToInt32(read["Person_ID"])), FileLocation = read["File_Location"].ToString() }; return result; } } return null; }
internal void AddDocument(Document doc) { Document.Add(doc.CaseID, doc.PersonWhoModified.PersonID, doc.FileLocation); }