示例#1
0
        public JsonResult LoadData(int type, string keyword, int pageIndex, int pageSize)
        {
            string str   = NonUnicode.RemoveUnicode(keyword).ToLower();
            var    model = new FeedbackDao().ListAll();

            switch (type)
            {
            case 0: model = model.Where(x => NonUnicode.RemoveUnicode(x.Name).ToLower().Contains(str) || x.Email.Contains(keyword)); break;

            case 1: model = model.Where(x => NonUnicode.RemoveUnicode(x.Name).ToLower().Contains(str)); break;

            case 2: model = model.Where(x => NonUnicode.RemoveUnicode(x.Email).ToLower().Contains(str)); break;
            }

            int totalRow = model.Count();

            model = model.OrderByDescending(x => x.CreateDate)
                    .Skip((pageIndex - 1) * pageSize)
                    .Take(pageSize);
            int totalRowCurent = model.Count();

            return(Json(new
            {
                data = model,
                total = totalRow,
                totalCurent = totalRowCurent,
                status = true
            }, JsonRequestBehavior.AllowGet));
        }
        public ActionResult Feedback(FeedbackModel model)
        {
            if (ModelState.IsValid)
            {
                var dao = new FeedbackDao();
                var fb  = new Feedback();

                fb.Name       = model.Name;
                fb.Content    = model.Content;
                fb.Phone      = model.Phone;
                fb.Email      = model.Email;
                fb.CreateDate = DateTime.Now;

                fb.UserID = model.UserID;

                var result = dao.Insert(fb);
                if (result > 0)
                {
                    model           = new FeedbackModel();
                    ViewBag.Success = "Gửi phản hồi thành công!";

                    return(RedirectToAction("Index", "Homeuser"));
                }
                else
                {
                    ModelState.AddModelError("", "Gửi phản hồi thất bại thất bại!");
                }
            }

            return(View(model));
        }
        // GET: Admin/Feedback
        public ActionResult Index(int page = 1, int pageSize = 5)
        {
            var dao   = new FeedbackDao();
            var model = dao.ListAllPaging(page, pageSize);

            return(View(model));
        }
示例#4
0
        public JsonResult Send(string name, string mobile, string address, string email, string content)
        {
            var feedback = new Feedback();

            feedback.Name        = name;
            feedback.Phone       = mobile;
            feedback.Address     = address;
            feedback.Email       = email;
            feedback.Content     = content;
            feedback.CreatedDate = DateTime.Now;

            var id = new FeedbackDao().Insert(feedback);

            if (id > 0)
            {
                return(Json(new
                {
                    status = true
                             //Có thể send mail ở đây, làm tương tự như bài gửi mail
                }));
            }
            else
            {
                return(Json(new
                {
                    status = false
                }));
            }
        }
示例#5
0
        public JsonResult Send(string name, string mobile, string address, string email, string content)
        {
            var feedback = new Feedback();

            feedback.Name       = name;
            feedback.Phone      = mobile;
            feedback.Address    = address;
            feedback.Email      = email;
            feedback.Content    = content;
            feedback.CreateDate = DateTime.Now;
            var result = new FeedbackDao().Insert(feedback);

            if (result)
            {
                return(Json(new
                {
                    status = true
                }));
                // gửi email   phản hồi tới  admin
                // gữi  thư  xác nhận  đã gửi email cho khách  hàng
            }
            else
            {
                return(Json(new
                {
                    status = false
                }));
            }
        }
示例#6
0
 public ActionResult Feedback(Feedback feedback)
 {
     if (ModelState.IsValid)
     {
         feedback.ViewStatus = false;
         feedback.Status     = true;
         var id = new FeedbackDao().Insert(feedback);
         if (id > 0)
         {
             if (Session[Constants.USER_INFO] != null)
             {
                 new LogDao().SetLog("Feedback", "Gửi feedback thành công", ((User)Session[Constants.USER_INFO]).ID);
             }
             return(RedirectToAction("FeedbackSuccess", "Contact"));
         }
         else
         {
             if (Session[Constants.USER_INFO] != null)
             {
                 new LogDao().SetLog("Feedback", "Gửi feedback không thành công", ((User)Session[Constants.USER_INFO]).ID);
             }
             return(RedirectToAction("FeedbackError", "Contact"));
         }
     }
     else
     {
         return(View("Index", feedback));
     }
 }
