public static void SetNotDeleted(int note_id, int un_deleted_by) { Note note = NoteDB.GetByID(note_id); NoteHistoryDB.Insert(note.NoteID, note.NoteType.ID, note.BodyPart.ID, note.Text, note.DateAdded, note.DateModified, note.DateDeleted, note.AddedBy == null ? -1 : note.AddedBy.StaffID, note.ModifiedBy == null ? -1 : note.ModifiedBy.StaffID, note.DeletedBy == null ? -1 : note.DeletedBy.StaffID, note.Site == null ? -1 : note.Site.SiteID); string sql = "UPDATE Note SET date_deleted = NULL, deleted_by = NULL, date_modified = '" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',modified_by = " + un_deleted_by + " WHERE note_id = " + note_id.ToString(); DBBase.ExecuteNonResult(sql); }
public static void Update(int note_id, DateTime date_added, int modified_by, int note_type_id, int body_part_id, int medical_service_type_id, string text, int site_id) { Note note = NoteDB.GetByID(note_id); NoteHistoryDB.Insert(note.NoteID, note.NoteType.ID, note.BodyPart.ID, note.Text, note.DateAdded, note.DateModified, note.DateDeleted, note.AddedBy == null ? -1 : note.AddedBy.StaffID, note.ModifiedBy == null ? -1 : note.ModifiedBy.StaffID, note.DeletedBy == null ? -1 : note.DeletedBy.StaffID, note.Site == null ? -1 : note.Site.SiteID); text = text.Replace("'", "''"); string sql = "UPDATE Note SET note_type_id = " + note_type_id + ",body_part_id = " + (body_part_id == -1 ? "NULL" : body_part_id.ToString()) + ",medical_service_type_id = " + (medical_service_type_id == -1 ? "NULL" : medical_service_type_id.ToString()) + ",date_added = '" + date_added.ToString("yyyy-MM-dd HH:mm:ss") + "'" + ",text = '" + text + "',date_modified = '" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',modified_by = " + modified_by + ",site_id = " + (site_id == -1 ? "NULL" : site_id.ToString()) + " WHERE note_id = " + note_id.ToString(); DBBase.ExecuteNonResult(sql); }