Ejemplo n.º 1
0
        public IHttpActionResult SaveContactUs(ContactUS objContactus)
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("Name", typeof(string));
            dt.Columns.Add("Email", typeof(string));
            dt.Columns.Add("Subject", typeof(string));
            dt.Columns.Add("Message", typeof(string));
            dt.Rows.Add(
                objContactus.Name,
                objContactus.Email,
                objContactus.Subject,
                objContactus.Message
                );
            try
            {
                using (SqlConnection con = new SqlConnection(sqlString.ToString()))
                {
                    using (SqlCommand cmd = new SqlCommand("saveContactUS", con))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@ContactUStbl", dt);
                        con.Open();
                        cmd.ExecuteNonQuery();
                    }
                }
            }
            catch (Exception ex)
            {
                return(Json("Failed" + ex.Message.ToString()));
            }
            return(Json("Success"));
        }
Ejemplo n.º 2
0
        public void SendEmail(ContactUS cu)
        {
            string emailContent = "";

            //var emailContent = string.Format(content, paymentInfo.InvoiceNumber, DateTime.Now.ToLongDateString(), DateTime.Now.ToLongTimeString()
            //    , Request.Form["firstname"]
            //    , Request.Form["email"]
            //    , Request.Form["phone"]
            //    , Request.Form["productinfo"]
            //    , Request.Form["mihpayid"]
            //    , Request.Form["txnid"]
            //    , Request.Form["MachineMac"]
            //    , paymentInfo.MachineIp
            //    , paymentInfo.Browser
            //    , Request.Form["status"]
            //    , Request.Form["error"] + " " + Request.Form["error_Message"]
            //    , paymentInfo.Amount,
            //    paymentInfo.Currency);

            emailContent  = "First Name: " + cu.FirstName;
            emailContent += "Last Name: " + cu.LastName;
            emailContent += "Email: " + cu.Email;
            emailContent += "Phone: " + cu.Phone;
            emailContent += "Company:" + cu.Company;
            emailContent += "ContactUs_Request:" + cu.ContactUs_Request;

            MailSend send = new MailSend();

            send.Send("title of email", emailContent);
        }
        Task CallWebservice(string Vin, short storeId, int mileage, string ddcuserid, string firstname, string lastname, string email, string phone)
        {
            return(Task.Factory.StartNew(() => {
                CreateAppraisalRequest apprrequest = new CreateAppraisalRequest();
                AppraisalResponse appresponse = new AppraisalResponse();

                apprrequest.VIN = Vin;
                apprrequest.StoreID = storeId;
                apprrequest.Mileage = mileage;
                apprrequest.DDCUserId = ddcuserid;
                apprrequest.FirstName = firstname;
                apprrequest.LastName = lastname;
                apprrequest.Phone = phone;
                apprrequest.Email = email;
                apprrequest.Is_Extrn_Customer = AppDelegate.appDelegate.IsCustomer;

                appresponse = ServiceFactory.getWebServiceHandle().CreateAppraisalKBB(apprrequest);
                ContactUS contactresponse = new ContactUS();
                contactresponse = ServiceFactory.getWebServiceHandle().GetContactUS();
                AppDelegate.appDelegate.Phone = contactresponse.Phone;
                AppDelegate.appDelegate.Email = contactresponse.EmailId;
                AppDelegate.appDelegate.Subject = contactresponse.Subject;
                AppDelegate.appDelegate.Body = contactresponse.Body;
                Console.WriteLine("vehicle id :: " + appresponse.VehicleID);

                if (null != appresponse.VIN)
                {
                    InvokeOnMainThread(() =>
                    {
                        Utility.HideLoadingIndicator(this.View);
                        AppDelegate.appDelegate.IsInfoSaved = false;
                        AppDelegate.appDelegate.IsFactorySaved = false;
                        AppDelegate.appDelegate.IsAftermarketSaved = false;
                        AppDelegate.appDelegate.IsHistorySaved = false;
                        AppDelegate.appDelegate.IsReconditionsSaved = false;
                        AppDelegate.appDelegate.IsPhotosSaved = false;
                        AppDelegate.appDelegate.vehicleID = appresponse.VehicleID;
                        AppDelegate.appDelegate.storeId = appresponse.StoreID;
                        AppDelegate.appDelegate.invtrId = appresponse.InvtrID;
                        AppDelegate.appDelegate.trimId = appresponse.KBBTrimId;


                        AppDelegate.appDelegate.mileage = Convert.ToInt32(txtMileage.Text);

                        var storyboard = UIStoryboard.FromName("Main", null);
                        var splitViewController = storyboard.InstantiateViewController("SplitViewControllerID");
                        var appDelegate = (AppDelegate)UIApplication.SharedApplication.Delegate;
                        appDelegate.Window.RootViewController = splitViewController;
                    });
                }
                else
                {
                    InvokeOnMainThread(() =>
                    {
                        Utility.HideLoadingIndicator(this.View);
                        Utility.ShowAlert("AppraisalApp", "Decode VIN Failed !!", "OK");
                    });
                }
            }));
        }