示例#7
0
        // GET: Admin/Course
        public ActionResult Index(string searchString, int page = 1, int pageSize = 5)
        {
            var dao   = new FeedbackDao();
            var model = dao.ListAllPaging(searchString, page, pageSize);

            ViewBag.SearchString = searchString;
            return(View(model));
        }
示例#8
0
        public JsonResult ChangeStatus(int id)
        {
            var result = new FeedbackDao().ChangeStatus(id);

            return(Json(new
            {
                status = result
            }));
        }
示例#9
0
        public JsonResult ShowContent(int id)
        {
            var res = new FeedbackDao().GetById(id);

            return(Json(new
            {
                data = res,
                status = true
            }, JsonRequestBehavior.AllowGet));
        }
示例#10
0
        // GET: Admin/Login
        public ActionResult Index()
        {
            var document = new DocumentDao();
            var feedback = new FeedbackDao();

            ViewBag.FeedbackCount = feedback.GetCountFeedback();
            ViewBag.DocumentCount = document.GetTotalDocument();
            ViewBag.TotalView     = document.GetTotalView();
            ViewBag.Feedback      = feedback.GetFeedback();
            return(View());
        }
示例#11
0
        // GET: Process
        public ActionResult Index(long id)
        {
            //Kiểm tra quyền truy cập của user
            UserLogin      us    = (UserLogin)Session[CommonConstant.USER_SESSION];
            ProjectUserDao puDao = new ProjectUserDao();

            //Kiểm tra quyền truy cập của lạnh đạo
            bool         inGroup = false;
            GroupUserDao gru     = new GroupUserDao();
            //Kiểm tra theo user có thuộc nhóm lãnh đạo kho
            Guid grid = new Guid("964D283D-BEA0-4D85-B7C0-355487A5DF0C");

            if (gru.FiindByID(grid, us.UserID) != null)
            {
                inGroup = true;
            }
            //Kiểm tra theo user có thuộc nhóm trong dự án ko
            ProjectUser objPU = puDao.FindByID(us.UserID, id);

            if (objPU != null)
            {
                inGroup = true;
            }
            if (inGroup == false)
            {
                SetAlert("Bạn không có quyền cập nhật tiến độ dự án", Common.CommonConstant.ALERT_DANGER);
                return(RedirectToAction("Details", "Project", new { id = id }));
            }

            ProjectDao bdDao = new ProjectDao();

            ViewBag.Project = bdDao.FindByID(id);
            if (ViewBag.Project.Status < 1)
            {
                SetAlert("Dự án chưa được duyệt!", Common.CommonConstant.ALERT_WARNING);
                return(RedirectToAction("Details", "Project", new { id = id }));
            }

            if (ViewBag.Project.Status > 2)
            {
                SetAlert("Dự án đã kết thúc!", Common.CommonConstant.ALERT_WARNING);
                return(RedirectToAction("Details", "Project", new { id = id }));
            }
            ProcessDao prcessDao = new ProcessDao();

            ViewBag.lstprocess = prcessDao.ToListProcessUserByProjectID(id);
            ViewBag.lstProjectProcessMessege = prcessDao.GetListProjectProcessMessege(id).ToArray <ProjectMessage>();
            ViewBag.Messege = prcessDao.CountProcessMessage(id).ToString();
            FeedbackDao feedDao = new FeedbackDao();

            ViewBag.Feedback = feedDao.ToListByProjectID(id).Count.ToString();
            return(View());
        }
 public ActionResult Delete(int id)
 {
     if (((User)Session[Constants.USER_INFO]).GroupID == Constants.GROUP_ADMIM)
     {
         SetActiveSlideBar(Constants.SLIDEBAR_AD_SYSTEM);
         var FeedbackModel = new FeedbackDao().GetDetail(id);
         new LogDao().SetLog("Admin_Feedback_Delete", null, ((User)Session[Constants.USER_INFO]).ID);
         return(View(FeedbackModel));
     }
     SetAlert("Tài khoản của bạn không có quyền", Constants.ALERTTYPE_ERROR);
     new LogDao().SetLog("Admin_Feedback_Delete", "Tài khoản của bạn không có quyền", ((User)Session[Constants.USER_INFO]).ID);
     return(RedirectToAction("Index", "Home"));
 }
 // GET: Admin/Feedback
 public ActionResult Index()
 {
     if (((User)Session[Constants.USER_INFO]).GroupID == Constants.GROUP_ADMIM)
     {
         SetActiveSlideBar(Constants.SLIDEBAR_AD_SYSTEM);
         var feedback = new FeedbackDao().ListAllFeedback();
         new LogDao().SetLog("Admin_Feedback_Index", null, ((User)Session[Constants.USER_INFO]).ID);
         return(View(feedback));
     }
     SetAlert("Tài khoản của bạn không có quyền", Constants.ALERTTYPE_ERROR);
     new LogDao().SetLog("Admin_Feedback_Index", "Tài khoản của bạn không có quyền", ((User)Session[Constants.USER_INFO]).ID);
     return(RedirectToAction("Index", "Home"));
 }
