public JsonResult GetSearchData([ModelBinder(typeof(DataTablesBinder))] IDataTablesRequest requestModel, string searchprm) { ScanTimeFilter ObjPara = new ScanTimeFilter(); ObjPara.FromDate = SystemConfig.CurrentDate.AddDays(-30); ObjPara.ToDate = SystemConfig.CurrentDate; //SearchKey.FromDate = SystemConfig.CurrentDate.AddDays(-30); //SearchKey.ToDate = SystemConfig.CurrentDate; if (!string.IsNullOrEmpty(searchprm)) { ObjPara = JsonConvert.DeserializeObject <ScanTimeFilter>(searchprm, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, DateFormatString = "dd/MM/yyyy" }); } //var dateTimeConverter = new Newtonsoft.Json.Converters.IsoDateTimeConverter { DateTimeFormat = "dd/MM/yyyy" }; //TimeSheetearchpara ObjPara = JsonConvert.DeserializeObject<TimeSheetearchpara>(searchprm,dateTimeConverter); //ScanTimeFilter SearchKey = ScanTimeFilter.SearchData(1, requestModel, "EmployeeID", "EmployeeID"); //SearchKey.OrderBy = "WorkDate"; //SearchKey.OrderDirection = "Desc"; ObjPara.OrderBy = "WorkDate"; ObjPara.OrderDirection = "Desc"; ObjPara.Page = (requestModel.Start / requestModel.Length) + 1; ObjPara.PageSize = requestModel.Length; ObjPara.Condition = ""; ObjPara.EmployeeCode = CurrentUser.EmployeeCode; ObjPara.CompanyID = CurrentUser.CompanyID; hrm_atd_ScanTimeCollection collection = hrm_atd_ScanTimeManager.Search(ObjPara); int TotalRecord = 0; if (collection.Count > 0) { TotalRecord = collection[0].TotalRecord; } //return Json(new DataTablesResponse(requestModel.Draw,null , TotalRecord, TotalRecord), JsonRequestBehavior.AllowGet); return(Json(new DataTablesResponse(requestModel.Draw, collection, TotalRecord, TotalRecord), JsonRequestBehavior.AllowGet)); }
/// <summary> /// /// </summary> /// <param name="requestModel"></param> /// <returns></returns> public JsonResult GetGata([ModelBinder(typeof(DataTablesBinder))] IDataTablesRequest requestModel) { ScanTimeFilter SearchKey = SearchData(1, requestModel, "EmployeeNo", "EmployeeNo"); //SearchKey.FromDate = SystemConfig.CurrentDate.AddDays(-30); //SearchKey.ToDate = SystemConfig.CurrentDate; SearchKey.FromDate = SearchKey.FromDate; SearchKey.FromDate = SearchKey.ToDate; SearchKey.EmployeeCode = CurrentUser.EmployeeCode; // SearchKey.Condition = " tbl.employeeID = " + CurrentUser.EmployeeCode + " "; // SearchKey.OrderBy = "Scan_Time"; // SearchKey.OrderDirection = "Desc"; hrm_atd_ScanTimeCollection collection = hrm_atd_ScanTimeManager.Search(SearchKey); int TotalRecord = 0; if (collection.Count > 0) { TotalRecord = collection[0].TotalRecord; } return(Json(new DataTablesResponse(requestModel.Draw, collection, TotalRecord, TotalRecord), JsonRequestBehavior.AllowGet)); }
public static hrm_atd_ScanTimeCollection GetAll() { hrm_atd_ScanTimeCollection items = new hrm_atd_ScanTimeCollection(); string key = SETTINGS_ALL_KEY; object obj2 = HttpCache.Get(key); if ((obj2 != null)) { return((hrm_atd_ScanTimeCollection)obj2); } using (var client = WebApiHelper.myclient(HouseEndpoint, SystemConst.APIJosonReturnValue)) { HttpResponseMessage response = client.GetAsync(Resource).GetAwaiter().GetResult(); if (response.IsSuccessStatusCode) { items = response.Content.ReadAsAsync <hrm_atd_ScanTimeCollection>().GetAwaiter().GetResult(); } } HttpCache.Max(key, items); return(items); }