Ejemplo n.º 4
0
 Task <ContactUS> GetContact()
 {
     return(Task <ContactUS> .Factory.StartNew(() =>
     {
         ContactUS contat = null;
         contat = ServiceFactory.getWebServiceHandle().GetContactUS();
         return contat;
     }));
 }
 public IActionResult SaveContact(ContactUS model)
 {
     if (ModelState.IsValid)
     {
         db.Contacts.Add(model);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View("Contact", model));
 }
        public ActionResult sendAnswerToUser(ContactUS contact)
        {
            var currentMessage = db.ContactUs.Where(w => w.DeletedDate == null && w.Id == contact.Id).FirstOrDefault();

            currentMessage.AnsweredMessage = contact.AnsweredMessage;
            currentMessage.isAnswered      = true;
            currentMessage.answeredDate    = DateTime.Now;
            db.Entry(currentMessage).State = EntityState.Modified;
            db.SaveChanges();
            MailExtention.SendMail(contact.Subject, contact.AnsweredMessage, contact.Email);
            var allMessages = db.ContactUs.OrderByDescending(w => w.Id).Where(w => w.DeletedDate == null).ToList();

            return(PartialView("~/Areas/Admin/Views/ContactUS/listofmessage.cshtml", allMessages));
        }
Ejemplo n.º 7
0
 public ActionResult Contact_Us(ContactUS cu)
 {
     if (ModelState.IsValid)
     {
         try
         {
             SendEmail(cu);
             cu.EmailSent = true;
             return(View(cu));
         }
         catch (Exception)
         {
             return(View(cu));
         }
     }
     return(View(cu));
 }
Ejemplo n.º 8
0
        public ActionResult SendEnquiry(ContactUS objContactUS)
        {
            using (SmtpClient smtpClient = new SmtpClient())
            {
                var basicCredential = new NetworkCredential(ConfigurationManager.AppSettings["FromEmail"], ConfigurationManager.AppSettings["PassWord"]);
                using (MailMessage message = new MailMessage())
                {
                    MailAddress fromAddress = new MailAddress(ConfigurationManager.AppSettings["FromEmail"]);

                    smtpClient.Host = ConfigurationManager.AppSettings["HostName"];
                    smtpClient.UseDefaultCredentials = false;
                    smtpClient.Port        = 25;
                    smtpClient.Credentials = basicCredential;

                    message.From       = fromAddress;
                    message.Subject    = ConfigurationManager.AppSettings["Subject"];
                    message.IsBodyHtml = true;
                    string appPath     = Server.MapPath("~");
                    string path        = appPath + "EmailTemplates\\AdminEnquiryTemplate.html";
                    string messageHtml = getMessage(path);
                    messageHtml = messageHtml.Replace("#Name#", objContactUS.Name).Replace("#Email#", objContactUS.Phone).Replace("#Subject#", objContactUS.Address).Replace("#Message#", objContactUS.Message);

                    message.Body = messageHtml;
                    System.IO.Stream stream    = new System.IO.MemoryStream(System.Text.ASCIIEncoding.ASCII.GetBytes(message.Body));
                    AlternateView    alternate = new AlternateView(stream, new System.Net.Mime.ContentType("text/html"));
                    message.AlternateViews.Add(alternate);

                    message.To.Add(ConfigurationManager.AppSettings["ToEmail"]);

                    try
                    {
                        smtpClient.Send(message);
                        Console.Write("send");
                    }
                    catch (Exception ex)
                    {
                        //Error, could not send the message
                        Console.Write(ex.Message);
                    }
                }
            }
            return(RedirectToAction("Index"));
        }
        public ActionResult ContactUs(string subject, string email, string message, HttpPostedFileBase file)
        {
            if (String.IsNullOrWhiteSpace(subject) || String.IsNullOrWhiteSpace(email) || String.IsNullOrWhiteSpace(message))
            {
                TempData["fillInput"] = "Zəhmət Olmasa Xanaları Doldurun !!!";
                return View();
            }
            string SaveLocation = "";
            string fileName = "";
            if (file != null)
            {

                fileName = System.IO.Path.GetFileName(file.FileName);
                SaveLocation = Server.MapPath("~/ContactFiles/") + "\\" + fileName;
                try
                {
                    file.SaveAs(SaveLocation);
                }
                catch (Exception ex)
                {
                    Response.Write("Error: " + ex.Message);
                }

            }

            var newMessage = new ContactUS()
            {
                Subject = subject,
                Email = email,
                Message = message,
                filePath = fileName,
                CreatedDate = DateTime.Now,
                answeredDate = DateTime.Now,
                //CreatedId = Todo
            };
            db.ContactUs.Add(newMessage);

            MailExtention.SendMail(newMessage.Subject, newMessage.Message, "*****@*****.**");
            db.SaveChanges();
            return View("Index");
        }
Ejemplo n.º 10
0
        public ContactUS GetContactUS()
        {
            string              result          = null;
            ContactUS           contactresponse = new ContactUS();
            HttpResponseMessage responseMessage = null;

            try
            {
                responseMessage = RestClient.doGet(Url.GetContactUsInfoDetail);
                if (responseMessage.IsSuccessStatusCode)
                {
                    result = responseMessage.Content.ReadAsStringAsync().Result;
                    SIMSResponseData rst = JsonConvert.DeserializeObject <SIMSResponseData>(result);
                    var ContactData      = JsonConvert.DeserializeObject <ContactUS>(rst.Data.ToString());

                    contactresponse = ContactData;

                    if (null != result)
                    {
                        //result = null;
                    }
                    // TO-DO : show alert message if the VIN appraisal already created
                }
                else
                {
                    result = null;

                    //Utilities.Utility.ShowAlert("Appraisal App", "Decode VIN Failed!!", "OK");
                }
            }
            catch (Exception exc)
            {
                System.Diagnostics.Debug.WriteLine("Exception occured :: " + exc.Message);
            }

            return(contactresponse);
        }