示例#14
0
 public ActionResult AddMessage(Feedback fb)
 {
     if (ModelState.IsValid)
     {
         FeedbackDao fbDao = new FeedbackDao();
         fb.TimeAdded = DateTime.Now;
         fbDao.AddMessage(fb);
         return(RedirectToAction("Index"));
     }
     else
     {
         return(View("Contact"));
     }
 }
示例#15
0
 public ActionResult Index(Feedback feed)
 {
     if (ModelState.IsValid)
     {
         var dao = new FeedbackDao();
         long result = dao.Insert(feed);
         if (result > 0)
         {
             ViewBag.Success = "Feedback sent successfully";
         }
         else
         {
             ModelState.AddModelError("", "Sending feedback failed");
         }
     }
     return View(feed);
 }
        public ResponseEntity <string> Add(Feedback feedback)
        {
            ResponseEntity <string> response = new ResponseEntity <string>();

            var  dao     = new FeedbackDao(ConfigurationManager.AppSettings["mysqlConnStr"]);
            bool success = dao.AddFeedback(feedback);

            if (success)
            {
                response = new ResponseEntity <string>(true, "反馈成功", "反馈成功");
            }
            else
            {
                response = new ResponseEntity <string>(true, "反馈失败", "反馈失败");
            }
            return(response);
        }
示例#17
0
        public ActionResult Create(Feedback model)
        {
            if (ModelState.IsValid)
            {
                var  dao    = new FeedbackDao();
                long result = dao.Insert(model);
                if (result > 0)
                {
                    return(RedirectToAction("Index", "Home"));
                }
                else
                {
                    ModelState.AddModelError("", "Feedback send not successfull!!");
                }
            }

            return(View("Create"));
        }
示例#18
0
 public ActionResult Edit(Feedback category)
 {
     if (ModelState.IsValid)
     {
         var dao    = new FeedbackDao();
         var result = dao.Update(category);
         if (result)
         {
             SetAlert("Cập nhật thông báo thành công", "success");
             return(RedirectToAction("Index", "Feedback"));
         }
         else
         {
             ModelState.AddModelError("", "Cập nhật thông báo không thành công");
         }
     }
     return(View("Index"));
 }
