Esempio n. 1
0
        public void ProcessRequest(HttpContext context)
        {
            _start = Start;
            _limit = Limit;

            context.Response.ContentType = "text/plain";

            // start
            if (!string.IsNullOrEmpty(context.Request["start"]))
            {
                _start = int.Parse(context.Request["start"]);
            }

            // limit
            if (!string.IsNullOrEmpty(context.Request["limit"]))
            {
                _limit = int.Parse(context.Request["limit"]);
            }

            if (!string.IsNullOrEmpty(context.Request["keyword"]))
            {
                _keyword = context.Request["keyword"];
            }

            if (DateTime.TryParseExact(context.Request["fromDate"], "dd/MM/yyyy", CultureInfo.CurrentCulture, DateTimeStyles.None, out var parseFromDate))
            {
                _fromDate = parseFromDate;
            }
            if (DateTime.TryParseExact(context.Request["toDate"], "dd/MM/yyyy", CultureInfo.CurrentCulture, DateTimeStyles.None, out var parseToDate))
            {
                _toDate = parseToDate;
            }

            CandidateType?type = null;

            if (!string.IsNullOrEmpty(context.Request["candidateType"]))
            {
                type = (CandidateType)Enum.Parse(typeof(CandidateType), context.Request["candidateType"]);
            }

            var pageResult =
                CandidateController.GetPaging(_keyword, null, null, type, _fromDate, _toDate, false, null, _start, _limit);

            context.Response.ContentType = "text/json";
            context.Response.Write("{{TotalRecords:{0},Data:{1}}}".FormatWith(pageResult.Total, Ext.Net.JSON.Serialize(pageResult.Data)));
        }