public Task <SendTransmissionResponse> SendContactEmail(ContactModels container)
        {
            //Create transmission object, with proper variables and container context
            var transmission = new Transmission
            {
                Content          = { TemplateId = "honeymoon-shop-contact" },
                SubstitutionData =
                {
                    ["NAME"]    = container.Name,
                    ["TEL_NR"]  = container.Phone,
                    ["MESSAGE"] = container.Comment,
                    ["REF"]     = container.Reference
                }
            };

            var recipient = new Recipient
            {
                Address = new Address {
                    Email = container.Email
                }
            };

            //Set recipient
            transmission.Recipients.Add(recipient);

            var client = new Client(SecretConfig.Value.SparkpostApiKey);

            client.CustomSettings.SendingMode = SendingModes.Async;

            //Return the send task
            return(client.Transmissions.Send(transmission));
        }
        private void SendEmail(ContactModels model)
        {
            MailMessage message = new MailMessage();

            message.To.Add("*****@*****.**");
            message.Subject = model.Subject;
            message.From    = new MailAddress(model.Email, model.Name);
            message.Body    = model.Message + "\n my email is: " + model.Email;

            SmtpClient client = new SmtpClient();

            client.DeliveryMethod = SmtpDeliveryMethod.Network; client.UseDefaultCredentials = false;
            client.EnableSsl      = true;
            client.Host           = "smtp.gmail.com";
            client.Port           = 587;
            client.Credentials    = new System.Net.NetworkCredential("*****@*****.**", "Ga");
            client.EnableSsl      = true;

            client.Send(message);

            IContent comment = Services.ContentService.CreateContent(model.Subject, CurrentPage.Id, "comment");

            comment.SetValue("email", model.Email);
            comment.SetValue("cname", model.Name);
            comment.SetValue("subject", model.Subject);
            comment.SetValue("message", model.Message);
            Services.ContentService.Save(comment);
        }
Example #3
0
 public ActionResult Contact(ContactModels c)
 {
     if (ModelState.IsValid)
     {
         try
         {
             MailMessage msg  = new MailMessage();
             SmtpClient  smtp = new SmtpClient();
             MailAddress from = new MailAddress("*****@*****.**");
             //MailAddress from = new MailAddress(c.Email.ToString());
             StringBuilder sb = new StringBuilder();
             msg.To.Add("*****@*****.**");
             msg.Subject    = "Contact Us";
             msg.IsBodyHtml = false;
             smtp.Host      = "smtp.pdx9.com";
             smtp.Port      = 25;
             sb.Append("Name: " + c.Name);
             sb.Append(Environment.NewLine);
             sb.Append("Email: " + c.Email);
             sb.Append(Environment.NewLine);
             sb.Append("Essay: " + c.Essay);
             msg.Body = sb.ToString();
             smtp.Send(msg);
             msg.Dispose();
             return(View("Success"));
         }
         catch (Exception e)
         {
             return(View("Error" + e.Message));
         }
     }
     return(View());
 }
Example #4
0
 public ActionResult Contact(ContactModels c)
 {
     if (ModelState.IsValid)
     {
         try
         {
             MailMessage   msg  = new MailMessage();
             SmtpClient    smtp = new SmtpClient();
             MailAddress   from = new MailAddress(c.Email.ToString());
             StringBuilder sb   = new StringBuilder();
             msg.To.Add("*****@*****.**");
             msg.Subject    = "Contact Us";
             msg.IsBodyHtml = false;
             smtp.Host      = "mail.yourdomain.com";
             smtp.Port      = 25;
             sb.Append("First name: " + c.FirstName);
             sb.Append(Environment.NewLine);
             sb.Append("Last name: " + c.LastName);
             sb.Append(Environment.NewLine);
             sb.Append("Email: " + c.Email);
             sb.Append(Environment.NewLine);
             sb.Append("Comments: " + c.Comment);
             msg.Body = sb.ToString();
             smtp.Send(msg);
             msg.Dispose();
             return(View("Success"));
         }
         catch (Exception)
         {
             return(View("Error"));
         }
     }
     return(View());
 }
