public IActionResult Details(int id) { InquiryVM = new InquiryVM { InquiryHeader = _inqHRepo.FirstOrDefault(x => x.Id == id), InquiryDetails = _inqDRepo.GetAll(x => x.InquiryHeaderId == id, includeProperies: "Product") }; return(View(InquiryVM)); }
public IActionResult Details(int id) { InquiryVM = new InquiryVM() { InquiryHeader = _inquiryHeader.FirstOrDefault(u => u.Id == id), InquiryDetails = _inquiryDetails.GetAll(u => u.InquiryHeaderId == id, includeProperties: "Product") }; return(View(InquiryVM)); }
public ActionResult Index() { //IEnumerable<DialogDTO> dialogDTOs = inquiryService.GetDialogs(); //var mapper = new MapperConfiguration(cfg => cfg.CreateMap<DialogDTO, DialogVM>()).CreateMapper(); //var dialogs = mapper.Map<IEnumerable<DialogDTO>, List<DialogVM>>(dialogDTOs); //return View(dialogs); InquiryVM inquiryVM = new InquiryVM(); return(View(inquiryVM)); }
// GET: Admin public ActionResult Index() { var inquiryVMs = new List <InquiryVM>(); using (var db = new NoPorscheInsuranceDBEntities()) { foreach (Inquiry i in db.Inquiries) { var iVM = new InquiryVM(i); inquiryVMs.Add(iVM); } } return(View(inquiryVMs)); }
public ActionResult PutInquiry(InquiryVM inquiryVM) { try { Mapper.Initialize(cfg => cfg.CreateMap <InquiryVM, InquiryDTO>()); var inquiryDTO = Mapper.Map <InquiryVM, InquiryDTO>(inquiryVM); inquiryService.SaveInquiry(inquiryDTO); return(Content("<h2>Ваш запрос принят в работу. Ответ будет выслан на указанный e-mail.</h2>")); } catch (ValidationException ex) { ModelState.AddModelError(ex.Property, ex.Message); } return(View(inquiryVM)); }
public ActionResult PutInquiry(int?id) { try { DialogDTO dialog = inquiryService.GetDialog(id); var request = new InquiryVM { Id = dialog.Id }; return(View(request)); } catch (ValidationException ex) { return(Content(ex.Message)); } }
public ActionResult SampleRequest(int?ReportID) { InquiryVM Enquiredata = new InquiryVM(); if (ReportID > 0) { var Reports = (from l in db.ReportMasters where l.ReportId == ReportID select new { l.ReportUrl, l.ReportTitle } ).FirstOrDefault(); Enquiredata.ReportTitle = Reports.ReportTitle.ToString(); Enquiredata.ReportUrl = Reports.ReportUrl.ToString(); } else { Enquiredata.ReportTitle = "!"; Enquiredata.ReportUrl = "!"; } //if (FormType == "SampleRequestForm") //{ // ViewBag.FormTitle = "<b>Please fill your details below, to receive sample report:</b><div style='font-size:15px;width:100%;'><label style='color:red; display:inline;'>*</label> Indicates required fields</div>"; //} //else //{ // ViewBag.FormTitle = "<b>Please submit the below form, to get more about this report:</b><div style='font-size:15px;width:100%;'><label style='color:red; display:inline;'>*</label> Indicates required fields</div>"; //} ViewBag.FormTitle = "<b>Please submit the form will contact you within 24 hours. :</b><div style='font-size:15px;width:100%;'><label style='color:red; display:inline;'>*</label> Indicates required fields</div>"; Session["Captcha"] = DrawCaptcha(); var PlainText = Session["Captcha"].ToString(); var EncryCaptcha = ExcellentMarketResearch.Areas.Admin.Models.Common.Encrypt(PlainText); Enquiredata.RealCaptcha = EncryCaptcha; Enquiredata.ReportId = ReportID ?? 0; Enquiredata.FormType = "SampleRequestForm"; return(PartialView(Enquiredata)); }
public ActionResult SubmitCoverageApplication(Inquiry inquiry) { // Validate Object - Fail if invalid if (inquiry.Valid() == false) { return(RedirectToAction("Index")); // I don't pass inquiry back in, so we just erase everything they entered. Nice. } // With some HTML, I could actually prevent this. ...I might add this feature. // Calculate quote inquiry.Quote = calculateQuote(inquiry); //Post to DB using (var db = new NoPorscheInsuranceDBEntities()) { db.Inquiries.Add(inquiry); db.SaveChanges(); } // Return success screen var inquiryVM = new InquiryVM(inquiry); return(RedirectToAction("Quote", inquiryVM)); }
public ActionResult InquiryForm(InquiryVM eq) { Emailsending objEmailsending = new Emailsending(); var response = Request["g-recaptcha-response"]; var catptchastatus = false; string secreatekey = "6LdU_nUUAAAAAD6JiuKTysnVW6Aa4D5SU0z1Fl4u"; var client = new WebClient(); string resstring = string.Format("https://www.google.com/recaptcha/api/siteverify?secret={0}&response={1}", secreatekey, response); var result = client.DownloadString(resstring); if (result.ToLower().Contains("false")) { catptchastatus = false; } else { catptchastatus = true; } // ViewBag.Message = status ? "Google recaptcha validation success" : "Google recaptcha validation fails"; CustomerInquiry e = new CustomerInquiry(); var Formname = string.Empty; int FormTypeId; string Publisher = string.Empty; if (catptchastatus == true) { if (ModelState.IsValid) { // cap = Session["Captcha"].ToString(); cap = ExcellentMarketResearch.Areas.Admin.Models.Common.Decrypt(eq.RealCaptcha); if (eq.ReportId > 0) { var Publish = (from l in db.ReportMasters join p in db.PublisherMasters on l.PublishereId equals p.PublisherId where l.ReportId == eq.ReportId select p).FirstOrDefault(); Publisher = Publish.PublisherName; } else { Publisher = "!"; } //if (eq.CaptchaCode == cap) //{ CustomerInquiry cst = new CustomerInquiry(); var IpAddress = ExcellentMarketResearch.Models.PaymentGateway.IPAddress.GetIPAddress(); cst.Company = eq.Company; cst.Country = eq.Country; cst.CustomerMessage = eq.CustomerMessage; cst.Designation = eq.Designation; cst.EmailId = eq.EmailId; cst.Name = eq.Name; eq.AreaCode += "-" + eq.PhoneNumber; cst.PhoneNumber = eq.AreaCode; cst.ReportId = eq.ReportId; cst.CaptchaCode = eq.CaptchaCode; cst.FormType = eq.FormType; cst.CaptchaCode = "121321"; if (eq.FormType == "InquiryForm") { Formname = "Inquiry"; FormTypeId = 1; } else if (eq.FormType == "SampleRequestForm") { Formname = "Request Sample"; FormTypeId = 2; } else if (eq.FormType == "ContactUs") { FormTypeId = 4; } else { // Checkout page FormTypeId = 3; } try { db.CustomerInquiries.Add(cst); //db.Entry(cst).State = EntityState.Added; db.SaveChanges(); // QYGroupRepository.PaymentGateway.Emailsending objEmailsending = new QYGroupRepository.PaymentGateway.Emailsending(); // string ipAddress = QYGroupRepository.PaymentGateway.IPAddress.GetIPAddress(); // Task.Run(() => new CRMWebService.WebServiceSoapClient().InsertUpdateKey(0, eq.ReportId, eq.ReportTitle, FormTypeId, 34, 1, 1, eq.ReportUrl, ipAddress, eq.Name, eq.EmailId, eq.AreaCode, eq.Company, eq.Designation, "!", "!", eq.Country, "!", eq.CustomerMessage, 1, "!", "!", "!", Publisher, 38, "BW&Zk^HfZ44P339nEzqrrawY4HL_VXw-5f+%8b4Hdw?$?m$G*!+kCGLK%3JjDn-74NY*LyhdJr6RAte&8MBWy6F2j82+qn7ap&DB@z-*q3sdH*#D-kwACucyaM7vzet4pSa?m^xnP@3zN5K9=*L6WLpDurTSuVTR3Hd&3XLHJnCcR!h*dL#fQhp^*#25LEFrMTt@z&8RWdf^CQcj!QrQU^WkdC5$Ub$8qnu!g7?*$$4%%M9?8spAugyCzZg5@dLGBNS_^7?x3VczR75J&=+9yFDVg*Qpd@R^_Jz-GtWgHxv4Kf$=2pxT@bqhx%aqgzZAN6RzZZ%rNX7km3fu$h?Z=+V3b_MQPLAxJBVT!=Ta+7Xd?CF3#4w44L@HU%nf4m#y-d2vgn6Gp2t7w!qFY%kN#y6DNAy#TbrZnqnjMtgeAd%BHSm9H29z4G_?qnBHE5J2EyutZ2RSh?P2fUE-sF8bNFdre@G^qQ??JzJuDCT3hby2py#+yfg*jC%&YBkrutHs")); //Auto Mailer Task.Run(() => objEmailsending.SendEmail("*****@*****.**", "Sales", cst.EmailId, "", "*****@*****.**", "excellentmarketresearch.com : " + eq.ReportTitle, objEmailsending.GenerateMailBody_RequestSample_AutoReply(cst.Name, eq.ReportTitle))); //To company // Task.Run(() => objEmailsending.SendEmail("*****@*****.**", "Sales", "*****@*****.**", "", "", "ExcellentMarketResearch.com" + " : " + Formname,objEmailsending.GenerateMailBody_RequestSample(eq.ReportTitle, cst.Name, cst.EmailId, cst.PhoneNumber, cst.Company, cst.Country, cst.Designation, cst.CustomerMessage))); Task.Run(() => objEmailsending.SendEmail("*****@*****.**", "Sales", "*****@*****.**", "", "", "excellentMarketResearch.com" + " : " + Formname, objEmailsending.GenerateMailBody_RequestSample(eq.ReportTitle, cst.Name, cst.EmailId, cst.PhoneNumber, cst.Company, cst.Country, cst.Designation, cst.CustomerMessage, IpAddress))); Session["Name"] = cst.Name; return(RedirectToAction("Index", "InquiryForm", new { reporrtid = cst.ReportId })); } catch (DbEntityValidationException dbEx) { foreach (var validationErrors in dbEx.EntityValidationErrors) { foreach (var validationError in validationErrors.ValidationErrors) { System.Console.WriteLine("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage); } } } //} //Return the if model not valid return(View(eq)); } return(View(eq)); } return(View(eq)); }
public ActionResult Quote(InquiryVM inquiryVM) { return(View(inquiryVM)); }
public ActionResult Index(ContactUsVM eq) { InquiryVM e = new InquiryVM(); Emailsending objEmailsending = new Emailsending(); var response = Request["g-recaptcha-response"]; var catptchastatus = false; string secreatekey = "6LdU_nUUAAAAAD6JiuKTysnVW6Aa4D5SU0z1Fl4u"; var client = new WebClient(); string resstring = string.Format("https://www.google.com/recaptcha/api/siteverify?secret={0}&response={1}", secreatekey, response); var result = client.DownloadString(resstring); if (result.ToLower().Contains("false")) { catptchastatus = false; } else { catptchastatus = true; } //int FormTypeId=4; string Publisher = string.Empty; if (catptchastatus) { if (ModelState.IsValid) { // cap = Session["Captcha"].ToString(); var cap = ExcellentMarketResearch.Areas.Admin.Models.Common.Decrypt(eq.RealCaptcha); Publisher = "!"; if (eq.CaptchaCode == cap) { CustomerInquiry cst = new CustomerInquiry(); cst.CustomerMessage = eq.CustomerMessage; cst.EmailId = eq.EmailId; cst.Name = eq.Name; // eq.AreaCode += "-" + eq.PhoneNumber; cst.PhoneNumber = eq.PhoneNumber; cst.ReportId = eq.ReportId; cst.Country = eq.Country; cst.CaptchaCode = eq.CaptchaCode; string ReportTitle = string.Empty; string ReportUrl = string.Empty; try { db.CustomerInquiries.Add(cst); //db.Entry(cst).State = EntityState.Added; db.SaveChanges(); // QYGroupRepository.PaymentGateway.Emailsending objEmailsending = new QYGroupRepository.PaymentGateway.Emailsending(); //Auto Mailer objEmailsending.SendEmail("*****@*****.**", "Sales", cst.EmailId, "", "", "ExcellentMarketResearch.com : ContactUs" + " ", GenerateMailBody_ContactUs_AutoReply(cst.Name, ReportTitle)); //To company objEmailsending.SendEmail("*****@*****.**", "Sales", "[email protected],", "", "*****@*****.**", "ExcellentMarketResearch.com " + " : " + "Contact Us", GenerateMailBody_ContactUs(ReportTitle, cst.Name, cst.EmailId, cst.PhoneNumber, "!", "!", "!", cst.CustomerMessage)); Session["Name"] = cst.Name; return(RedirectToAction("ContactusThanks", "ContactUs")); //return RedirectToRoute(new //{ // controller = "InquiryForm", // action = "Index", // reporrtid = cst.ReportId //}); } catch (DbEntityValidationException dbEx) { foreach (var validationErrors in dbEx.EntityValidationErrors) { foreach (var validationError in validationErrors.ValidationErrors) { System.Console.WriteLine("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage); } } } } //Return the if model not valid return(View()); } } return(View(eq)); }