// GET: Admin/FeedBack
        public ActionResult Index()
        {
            var dao   = new FeedBackDao();
            var model = dao.GetListFeedBack();

            return(View(model));
        }
        public ActionResult Delete(int id)
        {
            var dao = new FeedBackDao();

            dao.Delete(id);
            return(RedirectToAction("Index"));
        }
Example #3
0
        public ActionResult HasReadAll()
        {
            var dao = new FeedBackDao();

            dao.HasReadAll();
            return(RedirectToAction("Index"));
        }
        //[HasCredential(RoleID = "EDIT_USER")]
        public ActionResult Edit(User user)
        {
            if (ModelState.IsValid)
            {
                var dao = new FeedBackDao();
                if (!string.IsNullOrEmpty(user.Password))
                {
                    var encryptedMd5Pas = Encryptor.MD5Hash(user.Password);
                    user.Password = encryptedMd5Pas;
                }


                var result = dao.Update(user);
                if (result)
                {
                    SetAlert("Sửa user thành công", "success");
                    return(RedirectToAction("Index", "User"));
                }
                else
                {
                    ModelState.AddModelError("", "Cập nhật user không thành công");
                }
            }
            return(View("Index"));
        }
Example #5
0
 public ActionResult Login(LoginModel model)
 {
     if (ModelState.IsValid)
     {
         var dao    = new FeedBackDao();
         var result = dao.Login(model.UserName, model.Password);
         if (result == 1)
         {
             var user        = dao.GetById(model.UserName);
             var userSession = new UserLogin();
             userSession.UserName = user.UserName;
             userSession.UserID   = user.ID;
             Session.Add(CommonConstants.USER_SESSION, userSession);
             return(Redirect("/"));
         }
         else if (result == 0)
         {
             ModelState.AddModelError("", "Tài khoản không tồn tại.");
         }
         else if (result == -1)
         {
             ModelState.AddModelError("", "Tài khoản đang bị khoá.");
         }
         else if (result == -2)
         {
             ModelState.AddModelError("", "Mật khẩu không đúng.");
         }
         else
         {
             ModelState.AddModelError("", "đăng nhập không đúng.");
         }
     }
     return(View(model));
 }
        public ActionResult Index(int page = 1, int pageSize = 5)
        {
            var dao   = new FeedBackDao();
            var model = dao.ListPg(page, pageSize);

            return(View(model));
        }
        // GET: Admin/FeedBack
        public ActionResult Index()
        {
            var dao   = new FeedBackDao();
            var model = dao.ListAllPaging();

            return(View(model));
        }
Example #8
0
        public ActionResult FeedBack(string name, string phone, string address, string email, string content)
        {
            var feedback = new Feedback();

            feedback.CreatedDate = DateTime.Now;
            feedback.Name        = name;
            feedback.Phone       = phone;
            feedback.Address     = address;
            feedback.Email       = email;
            feedback.Content     = content;
            var result = new FeedBackDao().GetFeedBack(feedback);

            if (result > 0)
            {
                string fb = System.IO.File.ReadAllText(Server.MapPath("~/assets/client/template/feedback.html"));
                fb = fb.Replace("{{customername}}", name);
                fb = fb.Replace("{{phone}}", phone);
                fb = fb.Replace("{{email}}", email);
                fb = fb.Replace("{{address}}", address);
                fb = fb.Replace("{{content}}", content);
                new MailHelper().SendMail(email, "Nội dung phản hồi", fb);
                //new MailHelper().SendMail(email, "Đơn hàng mới từ Shop Si", content);
            }
            return(Redirect("/hoan-thanh"));
        }
        //
        // GET: /Admin/FeedBack/

        public ActionResult Index(string searchString, int page = 1, int pageSize = 10)
        {
            var dao   = new FeedBackDao();
            var model = dao.ListAllpaging(searchString, page, pageSize);

            ViewBag.searchString = searchString;
            return(View(model));
        }