Example #5
0
 public ActionResult OnEdit(ContactModels contact)
 {
     if (ModelState.IsValid)
     {
         var result = ContactService.Update
                      (
             contact.Id,
             contact.FullName,
             contact.Email,
             contact.Phone,
             contact.Message,
             contact.CreatedDate
                      );
         if (result == Result.NotExists)
         {
             ModelState.AddModelError("", "Thông tin liên hệ không tồn tại trên hệ thống.");
             return(View("Edit", contact));
         }
         SetFlashMessage($"Cập nhật Thông tin liên hệ '{contact.FullName}' thành công.");
         if (contact.SaveList)
         {
             return(RedirectToAction("Index"));
         }
         return(View("Edit", contact));
     }
     return(View("Edit", contact));
 }
Example #6
0
        public ActionResult Statistic()
        {
            RatingModels  ratingModels   = new RatingModels();
            ContactModels contactModels  = new ContactModels();
            var           statistic_view = new Statistic_view();
            ////Thống kê truy cập theo tháng trong năm (lấy 12 tháng gần nhất)
            List <C_Statistic> arrAll = new List <C_Statistic>();

            arrAll = StatisticModels.ListAll();

            StringBuilder sb = new StringBuilder();

            for (int j = 0; j < arrAll.Count; j++)
            {
                if (j < arrAll.Count - 1)
                {
                    sb.Append("[gd(" + arrAll[j].year + ", " + arrAll[j].month + ",1), " + arrAll[j].SoTruyCap + "],");
                }
                else
                {
                    sb.Append("[gd(" + arrAll[j].year + ", " + arrAll[j].month + ",1), " + arrAll[j].SoTruyCap + "]");
                }
            }

            statistic_view.Chart_text = HttpUtility.HtmlEncode(sb.ToString());

            ////Danh sách review và bình luận mới sản phẩm mới nhất
            statistic_view.List_rating_last  = ratingModels.GetListRatingLast();
            statistic_view.List_contact_last = contactModels.GetListContactLast();

            return(this.PartialView("../control/statistic", statistic_view));
        }
