public IActionResult Xem(int id, string traloi)
        {
            HoiDap hd = db.HoiDap.Find(id);

            hd.TrangThaiTl = true;
            hd.TraLoi      = traloi;
            db.SaveChanges();
            ViewData["reply"] = "Tin nhắn đã được gửi đến khách hàng";
            KhachHang   kh = db.KhachHang.SingleOrDefault(p => p.MaKh == hd.MaKh);
            MailMessage mm = new MailMessage("*****@*****.**", kh.Email);

            mm.Subject = "Thông báo phản hồi";
            string content = "<h1>{0}</h1> <br/> <div class='text text-success'><h2>Chào mừng bạn đến với ESHOP.</h2></div> <br> <h5> Cảm ơn bạn đã phản hồi với lời nhắn : <br/> <br/>";

            content      += "<h3 style='font-weight:bolder;color:red;'>" + hd.CauHoi + "</h3><br/><h3>Phản hồi từ ESHOP : </h3><br /><h3 style='color:blue;'>" + hd.TraLoi + "</h3><br />";
            mm.Body       = string.Format(content, kh.HoTen);
            mm.IsBodyHtml = true;
            SmtpClient smtp = new SmtpClient();

            smtp.Host        = "smtp.gmail.com";
            smtp.Port        = 587;
            smtp.EnableSsl   = true;
            smtp.Credentials = new System.Net.NetworkCredential("*****@*****.**", "eshop147258369");
            smtp.Send(mm);
            return(View(hd));
        }
