public async Task <ActionResult> Feedback(FeedBackModel model, int hospitalId = 0) { List <FeedbackType> feebackTypeList = FeedBackModel.LoadFeedbeackTypeList(); if (FeedBackModel.IsAssignedHospital(hospitalId)) { HospitalEntity hospitalEntity = await HomeModel.LoadHospitalById(hospitalId); feebackTypeList.Remove(feebackTypeList.First()); feebackTypeList.Remove(feebackTypeList.First()); feebackTypeList.Remove(feebackTypeList.First()); model.Header = hospitalEntity.Hospital_Name; model.HospitalID = hospitalId; } else { feebackTypeList.Remove(feebackTypeList.Last()); feebackTypeList.Remove(feebackTypeList.Last()); } ViewBag.FeedbackTypeList = new SelectList(feebackTypeList, Constants.FeedbackType, Constants.FeedbackTypeName); model.Email = User.Identity.Name.Split(Char.Parse(Constants.Minus))[0]; return(PartialView(model)); }
public ActionResult Feedback(string sFromDate, string sToDate, int feedbackType = 0, int responseType = 0, int page = 1) { try { DateTime fromDate = new DateTime(); DateTime toDate = new DateTime(); if (string.IsNullOrEmpty(sFromDate) || string.IsNullOrEmpty(sToDate)) { DateTime today = DateTime.Today; fromDate = new DateTime(today.Year, today.Month - 1, 1); toDate = new DateTime(today.Year, today.Month, 1); } else { fromDate = DateTime.ParseExact(sFromDate, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture); toDate = DateTime.ParseExact(sToDate + " 23:59:59", "dd/MM/yyyy HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture); } ViewBag.FeedbackList = FeedBackModel.LoadAdministratorFeedback(fromDate, toDate, feedbackType, responseType).ToPagedList(page, Constants.PageSize); ViewBag.FromDate = string.Format("{0:dd/MM/yyyy}", fromDate); ViewBag.ToDate = string.Format("{0:dd/MM/yyyy}", toDate); List <FeedbackType> feebackTypeList = FeedBackModel.LoadFeedbeackTypeList(); List <SelectListItem> feedbackTypeItemList = new List <SelectListItem>() { new SelectListItem { Value = "0", Text = "Tất cả loại phản hồi" }, new SelectListItem { Value = feebackTypeList[0].Type_ID.ToString(), Text = feebackTypeList[0].Type_Name }, new SelectListItem { Value = feebackTypeList[1].Type_ID.ToString(), Text = feebackTypeList[1].Type_Name }, new SelectListItem { Value = feebackTypeList[2].Type_ID.ToString(), Text = feebackTypeList[2].Type_Name }, }; ViewBag.FeedbackTypeList = new SelectList(feedbackTypeItemList, "Value", "Text", feedbackType); ViewBag.FeedbackType = feedbackType; List <SelectListItem> responseItemList = new List <SelectListItem>() { new SelectListItem { Value = "0", Text = "Tất cả phản hồi" }, new SelectListItem { Value = "1", Text = "Đã duyệt" }, new SelectListItem { Value = "2", Text = "Chưa duyệt" } }; ViewBag.ResponseTypeList = new SelectList(responseItemList, "Value", "Text", responseType); ViewBag.ResponseType = responseType; ViewBag.ApproveStatus = TempData["ApproveStatus"]; return(View()); } catch (Exception exception) { LoggingUtil.LogException(exception); return(RedirectToAction(Constants.SystemFailureHomeAction, Constants.ErrorController)); } }