Example #10
0
        // GET: Admin/Home
        public ActionResult Index()
        {
            var NewOrder = new OrderDao().NewOrder();
            var FBack    = new FeedBackDao().ListAll();

            ViewBag.NewOrder = NewOrder;
            ViewBag.FBack    = FBack;
            return(View());
        }
        //[HasCredential(RoleID = "EDIT_USER")]
        public JsonResult ChangeStatus(long id)
        {
            var result = new FeedBackDao().ChangeStatus(id);

            return(Json(new
            {
                status = result
            }));
        }
        public ActionResult Browser(int idFeed)
        {
            bool kq = new FeedBackDao().Duyet(idFeed);

            if (!kq)
            {
                ModelState.AddModelError("", "Có lỗi xảy ra");
            }
            return(Redirect("/Admin/BrowserFeedBack/BrowserFB"));
        }
        public ActionResult Delete(int id = 1)
        {
            var dao = new FeedBackDao();

            if (dao.Delete(id))
            {
                TempData["Success"] = "Xóa feedback hoàn tất";
            }
            else
            {
                TempData["Error"] = "Xóa feedback thất bại";
            }
            return(RedirectToAction("Index"));
        }
 public ActionResult Create(Feedback fb)
 {
     if (ModelState.IsValid)
     {
         long id = new FeedBackDao().Insert(fb);
         if (id > 0)
         {
             SetAlert("Gửi đi thành công", "success");
         }
         else
         {
             SetAlert("Chưa được gửi", "error");
         }
     }
     return(View("Index"));
 }
 public ActionResult Create(FeedBack feedback)
 {
     if (ModelState.IsValid)
     {
         var  dao = new FeedBackDao();
         long id  = dao.Insert(feedback);
         if (id > 0)
         {
             return(RedirectToAction("Index", "FeedBack"));
         }
         else
         {
             ModelState.AddModelError("", "Không thêm được");
         }
     }
     return(View("Index"));
 }
Example #16
0
        public ActionResult Register(RegisterModel model)
        {
            if (ModelState.IsValid)
            {
                var dao = new FeedBackDao();
                if (dao.CheckUserName(model.UserName))
                {
                    ModelState.AddModelError("", "Tên đăng nhập đã tồn tại");
                }
                else if (dao.CheckEmail(model.Email))
                {
                    ModelState.AddModelError("", "Email đã tồn tại");
                }
                else
                {
                    var user = new User();
                    user.Name        = model.Name;
                    user.Password    = model.Password;
                    user.Phone       = model.Phone;
                    user.Email       = model.Email;
                    user.Address     = model.Address;
                    user.CreatedDate = DateTime.Now;
                    user.Status      = true;
                    if (!string.IsNullOrEmpty(model.ProvinceID))
                    {
                        user.ProvinceID = int.Parse(model.ProvinceID);
                    }
                    if (!string.IsNullOrEmpty(model.DistrictID))
                    {
                        user.DistrictID = int.Parse(model.DistrictID);
                    }

                    var result = dao.Insert(user);
                    if (result > 0)
                    {
                        ViewBag.Success = "Đăng ký thành công";
                        model           = new RegisterModel();
                    }
                    else
                    {
                        ModelState.AddModelError("", "Đăng ký không thành công.");
                    }
                }
            }
            return(View(model));
        }
 public ActionResult Edit(FeedBack feedback)
 {
     if (ModelState.IsValid)
     {
         var dao    = new FeedBackDao();
         var result = dao.Update(feedback);
         if (result)
         {
             return(RedirectToAction("Index", "FeedBack"));
         }
         else
         {
             ModelState.AddModelError("", "Không thêm được");
         }
     }
     return(View("Index"));
 }
Example #18
0
 public ActionResult Create(LienHe id)
 {
     if (ModelState.IsValid)
     {
         var  dao    = new FeedBackDao();
         long result = dao.Insert(id);
         if (result > 0)
         {
             return(RedirectToAction("Index", "News"));
         }
         else
         {
             ModelState.AddModelError("", "Thêm bài báo thất bại");
         }
     }
     return(View("Index"));
 }
Example #19
0
 public ActionResult ViewDetail(LienHe paper)
 {
     if (ModelState.IsValid)
     {
         var  dao    = new FeedBackDao();
         bool result = dao.Update(paper);
         if (result)
         {
             return(RedirectToAction("Index", "News"));
         }
         else
         {
             ModelState.AddModelError("", "Cập nhật bài báo thất bại");
         }
     }
     return(View("Index"));
 }
Example #20
0
        public IEnumerable <TopicDTO> TopicList()
        {
            var dao       = new FeedBackDao();
            var topiclist = dao.GetListTopic();

            List <TopicDTO> topicDTOs = new List <TopicDTO>();

            foreach (var item in topiclist)
            {
                TopicDTO topic = new TopicDTO();
                topic.topicId   = item.Id_Topic;
                topic.topicName = item.Name_Topic;

                topicDTOs.Add(topic);
            }

            return(topicDTOs);
        }
Example #21
0
 public ActionResult Index(FeedBack model)
 {
     if (ModelState.IsValid)
     {
         var dao = new FeedBackDao();
         model.CreatedDate = DateTime.Now;
         model.Status      = false;
         if (dao.Insert(model))
         {
             TempData["Success"] = "Cảm ơn bạn đã liên hệ!";
             return(Redirect("/"));
         }
         else
         {
             TempData["Error"] = "Thông tin bị lỗi, xin vui lòng gửi lại!";
         }
     }
     return(View(model));
 }
