예제 #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));
        }
예제 #2
0
        public FeedbackDetail_DTO FindFeedback(int id)
        {
            FeedbackDetail     feedDAL = DAL.FindFeedback(id);
            FeedbackDetail_DTO feedApi = new FeedbackDetail_DTO();

            if (feedDAL != null)
            {
                feedApi.Id     = feedDAL.Id;
                feedApi.Rating = (int)feedDAL.Rating;
                if (!string.IsNullOrEmpty(feedDAL.Comment))
                {
                    feedApi.Comment = feedDAL.Comment;
                }
            }
            return(feedApi);
        }
예제 #3
0
        public void AddReply(FeedbackModel feedbackModel)
        {
            var feedBackDetail = new FeedbackDetail()
            {
                FeedbackId      = feedbackModel.Id,
                RepliedDateTime = feedbackModel.RepliedDateTime,
                ReplyContent    = feedbackModel.ReplyContent,
                UserId          = feedbackModel.ReplierId
            };

            if (feedBackDetail != null)
            {
                _shoppingContext.FeedbackDetails.Add(feedBackDetail);
                _shoppingContext.SaveChanges();
            }
        }
예제 #4
0
        // Create One New Feedback record into database
        public static bool InsertFeedback(FeedbackDetail feedback)
        {
            bool status;

            try
            {
                DbContext.FeedbackDetails.Add(feedback);
                DbContext.SaveChanges();
                status = true;
            }
            catch (Exception e)
            {
                status = false;
            }
            return(status);
        }
예제 #5
0
        public bool InsertFeedback(FeedbackDetail_DTO feedApi)
        {
            bool status = false;

            if (ModelState.IsValid)
            {
                FeedbackDetail feedDAL = new FeedbackDetail();

                feedDAL.Rating = (int)feedApi.Rating;
                if (!string.IsNullOrEmpty(feedApi.Comment))
                {
                    feedDAL.Comment = feedApi.Comment;
                }
                status = DAL.InsertFeedback(feedDAL);
            }
            return(status);
        }
예제 #6
0
        //Delete One Specific Feedback Record
        public static bool DeleteFeedback(int id)
        {
            bool status;

            try
            {
                FeedbackDetail Item = DbContext.FeedbackDetails.Where(p => p.Id == id).FirstOrDefault();
                if (Item != null)
                {
                    DbContext.FeedbackDetails.Remove(Item);
                    DbContext.SaveChanges();
                }
                status = true;
            }
            catch (Exception)
            {
                status = false;
            }
            return(status);
        }
예제 #7
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 }));
 }
예제 #8
0
        // Update One existed Feedback record
        public static bool UpdateFeedback(FeedbackDetail feedback)
        {
            bool status;

            try
            {
                FeedbackDetail Item = DbContext.FeedbackDetails.Where(p => p.Id == feedback.Id).FirstOrDefault();
                if (Item != null)
                {
                    Item.Rating = feedback.Rating;
                    if (!string.IsNullOrEmpty(feedback.Comment))
                    {
                        Item.Comment = feedback.Comment;
                    }
                    DbContext.SaveChanges();
                }
                status = true;
            }
            catch (Exception)
            {
                status = false;
            }
            return(status);
        }
예제 #9
0
 public FeedbackDetail AddDetail(FeedbackDetail model)
 {
     return(_feedbackDetailRepository.Add(model));
 }
예제 #10
0
 public void UpdateDetail(FeedbackDetail model)
 {
     _feedbackDetailRepository.Update(model);
 }