public ActionResult ListSupportTicket(GridCommand command, TransactionModel model)
        {
            var      gridModel      = new GridModel <SupportRequestModel>();
            DateTime?startDateValue = (model.StartDate == null) ? null : model.StartDate;
            DateTime?endDateValue   = (model.EndDate == null) ? null : model.EndDate;
            bool     status         = true;
            var      ticksts        = _adCampaignService.GetSupportRequest(status, model.CustomerId, command.Page - 1, command.PageSize);

            gridModel.Data = ticksts.Select(x =>
            {
                var transModel = new SupportRequestModel
                {
                    Id          = x.Id,
                    Subject     = x.Subject,
                    Message     = x.Message,
                    CreatedDate = x.CreatedDate,
                    Name        = x.Name,
                    CustomerId  = x.CustomerId,
                    LastReplied = x.LastReplied,
                    Status      = x.Status,
                    Email       = x.Customer.Email
                };

                return(transModel);
            });

            gridModel.Total = ticksts.TotalCount;

            return(new JsonResult
            {
                Data = gridModel
            });
        }
        public ActionResult ListTicket()
        {
            var model = new SupportRequestModel();

            model.GridPageSize = _adminAreaSettings.GridPageSize;
            return(View(model));
        }
Пример #3
0
 public ActionResult SendSupportRequest(SupportRequestModel m)
 {
     if (!SupportRequestModel.CanSupport)
     {
         return(Content("Support not available!"));
     }
     m.SendSupportRequest();
     return(Content("OK"));
 }
Пример #4
0
        public async Task <HttpResponseMessage> Post([FromBody] SupportRequestModel model)
        {
            HttpResponseMessage responseMessage = null;

            if (model == null || string.IsNullOrWhiteSpace(model.Email) || string.IsNullOrWhiteSpace(model.FullName) || string.IsNullOrWhiteSpace(model.AssistanceWith))
            {
                responseMessage         = new HttpResponseMessage(HttpStatusCode.BadRequest);
                responseMessage.Content = new StringContent("Enter all the required fields.");
                return(responseMessage);
            }

            if (!User.Identity.IsAuthenticated)
            {
                responseMessage         = new HttpResponseMessage(HttpStatusCode.Forbidden);
                responseMessage.Content = new StringContent("You need to log in to perform this operation.");
                return(responseMessage);
            }

            ClaimsPrincipal cp        = User as ClaimsPrincipal;
            Claim           nameClaim = cp.Claims.Where(x => x.Type == ClaimTypes.Name).FirstOrDefault();
            string          name      = string.Empty;

            if (nameClaim != null)
            {
                name = nameClaim.Value;
            }

            EmailInfo info = new EmailInfo
            {
                Category        = "EarnByMicrosoft Support",
                From            = model.Email,
                FromDisplayName = name,
                Subject         = model.AssistanceWith,
                HtmlBody        = model.ToString(),
                To = new List <string>
                {
                    "*****@*****.**"
                }
            };

            try
            {
                await EmailService.SendEmail(info);

                responseMessage         = new HttpResponseMessage(HttpStatusCode.OK);
                responseMessage.Content = new StringContent("Your request has been submitted successfully");
                return(await Task.FromResult <HttpResponseMessage>(responseMessage));
            }
            catch
            {
            }

            responseMessage         = new HttpResponseMessage(HttpStatusCode.InternalServerError);
            responseMessage.Content = new StringContent("An error occured sending the request. Retry later. If the issue persists, email [email protected]");
            return(await Task.FromResult <HttpResponseMessage>(responseMessage));
        }
Пример #5
0
        private string SubmitJiraSupportRequest(SupportRequestModel model)
        {
            var    currentUser = CheckPoint.Instance.IsAuthenticated ? CheckPoint.Instance.GetUser(this.tdb) : null;
            string reporter    = string.Empty;

            if (currentUser != null)
            {
                reporter = currentUser.Email;
            }
            else if (!string.IsNullOrEmpty(model.Email))
            {
                reporter = model.Email;
            }

            try
            {
                var priorityConfig = JiraSection.GetSection().Priorities[model.Priority];
                var typeConfig     = JiraSection.GetSection().Types[model.Type];

                if (priorityConfig == null)
                {
                    throw new Exception("Cannot find a configured JIRA priority mapping for " + model.Priority);
                }

                if (typeConfig == null)
                {
                    throw new Exception("Cannot find a configured JIRA type mapping for " + model.Type);
                }

                string issueTypeId = typeConfig.Id;

                if (string.IsNullOrEmpty(issueTypeId))
                {
                    issueTypeId = AppSettings.DefaultJiraTaskType;
                }

                JIRAIssueData issueData = new JIRAIssueData();
                issueData.project     = AppSettings.JiraProject;
                issueData.type        = issueTypeId;
                issueData.summary     = model.Summary;
                issueData.description = model.Details;
                issueData.reporter    = reporter;
                issueData.priority    = priorityConfig.Id;

                return(this.SubmitJIRAIssue(issueData, TRIFOLIA_SUPPORT_LABEL));
            }
            catch (Exception submitException)
            {
                Log.For(this).Error("Failed to submit JIRA support request", submitException);
                throw new Exception("Could not submit JIRA support request. Please notify the administrator.");
            }
        }
