Exemplo n.º 1
0
        public IActionResult Support(Reward reward, int id)
        {
            var campaign = _context.Campaigns.Find(id);
            var rew      = _context.Rewards.Find(reward.RewardId);

            if (campaign.RemainSum <= reward.Price)
            {
                campaign.RemainSum = 0;
            }
            else
            {
                campaign.RemainSum -= reward.Price;
            }
            if (rew.Count > 0)
            {
                rew.Count--;
            }
            _context.SaveChanges();
            var supportVm = new SupportViewModel
            {
                Campaign = campaign,
                Rewards  = _context.Rewards.ToList()
            };

            return(View(supportVm));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Update([FromBody] SupportViewModel value)
        {
            if (ModelState.IsValid)
            {
                //
                var userId = Utilities.GetUserId(this.User);
                //
                var m = new Support
                {
                    SupportId   = Guid.NewGuid(),
                    SupportCode = Guid.NewGuid().ToString(),
                    SupportName = value.SupportName,
                    Title       = value.Title,
                    Phone       = value.Phone,
                    Email       = value.Email,
                    CreatedBy   = userId,
                    UpdatedBy   = userId,
                    CreatedDate = DateTime.Now,
                    UpdatedDate = DateTime.Now,
                    Note        = value.Note
                };

                var ret = await this._unitOfWork.Supports.Save(m, value.SupportId);

                //return client side
                return(Ok(ret));
            }

            return(BadRequest(ModelState));
        }
Exemplo n.º 3
0
        public async Task <ActionResult> Support(SupportViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            try
            {
                var client  = new HttpClient();
                var content =
                    new FormUrlEncodedContent(new[]
                {
                    new KeyValuePair <string, string>("EmailAddress", model.Email),
                    new KeyValuePair <string, string>("CompanyName", model.CompanyName)
                });
                await client.PostAsync("https://coderrapp.com/support/register/", content);

                return(Redirect(Url.GetNextWizardStep()));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                return(View(model));
            }
        }
Exemplo n.º 4
0
        public IActionResult Support(int id)
        {
            var supportVm = new SupportViewModel
            {
                Campaign = _context.Campaigns.Find(id),
                Rewards  = _context.Rewards.Where(x => x.CampaignId == id).ToList()
            };

            return(View(supportVm));
        }
Exemplo n.º 5
0
        public IActionResult Index(DlsSubApplication dlsSubApplication)
        {
            var model = new SupportViewModel(
                dlsSubApplication,
                SupportPage.Support,
                configuration.GetCurrentSystemBaseUrl()
                );

            return(View("Support", model));
        }
 public ActionResult Support(SupportViewModel model)
 {
     UserManager.EmailService.SendAsync(new Microsoft.AspNet.Identity.IdentityMessage
     {
         Subject     = model.Subject,
         Body        = model.Message,
         Destination = "*****@*****.**"
     });
     return(View());
 }
Exemplo n.º 7
0
        public ActionResult Support()
        {
            SupportViewModel supportModel = new SupportViewModel();

            if (User.Identity.IsAuthenticated)
            {
                supportModel.Name  = db.UserDetails.Find(User.Identity.GetUserId()).FullName;
                supportModel.Email = User.Identity.Name;
            }

            return(View(supportModel));
        }
Exemplo n.º 8
0
        public ActionResult Support(SupportViewModel svm)
        {
            if (!ModelState.IsValid)
            {
                if (User.Identity.IsAuthenticated)
                {
                    svm.Name  = db.UserDetails.Find(User.Identity.GetUserId()).FullName;
                    svm.Email = User.Identity.Name;
                }

                return(View(svm));
            }

            // Enforcing user info
            if (User.Identity.IsAuthenticated)
            {
                svm.Name  = db.UserDetails.Find(User.Identity.GetUserId()).FullName;
                svm.Email = User.Identity.Name;
            }

            // Building Message
            string message = $"<h1>New Message</h1><h3>From <a href=\"mailto:{svm.Email}\">{svm.Name}</a></h3><hr><h3>{svm.Subject}</h3><p>{svm.Message}</p>";

            MailMessage mm = new MailMessage("from", "to", svm.Subject, message)
            {
                IsBodyHtml = true,
                Priority   = MailPriority.High
            };

            mm.ReplyToList.Add(svm.Email);

            SmtpClient client = new SmtpClient("myserver")
            {
                Credentials = new NetworkCredential("username", "password")
            };

            try
            {
                client.Send(mm);
                //TempData["Demo"] = true;
            }
            catch (Exception ex)
            {
                // Didn't work. Send the error and give the inputs back.
                ViewBag.ContactError = $"<h4>Uh oh. An error occurred.</h4>Here's what happened:{ex.StackTrace}";
                return(View(svm));
            }

            // Runs if no issues
            TempData["SentMail"] = true;
            return(RedirectToAction("Support"));
        }
Exemplo n.º 9
0
        public IActionResult SupportByMoney(int id, int sum)
        {
            var campaign = _context.Campaigns.Find(id);

            campaign.RemainSum += sum;
            _context.SaveChanges();

            var supportVm = new SupportViewModel
            {
                Campaign = _context.Campaigns.Find(id),
                Rewards  = _context.Rewards.Where(x => x.CampaignId == id).ToList()
            };

            return(View("Support", supportVm));
        }
Exemplo n.º 10
0
        public IActionResult Support(SupportViewModel model)
        {
            if (model.Email.Contains("aol.com"))
            {
                ModelState.AddModelError("Email", "We don't support aol addresses");
            }

            if (ModelState.IsValid)
            {
                _mailservice.SendMail(_config["MailSettings:ToAddress"], model.Email, model.Name + " | " + model.Phone, model.Message);
                ModelState.Clear();
                ViewBag.UserMessage = "We got your message! We will contact you back.";
            }
            return(View());
        }
Exemplo n.º 11
0
        public ActionResult GetSupport()
        {
            SupportViewModel model = new SupportViewModel();

            if (sm.UserSession != null)
            {
                model.Name         = sm.UserSession.Person.Name;
                model.EmailAddress = sm.UserSession.Person.PersonEmail.FirstOrDefault().Value;
            }
            else
            {
                model.isMemnber = false;
            }

            return(PartialView("_SupportPopup", model));
        }
Exemplo n.º 12
0
        public ActionResult ConatactUs(SupportViewModel model)
        {
            if (ModelState.IsValid)
            {
                Dictionary <string, string> param = new Dictionary <string, string>();
                param.Add("NAME", $"{model.Name}");
                param.Add("MESSAGE", model.Message);
                param.Add("Emailaddress", model.EmailAddress);

                string html   = bgService.GetHtml(AppDomain.CurrentDomain.BaseDirectory + ConfigurationManager.AppSettings["mxTemplatePath"] + "tmpSupport.html", param);
                var    mxType = lookupDal.GetAllMailoutType().Where(x => x.Id == 5).FirstOrDefault();
                mxDAL.CheckMailoutParameters(param, mxType.Id);
                var res = emailService.EmailBySMTP(ConfigurationManager.AppSettings["Support_Email"], ConfigurationManager.AppSettings["SMTP_FROM"], html, $"{mxType.Subject} : {model.Subject}");
            }

            return(RedirectToAction("ThankYouForContactingUs", new { Name = model.Name, EmailAddress = model.EmailAddress }));
        }
Exemplo n.º 13
0
        public async Task <IActionResult> Support(SupportViewModel model)
        {
            var translate = new Translate();

            ViewBag.Translate = translate;

            if (ModelState.IsValid)
            {
                await emailMessageProvider.SendEmailAsync(
                    new MailAddress[] { new MailAddress("*****@*****.**") },
                    $"{translate.Get("SUPPORT.SUPPORT")} [id:{DateTime.Now.Ticks}]", model.Message.ToHtml(),
                    fromEmailAsCc : new MailAddress(model.Email));

                return(RedirectToAction("SupportConfirmation", Request.RouteCulture()));
            }

            return(View(model));
        }
        public IActionResult Index(string inquireDateValue = null)
        {
            if (string.IsNullOrEmpty(inquireDateValue))
            {
                inquireDateValue = DateTime.Today.Date.ToString("yyyy-MM-dd");
            }

            var url = "https://d1gifumbnf.execute-api.us-east-1.amazonaws.com/prod/engineers/" + inquireDateValue; // Obtain list of all Engineers

            var model = new SupportViewModel
            {
                SupportDate = Convert.ToDateTime(inquireDateValue)
            };

            using (var client = new HttpClient())
            {
                var apiResponse = client.GetAsync(url).Result;

                if (apiResponse.IsSuccessStatusCode)
                {
                    var responseContent = apiResponse.Content;

                    string json = responseContent.ReadAsStringAsync().Result;

                    try
                    {
                        model.AssignedEngineers = JsonConvert.DeserializeObject <List <Engineer> >(json);
                        return(View(model));
                    }
                    catch
                    {
                        return(View(new ErrorViewModel {
                            RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier, ErrorMessage = "Failed to retrieve a List of Engineers from the API."
                        }));
                    }
                }
                else
                {
                    return(View(new ErrorViewModel {
                        RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier, ErrorMessage = "Failed to retrieve a List of Engineers from the API."
                    }));
                }
            }
        }
Exemplo n.º 15
0
        public async Task <SupportViewModel> Get(Guid index)
        {
            var c = await this._unitOfWork.Supports.Get(index, userId);

            var datas = new SupportViewModel
            {
                SupportId   = c.SupportId,
                SupportCode = c.SupportCode,
                SupportName = c.SupportName,
                Title       = c.Title,
                Phone       = c.Phone,
                Email       = c.Email,
                CreateDate  = c.CreatedDate,
                BranchId    = c.BranchId,
                Note        = c.Note
            };

            return(datas);
        }
Exemplo n.º 16
0
        public ActionResult RaiseSupportQuery(SupportViewModel model)
        {
            string responseCode = "OK";
            var    person       = cDal.GetPersonByEmailAddress(model.EmailAddress);

            if (person.Id > 0)
            {
                var personLog = lookupDal.GetPersonLog(person.Id).Where(x => x.Description == "SUPPORT QUERY HAS BEEN RAISED").OrderByDescending(o => o.CreatedOn).GroupBy(g => g.CreatedOn);
                try
                {
                    Dictionary <string, string> param = new Dictionary <string, string>();
                    param.Add("NAME", $"{person.Name}");
                    param.Add("MESSAGE", model.Message);
                    param.Add("Emailaddress", model.EmailAddress);

                    string html   = bgService.GetHtml(AppDomain.CurrentDomain.BaseDirectory + ConfigurationManager.AppSettings["mxTemplatePath"] + "tmpSupport.html", param);
                    var    mxType = lookupDal.GetAllMailoutType().Where(x => x.Id == 5).FirstOrDefault();
                    mxDAL.CheckMailoutParameters(param, mxType.Id);

                    var res = emailService.EmailBySMTP(ConfigurationManager.AppSettings["Support_Email"], ConfigurationManager.AppSettings["SMTP_FROM"], html, mxType.Subject);

                    if (res.HasError)
                    {
                        sDal.LogMe("EMAILEXCEPTION", $"EMAIL EXCEPTION: {res.ErrorMessage}", person.Id);
                        responseCode = res.ErrorMessage;
                    }
                }
                catch (Exception ex)
                {
                    responseCode = ex.Message;
                }

                sDal.LogMe("TRACKING", "SUPPORT QUERY HAS BEEN RAISED", person.Id);
            }
            else
            {
                responseCode = "NF";
            }

            return(Json(new { Ok = responseCode }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 17
0
        public ShellViewModel(
            IServiceLocator serviceLocator,
            IDialogManager dialogManager,
            IEventAggregator events,
            Func <HearthStatsDbContext> dbContext,
            [ImportMany] IEnumerable <IFlyout> flyouts,
            [ImportMany] IEnumerable <ITab> tabs,
            [ImportMany] IEnumerable <IWindowCommand> windowCommands,
            [ImportMany] IEnumerable <ICommandBarItem> commandBarItems,
            UpdateViewModel updateViewModel,
            UserPreferences.UserPreferences userPreferences,
            TrayIconViewModel trayIcon,
            SettingsManager settingsManager,
            SupportViewModel supportViewModel)
        {
            this.dialogManager    = dialogManager;
            this.events           = events;
            this.dbContext        = dbContext;
            this.serviceLocator   = serviceLocator;
            this.tabs             = tabs;
            this.updateViewModel  = updateViewModel;
            this.userPreferences  = userPreferences;
            this.trayIcon         = trayIcon;
            this.settingsManager  = settingsManager;
            this.supportViewModel = supportViewModel;
            this.commandBarItems  = new BindableCollection <ICommandBarItem>(commandBarItems.OrderBy(x => x.Order));
            this.windowCommands   = new BindableCollection <IWindowCommand>(windowCommands.OrderByDescending(x => x.Order));
            this.flyouts          = new BindableCollection <IFlyout>(flyouts);

            this.DisplayName = "HearthstoneTracker.com";
            this.events.Subscribe(this);
            this.userPreferences.PropertyChanged += (sender, args) =>
            {
                if (args.PropertyName == "WindowState")
                {
                    WindowState = userPreferences.WindowState;
                }
            };
            this.WindowState      = UserPreferences.WindowState;
            this.PropertyChanged += ShellViewModel_PropertyChanged;
        }
Exemplo n.º 18
0
        public void Constructor_ExpectedValues()
        {
            // Setup
            var settings = new GuiCoreSettings
            {
                SupportHeader            = "Support",
                SupportText              = "Some text",
                SupportWebsiteAddressUrl = "www.test.nl",
                SupportPhoneNumber       = "012-3456789"
            };

            // Call
            var viewModel = new SupportViewModel(settings);

            // Assert
            Assert.IsInstanceOf <IBackstagePageViewModel>(viewModel);
            Assert.AreEqual(settings.SupportHeader, viewModel.SupportHeader);
            Assert.AreEqual(settings.SupportText, viewModel.SupportText);
            Assert.AreEqual(settings.SupportWebsiteAddressUrl, viewModel.SupportWebsiteAddressUrl);
            Assert.AreEqual(settings.SupportPhoneNumber, viewModel.SupportPhoneNumber);
        }
Exemplo n.º 19
0
 public IHttpActionResult AddSupportAssignee(SupportViewModel model)
 {
     _itService.AddSupportAssignee(model.ToServiceRequestModel());
     return(Ok());
 }
Exemplo n.º 20
0
        public ActionResult InviaSupportReq(SupportViewModel supportReq)
        {
            try
            {
                string body = $"<b>Nome e Cognome: </b> {supportReq.Nome} <br>";
                body += $"<b>Azienda: </b>{supportReq.Azienda} <br>";
                body += $"<b>Telefono: </b>{supportReq.Prefisso} {supportReq.Telefono}<br>";
                body += $"<b>Email: </b>{supportReq.Email}<br>";
                body += $"<b>Nome Macchina: </b>{supportReq.NomeMacchina} <br>";
                body += $"<b>Seriale: </b>{supportReq.Seriale} <br>";
                body += $"<b>Testo: </b>{supportReq.Testo} <br>";
                var message = new MailMessage(ApplicationSettingService.GetWebConfigKey("EmailFromAddress"),
                                              ApplicationSettingService.GetWebConfigKey("EmailSupportAddress"),
                                              "Richiesta di supporto LOLA", body);
                message.IsBodyHtml = true;

                //invio copia all'utente per ricevuta
                var message2 = new MailMessage(ApplicationSettingService.GetWebConfigKey("EmailFromAddress"),
                                               supportReq.Email,
                                               "Richiesta di supporto a LOLA inviata",
                                               "Hai inviato la seguente richiesta di supporto: <br>" + body);
                message2.IsBodyHtml = true;

                if (supportReq.File != null && supportReq.File.Length > 0 && supportReq.File[0] != null)
                {
                    if (supportReq.File[0].ContentLength > 3 * 1024 * 1024 ||
                        !(supportReq.File[0].FileName.ToLower().EndsWith(".jpg") ||
                          supportReq.File[0].FileName.ToLower().EndsWith(".jpeg") ||
                          supportReq.File[0].FileName.ToLower().EndsWith(".png") ||
                          supportReq.File[0].FileName.ToLower().EndsWith(".doc") ||
                          supportReq.File[0].FileName.ToLower().EndsWith(".docx")))
                    {
                        return(Json(new
                        {
                            result = false,
                            msg = Resource.FileNotValid
                        }, JsonRequestBehavior.AllowGet));
                    }

                    Attachment attachment = new Attachment(supportReq.File[0].InputStream, supportReq.File[0].FileName);
                    message.Attachments.Add(attachment);
                    message2.Attachments.Add(attachment);
                }
                EmailSender.SendEmail(message);
                EmailSender.SendEmail(message2);

                object returnObj = new
                {
                    result = true
                };

                return(Json(returnObj, JsonRequestBehavior.AllowGet));
            }
            catch (InvalidOperationException ex)
            {
                object returnObj = new
                {
                    result = false,
                    msg    = ex.Message
                };

                return(Json(returnObj, JsonRequestBehavior.AllowGet));
            }
        }
Exemplo n.º 21
0
        public async Task <IHttpActionResult> AddSupportAssignee(SupportViewModel model)
        {
            await WebApiService.Instance.PostAsync("it/incidentsupport/update", model);

            return(Ok());
        }