コード例 #1
0
        public DomainStatusCodes GetPersonsRelativesAmountByType(int personId, RequestReportDTO reportData, out ReportDataDTO report)
        {
            report = null;

            if (!CheckIfPersonExists(personId, out _))
            {
                return(DomainStatusCodes.RecordNotFound);
            }

            report = new ReportDataDTO {
                RelationsAmount = _relatedPersonRepository.PersonsRelativesAmountByType(personId, reportData.RelatedPersonsType)
            };

            return(DomainStatusCodes.Success);
        }
コード例 #2
0
        public DTO.ReportDataDTO SearchReportData(int userId, System.Collections.Hashtable filters, int pageSize, int pageIndex, string orderBy, string orderDirection, out Library.DTO.Notification notification)
        {
            notification = new Library.DTO.Notification()
            {
                Type = Library.DTO.NotificationType.Success
            };
            DTO.ReportDataDTO data = new ReportDataDTO();

            try
            {
                int?   TypeOfInspectionID = null;
                int?   StatusID           = null;
                string CreatedDateStr     = null;
                string CreatedNM          = null;
                string ReportDateStr      = null;
                string ApprovalNM         = null;
                string ModelUD            = null;
                string ModelNM            = null;
                string ArticleCode        = null;


                if (filters.ContainsKey("typeOfInspectionID") && filters["typeOfInspectionID"] != null)
                {
                    TypeOfInspectionID = Convert.ToInt32(filters["typeOfInspectionID"]);
                }
                if (filters.ContainsKey("statusID") && filters["statusID"] != null)
                {
                    StatusID = Convert.ToInt32(filters["statusID"]);
                }
                if (filters.ContainsKey("createdDate") && !string.IsNullOrEmpty(filters["createdDate"].ToString()))
                {
                    CreatedDateStr = filters["createdDate"].ToString().Replace("'", "''");
                }
                if (filters.ContainsKey("createdNM") && !string.IsNullOrEmpty(filters["createdNM"].ToString()))
                {
                    CreatedNM = filters["createdNM"].ToString().Replace("'", "''");
                }
                if (filters.ContainsKey("reportDate") && !string.IsNullOrEmpty(filters["reportDate"].ToString()))
                {
                    ReportDateStr = filters["reportDate"].ToString().Replace("'", "''");
                }
                if (filters.ContainsKey("approvalNM") && !string.IsNullOrEmpty(filters["approvalNM"].ToString()))
                {
                    ApprovalNM = filters["approvalNM"].ToString().Replace("'", "''");
                }
                if (filters.ContainsKey("modelUD") && !string.IsNullOrEmpty(filters["modelUD"].ToString()))
                {
                    ModelUD = filters["modelUD"].ToString().Replace("'", "''");
                }
                if (filters.ContainsKey("modelNM") && !string.IsNullOrEmpty(filters["modelNM"].ToString()))
                {
                    ModelNM = filters["modelNM"].ToString().Replace("'", "''");
                }
                if (filters.ContainsKey("articleCode") && !string.IsNullOrEmpty(filters["articleCode"].ToString()))
                {
                    ArticleCode = filters["articleCode"].ToString().Replace("'", "''");
                }
                DateTime?CreatedDate = CreatedDateStr.ConvertStringToDateTime();
                DateTime?ReportDate  = ReportDateStr.ConvertStringToDateTime();

                using (var context = CreateContext()) {
                    data.totalRows = context.ReportQAQCMng_Function_SearchResult(userId, TypeOfInspectionID, StatusID, CreatedDate, CreatedNM, ReportDate, ApprovalNM, ModelUD, ModelNM, ArticleCode, orderBy, orderDirection).Count();
                    var result = context.ReportQAQCMng_Function_SearchResult(userId, TypeOfInspectionID, StatusID, CreatedDate, CreatedNM, ReportDate, ApprovalNM, ModelUD, ModelNM, ArticleCode, orderBy, orderDirection);
                    data.reportQAQCSearchDTOs = converter.DB2DTO_ReportSearch(result.Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList());
                    return(data);
                }
            }
            catch (Exception ex)
            {
                notification = new Library.DTO.Notification()
                {
                    Type = Library.DTO.NotificationType.Error
                };
                notification.Message = Library.Helper.GetInnerException(ex).Message;
                return(data);
            }
        }