Exemplo n.º 1
0
        public IHttpActionResult Post(SearchRequest requestModel)
        {
            //SearchFilter SearchKey = SearchFilter.SearchData(CompanyID, requestModel, "AccountID,Type", "AccountID");
            T_CMS_Master_WorkHoursCollection collection = T_CMS_Master_WorkHoursManager.Search(new SearchFilter()
            {
                CompanyID      = 1,
                Keyword        = requestModel.Search.Value,
                Page           = (requestModel.Start / requestModel.Length) + 1,
                PageSize       = requestModel.Length,
                ColumnsName    = "WorkHoursID",
                OrderBy        = "WorkHoursID",
                OrderDirection = "ASC",
            });
            int TotalRecord = 0;

            if (collection.Count > 0)
            {
                TotalRecord = collection[0].TotalRecord;
            }
            var response = new T_CMS_Master_WorkHoursResponse
            {
                data            = collection,
                draw            = requestModel.Draw,
                recordsFiltered = TotalRecord,
                recordsTotal    = TotalRecord
            };

            return(Ok(response));
        }
Exemplo n.º 2
0
        public ContentResult Search(SearchFilter SearchKey)
        {
            SearchKey.OrderBy = string.IsNullOrEmpty(SearchKey.OrderBy) ? "WorkHoursID" : SearchKey.OrderBy;
            T_CMS_Master_WorkHoursCollection collection = T_CMS_Master_WorkHoursManager.Search(SearchKey);

            return(Content(JsonConvert.SerializeObject(collection), "application/json"));
        }
Exemplo n.º 3
0
        /// <summary>
        /// use for scrolling page
        /// </summary>
        /// <returns></returns>
        public ContentResult GetPg(int page, int pagesize)
        {
            string       condition = "";
            SearchFilter SearchKey = SearchFilter.SearchPG(1, page, pagesize, "WorkHoursID", "WorkHoursID", "Desc", condition);
            T_CMS_Master_WorkHoursCollection objItem = T_CMS_Master_WorkHoursManager.Search(SearchKey);

            return(Content(JsonConvert.SerializeObject(objItem), "application/json"));
        }
Exemplo n.º 4
0
        public JsonResult GetGata([ModelBinder(typeof(DataTablesBinder))] IDataTablesRequest requestModel)
        {
            SearchFilter SearchKey = SearchFilter.SearchData(1, requestModel, "WorkHoursID", "WorkHoursID");
            T_CMS_Master_WorkHoursCollection collection = T_CMS_Master_WorkHoursManager.Search(SearchKey);
            int TotalRecord = 0;

            if (collection.Count > 0)
            {
                TotalRecord = collection[0].TotalRecord;
            }
            return(Json(new DataTablesResponse(requestModel.Draw, collection, TotalRecord, TotalRecord), JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 5
0
 // GET api/<controller>
 /// <summary>
 /// Gets this instance.
 /// </summary>
 /// <returns></returns>
 public T_CMS_Master_WorkHoursCollection Post(string method, [FromBody] SearchFilter value)
 {
     return(T_CMS_Master_WorkHoursManager.Search(value));
 }