public JsonResult PublishUnitReport(int reportId, int?TypeSelect) { try { UnitReportDAL objCtrl = new UnitReportDAL(); UnitReport obj = objCtrl.GetItemByID("Id", reportId); if (obj.Id > 0) { obj.PublishedBy = SysBaseInfor.GetCurrentUserId(); obj.PublishedAt = DateTime.Now; if (TypeSelect > 0) { obj.Status = 0; } else { obj.Status = 1; } objCtrl.UpdateItem(obj); } return(Json(new { Msg = "Success" })); } catch (Exception ex) { return(Json(new { Msg = "Fail" })); } }
public ActionResult ShowDetailUnitReport(int reportId, int?TypeSelect) { try { UnitReportDAL unitReportCtrl = new UnitReportDAL(); var vnFormat = new CultureInfo("VI-vi"); var listDayForSelect = new List <SelectListItem>(); if (TypeSelect > 0) { DateTime startOfWeek = DateTime.Today.AddDays(-1 * (int)(DateTime.Today.DayOfWeek) + 1); DateTime endOfWeek = startOfWeek.AddDays(5); for (int tmpI = (int)DateTime.Today.DayOfWeek; tmpI < 7; tmpI++) { var tmpDow = DateTime.Today.AddDays(tmpI - (int)DateTime.Today.DayOfWeek); listDayForSelect.Add(new SelectListItem() { Text = vnFormat.DateTimeFormat.GetDayName(tmpDow.DayOfWeek) + " " + tmpDow.ToString("dd/MM/yyyy"), Value = tmpDow.ToString() }); } } else { listDayForSelect.Add(new SelectListItem() { Text = vnFormat.DateTimeFormat.GetDayName(DateTime.Now.DayOfWeek) + " " + DateTime.Now.ToString("dd/MM/yyyy"), Value = DateTime.Now.ToString("dd/MM/yyyy") }); } ViewBag.ListDayForSelect = new SelectList(listDayForSelect, "Value", "Text"); var roleManager = HttpContext.GetOwinContext().Get <ApplicationRoleManager>(); ViewBag.ListGroupRoles = new SelectList(roleManager.GetListRoleByUnitIdAndType(SysBaseInfor.GetCurrentUnitCode() + SysBaseInfor.SignProject, SysBaseInfor.GetCurrentUnitId().ToInt32(), 2), "Id", "Name"); var result = new UnitReport(); if (reportId > 0) { result = unitReportCtrl.GetItemByID("Id", reportId); } return(PartialView("~/Views/UnitReport/_DetailUnitReport.cshtml", result)); } catch (Exception ex) { return(PartialView(blankViewUrl)); } }