Beispiel #2
0
        public bool TraLoiCauHoi_Update(HoiDap entity)
        {
            try
            {
                var model = db.HoiDaps.Find(entity.IDCauHoi);
                if (model != null)
                {
                    model.IDBenhNhan = model.IDBenhNhan;
                    model.CauHoi     = model.CauHoi;
                    model.TraLoi     = entity.TraLoi;
                    model.TrangThai  = 1;


                    db.SaveChanges();
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception)
            {
                return(false);
            }
        }
Beispiel #3
0
 protected void SetData(HoiDap hoiDap)
 {
     lbTitle.Text = hoiDap.TieuDe;
     lbNoiDungHoi.Text = hoiDap.NoiDungHoi;
     lbHoTen.Text = "(" + hoiDap.HoTen;
     lbNgayGui.Text = hoiDap.NgayGui.ToString().Split(' ').First().ToString() + ")";
     ltNoiDungDap.Text = hoiDap.NoiDungDap;
 }
        public IActionResult Xoa(int id)
        {
            HoiDap hd = db.HoiDap.Find(id);

            db.HoiDap.Remove(hd);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #5
0
        public ActionResult DeleteConfirmed(int id)
        {
            HoiDap hoiDap = db.HoiDaps.Find(id);

            db.HoiDaps.Remove(hoiDap);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #6
0
 public ActionResult TraLoiCauHoi(HoiDap entity)
 {
     if (TraLoiCauHoi_Update(entity) == true)
     {
         return(RedirectToAction("Index"));
     }
     else
     {
         return(View(entity));
     }
 }
Beispiel #7
0
 public ActionResult Edit([Bind(Include = "HoiDapId,CauHoi,Content,ImagePath,FilePath,LinhVucId,OrderHint,CreatedDate,CreatedBy,UpdatedDate,UpdatedBy,MetaKeyword,MetaDescription,Status")] HoiDap hoiDap)
 {
     if (ModelState.IsValid)
     {
         _hoiDapService.Update(hoiDap);
         _hoiDapService.Save();
         return(RedirectToAction("Index"));
     }
     ViewBag.LinhVucId = new SelectList(db.LinhVucs, "LinhVucId", "TenLinhVuc", hoiDap.LinhVucId);
     return(View(hoiDap));
 }
Beispiel #8
0
 public ActionResult Edit([Bind(Include = "IDCauHoi,IDBenhNhan,CauHoi,TraLoi,NgayHoi")] HoiDap hoiDap)
 {
     if (ModelState.IsValid)
     {
         db.Entry(hoiDap).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.IDBenhNhan = new SelectList(db.BenhNhans, "IDBenhNhan", "HoTen", hoiDap.IDBenhNhan);
     return(View(hoiDap));
 }
Beispiel #9
0
        public ActionResult Create([Bind(Include = "IDCauHoi,IDBenhNhan,CauHoi,TraLoi,NgayHoi")] HoiDap hoiDap)
        {
            if (ModelState.IsValid)
            {
                db.HoiDaps.Add(hoiDap);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.IDBenhNhan = new SelectList(db.BenhNhans, "IDBenhNhan", "HoTen", hoiDap.IDBenhNhan);
            return(View(hoiDap));
        }
Beispiel #10
0
 public ActionResult Edit([Bind(Include = "IDHoidap,CauHoi,TraLoi,IDNguoiDung,IDQuanTri,NgayGui,GhiChu,TrangThai")] HoiDap hoiDap)
 {
     if (ModelState.IsValid)
     {
         db.Entry(hoiDap).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.IDNguoiDung = new SelectList(db.NguoiDungs, "IDNguoiDung", "HoTen", hoiDap.IDNguoiDung);
     ViewBag.IDQuanTri   = new SelectList(db.QuanTris, "IDQuanTri", "TaiKhoan", hoiDap.IDQuanTri);
     return(View(hoiDap));
 }
Beispiel #11
0
        // GET: Hoidap/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            HoiDap hoiDap = db.HoiDaps.Find(id);

            if (hoiDap == null)
            {
                return(HttpNotFound());
            }
            return(View(hoiDap));
        }
Beispiel #12
0
        // GET: Admin/HoiDaps/Edit/5
        public ActionResult Edit(int id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            HoiDap hoiDap = _hoiDapService.SelectById(id);

            if (hoiDap == null)
            {
                return(HttpNotFound());
            }
            ViewBag.LinhVucId = new SelectList(db.LinhVucs, "LinhVucId", "TenLinhVuc", hoiDap.LinhVucId);
            return(View(hoiDap));
        }
Beispiel #13
0
        // GET: Admin/HoiDaps/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            HoiDap hoiDap = db.HoiDaps.Find(id);

            if (hoiDap == null)
            {
                return(HttpNotFound());
            }
            ViewBag.IDBenhNhan = new SelectList(db.BenhNhans, "IDBenhNhan", "HoTen", hoiDap.IDBenhNhan);
            return(View(hoiDap));
        }
Beispiel #14
0
        // GET: Admin/HoiDaps/Details/5
        public ActionResult Details(int id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            HoiDap hoiDap = _hoiDapService.SelectById(id);

            if (hoiDap == null)
            {
                return(HttpNotFound());
            }
            return(View(hoiDap));
        }
Beispiel #15
0
        // GET: Hoidap/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            HoiDap hoiDap = db.HoiDaps.Find(id);

            if (hoiDap == null)
            {
                return(HttpNotFound());
            }
            ViewBag.IDNguoiDung = new SelectList(db.NguoiDungs.Where(x => x.IDNguoiDung == hoiDap.IDNguoiDung), "IDNguoiDung", "HoTen", hoiDap.IDNguoiDung);
            ViewBag.IDQuanTri   = new SelectList(db.QuanTris.Where(x => x.IDQuanTri == hoiDap.IDQuanTri), "IDQuanTri", "HoTen", hoiDap.IDQuanTri);
            return(View(hoiDap));
        }
Beispiel #16
0
        public ActionResult Create([Bind(Include = "IDHoidap,CauHoi,TraLoi,IDNguoiDung,IDQuanTri,NgayGui,GhiChu,TrangThai")] HoiDap hoiDap)
        {
            if (ModelState.IsValid)
            {
                var d = DateTime.Now;
                hoiDap.NgayGui   = d;
                hoiDap.TrangThai = 0;
                db.HoiDaps.Add(hoiDap);
                db.SaveChanges();
                return(RedirectToAction("Index", "Hoidap", new { id = hoiDap.IDNguoiDung }));
            }

            ViewBag.IDNguoiDung = new SelectList(db.NguoiDungs, "IDNguoiDung", "HoTen", hoiDap.IDNguoiDung);
            ViewBag.IDQuanTri   = new SelectList(db.QuanTris, "IDQuanTri", "TaiKhoan", hoiDap.IDQuanTri);
            return(View(hoiDap));
        }
Beispiel #17
0
        public ActionResult Traloicauhoi(int?id)
        {
            if (id == null)

            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            HoiDap hoiDap = db.HoiDaps.Find(id);

            if (hoiDap == null)
            {
                return(HttpNotFound());
            }
            ViewBag.IDNguoiDung = new SelectList(db.NguoiDungs, "IDNguoiDung", "HoTen", hoiDap.IDNguoiDung);
            ViewBag.IDQuanTri   = new SelectList(db.QuanTris, "IDQuanTri", "TaiKhoan", hoiDap.IDQuanTri);
            return(View(hoiDap));
        }
Beispiel #18
0
    protected void btnbtnGui_Click(object sender, EventArgs e)
    {
        // Neu tat ca du lieu deu duoc nhap hop le
        if (Page.IsValid)
        {
            CaptchaProvider captchaPro = new CaptchaProvider();
            if (captchaPro.IsValidCode(txtInputString.Text))
            {
                lbcapcha.Visible = false;
                bool rs = false;

                HoiDap data = new HoiDap();
                data.HoTen = txtHoTen.Text;
                data.Email = txtEmail.Text;
                data.TieuDe = txtTieuDe.Text;
                data.NoiDungHoi = txtNoiDung.Text;
                data.NoiDungDap = "";
                data.DiaChi = txtDiaChi.Text;
                data.NgayGui = DateTime.Now;
                data.TrangThai = 0;

                rs = HoiDap.Them(data);
                if (rs)
                {
                    succesfull.Visible = true;
                    refesh();
                    succesfull.Text = "Nội dung liên hệ của bạn đã được gủi đến bệnh viện Nam Bình Thuận. Chúng tôi sẽ trả lời liên hệ của bạn trong thời gian sớm nhất!";
                }
                else
                {
                    succesfull.Visible = true;
                    succesfull.Text = "Gửi ý kiến thất bại!";
                }
            }
            else
            {
                lbcapcha.Visible = true;
                succesfull.Visible = false;
                lbcapcha.Text = "Sai mã xác nhận!";
            }
        }
    }
 public IActionResult Contact(string cauhoi)
 {
     if (HttpContext.Session.Get <KhachHang>("user") != null)
     {
         HoiDap hd = new HoiDap
         {
             CauHoi  = cauhoi,
             NgayDua = DateTime.Now,
             MaKh    = HttpContext.Session.Get <KhachHang>("user").MaKh
         };
         db.HoiDap.Add(hd);
         db.SaveChanges();
         ViewData["MessContact"] = "Thông tin phản hồi của bạn đã gửi đi thành công.";
     }
     else
     {
         ViewData["MessContact"] = "Vui lòng đăng nhập để gửi phản hồi";
     }
     return(View());
 }
Beispiel #20
0
 public HoiDap Insert(HoiDap HoiDap)
 {
     return(_HoiDapRepository.Add(HoiDap));
 }
Beispiel #21
0
 public void Update(HoiDap HoiDap)
 {
     _HoiDapRepository.Update(HoiDap);
 }
        public IActionResult Xem(int id)
        {
            HoiDap hd = db.HoiDap.Find(id);

            return(View(hd));
        }