public ContentResult Search(SearchFilter SearchKey) { SearchKey.OrderBy = string.IsNullOrEmpty(SearchKey.OrderBy) ? "Id" : SearchKey.OrderBy; ScheduleTaskCollection collection = ScheduleTaskManager.Search(SearchKey); return(Content(JsonConvert.SerializeObject(collection), "application/json")); }
public static ScheduleTaskCollection Search(SearchFilter value) { ScheduleTaskCollection items = new ScheduleTaskCollection(); //string key = string.Format(SETTINGS_Search_KEY, value.CompanyID+value.Keyword+value.Page+value.PageSize+value.OrderBy+value.OrderDirection) string key = string.Format(SETTINGS_Search_KEY, value.Keyword, value.Page, value.PageSize, value.OrderBy, value.OrderDirection, value.Condition); if (SystemConfig.AllowSearchCache) { object obj2 = HttpCache.Get(key); if ((obj2 != null)) { return((ScheduleTaskCollection)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 <ScheduleTaskCollection>().GetAwaiter().GetResult(); } } if (SystemConfig.AllowSearchCache) { HttpCache.Max(key, items); } return(items); }
/// <summary> /// use for scrolling page /// </summary> /// <returns></returns> public ContentResult GetPg(int page, int pagesize) { string condition = ""; SearchFilter SearchKey = SearchFilter.SearchPG(CurrentUser.CompanyID, page, pagesize, "Id", "Id", "Desc", condition); ScheduleTaskCollection objItem = ScheduleTaskManager.Search(SearchKey); return(Content(JsonConvert.SerializeObject(objItem), "application/json")); }
public JsonResult GetGata([ModelBinder(typeof(DataTablesBinder))] IDataTablesRequest requestModel) { SearchFilter SearchKey = SearchFilter.SearchData(CurrentUser.CompanyID, requestModel, "Id", "Id"); ScheduleTaskCollection collection = ScheduleTaskManager.Search(SearchKey); int TotalRecord = 0; if (collection.Count > 0) { TotalRecord = collection[0].TotalRecord; } //ScheduleTaskCollection data = ScheduleTaskManager.GetAll(CurrentUser.CompanyID); return(Json(new DataTablesResponse(requestModel.Draw, collection, TotalRecord, TotalRecord), JsonRequestBehavior.AllowGet)); }
public JsonResult GetSearchData([ModelBinder(typeof(DataTablesBinder))] IDataTablesRequest requestModel, string searchprm) { SearchFilter SearchKey = BindSearch(searchprm); SearchKey = SearchFilter.SearchData(SearchKey, requestModel); ScheduleTaskCollection collection = ScheduleTaskManager.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 ScheduleTaskCollection Search(SearchFilter SearchKey) { ScheduleTaskCollection collection = new ScheduleTaskCollection(); using (var reader = SqlHelper.ExecuteReader("ScheduleTask_Search", SearchFilterManager.SqlSearchParam(SearchKey))) { while (reader.Read()) { ScheduleTask obj = new ScheduleTask(); obj = GetItemFromReader(reader); collection.Add(obj); } } return(collection); }
/// <summary> /// ExportExcel File /// </summary> /// <returns></returns> public string ExportExcel() { ScheduleTaskCollection collection = ScheduleTaskManager.GetAll(CurrentUser.CompanyID); DataTable dt = collection.ToDataTable <ScheduleTask>(); string fileName = "ScheduleTask_" + SystemConfig.CurrentDate.ToString("MM-dd-yyyy"); string[] RemoveColumn = { "CompanyID", "TargetDisplayID", "ReturnDisplay", "TotalRecord", "CreatedUser", "CreatedDate" }; for (int i = 0; i < RemoveColumn.Length; i++) { if (dt.Columns.Contains(RemoveColumn[i])) { dt.Columns.Remove(RemoveColumn[i]); } } FileInputHelper.ExportExcel(dt, fileName, "ScheduleTask List", false); return(fileName); }
public virtual DataTable ImportData(DataTable objList) { IEnumerable <ScheduleTask> myList = objList.ToList <ScheduleTask>(); ScheduleTaskCollection ErrorList = new ScheduleTaskCollection(); foreach (ScheduleTask objitem in myList) { try { Save(objitem); } catch (Exception objEx) { objitem.ErrorMesssage = "<div class='error'>" + objEx.Message + "</div>"; ErrorList.Add(objitem); } } return(ErrorList.ToDataTable <ScheduleTask>()); }
public static ScheduleTaskCollection GetbyUser(string CreatedUser, int CompanyID) { ScheduleTaskCollection collection = new ScheduleTaskCollection(); ScheduleTask obj; var sqlParams = new SqlParameter[] { new SqlParameter("@CreatedUser", CreatedUser), new SqlParameter("@CompanyID", CompanyID), }; using (var reader = SqlHelper.ExecuteReader("ScheduleTask_GetAll_byUser", sqlParams)) { while (reader.Read()) { obj = GetItemFromReader(reader); collection.Add(obj); } } return(collection); }
public static ScheduleTaskCollection GetAllItem(int CompanyID) { ScheduleTaskCollection collection = new ScheduleTaskCollection(); var sqlParams = new SqlParameter[] { new SqlParameter("@CompanyID", CompanyID), }; using (var reader = SqlHelper.ExecuteReader("ScheduleTask_GetAll", sqlParams)) { while (reader.Read()) { ScheduleTask obj = new ScheduleTask(); obj = GetItemFromReader(reader); collection.Add(obj); } } return(collection); }
public static ScheduleTaskCollection GetAll(int CompanyID) { ScheduleTaskCollection items = new ScheduleTaskCollection(); string key = String.Format(SETTINGS_ALL_KEY, CompanyID); object obj2 = HttpCache.Get(key); if ((obj2 != null)) { return((ScheduleTaskCollection)obj2); } using (var client = WebApiHelper.myclient(HouseEndpoint, SystemConst.APIJosonReturnValue)) { HttpResponseMessage response = client.GetAsync(string.Format(Resource + "?CompanyID={0}", CompanyID)).GetAwaiter().GetResult(); if (response.IsSuccessStatusCode) { items = response.Content.ReadAsAsync <ScheduleTaskCollection>().GetAwaiter().GetResult(); } } HttpCache.Max(key, items); return(items); }
public ActionResult list() { ScheduleTaskCollection collection = ScheduleTaskManager.GetAll(CurrentUser.CompanyID); return(View(ViewFolder + "list.cshtml", collection)); }