Exemplo n.º 1
0
        public ActionResult YKienDongGopDetail(DongGopYKienModel model, HttpPostedFileBase FileAtachment)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    string _captcha = Session["CAPTCHA"].ToString();
                    if (_captcha.ToLower() == model.CaptCha.ToLower())
                    {
                        if (FileAtachment != null && FileAtachment.ContentLength > 0)
                        {
                            string _fileName = Path.GetFileName(FileAtachment.FileName);
                            bool   exists    = System.IO.Directory.Exists(Server.MapPath("~/FileAtachment"));
                            if (!exists)
                            {
                                System.IO.Directory.CreateDirectory(Server.MapPath("~/FileAtachment"));
                            }
                            string _path = Path.Combine(Server.MapPath("~/FileAtachment"), _fileName);
                            FileAtachment.SaveAs(_path);
                            var entity = new FeedbackDetail();
                            entity.fileAttachment  = _fileName;
                            entity.feedbackContent = model.Body;
                            entity.feedbackId      = model.feedbackId;
                            entity.fullName        = model.FullName;
                            entity.email           = model.Email;
                            entity.address         = model.Add;
                            entity.phone           = model.Phone;
                            entity.isTrash         = false;
                            entity.isApproval      = false;
                            entity.createTime      = DateTime.Now;
                            _feedbackServices.AddDetail(entity);
                            _feedbackServices.Save();
                            return(RedirectToAction("YKienDongGopDetail", new { Id = model.feedbackId }));
                        }
                    }
                    else
                    {
                        ModelState.AddModelError("", "Mã bảo mật không đúng!");
                    }
                }
                catch (Exception ex)
                {
                }
            }
            var entitys = _feedbackServices.GetById(model.feedbackId);

            ViewBag.Title      = entitys.feedbackName;
            ViewBag.StartDate  = entitys.startDate.ToString("dd-MM-yyyy");
            ViewBag.EndDate    = entitys.endDate.ToString("dd-MM-yyyy");
            ViewBag.End        = entitys.isEnd;
            ViewBag.FeedbackId = entitys.feedbackId;
            var models = _feedbackServices.GetDetailByFeedbackId(model.feedbackId);

            if (models != null)
            {
                models = models.Where(x => x.isTrash == false && x.isApproval == true);
            }
            ViewBag.ListFile = models.ToList();
            return(View(model));
        }
Exemplo n.º 2
0
        public ActionResult FromDongGop(int feedbackId)
        {
            DongGopYKienModel model = new DongGopYKienModel();

            model.feedbackId   = feedbackId;
            Session["CAPTCHA"] = GetRandomText();
            return(PartialView(model));
        }
Exemplo n.º 3
0
 public ActionResult FromDongGop(DongGopYKienModel model, HttpPostedFileBase FileAtachment)
 {
     if (ModelState.IsValid)
     {
         try
         {
             string _captcha = Session["CAPTCHA"].ToString();
             if (_captcha.ToLower() == model.CaptCha.ToLower())
             {
                 if (FileAtachment != null && FileAtachment.ContentLength > 0)
                 {
                     string _fileName = Path.GetFileName(FileAtachment.FileName);
                     string _path     = Path.Combine(Server.MapPath("~/FileAtachment"), _fileName);
                     FileAtachment.SaveAs(_path);
                     var entity = new FeedbackDetail();
                     entity.fileAttachment  = _fileName;
                     entity.feedbackContent = model.Body;
                     entity.feedbackId      = model.feedbackId;
                     entity.fullName        = model.FullName;
                     entity.email           = model.Email;
                     entity.address         = model.Add;
                     entity.phone           = model.Phone;
                     entity.isTrash         = false;
                     entity.isApproval      = false;
                     entity.createTime      = DateTime.Now;
                     _feedbackServices.AddDetail(entity);
                     _feedbackServices.Save();
                     return(RedirectToAction("YKienDongGopDetail", new { Id = model.feedbackId }));
                 }
             }
             else
             {
                 ModelState.AddModelError("", "Mã bảo mật không đúng!");
             }
         }
         catch (Exception ex)
         {
         }
     }
     return(RedirectToAction("YKienDongGopDetail", new { Id = model.feedbackId }));
 }
Exemplo n.º 4
0
        public ActionResult YKienDongGopDetail(int Id)
        {
            var entity = _feedbackServices.GetById(Id);

            ViewBag.Title      = entity.feedbackName;
            ViewBag.StartDate  = entity.startDate.ToString("dd-MM-yyyy");
            ViewBag.EndDate    = entity.endDate.ToString("dd-MM-yyyy");
            ViewBag.End        = entity.isEnd;
            ViewBag.FeedbackId = entity.feedbackId;
            ViewBag.Note       = entity.feedbackNote;
            ViewBag.Content    = entity.feedbackBody;
            var model = _feedbackServices.GetDetailByFeedbackId(Id);

            if (model != null)
            {
                model = model.Where(x => x.isTrash == false && x.isApproval == true);
            }
            ViewBag.ListFile = model.ToList();
            DongGopYKienModel enYKien = new DongGopYKienModel();

            enYKien.feedbackId = Id;
            Session["CAPTCHA"] = GetRandomText();
            return(View(enYKien));
        }