示例#19
0
        public JsonResult Delete(int id)
        {
            var res = new FeedbackDao().Delete(id);

            if (res)
            {
                return(Json(new
                {
                    status = true
                }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(new
                {
                    status = false
                }, JsonRequestBehavior.AllowGet));
            }
        }
        public AllFeedbacks GetAllFollows(int pageIndex, int pageSize)
        {
            AllFeedbacks result = new AllFeedbacks();

            var    feedbackDao = new FeedbackDao(ConfigurationManager.AppSettings["mysqlConnStr"]);
            string filter      = string.Empty;

            //if (!string.IsNullOrEmpty(followerName))
            //{
            //    filter = $" and u2.nickName like '%{followerName}%' ";
            //}
            var allFeedbacks = feedbackDao.GetFeedbacks(pageIndex, pageSize, filter);
            var count        = feedbackDao.GetFeedbackCount(filter);

            result.feedbacks = allFeedbacks;
            result.count     = count;

            return(result);
        }
示例#21
0
 public ActionResult SendFeedBack(long matk, string tentk, string noidung)
 {
     var fb = new DanhGia();
     fb.MaTK = matk;
     fb.TenTK = tentk;
     fb.NoiDung = noidung;
     fb.NgayDanhGia = DateTime.Now;
     var fback = new FeedbackDao();
     long tc = fback.Insert(fb);
     if (tc > 0)
     {
         return Redirect("Contact");
     }
     else
     {
         ModelState.AddModelError("", "Không thành công");
     }
     return Redirect("Contact");
 }
示例#22
0
        public ActionResult Index(FormCollection data)
        {
            try
            {
                UserLogin  us        = (UserLogin)Session[CommonConstant.USER_SESSION];
                var        dao       = new  FeedbackDao();
                long       projectID = Convert.ToInt64(data["txtID"].ToString());
                ProcessDao prcessDao = new ProcessDao();
                ViewBag.lstprocess = prcessDao.ToListProcessUserByProjectID(projectID);
                ViewBag.lstProjectProcessMessege = prcessDao.GetListProjectProcessMessege(projectID).ToArray <ProjectMessage>();
                ViewBag.Messege = prcessDao.CountProcessMessage(projectID).ToString();
                Feedback objFeedback = new Feedback();

                objFeedback.ProjectID    = projectID;
                objFeedback.Description  = data["txtDescription"].ToString();
                objFeedback.CreateDate   = Hepper.GetDateServer();
                objFeedback.ModifiedDate = Hepper.GetDateServer();
                objFeedback.CreateBy     = us.UserName;
                objFeedback.ModifiedBy   = us.UserName;
                if (dao.Insert(objFeedback) > 0)
                {
                    SetAlert("Thêm thành công", "success");
                    ViewBag.Feedback = dao.ToListFeebBackUser(projectID).ToArray <FeedbackUser>();
                    List <FeedbackUser> fdnul = new List <FeedbackUser>();
                    foreach (FeedbackUser fb in ViewBag.Feedback)
                    {
                        if (fb.ChildID == null)
                        {
                            fdnul.Add(fb);
                        }
                    }
                    ViewBag.FeedbackNull = fdnul.ToArray <FeedbackUser>();
                    return(RedirectToAction("Index"));
                }
            }
            catch
            {
                SetAlert("Không thêm được", "danger");
                return(View());
            }
            return(View());
        }
示例#23
0
        public JsonResult CreateFeedBack(long projectID, string content, long?chilID = null)
        {
            UserLogin us          = (UserLogin)Session[CommonConstant.USER_SESSION];
            Feedback  objFeedback = new Feedback();
            var       dao         = new FeedbackDao();

            objFeedback.ProjectID    = projectID;
            objFeedback.Description  = content;
            objFeedback.ChildID      = chilID;
            objFeedback.CreateDate   = Hepper.GetDateServer();
            objFeedback.ModifiedDate = Hepper.GetDateServer();
            objFeedback.CreateBy     = us.UserName;
            objFeedback.ModifiedBy   = us.UserName;
            var        data   = dao.Insert(objFeedback);
            JsonResult result = new JsonResult();

            result.Data = data;
            result.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
            return(result);
        }
 public ActionResult Delete(Feedback feedback)
 {
     if (((User)Session[Constants.USER_INFO]).GroupID == Constants.GROUP_ADMIM)
     {
         var result = new FeedbackDao().Remove(feedback);
         if (result)
         {
             SetAlert("Xoá Feedback thành công", Constants.ALERTTYPE_SUCCESS);
             new LogDao().SetLog("Admin_Feedback_Delete", "Xoá Feedback thành công", ((User)Session[Constants.USER_INFO]).ID);
             return(RedirectToAction("Index", "Feedback"));
         }
         else
         {
             SetAlert("Xoá Feedback không thành công", Constants.ALERTTYPE_ERROR);
             new LogDao().SetLog("Admin_Feedback_Delete", "Xoá Feedback không thành công", ((User)Session[Constants.USER_INFO]).ID);
             return(RedirectToAction("Index", "Feedback"));
         }
     }
     SetAlert("Tài khoản của bạn không có quyền", Constants.ALERTTYPE_ERROR);
     new LogDao().SetLog("Admin_Feedback_Delete", "Tài khoản của bạn không có quyền", ((User)Session[Constants.USER_INFO]).ID);
     return(RedirectToAction("Index", "Home"));
 }
示例#25
0
        public JsonResult UpdateUserRead(long feedID)
        {
            UserLogin us = (UserLogin)Session[CommonConstant.USER_SESSION];

            var      dao         = new FeedbackDao();
            long     data        = 0;
            Feedback objFeedback = dao.FindByID(feedID);
            string   usID        = us.UserID.ToString();
            string   sUserID     = objFeedback.UsersRead;

            string[] listUerID;
            bool     kt = false;

            if (sUserID == null)
            {
                sUserID = usID;
                kt      = true;
            }
            else
            {
                listUerID = objFeedback.UsersRead.Split('.');
                if (!listUerID.Contains(usID))
                {
                    sUserID += "." + usID;
                    kt       = true;
                }
            }
            if (kt == true)
            {
                objFeedback.UsersRead = sUserID;
                data = dao.Update(objFeedback);
            }

            JsonResult result = new JsonResult();

            result.Data = data;
            result.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
            return(result);
        }
        public JsonResult Send(string name, string mobile, string address, string email, string content)
        {
            var feedback = new Feedback();

            feedback.Name        = name;
            feedback.Email       = email;
            feedback.Address     = address;
            feedback.CreatedTime = DateTime.Now;
            feedback.Phone       = mobile;
            feedback.Content     = content;
            var id = new FeedbackDao().InsertFeedback(feedback);

            if (id > 0)
            {
                //send email
                string noidung = System.IO.File.ReadAllText(Server.MapPath("~/assets/client/template/newcontact.html"));
                noidung = noidung.Replace("{{CustomerName}}", name);
                noidung = noidung.Replace("{{Phone}}", mobile);
                noidung = noidung.Replace("{{Email}}", email);
                noidung = noidung.Replace("{{Address}}", address);
                noidung = noidung.Replace("{{Content}}", content);
                var toEmail = ConfigurationManager.AppSettings["ToEmailAddress"].ToString();

                new MailHelper().SendMail(toEmail, "Liên hệ mới từ OnlineShop", noidung);
                new MailHelper().SendMail(email, "Liên hệ mới từ OnlineShop", noidung);
                return(Json(new
                {
                    status = true
                }));
            }
            else
            {
                return(Json(new
                {
                    status = false
                }));
            }
        }
示例#27
0
        public ActionResult SendFeedbackToDb(string name, string email, string address, string comment)
        {
            bool result;

            try
            {
                var model    = new FeedbackDao();
                var feedback = new Feedback
                {
                    Name    = name,
                    Email   = email,
                    Address = address,
                    Content = comment,
                };
                var id = model.Create(feedback);
                result = id != 0;
            }
            catch (Exception ex)
            {
                result = false;
            }
            return(Json(new { result }, JsonRequestBehavior.AllowGet));
        }
示例#28
0
        public JsonResult SendFeedback(string name, string address, string mobile, string email, string title, string message)
        {
            try
            {
                var feedback = new Feedback();
                feedback.Name       = name;
                feedback.Address    = address;
                feedback.Phone      = mobile;
                feedback.CreateDate = DateTime.Now;
                feedback.Email      = email;
                feedback.Content    = message;
                feedback.Status     = false;

                var id = new FeedbackDao().Insert(feedback);

                string content = System.IO.File.ReadAllText(Server.MapPath("~/Asset/Client/template/feedback.html"));
                content = content.Replace("{{Title}}", title);
                content = content.Replace("{{CustomerName}}", name);
                content = content.Replace("{{Email}}", email);
                content = content.Replace("{{Feedback}}", message);

                var toEmail = ConfigurationManager.AppSettings["ToEmailAddress"].ToString();
                new MailHelper().SendMailFeedback(toEmail, "Phản hồi", content);
                return(Json(new
                {
                    status = true
                }, JsonRequestBehavior.AllowGet));
            }
            catch
            {
                return(Json(new
                {
                    status = false
                }, JsonRequestBehavior.AllowGet));
            }
        }
示例#29
0
        // GET: Feedback
        public ActionResult Index(long id)
        {
            ////Kiểm tra quyền truy cập của user
            //UserLogin us = (UserLogin)Session[CommonConstant.USER_SESSION];
            //ProjectUserDao usDao = new ProjectUserDao();
            //List<ProjectUser> lstUP = usDao.FindByProjectID(id);
            //bool inGroup = false;
            //foreach (var u in lstUP)
            //{
            //    if (u.LoginID == us.UserID)
            //    {
            //        inGroup = true;
            //        break;
            //    }
            //}
            ////Kiểm tra quyền truy cập của lạnh đạo
            //GroupUserDao gru = new GroupUserDao();
            //Guid grid = new Guid("964D283D-BEA0-4D85-B7C0-355487A5DF0C");
            //if (gru.FiindByID(grid, us.UserID) != null)
            //{
            //    inGroup = true;
            //}
            //if (!inGroup)
            //{
            //    RedirectToAction("NotiAuthorize", "Home");

            //}
            ProjectDao bdDao = new ProjectDao();

            ViewBag.Project = bdDao.FindByID(id);
            if (ViewBag.Project.Status < 1)
            {
                SetAlert("Dự án chưa được duyệt!", Common.CommonConstant.ALERT_WARNING);
                return(RedirectToAction("Details", "Project", new { id = id }));
            }

            if (ViewBag.Project.Status > 2)
            {
                SetAlert("Dự án đã kết thúc!", Common.CommonConstant.ALERT_WARNING);
                return(RedirectToAction("Details", "Project", new { id = id }));
            }

            ProcessDao prcessDao = new ProcessDao();

            //ViewBag.lstprocess = prcessDao.ToListProcessUserByProjectID(id);
            //ViewBag.lstProjectProcessMessege = prcessDao.GetListProjectProcessMessege(id).ToArray<ProjectMessage>();
            ViewBag.Messege = prcessDao.CountProcessMessage(id).ToString();
            FeedbackDao feedDao = new FeedbackDao();

            ViewBag.Feedback = feedDao.ToListFeebBackUser(id).ToArray <FeedbackUser>();
            List <FeedbackUser> fdnul = new List <FeedbackUser>();

            foreach (FeedbackUser fb in ViewBag.Feedback)
            {
                if (fb.ChildID == null)
                {
                    fdnul.Add(fb);
                }
            }
            ViewBag.FeedbackNull = fdnul.ToArray <FeedbackUser>();
            return(View());
        }
示例#30
0
 public ContactController()
 {
     feedbackDao = new FeedbackDao();
 }