Example #7
0
        public async Task <ActionResult> Contact(ContactModels data)
        {
            if (ModelState.IsValid)
            {
                //prepare email
                var body    = "<p>From: {0} ({1})</p><p>Email: {2}</p><p>Message:</p><p>{3}</p>";
                var message = new MailMessage();
                message.To.Add(new MailAddress("*****@*****.**"));
                message.From       = new MailAddress("*****@*****.**");
                message.Subject    = "Personal Website - Contact Me";
                message.Body       = string.Format(body, data.FirstName, data.LastName, data.Email, data.Comment);
                message.IsBodyHtml = true;


                using (var smtp = new SmtpClient())
                {
                    var credential = new NetworkCredential
                    {
                        UserName = "******",
                        Password = "******"
                    };
                    smtp.UseDefaultCredentials = true;
                    //smtp.Credentials = credential;
                    await smtp.SendMailAsync(message);

                    return(View("Success", data));
                }
            }

            return(View(data));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            ContactModels contactModels = db.ContactModels.Find(id);

            db.ContactModels.Remove(contactModels);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #9
0
 public ActionResult Contact(ContactModels contactModel)
 {
     if (ModelState.IsValid)
     {
         _emailService.SendContactMe(contactModel.Email, contactModel.Message);
     }
     return(RedirectToAction("Contact"));
 }
Example #10
0
 public ActionResult HandleIndex(ContactModels contact)
 {
     if (ModelState.IsValid)
     {
         ContactService.Insert(contact.Name, contact.Email, contact.Phone, contact.Message, DateTime.Now);
         ViewBag.Message = "Cảm ơn bạn đã gửi thông tin liên hệ cho chúng tôi. Chúng tôi sẽ liên hệ ngay với bạn.";
     }
     return(View("Contact", contact));
 }
 public ActionResult Edit([Bind(Include = "ID,Name,duty,AddressLine1,AddressLine2,AddressLine3,AddressLine4,cell,phone,fax,email")] ContactModels contactModels)
 {
     if (ModelState.IsValid)
     {
         db.Entry(contactModels).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(contactModels));
 }
 public IActionResult Contact(ContactModels model)
 {
     if (ModelState.IsValid)
     {
         _mailService.SendMessage("*****@*****.**", model.Name, $"From: {model.Email}, Message: {model.Message}");
         ViewBag.UserMessage = "Mail Sent";
         ModelState.Clear();
     }
     return(View());
 }
Example #13
0
        public ActionResult Contact(ContactModels c)
        {
            if (ModelState.IsValid)
            {
                _emailService.SendContactEmail(c);

                return(View("Success"));
            }
            return(View());
        }
 public ActionResult Contact()
 {
     ViewBag.Message = "Your contact page.";
     var r = new Random();
     if (r.Next() % 2 == 0)
     {
         var c = new ContactModels();
         c.doSomething();
     }
     return View();
 }
        public ActionResult Create([Bind(Include = "ID,Name,duty,AddressLine1,AddressLine2,AddressLine3,AddressLine4,cell,phone,fax,email")] ContactModels contactModels)
        {
            if (ModelState.IsValid)
            {
                db.ContactModels.Add(contactModels);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(contactModels));
        }
        public ActionResult Contact()
        {
            ViewBag.Message = "Your contact page.";
            var r = new Random();

            if (r.Next() % 2 == 0)
            {
                var c = new ContactModels();
                c.doSomething();
            }
            return(View());
        }
 public ActionResult SubmitForm(ContactModels model)
 {
     if (ModelState.IsValid)
     {
         SendEmail(model);
         TempData["success"] = true;
         return(RedirectToCurrentUmbracoPage());
     }
     else
     {
         return(CurrentUmbracoPage());
     }
 }
Example #18
0
        public ActionResult Contact(ContactModels c)
        {
            ViewBag.Message = "Contact Page";
            if (ModelState.IsValid)
            {
                try
                {
                    System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage();
                    //SmtpClient smtp = new SmtpClient();
                    MailAddress   from = new MailAddress(c.Email.ToString());
                    StringBuilder sb   = new System.Text.StringBuilder();
                    //Need to update with actual Bewander email address and Host if We use gmail as our smtp client, change code to this:
                    SmtpClient client = new SmtpClient();

                    client.Host                  = "smtp.gmail.com";
                    client.Port                  = 587;
                    client.EnableSsl             = true;
                    client.DeliveryMethod        = SmtpDeliveryMethod.Network;
                    client.UseDefaultCredentials = false;
                    client.Credentials           = new System.Net.NetworkCredential("*****@*****.**", "bewander"); //Admin (email, password)
                    msg.From = new MailAddress(c.Email.ToString());
                    msg.To.Add("*****@*****.**");                                                                  //Admin email
                    msg.Subject    = "(Bewander user:) " + c.Subject;
                    msg.IsBodyHtml = false;
                    //smtp.Host = "smtp.gmail.com";
                    //smtp.Port = 25;
                    sb.Append("First name: " + c.FirstName);
                    sb.Append(Environment.NewLine);
                    sb.Append("Last name: " + c.LastName);
                    sb.Append(Environment.NewLine);
                    sb.Append("Email: " + c.Email);
                    sb.Append(Environment.NewLine);
                    sb.Append("Subject: " + c.Subject);
                    sb.Append(Environment.NewLine);
                    sb.Append("Message: " + c.Message);
                    msg.Body = sb.ToString();
                    //smtp.Send(msg);
                    client.Send(msg);

                    msg.Dispose();
                    return(View("Success"));
                }
                catch (Exception e)
                {
                    return(View("Error"));

                    throw e;
                }
            }
            return(View());
        }
Example #19
0
 public ActionResult Index(ContactModels model)
 {
     if (ModelState.IsValid)
     {
         var body = new StringBuilder();
         body.AppendLine("Ad/Soyad: " + model.fullname);
         body.AppendLine("Email: " + model.email);
         body.AppendLine("Mesaj: " + model.text);
         Gmail.SendMail(body.ToString());
         ViewBag.Success = true;
     }
     ViewBag.setting = db.Setting.Find(1);
     return(View());
 }
Example #20
0
        public ActionResult Index()
        {
            var userInfo = AccountService.GetByUserId(AuthenticationHelper.CurrentUser);
            var model    = new ContactModels();

            if (userInfo != null)
            {
                model.Email = userInfo.Email;
                model.Phone = userInfo.Phone;
                model.Name  = userInfo.FullName;
            }

            return(View("Contact", model));
        }
        // GET: ContactModels/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ContactModels contactModels = db.ContactModels.Find(id);

            if (contactModels == null)
            {
                return(HttpNotFound());
            }
            return(View(contactModels));
        }
