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));
        }
Exemple #2
0
        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));
        }
Exemple #3
0
        public ActionResult CheckoutForm(BuyingVM ObjBuy)
        {
            //  var MailbodyMethodCall = new QYGroupRepository.PaymentGateway.Emailsending();

            if (ModelState.IsValid)
            {
                //string realCaptcha = Session["Captchacode"].ToString();
                string Publisher = string.Empty;
                if (ObjBuy.ReportId > 0)
                {
                    var publish = (from l in db.ReportMasters
                                   join p in db.PublisherMasters on l.PublishereId equals p.PublisherId
                                   where l.ReportId == ObjBuy.ReportId
                                   select p).FirstOrDefault();
                    Publisher = publish.PublisherName;
                }
                //if (ObjBuy.CaptchaCode == realCaptcha)
                //{
                //JavaScriptSerializer serializer = new JavaScriptSerializer();
                //var s = serializer.Serialize(Enquiredata);
                //BuyingInfo cst = serializer.Deserialize<BuyingInfo>(s);
                //CategoryMaster categorymaster = serializer.Deserialize<CategoryMaster>(s);

                ObjBuy.GuId      = System.Guid.NewGuid().ToString();
                ObjBuy.IPAddress = ExcellentMarketResearch.Models.PaymentGateway.IPAddress.GetIPAddress();


                BuyingInfo binfo = new BuyingInfo();

                binfo.Address         = ObjBuy.Address;
                binfo.Name            = ObjBuy.Name;
                binfo.AreaCode        = ObjBuy.AreaCode;
                binfo.CustomerMessage = ObjBuy.CustomerMessage;
                binfo.ReportTitle     = ObjBuy.ReportTitle;
                binfo.ReportUrl       = ObjBuy.ReportUrl;
                binfo.EmailId         = ObjBuy.EmailId;
                binfo.Company         = ObjBuy.Company;
                binfo.CaptchaCode     = "Systems";
                binfo.Country         = ObjBuy.Country;
                binfo.Designation     = ObjBuy.Designation;
                binfo.State           = ObjBuy.State;
                binfo.City            = ObjBuy.City;
                binfo.Price           = ObjBuy.Price;
                binfo.PhoneNumber     = ObjBuy.PhoneNumber;
                binfo.Type            = ObjBuy.Type;
                binfo.ReportId        = ObjBuy.ReportId;
                binfo.Zipcode         = ObjBuy.Zipcode;
                binfo.Paymentmode     = ObjBuy.Paymentmode;
                binfo.GuId            = ObjBuy.GuId;
                binfo.IPAddress       = ObjBuy.IPAddress;
                try
                {
                    db.BuyingInfoes.Add(binfo);
                    //  db.Entry(cst).State = EntityState.Added;
                    db.SaveChanges();

                    //The lead information goes to CRM here......
                    //  new CRMWebService.WebServiceSoapClient().InsertUpdateKey(0, ObjBuy.ReportId, ObjBuy.ReportTitle, 3, 34, 1, 1, ObjBuy.ReportUrl, QYGroupRepository.PaymentGateway.IPAddress.GetIPAddress(), ObjBuy.Name, ObjBuy.EmailId, ObjBuy.AreaCode, ObjBuy.Company, ObjBuy.Designation, "!", ObjBuy.State, ObjBuy.Country, ObjBuy.Zipcode, ObjBuy.CustomerMessage, 1, ObjBuy.GuId, "!", "!", 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");

                    if (ObjBuy.Paymentmode == "wireTransfer")
                    {
                        //Auto Mailer
                        //  objEmailsending.SendEmail("*****@*****.**", "Sales", ObjBuy.EmailId, "", "*****@*****.**", "Payment Initiated : " + ObjBuy.ReportTitle, MailbodyMethodCall.GenerateMailBody_PaymentInitiated_AutoReply(ObjBuy.ReportTitle, ObjBuy.Name));
                        //To company
                        //                            objEmailsending.SendEmail(ObjBuy.EmailId, ObjBuy.Name, "*****@*****.**", "", "[email protected],[email protected]", "xyz.com" + " : Payment Initiated(Wire Transfer)", MailbodyMethodCall.GenerateMailBody_PaymentInitiated(ObjBuy.ReportTitle, ObjBuy.Name, ObjBuy.EmailId, ObjBuy.PhoneNumber, ObjBuy.Company, "", "", ObjBuy.Country, ""));
                    }
                    else
                    {
                        //Auto Mailer
                        //                          objEmailsending.SendEmail("*****@*****.**", "Sales", ObjBuy.EmailId, "", "*****@*****.**", "Payment Initiated : " + ObjBuy.ReportTitle, GenerateMailBody_PaymentInitiated_AutoReply(ObjBuy.ReportTitle, ObjBuy.Name));

                        //To company
                        //                        objEmailsending.SendEmail(ObjBuy.EmailId, ObjBuy.Name, "*****@*****.**", "", "[email protected],[email protected]", "xyz.com" + " : Payment Initiated(pay pal )", GenerateMailBody_PaymentInitiated(ObjBuy.ReportTitle, ObjBuy.Name, ObjBuy.EmailId, ObjBuy.PhoneNumber, ObjBuy.Company, "", "", ObjBuy.Country, ""));

                        //Auto Mailer
                        Task.Run(() => objEmailsending.SendEmail("*****@*****.**", "Sales", ObjBuy.EmailId, "", "*****@*****.**", "excellentmarketresearch.com : (Payment Initiated )" + ObjBuy.ReportTitle, GenerateMailBody_PaymentInitiated_AutoReply(ObjBuy.ReportTitle, ObjBuy.Name)));

                        //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" + " : Payment Initiated(pay pal ) ", GenerateMailBody_PaymentInitiated(ObjBuy.ReportTitle, ObjBuy.Name, ObjBuy.EmailId, ObjBuy.PhoneNumber, ObjBuy.Company, "", "", ObjBuy.Country, "")));


                        //The paypalpage will appear to the user or buer ....
                        //Paypal._PayPal(ObjBuy);

                        //PaymentWithPaypal(ObjBuy, null);
                        //return RedirectToAction("PaymentWithPaypal", "ReportBuying", new {ObjBuy, Cancel = false });
                        //return RedirectToAction("PaymentWithPaypal");
                    }

                    //  return RedirectToAction("Index");
                }
                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);
                        }
                    }
                }
                Session["Name"] = ObjBuy.Name;
                return(Json(new
                {
                    msg = ObjBuy.GuId
                          //return RedirectToAction("Index", "InquiryForm", new { reportid = ObjBuy.ReportId });
                }));
                //}
                //else
                //{
                //    ModelState.AddModelError("", "Verification Code is Incorrect");
                //}
            }
            return(Json(new
            {
                msg = "Error"
                      //return RedirectToAction("Index", "InquiryForm", new { reportid = ObjBuy.ReportId });
            }));
        }