public static hrm_atd_ScanTimeCollection Search(ScanTimeFilter value) { hrm_atd_ScanTimeCollection items = new hrm_atd_ScanTimeCollection(); string key = string.Format(SETTINGS_Search_KEY, value.Keyword, value.Page, value.PageSize, value.OrderBy, value.OrderDirection, value.FromDate, value.ToDate, value.EmployeeCode, value.CompanyID, value.Condition); //if (SystemConfig.AllowSearchCache) //{ // object obj2 = HttpCache.Get(key); // if ((obj2 != null)) // { // return (hrm_atd_ScanTimeCollection)obj2; // } //} using (var client = WebApiHelper.myclient(HouseEndpoint, SystemConst.APIJosonReturnValue)) { HttpResponseMessage response = client.PostAsJsonAsync(Resource + "?method=search", value).GetAwaiter().GetResult(); if (response.IsSuccessStatusCode) { items = response.Content.ReadAsAsync <hrm_atd_ScanTimeCollection>().GetAwaiter().GetResult(); } } if (SystemConfig.AllowSearchCache && items.Count > 0) { HttpCache.Max(key, items); } return(items); }
public JsonResult GetEmployeeGata([ModelBinder(typeof(DataTablesBinder))] IDataTablesRequest requestModel, int EmployeeCode) { ScanTimeFilter SearchKey = SearchData(1, requestModel, "EmployeeNo", "EmployeeNo"); //SearchKey.Condition = "employeeID = " + EmployeeCode + " "; 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 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)); }
// GET api/<controller> /// <summary> /// Gets this instance. /// </summary> /// <returns></returns> public hrm_atd_ScanTimeCollection Post(string method, [FromBody] ScanTimeFilter value) { return(hrm_atd_ScanTimeManager.Search(value)); }