Example #22
0
        public ActionResult Contact(ContactModels contactModels)
        {
            var mail      = new MailMessage();
            var loginInfo = new NetworkCredential("*****@*****.**", "Ebtihal611izmaR");

            mail.From = new MailAddress(contactModels.Email);
            mail.To.Add(new MailAddress("*****@*****.**"));
            mail.Subject = contactModels.Message;

            SmtpClient smp = new SmtpClient("smpt.gmail.com", 587);

            smp.EnableSsl   = true;
            smp.Credentials = loginInfo;
            smp.Send(mail);

            return(RedirectToAction("Index"));
        }
 public async Task<ActionResult> Contact(ContactModels model)
 {
     if (ModelState.IsValid)
     {
         var body = "<p>Email From: {0} ({1})</p><p>Message:</p><p>{2}</p>";
         var message = new MailMessage();
         message.To.Add(new MailAddress("*****@*****.**")); //replace with valid value
         message.Subject = "Contact Inquiry";
         message.Body = string.Format(body, model.FromName, model.FromEmail, model.Message);
         message.IsBodyHtml = true;
         using (var smtp = new SmtpClient())
         {
             await smtp.SendMailAsync(message);
             return RedirectToAction("Sent");
         }
     }
     return View(model);
 }
Example #24
0
        public ActionResult Contact(ContactModels contact)
        {
            if(ModelState.IsValid)
            {
                try
                {
                    Message newMessage = new Message("Contact Us Page", contact.Email, contact.FirstName + " " + contact.LastName + ": " + contact.Comment);
                    this.messagingService.SendMessage(newMessage);

                    return View("SuccessContact");
                }
                catch (Exception ex)
                {
                    myLogger.Error("Error in Home/Contact messagingService.SendMessage", ex);
                    return View("Error");
                }
            }

            return View();
        }
Example #25
0
        public async Task <ActionResult> Contact(ContactModels model, HttpPostedFileBase Attachment)
        {
            if (ModelState.IsValid)
            {
                var    body            = "<p>Email From: {0} {1} ({2}) Phone: {4}<p>Message:</p><p>{3}</p>";
                string yourEncodedHtml = "Email Sent Successfully.<br/>Feel free to send another one if you like.<br/><p>Have a great day.<p/>";
                var    html            = new MvcHtmlString(yourEncodedHtml);
                var    message         = new MailMessage();
                message.To.Add(new MailAddress(Config.sgEmail));   // replace with valid value
                message.From       = new MailAddress(model.Email); // replace with valid value
                message.Subject    = model.Subject;
                message.Body       = string.Format(body, model.FirstName, model.LastName, model.Email, model.Comment, model.PhoneNumber);
                message.IsBodyHtml = true;
                if (Attachment != null)
                {
                    string pathToSave = Server.MapPath(Config.objectDataPath) + "\\Temp\\" + model.Email.Replace("@", "_").Replace(".", "_").ToString() + "\\";
                    IO.CreateFolder(pathToSave);
                    IO.DeleteFilesInFolder(pathToSave);
                    Attachment.SaveAs(pathToSave + Path.GetFileName(Attachment.FileName));

                    var attachment = new Attachment(pathToSave + Path.GetFileName(Attachment.FileName));
                    message.Attachments.Add(attachment);
                }
                try
                {
                    using (SmtpClient smtp = new SmtpClient())
                    {
                        await smtp.SendMailAsync(message);
                    }
                    ViewBag.Status = html;
                    ModelState.Clear();
                }
                catch (Exception)
                {
                    ViewBag.Status = "Problem while sending email, Please check details.";
                }
            }
            return(View());
        }
