コード例 #1
0
        public JsonResult GetData([ModelBinder(typeof(DataTablesBinder))] IDataTablesRequest requestModel)
        {
            SearchFilter searchFilter = ScanTimeApprovalManager.SearchData(requestModel);
            ScanTimeApprovalSqlParameters parameters = new ScanTimeApprovalSqlParameters();

            parameters.FromDate       = SystemConfig.CurrentDate.AddDays(-30);
            parameters.ToDate         = SystemConfig.CurrentDate;
            parameters.UserLoggedIn   = CustomerAuthorize.CurrentUser.EmployeeCode;
            parameters.ShowWaiting    = true;
            parameters.StartRow       = (requestModel.Start / requestModel.Length) + 1;
            parameters.EndRow         = requestModel.Length;
            parameters.OrderBy        = string.IsNullOrEmpty(searchFilter.OrderBy) ? "EmployeeNo" : searchFilter.OrderBy;
            parameters.OrderDirection = searchFilter.OrderDirection == "ASC" ? 1 : 0;
            parameters.FilterBy       = requestModel.Search.Value;
            parameters.ShowUnNoReg    = false;
            parameters.Condition      = requestModel.Search.Value;

            ScanTimeApprovalCollection collection = ScanTimeApprovalManager.GetAll(parameters);
            int totalRecord = 0;

            if (collection.Count > 0)
            {
                totalRecord = collection[0].TotalRecord;
            }
            return(Json(new DataTablesResponse(requestModel.Draw, collection, totalRecord, totalRecord), JsonRequestBehavior.AllowGet));
        }
コード例 #2
0
        public JsonResult FilterData([ModelBinder(typeof(DataTablesBinder))] IDataTablesRequest requestModel, string searchprm)
        {
            SearchFilter searchFilter = ScanTimeApprovalManager.SearchData(requestModel);
            ScanTimeApprovalSqlParameters parameters = new ScanTimeApprovalSqlParameters();
            var dateTimeConverter = new Newtonsoft.Json.Converters.IsoDateTimeConverter {
                DateTimeFormat = "dd/MM/yyyy"
            };
            SearchParams param = new SearchParams();

            if (!string.IsNullOrEmpty(searchprm))
            {
                param = JsonConvert.DeserializeObject <SearchParams>(searchprm, dateTimeConverter);
            }

            parameters.FromDate       = param.StartDate ?? SystemConfig.CurrentDate.AddDays(-30);
            parameters.ToDate         = param.EndDate ?? SystemConfig.CurrentDate;
            parameters.UserLoggedIn   = CustomerAuthorize.CurrentUser.EmployeeCode;
            parameters.ShowWaiting    = param.ShowMissing == "on";
            parameters.StartRow       = (requestModel.Start / requestModel.Length) + 1;
            parameters.EndRow         = requestModel.Length;
            parameters.OrderBy        = string.IsNullOrEmpty(searchFilter.OrderBy) ? "EmployeeNo" : searchFilter.OrderBy;
            parameters.OrderDirection = searchFilter.OrderDirection == "ASC" ? 1 : 0;
            parameters.FilterBy       = parameters.FilterBy = requestModel.Search.Value;
            parameters.ShowUnNoReg    = false;

            ScanTimeApprovalCollection collection = ScanTimeApprovalManager.GetAll(parameters);
            int totalRecord = 0;

            if (collection.Count > 0)
            {
                totalRecord = collection[0].TotalRecord;
            }
            return(Json(new DataTablesResponse(requestModel.Draw, collection, totalRecord, totalRecord), JsonRequestBehavior.AllowGet));
        }
コード例 #3
0
        public static ScanTimeApprovalCollection Search(ScanTimeApprovalSqlParameters value)
        {
            ScanTimeApprovalCollection items = new ScanTimeApprovalCollection();
            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((ScanTimeApprovalCollection)obj2);
                }
            }

            using (var client = WebApiHelper.myclient(HouseEndpoint, SystemConst.APIJosonReturnValue))
            {
                HttpResponseMessage response = client.PostAsJsonAsync(Resource + "/Get", value).GetAwaiter().GetResult();

                if (response.IsSuccessStatusCode)
                {
                    items = response.Content.ReadAsAsync <ScanTimeApprovalCollection>().GetAwaiter().GetResult();
                }
            }

            if (SystemConfig.AllowSearchCache && items.Count > 0)
            {
                HttpCache.Max(key, items);
            }
            return(items);
        }
コード例 #4
0
    public static SqlParameter[] SqlSearchParam(ScanTimeApprovalSqlParameters value)
    {
        var pars = new SqlParameter[]
        {
            new SqlParameter("@FromDate", value.FromDate),
            new SqlParameter("@ToDate", value.ToDate),
            new SqlParameter("@User", value.UserLoggedIn),
            new SqlParameter("@ShowWaiting", value.ShowWaiting),
            new SqlParameter("@StartRow", value.StartRow),
            new SqlParameter("@EndRow", value.EndRow),
            new SqlParameter("@OrderBy", value.OrderBy),
            new SqlParameter("@OrderDirection", value.OrderDirection),
            new SqlParameter("@FilterBy", value.FilterBy),
            new SqlParameter("@ShowUnNoReg", value.ShowUnNoReg)
        };

        return(pars);
    }
コード例 #5
0
        public static ScanTimeApprovalCollection GetAll(ScanTimeApprovalSqlParameters value)
        {
            ScanTimeApprovalCollection items = new ScanTimeApprovalCollection();
            string key  = SETTINGS_ALL_KEY;
            object obj2 = HttpCache.Get(key);

            if ((obj2 != null) && value.IsOrdering)
            {
                return((ScanTimeApprovalCollection)obj2);
            }
            using (var client = WebApiHelper.myclient(HouseEndpoint, SystemConst.APIJosonReturnValue))
            {
                HttpResponseMessage response = client.PostAsJsonAsync(string.Format(Resource), value).GetAwaiter().GetResult();

                if (response.IsSuccessStatusCode)
                {
                    items = response.Content.ReadAsAsync <ScanTimeApprovalCollection>().GetAwaiter().GetResult();
                }
            }
            HttpCache.Max(key, items);
            return(items);
        }
コード例 #6
0
 public hrm_atd_ScanTimeApprovalCollection Get([FromBody] ScanTimeApprovalSqlParameters value)
 {
     return(hrm_atd_ScanTimeApprovalManager.GetAllItem(value));
 }
コード例 #7
0
 public ScanTimeApprovalCollection Post([FromBody] ScanTimeApprovalSqlParameters value)
 {
     return(ScanTimeApprovalManager.GetAllItemByManager(value));
 }