/// <summary> /// Gets an IList with all instances of Letter. /// </summary> public static List <Letter> GetAll(Guid letterInfoGuid) { List <Letter> letterList = new List <Letter>(); IDataReader reader = DBLetter.GetAll(letterInfoGuid); return(PopulateFromReader(reader)); }
/// <summary> /// Updates this instance of Letter. Returns true on success. /// </summary> /// <returns>bool</returns> private bool Update() { this.lastModUTC = DateTime.UtcNow; return(DBLetter.Update( this.letterGuid, this.letterInfoGuid, this.subject, this.htmlBody, this.textBody, this.lastModBy, this.lastModUTC, this.isApproved, this.approvedBy)); }
/// <summary> /// Updates this instance of Letter. Returns true on success. /// </summary> /// <returns>bool</returns> private bool Update() { this.LastModUtc = DateTime.UtcNow; return(DBLetter.Update( this.LetterGuid, this.LetterInfoGuid, this.Subject, this.HtmlBody, this.TextBody, this.LastModBy, this.LastModUtc, this.IsApproved, this.ApprovedBy)); }
/// <summary> /// Gets an IList with page of instances of Letter. /// </summary> public static List <Letter> GetDrafts( Guid letterInfoGuid, int pageNumber, int pageSize, out int totalPages) { totalPages = 1; IDataReader reader = DBLetter.GetDrafts( letterInfoGuid, pageNumber, pageSize, out totalPages); return(PopulateFromReader(reader)); }
/// <summary> /// Persists a new instance of Letter. Returns true on success. /// </summary> /// <returns></returns> private bool Create() { Guid newID = Guid.NewGuid(); this.letterGuid = newID; this.createdUTC = DateTime.UtcNow; this.lastModUTC = DateTime.UtcNow; int rowsAffected = DBLetter.Create( this.letterGuid, this.letterInfoGuid, this.subject, this.htmlBody, this.textBody, this.createdBy, this.createdUTC, this.lastModBy, this.lastModUTC, this.isApproved, this.approvedBy); return(rowsAffected > 0); }
/// <summary> /// Persists a new instance of Letter. Returns true on success. /// </summary> /// <returns></returns> private bool Create() { Guid newID = Guid.NewGuid(); this.LetterGuid = newID; this.CreatedUtc = DateTime.UtcNow; this.LastModUtc = DateTime.UtcNow; int rowsAffected = DBLetter.Create( this.LetterGuid, this.LetterInfoGuid, this.Subject, this.HtmlBody, this.TextBody, this.CreatedBy, this.CreatedUtc, this.LastModBy, this.LastModUtc, this.IsApproved, this.ApprovedBy); return(rowsAffected > 0); }
/// <summary> /// Gets an instance of Letter. /// </summary> /// <param name="letterGuid"> letterGuid </param> private void GetLetter(Guid letterGuid) { using (IDataReader reader = DBLetter.GetOne(letterGuid)) { if (reader.Read()) { this.letterGuid = new Guid(reader["LetterGuid"].ToString()); this.letterInfoGuid = new Guid(reader["LetterInfoGuid"].ToString()); this.subject = reader["Subject"].ToString(); this.htmlBody = reader["HtmlBody"].ToString(); this.textBody = reader["TextBody"].ToString(); this.createdBy = new Guid(reader["CreatedBy"].ToString()); this.createdUTC = Convert.ToDateTime(reader["CreatedUTC"]); this.lastModBy = new Guid(reader["LastModBy"].ToString()); this.lastModUTC = Convert.ToDateTime(reader["LastModUTC"]); this.isApproved = Convert.ToBoolean(reader["IsApproved"]); this.approvedBy = new Guid(reader["ApprovedBy"].ToString()); if (reader["SendClickedUTC"] != DBNull.Value) { this.sendClickedUTC = Convert.ToDateTime(reader["SendClickedUTC"]); } if (reader["SendStartedUTC"] != DBNull.Value) { this.sendStartedUTC = Convert.ToDateTime(reader["SendStartedUTC"]); } if (reader["SendCompleteUTC"] != DBNull.Value) { this.sendCompleteUTC = Convert.ToDateTime(reader["SendCompleteUTC"]); } this.sendCount = Convert.ToInt32(reader["SendCount"]); } } }
/// <summary> /// Deletes a row from the mp_Letter table. Returns true if row deleted. /// </summary> /// <param name="letterInfoGuid"> letterInfoGuid </param> /// <returns>bool</returns> public static bool DeleteByLetterInfo(Guid letterInfoGuid) { return(DBLetter.DeleteByLetterInfo(letterInfoGuid)); }
/// <summary> /// Deletes an instance of Letter. Returns true on success. /// </summary> /// <param name="letterGuid"> letterGuid </param> /// <returns>bool</returns> public static bool Delete(Guid letterGuid) { LetterSendLog.DeleteByLetter(letterGuid); return(DBLetter.Delete(letterGuid)); }
/// <summary> /// Records the completion of sending the letter from the task queue. /// </summary> /// <returns></returns> public bool TrackSendComplete(int sendCount) { return(DBLetter.SendComplete(this.letterGuid, DateTime.UtcNow, sendCount)); }
/// <summary> /// Records the start of sending the letter from the task queue. /// </summary> /// <returns></returns> public bool TrackSendStarted() { return(DBLetter.SendStarted(this.letterGuid, DateTime.UtcNow)); }
/// <summary> /// Records click of the send button. Sending occurs by a task queue. /// </summary> /// <returns></returns> public bool TrackSendClicked() { return(DBLetter.SendClicked(this.LetterGuid, DateTime.UtcNow)); }