public static void DeleteAltEmail(string id) { if (!UserSession.CurrentUser.IsSystemAdmin) { return; } EMailAlternateInbound.DeleteFromDB(UserSession.LoginUser, new Guid(id)); }
public static string GetEMailAlternateInboundItem(RestCommand command, int systemEMailID) { EMailAlternateInboundItem eMailAlternateInboundItem = EMailAlternateInbound.GetEMailAlternateInboundItem(command.LoginUser, systemEMailID); if (eMailAlternateInboundItem.OrganizationID != command.Organization.OrganizationID) { throw new RestException(HttpStatusCode.Unauthorized); } return(eMailAlternateInboundItem.GetXml("EMailAlternateInboundItem", true)); }
public static string GetEMailAlternateInbound(RestCommand command) { EMailAlternateInbound eMailAlternateInbound = new EMailAlternateInbound(command.LoginUser); eMailAlternateInbound.LoadByOrganizationID(command.Organization.OrganizationID); if (command.Format == RestFormat.XML) { return(eMailAlternateInbound.GetXml("EMailAlternateInbound", "EMailAlternateInboundItem", true, command.Filters)); } else { throw new RestException(HttpStatusCode.BadRequest, "Invalid data format"); } }
public static void SaveAltEmail(string id, string description, int?groupID, int?ticketTypeID, int?productID, string sendingEmailAddress) { if (!UserSession.CurrentUser.IsSystemAdmin) { return; } EMailAlternateInboundItem item = id != null?EMailAlternateInbound.GetItem(UserSession.LoginUser, new Guid(id)) : (new EMailAlternateInbound(UserSession.LoginUser)).AddNewEMailAlternateInboundItem(); item.OrganizationID = UserSession.LoginUser.OrganizationID; item.Description = description; item.GroupToAssign = groupID < 0 ? null : groupID; item.DefaultTicketType = ticketTypeID < 0 ? null : ticketTypeID; item.ProductID = productID < 0 ? null : productID; item.SendingEMailAddress = sendingEmailAddress; item.Collection.Save(); }
public static AltEmail GetAltEmail(Guid id) { EMailAlternateInboundItem item = EMailAlternateInbound.GetItem(UserSession.LoginUser, id); AltEmail result = new AltEmail(); result.Email = item.SystemEMailID.ToString(); result.Description = item.Description ?? ""; result.GroupID = item.GroupToAssign == null ? -1 : item.GroupToAssign; result.TicketTypeID = item.DefaultTicketType == null ? -1 : item.DefaultTicketType; result.ProductID = item.ProductID == null ? -1 : item.ProductID; result.Product = item.Row["ProductName"].ToString(); result.Group = item.Row["GroupName"].ToString(); result.TicketType = item.Row["TicketTypeName"].ToString(); result.SendingEmailAddress = item.Row["SendingEMailAddress"].ToString(); return(result); }
public static AltEmail[] GetAltEmails() { EMailAlternateInbound items = new EMailAlternateInbound(UserSession.LoginUser); items.LoadByOrganizationID(UserSession.LoginUser.OrganizationID); List <AltEmail> result = new List <AltEmail>(); foreach (EMailAlternateInboundItem item in items) { AltEmail altEmail = new AltEmail(); altEmail.Email = item.SystemEMailID.ToString(); altEmail.Description = item.Description ?? ""; altEmail.GroupID = item.GroupToAssign == null ? -1 : item.GroupToAssign; altEmail.TicketTypeID = item.DefaultTicketType == null ? -1 : item.DefaultTicketType; altEmail.ProductID = item.ProductID == null ? -1 : item.ProductID; altEmail.Product = item.Row["ProductName"].ToString(); altEmail.Group = item.Row["GroupName"].ToString(); altEmail.TicketType = item.Row["TicketTypeName"].ToString(); altEmail.SendingEmailAddress = item.Row["SendingEMailAddress"].ToString(); result.Add(altEmail); } return(result.ToArray()); }