Example #22
0
        public ActionResult FacebookCallback(string code)
        {
            var     fb     = new FacebookClient();
            dynamic result = fb.Post("oauth/access_token", new
            {
                client_id     = ConfigurationManager.AppSettings["FbAppId"],
                client_secret = ConfigurationManager.AppSettings["FbAppSecret"],
                redirect_uri  = RedirectUri.AbsoluteUri,
                code          = code
            });


            var accessToken = result.access_token;

            if (!string.IsNullOrEmpty(accessToken))
            {
                fb.AccessToken = accessToken;
                // Get the user's information, like email, first name, middle name etc
                dynamic me         = fb.Get("me?fields=first_name,middle_name,last_name,id,email");
                string  email      = me.email;
                string  userName   = me.email;
                string  firstname  = me.first_name;
                string  middlename = me.middle_name;
                string  lastname   = me.last_name;

                var user = new User();
                user.Email       = email;
                user.UserName    = email;
                user.Status      = true;
                user.Name        = firstname + " " + middlename + " " + lastname;
                user.CreatedDate = DateTime.Now;
                var resultInsert = new FeedBackDao().InsertForFacebook(user);
                if (resultInsert > 0)
                {
                    var userSession = new UserLogin();
                    userSession.UserName = user.UserName;
                    userSession.UserID   = user.ID;
                    Session.Add(CommonConstants.USER_SESSION, userSession);
                }
            }
            return(Redirect("/"));
        }
        public ActionResult Login(LoginModel model)
        {
            if (ModelState.IsValid)
            {
                var dao    = new FeedBackDao();
                var result = dao.Login(model.UserName, Encryptor.MD5Hash(model.Password));
                if (result == 1)
                {
                    var user        = dao.GetById(model.UserName);
                    var userSession = new UserLogin();
                    userSession.UserName = user.UserName;
                    userSession.UserID   = user.ID;
                    userSession.GroupID  = user.GroupID;
                    var listCredentials = dao.GetListCredential(model.UserName);

                    Session.Add(CommonConstants.SESSION_CREDENTIALS, listCredentials);
                    Session.Add(CommonConstants.USER_SESSION, userSession);
                    return(RedirectToAction("Index", "Home"));
                }
                else if (result == 0)
                {
                    ModelState.AddModelError("", "Tài khoản không tồn tại.");
                }
                else if (result == -1)
                {
                    ModelState.AddModelError("", "Tài khoản đang bị khoá.");
                }
                else if (result == -2)
                {
                    ModelState.AddModelError("", "Mật khẩu không đúng.");
                }
                else if (result == -3)
                {
                    ModelState.AddModelError("", "Tài khoản của bạn không có quyền đăng nhập.");
                }
                else
                {
                    ModelState.AddModelError("", "đăng nhập không đúng.");
                }
            }
            return(View("Index"));
        }
 public ActionResult Create(FeedBack feedback)
 {
     if (ModelState.IsValid)
     {
         var dao = new FeedBackDao();
         feedback.CreatedDate = DateTime.Now;
         feedback.Status      = true;
         long id = dao.Insert(feedback);
         if (id > 0)
         {
             ViewBag.Success = "Phản hồi thành công. Cám ơn bạn đã đóng góp ý kiến.";
             ModelState.Clear();
         }
         else
         {
             ModelState.AddModelError("", "Phản hồi không thành công");
         }
     }
     return(View("Create"));
 }
        //[HasCredential(RoleID = "ADD_USER")]
        public ActionResult Create(User user)
        {
            if (ModelState.IsValid)
            {
                var dao = new FeedBackDao();

                var encryptedMd5Pas = Encryptor.MD5Hash(user.Password);
                user.Password = encryptedMd5Pas;

                long id = dao.Insert(user);
                if (id > 0)
                {
                    SetAlert("Thêm user thành công", "success");
                    return(RedirectToAction("Index", "User"));
                }
                else
                {
                    ModelState.AddModelError("", "Thêm user không thành công");
                }
            }
            return(View("Index"));
        }
        public ActionResult BrowserFB(int page = 1, int pagesize = 5)
        {
            var model = new FeedBackDao().GetFeedBack(page, pagesize);

            return(View(model));
        }
Example #27
0
        public JsonResult GetFBByID(int id)
        {
            var data = new FeedBackDao().GetbyID(id);

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
Example #28
0
        public JsonResult FeedBackByStatus(int status)
        {
            var data = new FeedBackDao().ListByStatus(status);

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
        public ActionResult Edit(long id)
        {
            var feedback = new FeedBackDao().ViewDetail(id);

            return(View(feedback));
        }
Example #30
0
        public ActionResult ViewDetail(long ID)
        {
            var tintuc = new FeedBackDao().ViewDetail(ID);

            return(View(tintuc));
        }