Пример #6
0
        private string EmailSupportRequest(SupportRequestModel model)
        {
            if (string.IsNullOrEmpty(AppSettings.MailFromAddress))
            {
                throw new Exception("MailFromAddress is not configured.");
            }

            if (string.IsNullOrEmpty(AppSettings.SupportEmailTo))
            {
                throw new Exception("SupportEmailTo is not configured");
            }

            var client = new SmtpClient(AppSettings.MailHost, AppSettings.MailPort)
            {
                Credentials = new NetworkCredential(AppSettings.MailUser, AppSettings.MailPassword),
                Port        = AppSettings.MailPort,
                EnableSsl   = AppSettings.MailEnableSSL
            };

            var    currentUser = CheckPoint.Instance.IsAuthenticated ? CheckPoint.Instance.GetUser(this.tdb) : null;
            string byName      = currentUser != null?string.Format("{0} {1}", currentUser.FirstName, currentUser.LastName) : model.Name;

            string byEmail = currentUser != null ? currentUser.Email : model.Email;

            string lBody = string.Format("Issue Type: {0}\nIssue Priority: {1}\nDetails: {2}\nSubmitted By: {3} ({4})",
                                         model.Type,
                                         model.Priority,
                                         model.Details,
                                         byName,
                                         byEmail);

            string lSubject = string.Format("Trifolia Support: {0}", model.Summary);

            try
            {
                string emailTo = !string.IsNullOrEmpty(AppSettings.DebugMailTo) ? AppSettings.DebugMailTo : AppSettings.SupportEmailTo;
                client.Send(
                    AppSettings.MailFromAddress,
                    emailTo,
                    lSubject,
                    lBody);

                return("Email sent");
            }
            catch (Exception ex)
            {
                Log.For(this).Error("Error sending support request email", ex);
                throw ex;
            }
        }
Пример #7
0
        public string SubmitSupportRequest(SupportRequestModel model)
        {
            var supportType = GetPreferredSupportType();

            if (supportType == SupportTypes.JIRA)
            {
                return(SubmitJiraSupportRequest(model));
            }
            else if (supportType == SupportTypes.EMAIL)
            {
                return(EmailSupportRequest(model));
            }
            else
            {
                Log.For(this).Warn("User attempted to send support request via incorrect method (" + supportType.ToString() + ")");
                throw new Exception("Cannot submit support request (support method is invalid)");
            }
        }
Пример #8
0
        public string SubmitSupportRequest(SupportRequestModel model)
        {
            if (!AppSettings.EnableJiraSupport)
            {
                if (string.IsNullOrEmpty(AppSettings.MailFromAddress))
                {
                    throw new Exception("MailFromAddress is not configured.");
                }

                if (string.IsNullOrEmpty(AppSettings.SupportEmailTo))
                {
                    throw new Exception("SupportEmailTo is not configured");
                }

                var client = new SmtpClient(AppSettings.MailHost, AppSettings.MailPort)
                {
                    Credentials = new NetworkCredential(AppSettings.MailUser, AppSettings.MailPassword),
                    Port        = AppSettings.MailPort,
                    EnableSsl   = AppSettings.MailEnableSSL
                };

                string lBody = string.Format("Issue Type: {0}\nIssue Priority: {1}\nDetails: {2}\nSubmitted By: {3} ({4})",
                                             model.Type,
                                             model.Priority,
                                             model.Details,
                                             CheckPoint.Instance.UserFullName,
                                             CheckPoint.Instance.UserName);

                string lSubject = string.Format("Trifolia Support: {0}", model.Summary);

                try
                {
                    client.Send(
                        AppSettings.MailFromAddress,
                        AppSettings.SupportEmailTo,
                        lSubject,
                        lBody);

                    return("Email sent");
                }
                catch (Exception ex)
                {
                    Log.For(this).Error("Error sending support request email", ex);
                    throw ex;
                }
            }
            //Send a JIRA ticket
            else
            {
                JIRAProxy lProxy    = new JIRAProxy();
                string    lUserName = string.Empty;

                if (this.User.Identity.IsAuthenticated)
                {
                    lUserName = this.User.Identity.Name;
                }
                else
                {
                    lUserName = model.Name + "; " + model.Email;
                }

                try
                {
                    var priorityConfig = JiraSection.GetSection().Priorities[model.Priority];
                    var typeConfig     = JiraSection.GetSection().Types[model.Type];

                    if (priorityConfig == null)
                    {
                        throw new Exception("Cannot find a configured JIRA priority mapping for " + model.Priority);
                    }

                    if (typeConfig == null)
                    {
                        throw new Exception("Cannot find a configured JIRA type mapping for " + model.Type);
                    }

                    return(lProxy.SubmitSupportTicket(lUserName, model.Summary, model.Details, priorityConfig.Id, typeConfig.Id));
                }
                catch (Exception submitException)
                {
                    Log.For(this).Error("Failed to submit JIRA beta user application", submitException);
                    throw new Exception("Could not submit beta user application.  Please notify the administrator");
                }
            }
        }