public DTO.ResponseService <DTO.Exams.GetExamScheduleByCriteriaResponse> GetExamScheduleByCriteria (string examPlaceGroupCode, string examPlaceCode, string licenseTypeCode, string agentType, String year, String month, String day, string timeCode, String currentPage, String pageSize, String totalItem, String userId, string Owner = "") { //string tsDate = (testingDate == null ? string.Empty : Convert.ToDateTime(testingDate).ToString_yyyyMMdd()); DTO.Exams.GetExamScheduleByCriteriaRequest request = new GetExamScheduleByCriteriaRequest(); request.UserId = userId; request.ExamCriteria = new ExamCriteriaDTO(); request.ExamCriteria.ExamPlaceGroupCode = examPlaceGroupCode; request.ExamCriteria.ExamPlaceCode = examPlaceCode; request.ExamCriteria.LicenseTypeCode = licenseTypeCode; request.ExamCriteria.AgentType = agentType; Int32 y = 0; if (!Int32.TryParse(year, out y)) { throw new ApplicationException("คุณระบุปีไม่ถูกต้อง."); } Int32 m = 0; if (!Int32.TryParse(month, out m)) { throw new ApplicationException("คุณระบุเดือนไม่ถูกต้อง."); } else { if (m < 1 || m > 12) { throw new ApplicationException("คุณระบุเดือนไม่ถูกต้อง."); } } Int32 d = -1; if (!String.IsNullOrWhiteSpace(day)) { if (!Int32.TryParse(day, out d)) { throw new ApplicationException("คุณระบุวันไม่ถูกต้อง."); } try { DateTime testingdate = new DateTime(y, m, d); } catch (Exception) { throw new ApplicationException(String.Format("คุณระบุวันที่ไม่ถูกต้อง. {0}/{1}/{2}", y.ToString(), m.ToString(), d.ToString())); } } request.ExamCriteria.Year = (y > 2500) ? y - 543 : y; request.ExamCriteria.Month = m; request.ExamCriteria.Day = d; request.ExamCriteria.TimeCode = timeCode; request.ExamCriteria.OwnerCode = Owner; Int32 curPage = 0; Int32.TryParse(currentPage, out curPage); Int32 pSize = 0; Int32.TryParse(pageSize, out pSize); Int32 tItems = 0; Int32.TryParse(totalItem, out tItems); DTO.PagingInfo pageInfo = new PagingInfo() { CurrentPage = curPage, ItemsPerPage = pSize, TotalItems = tItems }; request.PageInfo = pageInfo; return(svc.GetExamScheduleByCriteria(request)); }