public void CreateGroup(RecipientGroup group) { CreateUpdateGroups(group); }
public string SendMessage(Message message, RecipientGroup recipientGroup, string smsUrl) { IList<string> recipientMobileNos = GetRecipients(recipientGroup.Id.Value).Select(r => r.MobileNo.ToString()).ToList(); try { SendMessage(message.MessageText, string.Join(",", recipientMobileNos), smsUrl); } catch (Exception ex) { return "FAIL send messages: " + ex.Message; } return "Messages sent successfully."; }
private void CreateUpdateGroups(RecipientGroup group) { //ICMS_spCreateUpdateRecipientGroup // @pId as uniqueidentifier = null, //@pGroupName as nvarchar(50), //@pRoleName as varchar(20) SqlService sql = new SqlService(_sqlConnection); if (group.Id != null) sql.AddParameter("@pId", System.Data.SqlDbType.UniqueIdentifier, group.Id); sql.AddParameter("@pGroupName", System.Data.SqlDbType.VarChar, group.GroupName); sql.AddParameter("@pRoleName", System.Data.SqlDbType.VarChar, group.UserRole); sql.ExecuteSP("ICMS_spCreateSMSUpdateRecipientGroup"); }
public RecipientGroup GetRecipientGroup(Guid id) { SqlService sql = new SqlService(_sqlConnection); sql.AddParameter("@pId", System.Data.SqlDbType.UniqueIdentifier, id); RecipientGroup r = new RecipientGroup(); using (SqlDataReader reader = sql.ExecuteSPReader("ICMS_spGetSMSRecipientGroup")) { if (reader.HasRows) { while (reader.Read()) { r.Id = id; r.GroupName = reader.SafeGetString(reader.GetOrdinal("GroupName")); r.UserRole = reader.SafeGetString(reader.GetOrdinal("UserRole")); } } } return r; }