public JsonResult SaveDetailUnitReport(UnitReport objReport) { try { UnitReportDAL objCtrl = new UnitReportDAL(); if (objReport.DayReport != null) { objReport.DayReport = objReport.DayReport.ToLocalTime(); } if (objReport.Id > 0) { objReport.UpdatedBy = SysBaseInfor.GetCurrentUserId(); objCtrl.UpdateItem(objReport); return(Json(new { Msg = "Success", Type = "Edit" })); } else { objReport.Status = 0; objReport.CreatedBy = SysBaseInfor.GetCurrentUserId(); objReport.UnitId = SysBaseInfor.GetCurrentUnitId().ToInt32(); objCtrl.CreateItem(objReport); return(Json(new { Msg = "Success", Type = "Create" })); } } catch (Exception ex) { return(Json(new { Msg = "Fail" })); } }
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" })); } }