Example #26
0
 public ActionResult Contact(ContactModels c)
 {
     if (ModelState.IsValid)
     {
         try
         {
             MailMessage   msg  = new MailMessage();
             SmtpClient    smtp = new SmtpClient();
             MailAddress   from = new MailAddress("*****@*****.**");
             StringBuilder sb   = new StringBuilder();
             msg.IsBodyHtml      = false;
             smtp.Host           = "smtp.gmail.com";
             smtp.Port           = 587;
             smtp.EnableSsl      = true;
             smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
             smtp.Credentials    = new System.Net.NetworkCredential("*****@*****.**", "Hero_1234");
             msg.To.Add("*****@*****.**");
             msg.From    = from;
             msg.Subject = "Contact inquiry";
             sb.Append("First name: " + c.FirstName);
             sb.Append(Environment.NewLine);
             sb.Append("Last name: " + c.LastName);
             sb.Append(Environment.NewLine);
             sb.Append("Email: " + c.Email);
             sb.Append(Environment.NewLine);
             sb.Append("Comments: " + c.Comment);
             msg.Body = sb.ToString();
             smtp.Send(msg);
             msg.Dispose();
             return(View("Success"));
         }
         catch (Exception ex)
         {
             return(View(ex.Message));
         }
     }
     return(View());
 }
Example #27
0
 public ActionResult Contact(ContactModels c)
 {
     if (ModelState.IsValid)
     {
         try
         {
             MailMessage   msg  = new MailMessage();
             SmtpClient    smtp = new SmtpClient();
             MailAddress   from = new MailAddress(c.Email.ToString());
             StringBuilder sb   = new StringBuilder();
             msg.From = from;
             msg.To.Add("*****@*****.**");
             msg.Subject         = "Wiadomość od klienta";
             msg.IsBodyHtml      = false;
             smtp.Host           = "smtp.gmail.com";
             smtp.Port           = 25;
             smtp.EnableSsl      = true;
             smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
             smtp.Credentials    = new System.Net.NetworkCredential("*****@*****.**", "adrian89");
             sb.Append("First name: " + c.FirstName);
             sb.Append(Environment.NewLine);
             sb.Append("Last name: " + c.LastName);
             sb.Append(Environment.NewLine);
             sb.Append("Email: " + c.Email);
             sb.Append(Environment.NewLine);
             sb.Append("Comments: " + c.Comment);
             msg.Body = sb.ToString();
             smtp.Send(msg);
             msg.Dispose();
             return(View("Success"));
         }
         catch (Exception)
         {
             return(View("Error"));
         }
     }
     return(View());
 }
Example #28
0
        public ActionResult Contact(ContactModels c)
        {
            if (ModelState.IsValid)
            {
                //try
                //{
                //MailMessage msg = new MailMessage();
                //SmtpClient smtp = new SmtpClient();
                //MailAddress from = new MailAddress(c.Email.ToString());
                string        fromAddress = c.Email.ToString();
                StringBuilder sb          = new StringBuilder();

                //msg.To.Add("*****@*****.**");
                string toAddress = "*****@*****.**";
                //msg.Subject = "Contact Me";
                string subject = "Contact Me";
                //msg.IsBodyHtml = false;

                /*
                 * SmtpClient client = new SmtpClient();
                 * // We use gmail as our smtp client
                 * client.Host = "smtp.gmail.com";
                 * client.Port = 587;
                 * client.EnableSsl = true;
                 * client.DeliveryMethod = SmtpDeliveryMethod.Network;
                 * client.Credentials = new System.Net.NetworkCredential("*****@*****.**", "!C25a47d2ec");
                 */

                sb.Append("First name: " + c.FirstName + "\n");
                sb.Append("Last name: " + c.LastName + "\n");
                sb.Append("Email: " + c.Email + "\n");
                sb.Append("Phone: " + c.Phone + "\n");
                sb.Append("Comments: " + c.Comment + "\n");

                //start email Thread


                //msg.Body = sb.ToString();
                string message = sb.ToString();
                // var tEmail = new Thread(() =>
                try
                {
                    SendEmail(toAddress, fromAddress, subject, message);
                    //tEmail.Start();
                    return(View("Success"));
                }
                catch (Exception e)
                {
                    Response.Write(e.ToString());
                    return(View("Failure"));
                }
                //client.Send(msg);
                //msg.Dispose();
                // return View("Success");
                //}
                //catch (Exception)
                //{
                //    return View("Error");
                //}
            }
            return(View());
        }
