public ActionResult TextMessageNew(string type, string id) { MessageModel model = new MessageModel(); try { model.OwnerType = (GroupOwnerTypeEnum)Enum.Parse(typeof(GroupOwnerTypeEnum), type); model.OwnerId = new Guid(id); model.SendEmailForMessage = true; var memId = RDN.Library.Classes.Account.User.GetMemberId(); var mem = MemberCache.GetMemberDisplay(memId); model.IsCarrierVerified = mem.IsCarrierVerified; if (model.OwnerType == GroupOwnerTypeEnum.member) model.Recipients = Messages.GetConnectedMembersOfMember(new Guid(id)); else model.Recipients = Messages.GetConnectedMembersOfGroup(new Guid(id)); } catch (Exception exception) { ErrorDatabaseManager.AddException(exception, exception.GetType()); } return View(model); }
public ActionResult CreateNewTextMessage(MessageModel model) { try { RDN.Portable.Classes.Controls.Message.ConversationModel mess = new Portable.Classes.Controls.Message.ConversationModel(); List<Guid> listOfGuids = new List<Guid>(); List<long> listOfGroupIds = new List<long>(); mess.MemberId = model.OwnerId; mess.FromId = model.OwnerId; mess.Message = model.MessageTextWriting; listOfGuids.Add(RDN.Library.Classes.Account.User.GetMemberId()); mess.OwnerType = model.OwnerType; if (!String.IsNullOrEmpty(model.ToMemberIds)) { foreach (string guid in model.ToMemberIds.Split(',')) { Guid temp = new Guid(); bool didWork = Guid.TryParse(guid, out temp); if (didWork) listOfGuids.Add(temp); } } if (!String.IsNullOrEmpty(model.ToMemberNames)) { foreach (string guid in model.ToMemberNames.Split(',')) { Guid temp = new Guid(); bool didWork = Guid.TryParse(guid, out temp); if (didWork) listOfGuids.Add(temp); } } if (!String.IsNullOrEmpty(model.ToGroupIds)) { foreach (string guid in model.ToGroupIds.Split(',')) { long temp = new long(); if (Int64.TryParse(guid, out temp)) listOfGroupIds.Add(temp); } } listOfGuids = listOfGuids.Distinct().ToList(); foreach (var guid in listOfGuids) { MemberDisplayMessage mem = new MemberDisplayMessage(); mem.MemberId = guid; mess.Recipients.Add(mem); } listOfGroupIds = listOfGroupIds.Distinct().ToList(); foreach (var guid in listOfGroupIds) { mess.GroupIds.Add(guid); } Messages.CreateNewTextMessageForGroup(mess); return Redirect("~/messages/" + GroupOwnerTypeEnum.member.ToString() + "/" + model.OwnerId.ToString().Replace("-", "") + "?u=" + SiteMessagesEnum.ms.ToString()); } catch (Exception exception) { ErrorDatabaseManager.AddException(exception, exception.GetType()); } return Redirect("~/messages/" + GroupOwnerTypeEnum.member.ToString() + "/" + model.OwnerId.ToString().Replace("-", "") + "?u=" + SiteMessagesEnum.mns.ToString()); }
public ActionResult MessageNew(string type, string id) { MessageModel model = new MessageModel(); try { model.OwnerType = (GroupOwnerTypeEnum)Enum.Parse(typeof(GroupOwnerTypeEnum), type); model.OwnerId = new Guid(id); model.SendEmailForMessage = true; if (model.OwnerType == GroupOwnerTypeEnum.member) model.Recipients = Messages.GetConnectedMembersOfMember(new Guid(id)); else if (model.OwnerType == GroupOwnerTypeEnum.shop) { model.Recipients = Messages.GetConnectedShopRecipient(new Guid(id)); model.Title = "Shop Message: "; } else if (model.OwnerType == GroupOwnerTypeEnum.jobboard) { var mem = MemberCache.GetMemberDisplay(model.OwnerId); model.Recipients = new List<MemberDisplayBasic>(); model.Recipients.Add(mem); model.Title = "Jobs: "; } else if (model.OwnerType == GroupOwnerTypeEnum.officiating) { var mem = MemberCache.GetMemberDisplay(model.OwnerId); model.Recipients = new List<MemberDisplayBasic>(); model.Recipients.Add(mem); model.Title = "Officiating: "; } else if (model.OwnerType == GroupOwnerTypeEnum.league) { model.Recipients = Messages.GetConnectedLeagueRecipient(new Guid(id)); model.Title = "League Message: "; } else if (model.OwnerType == GroupOwnerTypeEnum.paywall) { model.Recipients = Messages.GetConnectedShopRecipient(new Guid(id)); model.Title = "Paywall Message: "; } else if (model.OwnerType == GroupOwnerTypeEnum.calevent) { model.Recipients = Messages.GetConnectedCalEventRecipient(new Guid(id)); model.Title = "Public Event: "; } else model.Recipients = Messages.GetConnectedMembersOfGroup(new Guid(id)); } catch (Exception exception) { ErrorDatabaseManager.AddException(exception, exception.GetType()); } return View(model); }