//ICMS_spUpdateReportRecipients //@pId as uniqueidentifier = null, //@pFirstName as varchar(50) = null, //@pLastName as varchar(50) = null, //@pRole as varchar(50) = null, //@pEmail as varchar(50) = null /// <summary> /// Add a new report recipient /// </summary> /// <param name="recipient"></param> public void AddRecipient(Recipient recipient) { SqlService sql = new SqlService(_sqlConnection); sql.AddParameter("@pName", System.Data.SqlDbType.VarChar, recipient.Name); sql.AddParameter("@pRole", System.Data.SqlDbType.VarChar, recipient.Role); sql.AddParameter("@pEmail", System.Data.SqlDbType.VarChar, recipient.Email); sql.ExecuteSP("ICMS_spUpdateReportRecipients"); }
public Recipient GetRecipient(Guid id) { Recipient rec = new Recipient(); SqlService sql = new SqlService(_sqlConnection); sql.AddParameter("@pId", System.Data.SqlDbType.UniqueIdentifier, id); using (SqlDataReader reader = sql.ExecuteSPReader("ICMS_spGetRecipients")) { if (reader.HasRows) { while (reader.Read()) { rec.Id = reader.SafeGetGuid(reader.GetOrdinal("recId")).Value; rec.Name = reader.SafeGetString(reader.GetOrdinal("recName")); rec.Email = reader.SafeGetString(reader.GetOrdinal("recEmail")); rec.Role = reader.SafeGetString(reader.GetOrdinal("recRoleDescription")); } } } return rec; }
public IList<Recipient> GetRecipientsList() { IList<Recipient> recipientsList = new List<Recipient>(); SqlService sql = new SqlService(_sqlConnection); using (SqlDataReader reader = sql.ExecuteSPReader("ICMS_spGetRecipients")) { if (reader.HasRows) { while (reader.Read()) { Recipient rec = new Recipient(); rec.Id = reader.SafeGetGuid(reader.GetOrdinal("recId")).Value; rec.Name = reader.SafeGetString(reader.GetOrdinal("recName")); rec.Email = reader.SafeGetString(reader.GetOrdinal("recEmail")); rec.Role = reader.SafeGetString(reader.GetOrdinal("recRoleDescription")); recipientsList.Add(rec); } } } return recipientsList; }