public ActionResult RememberHistory(int function_id) { try { int callId = (Session["caller"] as Caller).user_id; IFunctionHistoryImplMgr _fhMgr = new FunctionHistoryMgr(connectionString); return Json(new { success = _fhMgr.Save(new FunctionHistory { Function_Id = function_id,User_Id = callId,Operate_Time = DateTime.Now})}); } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); return Json(new { success = false }); } }
/// add by wwei0216w 2015/04/03 #region 查詢控件的歷史記錄 public ActionResult QueryHistory() { try { int total = 0; int function_id = Convert.ToInt32(Request["function_id"]); IFunctionHistoryImplMgr _fhMgr = new FunctionHistoryMgr(connectionString); FunctionHistory fh = new FunctionHistory(); _fhMgr = new FunctionHistoryMgr(connectionString); int start = int.Parse(Request.Form["start"] ?? "0"); int limit = int.Parse(Request.Form["limit"] ?? "0"); string condition = Request.Form["conditional"]; DateTime startTime = Request.Form["startTime"] == "" ? DateTime.MinValue : Convert.ToDateTime(Request.Form["startTime"]); DateTime startEnd = Request.Form["endTime"] == "" ? DateTime.MaxValue : Convert.ToDateTime(Request.Form["endTime"]); var course = _fhMgr.Query(function_id, start, limit, condition, startTime, startEnd, out total); IsoDateTimeConverter iso = new IsoDateTimeConverter() { DateTimeFormat = "yyyy-MM-dd HH:mm:ss" }; return Content("{success:true,totalCount:" + total + ",item:" + JsonConvert.SerializeObject(course, Formatting.None, iso) + "}"); } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); return new EmptyResult(); } }