public async Task <IActionResult> Edit(int id, [Bind("Id,Problema,Detalle,Estado,ClienteId")] SupportModel supportModel)
        {
            if (id != supportModel.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(supportModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SupportModelExists(supportModel.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ClienteId"] = new SelectList(_context.Cliente, "Id", "Nombre", supportModel.ClienteId);
            return(View(supportModel));
        }
        public IList <SupportModel> GetListSupport(string status)
        {
            try
            {
                var datas        = new List <SupportModel>();
                var supportStore = new SupportStore();
                var dt           = supportStore.GetListSupport(status);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    var model = new SupportModel()
                    {
                        ID         = int.Parse(dt.Rows[i]["SUPPORT_ID"].ToString()),
                        TITLE      = dt.Rows[i]["SUPPORT_HOTEN"].ToString(),
                        CONTENT    = dt.Rows[i]["SUPPORT_CONTENT"].ToString(),
                        EMAIL      = dt.Rows[i]["SUPPORT_EMAIL"].ToString(),
                        STATUS     = dt.Rows[i]["SUPPORT_STATUS"].ToString().Trim() == "1",
                        FROM_EMAIL = dt.Rows[i]["FROM_EMAIL"].ToString(),
                        SDT        = dt.Rows[i]["SUPPORT_SDT"].ToString()
                    };
                    datas.Add(model);
                }
                return(datas);
            }

            catch (Exception)
            {
                return(null);
            }
        }
Beispiel #3
0
        public IActionResult Support(SupportModel model)
        {
            try
            {
                using (IDbConnection conn = Connection)
                {
                    var param = new DynamicParameters();
                    param.Add("@Details", model.Details);
                    param.Add("@Subject", model.Subject);
                    param.Add("@EmailAddress", model.EmailAddress);
                    param.Add("@Status", 1);
                    param.Add("@CreatedBy", model.CreatedBy);
                    param.Add("@CreatedDate", DateTime.Now);
                    param.Add("@IsActive", 1);

                    model = conn.Query <SupportModel>("sp_Tbl_Trx_SupportInsert", param,
                                                      commandType: CommandType.StoredProcedure).FirstOrDefault();
                }
                return(Json("OK"));
            }
            catch (Exception ex)
            {
                return(Json("Error"));

                throw ex;
            }
        }
        public IActionResult GetUpdateInfo(int id)
        {
            DataAccess.TASM_SUPPORT_Da manager = new DataAccess.TASM_SUPPORT_Da();
            SupportModel model = manager.SelectById(id);

            return(SuccessResult(model));
        }
Beispiel #5
0
        public ActionResult Support()
        {
            var model = new SupportModel();

            model = _commonModelFactory.PrepareSupportModel(model, false);
            return(View(model));
        }
Beispiel #6
0
        public bool Email(EmailModel emailModel)
        {
            var model = new SupportModel();

            //return Redirect("/");
            // return View(model);
            return(model.sendMail(emailModel));
        }
    protected void submit_Click(object sender, EventArgs e)
    {
        bool validForm = true;
        if (dropdownService.SelectedIndex == 0)
        {
            servicesError.Text = "Must select a service";
            validForm = false;
        }
        else
        {
            servicesError.Text = "";
        }
        if (!terms_checkbox.Checked)
        {
            checkboxError.Text = "Please accepts Terms and Conditions";
            validForm = false;
        }
        else
        {
            checkboxError.Text = "";
        }

        if (validForm)
        {
            var name = nameTextbox.Text;
            var email = emailTextBox.Text;
            var mobile = mobileTextbox.Text;
            var message = messageTextbox.Text;
            var service = dropdownService.SelectedValue;
            EmailModel emailModel = new EmailModel(email, mobile, name, message, service);
            SupportModel supportModel = new SupportModel();
            var emailSentSuccessfully = supportModel.sendMail(emailModel);
        }
       // if (emailSentSuccessfully)
       // {
           // emailTextBox.Visible = false;
           // mobileTextbox.Visible = false;
           // nameTextbox.Visible = false;
           // messageTextbox.Visible = false;
            //terms_checkbox.Visible = false;
         //   downloadLink.Visible = true;
            //termsAndCondition.Visible = false;
            //submitBtn.Visible = false;
            //configText.Visible = false;
          //  downloadLabel.Visible = true;
           // emailTitle.Visible = false;
           // nameTitle.Visible = false;
           // phoneNumberTitle.Visible = false;
           // messageTitle.Visible = false;
           // serviceLabel.Visible = false;
          //  dropdownService.Visible = false;
          //  CheckBoxRequired.Visible = false;
          //  MainHeader.Text = "Your request has been sent in! Sit back and relax! A representative will get in contact with you shortly, Expect a call to this number: " + mobileTextbox.Text;
          //  downloadLabel.Text = "Our agents to assist you soon. A link will be provided to allow agent to assist you once you receive a call \r\n.";

    //    }

    }
        public async Task <IActionResult> Create([Bind("Id,Problema,Detalle,Estado,ClienteId")] SupportModel supportModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(supportModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ClienteId"] = new SelectList(_context.Cliente, "Id", "Nombre", supportModel.ClienteId);
            return(View(supportModel));
        }
 public ActionResult Support(SupportModel model)
 {
     if (model.Recipient != null && !_RecipientOptions.Any(o => o.Id == model.Recipient))
     {
         ModelState.AddModelError("Recipient", "Must be a valid option");
     }
     if (!ModelState.IsValid)
     {
         return(this._SupportUnpostedView(model));
     }
     return(this.View("SupportPosted", new SupportPostedViewModel()));
 }
Beispiel #10
0
        // GET: SupportTickets
        public async Task <IActionResult> Index()
        {
            AppUser currentUser = await _userManager.FindByIdAsync(User.FindFirstValue(ClaimTypes.NameIdentifier));

            SupportModel viewModel = new SupportModel
            {
                Username      = currentUser.UserName,
                Email         = currentUser.Email,
                SupportTicket = new SupportTicket()
            };

            return(View(viewModel));
        }
Beispiel #11
0
        /// <summary>
        /// Prepare the contact us model
        /// </summary>
        /// <param name="model">Contact us model</param>
        /// <param name="excludeProperties">Whether to exclude populating of model properties from the entity</param>
        /// <returns>Contact us model</returns>
        public virtual SupportModel PrepareSupportModel(SupportModel model, bool excludeProperties)
        {
            if (model == null)
            {
                throw new ArgumentNullException(nameof(model));
            }

            if (!excludeProperties)
            {
                model.Email    = _workContext.CurrentCustomer.Email;
                model.FullName = _workContext.CurrentCustomer.GetFullName();
                model.Company  = _workContext.CurrentCustomer.BillingAddress.Company;
            }
            //model.SubjectEnabled = _commonSettings.SubjectFieldOnContactUsForm;
            model.DisplayCaptcha = _captchaSettings.Enabled && _captchaSettings.ShowOnContactUsPage;

            return(model);
        }
Beispiel #12
0
        public SupportModel SelectById(int sid)
        {
            string sql         = @"
SELECT T.*,
       TR.USER_ID   CREATORID,
       TR.USER_NAME CREATORNAME,
       TU.USER_ID   CONDUCTORID,
       TU.USER_NAME CONDUCTORNAME,
       TP.PID       PROJECTID,
       TP.NAME      PROJECTNAME,
       TP.CODE      PROJECTCODE,
       tm.name      MACHINENAME,
       tm.serial    MACHINESERIAL

  FROM TASM_SUPPORT T

  LEFT JOIN TASM_USER TR
    ON TR.USER_ID = T.CREATOR
  LEFT JOIN TASM_USER TU
    ON TU.USER_ID = T.CONDUCTOR
  LEFT JOIN TASM_PROJECT TP
    ON TP.PID = T.PROJECT
  left join tasm_machine tm
    on tm.mid = t.mid

WHERE 1=1  and t.SID=:sid

";
            var    configParms = new List <SugarParameter>();

            configParms.Add(new SugarParameter("sid", sid));


            SupportModel model = Db.SqlQueryable <SupportModel>(sql)
                                 .AddParameters(configParms)
                                 .First();

            return(model);
        }
Beispiel #13
0
        public async Task <ActionResult> SendSupportRequest(SupportModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View("Support", model));
            }

            if (!CryptopiaAuthenticationHelper.ValidateCaptcha())
            {
                ModelState.AddModelError("", Resources.Support.supportReCaptchaError);
                return(View("Support", model));
            }

            if (!await SendSystemEmailAsync(EmailTemplateType.SupportRequest, SystemEmailType.Email_System, model.Email, model.Subject, model.Message))
            {
                model.IsError = true;
                model.Result  = Resources.Support.supportFailedError;
                return(View("Support", model));
            }
            ModelState.Clear();
            return(View("Support", new SupportModel {
                Result = Resources.Support.supportSuccessMessage
            }));
        }
Beispiel #14
0
        public SupportModel GetSupportById(string id)
        {
            try
            {
                var supporttStore = new SupportStore();
                var dt            = supporttStore.GetSupportById(id);
                var model         = new SupportModel();
                if (dt.Rows.Count == 0)
                {
                    return(null);
                }
                model.ID     = int.Parse(dt.Rows[0]["SUPPORT_ID"].ToString());
                model.TITLE  = dt.Rows[0]["SUPPORT_HOTEN"].ToString();
                model.SDT    = dt.Rows[0]["SUPPORT_SDT"].ToString();
                model.STATUS = dt.Rows[0]["SUPPORT_STATUS"].ToString().Trim() == "1";
                model.EMAIL  = dt.Rows[0]["SUPPORT_EMAIL"].ToString();
                return(model);
            }

            catch (Exception)
            {
                return(null);
            }
        }
    protected void submit_Click(object sender, EventArgs e)
    {
        var name = nameTextbox.Text;
        var email = emailTextBox.Text;
        var mobile = mobileTextbox.Text;
        var message = messageTextBox.Text;
        var service = dropdownService.SelectedValue;
        EmailModel emailModel = new EmailModel(email, mobile, name, message, service);
        SupportModel supportModel = new SupportModel();
        var emailSentSuccessfully = supportModel.sendMail(emailModel);

        if (emailSentSuccessfully)
        {
            emailTextBox.Visible = false;
            mobileTextbox.Visible = false;
            nameTextbox.Visible = false;
            messageTextBox.Visible = false;
            terms_checkbox.Visible = false;
            downloadLink.Visible = true;
            termsAndCondition.Visible = false;
            submitBtn.Visible = false;
            configText.Visible = false;
            downloadLabel.Visible = true;
            emailTitle.Visible = false;
            nameTitle.Visible = false;
            phoneNumberTitle.Visible = false;
            messageTitle.Visible = false;
            serviceLabel.Visible = false;
            dropdownService.Visible = false;
            CheckBoxRequired.Visible = false;
            MainHeader.Text = "Your request has been sent in! Sit back and relax! A representative will get in contact with you shortly, Expect a call to this number: " + mobileTextbox.Text;
            downloadLabel.Text = "Our agents to assist you soon. A link will be provided to allow agent to assist you once you receive a call \r\n.";

        }
        
    }
Beispiel #16
0
        public IActionResult AddSupport(int ArticleId, [FromBody] SupportModel model)
        {
            try
            {
                Compte  compte  = _context.Comptes.Where(c => c.CompteId.Equals(model.CompteId)).FirstOrDefault();
                Article article = _context.Articles.Where(a => a.ArticleId.Equals(ArticleId)).FirstOrDefault();


                Support support = new Support(article)
                {
                    Objet        = model.Objet,
                    Description  = model.Description,
                    DateCreation = DateTime.Now,
                    Compte       = compte,
                };
                _context.Supports.Add(support);
                _context.SaveChanges();

                return(Ok());
            }
            catch (Exception) { }

            return(BadRequest());
        }
Beispiel #17
0
        public ActionResult Support(SupportModel Model)
        {
            //Save Support Form
            Support spt           = new Support();
            var     isSaveSuccess = true;

            if (isSaveSuccess)
            {
                spt.Name = Model.Name;
            }
            spt.Email             = Model.Email;
            spt.PhoneNo           = Model.PhoneNo;
            spt.Subject           = Model.Subject;
            spt.DescribeYourIssue = Model.DescribeYourIssue;
            dba.Supports.InsertOnSubmit(spt);
            dba.SubmitChanges();
            if (ModelState.IsValid)
            {
                try
                {
                    MailMessage mail   = new MailMessage();
                    SmtpClient  client = new SmtpClient();
                    mail.To.Add("*****@*****.**");
                    mail.From                    = new MailAddress("*****@*****.**");
                    client.Port                  = 587;
                    client.Host                  = "smtp.gmail.com";
                    client.EnableSsl             = true;
                    client.Timeout               = 10000;
                    client.DeliveryMethod        = SmtpDeliveryMethod.Network;
                    client.UseDefaultCredentials = false;
                    client.Credentials           = new System.Net.NetworkCredential("*****@*****.**", "testing@123");
                    mail.Subject                 = Model.Subject;
                    string msgbody = "";
                    msgbody = "Hi ";
                    string Template = "";
                    Template = "Templates/Support.html";
                    using (StreamReader reader = new StreamReader(Path.Combine(HttpRuntime.AppDomainAppPath, Template)))
                    {
                        msgbody = reader.ReadToEnd();
                        //Replace UserName and Other variables available in body Stream
                        msgbody = msgbody.Replace("{Name}", Model.Name);
                        msgbody = msgbody.Replace("{Email}", Model.Email);
                        msgbody = msgbody.Replace("{PhoneNo}", Model.PhoneNo);
                        msgbody = msgbody.Replace("{Subject}", Model.Subject);
                        msgbody = msgbody.Replace("{DescribeYourIssue}", Model.DescribeYourIssue);
                    }
                    mail.BodyEncoding    = System.Text.Encoding.UTF8;
                    mail.SubjectEncoding = System.Text.Encoding.UTF8;
                    System.Net.Mail.AlternateView plainView = System.Net.Mail.AlternateView.CreateAlternateViewFromString(System.Text.RegularExpressions.Regex.Replace(msgbody, @"<(.|\n)*?>", string.Empty), null, "text/plain");
                    System.Net.Mail.AlternateView htmlView  = System.Net.Mail.AlternateView.CreateAlternateViewFromString(msgbody, null, "text/html");
                    mail.AlternateViews.Add(plainView);
                    mail.AlternateViews.Add(htmlView);
                    mail.IsBodyHtml = true;
                    client.Send(mail);
                    ModelState.Clear();
                    ViewBag.Message = "Thank you for Contacting us ";
                }
                catch (Exception ex)
                {
                    ModelState.Clear();
                    ViewBag.Message = $" Sorry we are facing Problem here {ex.Message}";
                }
            }
            return(View());
        }
Beispiel #18
0
        public async Task <string> TroubleShootProblem(int supportId)
        {
            var model = new SupportModel();

            return(await model.retrieveSupportStringForId(supportId));
        }
 private ActionResult _SupportUnpostedView(SupportModel model)
 {
     return(this.View("SupportUnposted", new SupportUnpostedViewModel {
         RecipientOptions = _RecipientOptions
     }, model));
 }
Beispiel #20
0
        public virtual IActionResult SupportSend(SupportModel model, bool captchaValid)
        {
            //validate CAPTCHA
            if (_captchaSettings.Enabled && _captchaSettings.ShowOnContactUsPage && !captchaValid)
            {
                ModelState.AddModelError("", _captchaSettings.GetWrongCaptchaMessage(_localizationService));
            }

            model = _commonModelFactory.PrepareSupportModel(model, true);

            if (ModelState.IsValid)
            {
                //var subject = _commonSettings.SubjectFieldOnContactUsForm ? model.Subject : null;
                //var body = Core.Html.HtmlHelper.FormatText(model.Enquiry, false, true, false, false, false, false);

                //_workflowMessageService.SendContactUsMessage(_workContext.WorkingLanguage.Id,
                //    model.Email.Trim(), model.FullName, subject, body);

                var msgBody = "<b>Name: </b>" + model.FullName + "<br>";
                msgBody += "<b>Email: </b>" + model.Email + "<br>";
                msgBody += "<b>Phone: </b>" + model.Phone + "<br>";
                msgBody += "<b>Description: </b>" + model.Description + "<br>";
                msgBody += "<b>Copier: </b>" + model.Copier + "<br>";
                msgBody += "<b>Company: </b>" + model.Company + "<br>";
                msgBody += "<b>Accessory Model: </b>" + model.AccessoryModel + "<br>";
                msgBody += "<b>Location of Issue: </b>" + model.LocationOfIssue + "<br>";
                msgBody += "<b>Error Code: </b>" + model.ErrorCode + "<br>";
                msgBody += "<b>How Long Have You Had This Issue?: </b>" + model.HowLongHaveYouHadThisIssue + "<br>";
                msgBody += "<b>Parts/Supplies Affected: </b>" + model.PartsSuppliesAffected + "<br>";

                var senderAccount = _emailAccountService.GetEmailAccountById(_emailAccountSettings.DefaultEmailAccountId);

                var email = new QueuedEmail
                {
                    Priority              = QueuedEmailPriority.Low,
                    From                  = senderAccount.Email,
                    FromName              = senderAccount.DisplayName,
                    To                    = "*****@*****.**",
                    CC                    = "*****@*****.**",
                    Subject               = "Support Request",
                    Body                  = msgBody,
                    CreatedOnUtc          = DateTime.UtcNow,
                    EmailAccountId        = 1,
                    DontSendBeforeDateUtc = DateTime.UtcNow
                };

                if (model.Attachments != null && model.Attachments.Length > 0)
                {
                    //Assigning Unique Filename (Guid)
                    var myUniqueFileName = Convert.ToString(Guid.NewGuid());

                    //Getting file Extension
                    var FileExtension = Path.GetExtension(model.Attachments.FileName);

                    // concating  FileName + FileExtension
                    var newFileName = myUniqueFileName + FileExtension;

                    // Combines two strings into a path.
                    var fileName = Path.Combine(_hostingEnvironment.WebRootPath, "SupportPicture") + $@"\{newFileName}";

                    // if you want to store path of folder in database
                    var imagePath = "SupportPicture/" + newFileName;
                    //var tmp = HostingEnvironment.ApplicationPhysicalPath; // Server.MapPath("~");

                    using (var stream = new FileStream(fileName, FileMode.Create))
                    {
                        model.Attachments.CopyTo(stream);
                    }



                    email.AttachmentFileName = model.Attachments.FileName;
                    email.AttachmentFilePath = fileName;
                }


                _queuedEmailService.InsertQueuedEmail(email);



                model.SuccessfullySent = true;
                model.Result           = _localizationService.GetResource("Support.YourEnquiryHasBeenSent");

                //activity log
                _customerActivityService.InsertActivity("PublicStore.Support", _localizationService.GetResource("ActivityLog.PublicStore.Support"));

                return(View(model));
            }

            return(View(model));
        }