Example #29
0
        public ActionResult Contact(ContactModels c)
        {
            if (ModelState.IsValid)
            {
                //try
                //{
                //    MailMessage msg = new MailMessage();
                //    //SmtpClient smtp = new SmtpClient();
                //    MailAddress from = new MailAddress(c.Email.ToString());
                //    StringBuilder sb = new StringBuilder();

                //    SmtpClient smtp = new SmtpClient();
                //    NetworkCredential basicCredential =
                //        new NetworkCredential("*****@*****.**", "Zajhae@22");
                //    //MailMessage message = new MailMessage();
                //    //MailAddress fromAddress = new MailAddress("*****@*****.**");

                //    //smtp.Host = "mail.mydomain.com";
                //    smtp.UseDefaultCredentials = false;
                //    smtp.Credentials = basicCredential;


                //    msg.IsBodyHtml = false;
                //    smtp.Host = "smtp.google.com";
                //    smtp.Port = 587;
                //    msg.To.Add("*****@*****.**");
                //    msg.From = from;
                //    msg.Subject = "Contact Us";
                //    sb.Append("First name: " + c.FirstName);
                //    sb.Append(Environment.NewLine);
                //    sb.Append("Last name: " + c.LastName);
                //    sb.Append(Environment.NewLine);
                //    sb.Append("Email: " + c.Email);
                //    sb.Append(Environment.NewLine);
                //    sb.Append("Comments: " + c.Comment);
                //    msg.Body = sb.ToString();
                //    smtp.Send(msg);
                //    msg.Dispose();
                //    return View("Success");
                //}
                //catch (Exception)
                //{
                //    return View("Error");
                //}

                SmtpClient        smtpClient      = new SmtpClient();
                NetworkCredential basicCredential =
                    new NetworkCredential("*****@*****.**", "Marcelo@flores22");
                MailMessage   message     = new MailMessage();
                MailAddress   fromAddress = new MailAddress("*****@*****.**");
                StringBuilder sb          = new StringBuilder();

                smtpClient.Host = "smtp.gmail.com";
                smtpClient.Port = 587;
                smtpClient.UseDefaultCredentials = false;
                smtpClient.Credentials           = basicCredential;
                smtpClient.EnableSsl             = true;

                message.From    = fromAddress;
                message.Subject = "prueba";
                sb.Append("First name: " + c.Nombre);
                sb.Append(Environment.NewLine);
                sb.Append("Last name: " + c.Apellido);
                sb.Append(Environment.NewLine);
                sb.Append("Email: " + c.Email);
                sb.Append(Environment.NewLine);
                sb.Append("Comments: " + c.Comentario);
                sb.Append(Environment.NewLine);
                sb.Append("Destinatario: " + c.destinatario);
                //Set IsBodyHtml to true means you can send HTML email.
                message.IsBodyHtml = true;
                message.Body       = sb.ToString();
                message.To.Add(c.destinatario);

                try
                {
                    smtpClient.Send(message);
                    message.Dispose();
                    return(View("Success"));
                }
                catch (Exception ex)
                {
                    //Error, could not send the message
                    Response.Write(ex.Message);
                    return(View("Error"));
                }
            }
            return(View());
        }
        public ActionResult List_contact(int?id, string type, string act, string ctrl, string type_act, string lang, string search, int?page, int?page_size, string order_by, string order_type)
        {
            ContactModels contactModels     = new ContactModels();
            C_Contact     objectContact     = new C_Contact();
            StringBuilder sb                = new StringBuilder();
            var           list_contact_view = new Web.Areas.Admin.ViewModels.List_contact_view();
            int           total_record      = 0;

            if (string.IsNullOrEmpty(type))
            {
                type = Request.QueryString["type"] != null ? Request.QueryString["type"].ToString() : string.Empty;
            }

            if (string.IsNullOrEmpty(act))
            {
                act = Request.QueryString["act"] != null ? Request.QueryString["act"].ToString() : "list_contact";
            }

            if (string.IsNullOrEmpty(ctrl))
            {
                ctrl = Request.QueryString["ctrl"] != null ? Request.QueryString["ctrl"].ToString() : "adminGeneral";
            }

            if (page == null || page == 0)
            {
                page = Request.QueryString["page"] != null?Convert.ToInt32(Request.QueryString["page"].ToString()) : 1;
            }

            if (page_size == null)
            {
                page_size = int.Parse(Util.GetConfigValue("NumberPageSizeAdmin", "30"));
            }

            if (id != null && type_act != null && type_act == CommonGlobal.Delete)
            {
                if (UserModels.CheckPermission(this.Session["mem"] != null ? this.Session["mem"].ToString() : string.Empty, act, ctrl, type_act, type))
                {
                    objectContact = contactModels.GetByID((int)id);
                    if (objectContact != null)
                    {
                        ////delete contact
                        bool rt = contactModels.Delete((int)id);
                        if (rt)
                        {
                            list_contact_view.Message = "Bạn đã xóa " + id;
                        }
                        else
                        {
                            list_contact_view.Message = "Xóa không thành công";
                        }
                    }
                    else
                    {
                        list_contact_view.Message = "Không tìm thấy  : " + id;
                    }
                }
                else
                {
                    list_contact_view.Message = " Bạn không có quyền thực thi hành động xóa.";
                }
            }

            if (string.IsNullOrEmpty(order_by) || string.IsNullOrEmpty(order_type))
            {
                order_by   = "ContactId";
                order_type = "desc";
            }

            list_contact_view.Type      = type;
            list_contact_view.Cate_type = "Ý kiến khách hàng";
            list_contact_view.Type_act  = type_act;
            ////tab
            sb.Append("<li class=\"active\"><a class=\"active\" href=\"#\"><span><span>Ý kiến khách hàng</span></span></a></li>");
            list_contact_view.Html_link_tab = sb.ToString();
            ////list page size and paging
            list_contact_view.List_page_size = this.GetSizePagingPublic((int)page_size);
            list_contact_view.Page           = (int)page;
            list_contact_view.Page_size      = (int)page_size;
            ////list catalog
            list_contact_view.Page_list_contact = contactModels.AdminGetAllContactClient(lang, search, (int)page, (int)page_size, order_by, order_type, out total_record);
            list_contact_view.Search            = search;
            list_contact_view.Order_by          = order_by;
            list_contact_view.Order_type        = order_type;
            list_contact_view.Total_record      = total_record;
            ////acton and parent action
            list_contact_view.Act               = act;
            list_contact_view.Ctrl              = ctrl;
            list_contact_view.Parent_action     = HttpContext.Request.RequestContext.RouteData.Values["action"].ToString();
            list_contact_view.Parent_controller = HttpContext.Request.RequestContext.RouteData.Values["controller"].ToString();

            return(this.PartialView("../control/list_contact", list_contact_view));
        }
Example #31
0
 internal static Task SendContactForm(ContactModels model)
 {
     throw new NotImplementedException();
 }
Example #32
0
 private void btnContact3_Click(object sender, RoutedEventArgs e)
 {
     DataContext = new ContactModels();
 }