public virtual Boolean isRequiredField(ExportFieldType fType, ExporPathData exportData)
        {
            Boolean found = false;

            if (Fields.Any())
            {
                found = Fields.Where(f => f.Type == fType && f.isAvailable(exportData)).Any();
            }
            return(found);
        }
        public virtual Boolean HasRequiredIdentiFiers(ExporPathData exportData)
        {
            Boolean found = false;

            if (Fields.Any())
            {
                found = Fields.Where(f => (f.Type == ExportFieldType.IdUser || f.Type == ExportFieldType.IdUnit || f.Type == ExportFieldType.IdSubActivity || f.Type == ExportFieldType.IdRole || f.Type == ExportFieldType.IdQuestionnaire ||
                                           f.Type == ExportFieldType.IdPath || f.Type == ExportFieldType.IdCommunity || f.Type == ExportFieldType.IdActivity) && f.isAvailable(exportData)).Any();
            }
            return(found);
        }
        public virtual Boolean isAvailable(ExporPathData exportData)
        {
            switch (exportData)
            {
            case ExporPathData.Normal:
                return(Availability == ExportFieldTypeAvailability.Always || Availability == ExportFieldTypeAvailability.Normal);

            case ExporPathData.Full:
                return(Availability == ExportFieldTypeAvailability.Always || Availability == ExportFieldTypeAvailability.FullData || Availability == ExportFieldTypeAvailability.FullAndCertification);

            case ExporPathData.Certification:
                return(Availability == ExportFieldTypeAvailability.Always || Availability == ExportFieldTypeAvailability.Certification || Availability == ExportFieldTypeAvailability.FullAndCertification);

            default:
                return(false);
            }
        }
示例#4
0
        public Dictionary <CellType, Boolean> GetAvaliableCells(DateTime nDate, dtoPathUsers statistics, List <dtoBaseUserPathQuiz> qInfos, dtoExportConfigurationSetting settings, ExporPathData exportData)
        {
            Dictionary <CellType, Boolean> cells = GetAllCells();

            cells[CellType.Auto] = CheckEpType(statistics.PathType, EPType.Auto);
            cells[CellType.Time] = CheckEpType(statistics.PathType, EPType.Time);
            cells[CellType.Mark] = CheckEpType(statistics.PathType, EPType.Mark);

            cells[CellType.Deadline]        = statistics.Users.Where(p => p.StDeadline.HasValue).Any();
            cells[CellType.StartDate]       = statistics.Users.Where(u => u.StStartDate.HasValue).Any();
            cells[CellType.EndDate]         = statistics.Users.Where(u => u.StEndDate.HasValue).Any();
            cells[CellType.QuizCells]       = (qInfos != null && qInfos.Any());
            cells[CellType.UserTaxCode]     = settings.isRequiredField(ExportFieldType.TaxCodeInfo, exportData);
            cells[CellType.PathName]        = true;
            cells[CellType.FirstActivityOn] = true;

            Boolean advancedInfo      = settings.isRequiredField(ExportFieldType.QuestionnaireAdvancedInfo, exportData);
            Boolean certificationInfo = settings.isRequiredField(ExportFieldType.QuestionnaireCertificationInfo, exportData);

            if (cells[CellType.QuizCells])
            {
                Boolean eActive = statistics.HasQuestionnaires(true);
                cells[CellType.QuizCompleted]      = qInfos.Where(q => q.Answers.Any() && q.Answers.Where(a => a.CompletedOn.HasValue).Any()).Any();
                cells[CellType.SemiCorrectAnswers] = (advancedInfo || certificationInfo) && eActive && qInfos.Where(q => statistics.GetIdQuestionnaires(true).Contains(q.IdQuestionnaire) && q.Answers.Any() && q.Answers.Where(a => a.SemiCorrectAnswers.HasValue).Any()).Any();
                cells[CellType.UngradedAnswers]    = (advancedInfo || certificationInfo) && eActive && qInfos.Where(q => statistics.GetIdQuestionnaires(true).Contains(q.IdQuestionnaire) && q.Answers.Any() && q.Answers.Where(a => a.UngradedAnswers.HasValue).Any()).Any();
                cells[CellType.QuestionsSkipped]   = (advancedInfo || certificationInfo) && eActive && qInfos.Where(q => statistics.GetIdQuestionnaires(true).Contains(q.IdQuestionnaire) && q.Answers.Any() && q.Answers.Where(a => a.QuestionsSkipped.HasValue).Any()).Any();
                cells[CellType.QuizAttempts]       = (advancedInfo || certificationInfo) && statistics.Questionnaires.Where(q => q.QuestionnaireInfo.AllowMultipleAttempts).Any();
                cells[CellType.NoEvaluations]      = statistics.HasQuestionnaires(false);
                cells[CellType.WithEvaluations]    = eActive;
                cells[CellType.QuestionsCount]     = (advancedInfo || certificationInfo);
                cells[CellType.WrongAnswers]       = (advancedInfo || certificationInfo);
                cells[CellType.CorrectAnswers]     = (advancedInfo || certificationInfo);
            }
            if (statistics.Users.Any())
            {
                Boolean loadAgencyInfo = settings.isRequiredField(ExportFieldType.AgencyInfo, exportData);
                cells[CellType.AgencyStart]   = loadAgencyInfo && statistics.Users.Where(p => p.StStartDate.HasValue).Any() && Manager.UsersHasAgencyAffiliations(statistics.Users.Select(u => u.IdPerson).ToList(), statistics.Users.Where(p => p.StStartDate.HasValue).Select(p => p.StStartDate.Value).Min(), statistics.Users.Where(p => p.StStartDate.HasValue).Select(p => p.StStartDate.Value).Max());
                cells[CellType.AgencyEnd]     = loadAgencyInfo && statistics.Users.Where(p => p.StEndDate.HasValue).Any() && Manager.UsersHasAgencyAffiliations(statistics.Users.Select(u => u.IdPerson).ToList(), statistics.Users.Where(p => p.StEndDate.HasValue).Select(p => p.StStartDate.Value).Min(), statistics.Users.Where(p => p.StEndDate.HasValue).Select(p => p.StStartDate.Value).Max());
                cells[CellType.AgencyCurrent] = loadAgencyInfo && Manager.UsersHasAgencyAffiliations(statistics.Users.Select(u => u.IdPerson).ToList(), nDate);
            }
            cells[CellType.IdUser]           = settings.isRequiredField(ExportFieldType.IdUser, exportData);
            cells[CellType.IdCommunity]      = settings.isRequiredField(ExportFieldType.IdCommunity, exportData);
            cells[CellType.IdRole]           = settings.isRequiredField(ExportFieldType.IdRole, exportData);
            cells[CellType.IdAgency]         = settings.isRequiredField(ExportFieldType.IdAgency, exportData);
            cells[CellType.IdPath]           = settings.isRequiredField(ExportFieldType.IdPath, exportData);
            cells[CellType.CommunityName]    = settings.isRequiredField(ExportFieldType.CommunityName, exportData);
            cells[CellType.IdOrganization]   = settings.isRequiredField(ExportFieldType.IdOrganization, exportData);
            cells[CellType.OrganizationName] = settings.isRequiredField(ExportFieldType.OrganizationName, exportData);
            return(cells);
        }
示例#5
0
        public Dictionary <CellType, Boolean> GetAvaliableCells(Int32 idUser, litePerson user, DateTime nDate, dtoUserPaths statistics, List <dtoUserPathQuiz> qInfos, dtoExportConfigurationSetting settings, ExporPathData exportData)
        {
            Dictionary <CellType, Boolean> cells = GetAllCells();

            cells[CellType.PathName] = true;
            cells[CellType.Auto]     = statistics.Paths.Where(p => CheckEpType(p.PathType, EPType.Auto)).Any();
            cells[CellType.Time]     = statistics.Paths.Where(p => CheckEpType(p.PathType, EPType.Time)).Any();
            cells[CellType.Mark]     = statistics.Paths.Where(p => CheckEpType(p.PathType, EPType.Mark)).Any();

            cells[CellType.Deadline]        = statistics.Paths.Where(p => !String.IsNullOrEmpty(p.Deadline)).Any();
            cells[CellType.StartDate]       = statistics.Paths.Where(p => p.PathInfo != null && p.PathInfo.StartDate.HasValue).Any();
            cells[CellType.EndDate]         = statistics.Paths.Where(p => p.PathInfo != null && p.PathInfo.EndDate.HasValue).Any();
            cells[CellType.QuizCells]       = (qInfos != null && qInfos.Any());
            cells[CellType.UserTaxCode]     = settings.isRequiredField(ExportFieldType.TaxCodeInfo, exportData);
            cells[CellType.FirstActivityOn] = true;
            Boolean advancedInfo      = settings.isRequiredField(ExportFieldType.QuestionnaireAdvancedInfo, exportData);
            Boolean certificationInfo = settings.isRequiredField(ExportFieldType.QuestionnaireCertificationInfo, exportData);


            if (cells[CellType.QuizCells])
            {
                cells[CellType.QuizCompleted]      = qInfos.Where(q => q.Answers.Any() && q.Answers.Where(a => a.CompletedOn.HasValue).Any()).Any();
                cells[CellType.SemiCorrectAnswers] = (advancedInfo || certificationInfo) && qInfos.Where(q => q.QuestionnaireInfo.EvaluationActive && q.Answers.Any() && q.Answers.Where(a => a.SemiCorrectAnswers.HasValue).Any()).Any();
                cells[CellType.UngradedAnswers]    = (advancedInfo || certificationInfo) && qInfos.Where(q => q.QuestionnaireInfo.EvaluationActive && q.Answers.Any() && q.Answers.Where(a => a.UngradedAnswers.HasValue).Any()).Any();
                cells[CellType.QuestionsSkipped]   = (advancedInfo || certificationInfo) && qInfos.Where(q => q.QuestionnaireInfo.EvaluationActive && q.Answers.Any() && q.Answers.Where(a => a.QuestionsSkipped.HasValue).Any()).Any();
                cells[CellType.QuizAttempts]       = (advancedInfo || certificationInfo) && qInfos.Where(q => q.QuestionnaireInfo.AllowMultipleAttempts).Any();
                cells[CellType.NoEvaluations]      = qInfos.Where(q => !q.QuestionnaireInfo.EvaluationActive).Any();
                cells[CellType.WithEvaluations]    = qInfos.Where(q => q.QuestionnaireInfo.EvaluationActive).Any();
                cells[CellType.QuestionsCount]     = (advancedInfo || certificationInfo);
                cells[CellType.WrongAnswers]       = (advancedInfo || certificationInfo);
                cells[CellType.CorrectAnswers]     = (advancedInfo || certificationInfo);
            }


            Boolean loadAgencyInfo = settings.isRequiredField(ExportFieldType.AgencyInfo, exportData);

            cells[CellType.AgencyStart]   = loadAgencyInfo && statistics.Paths.Where(p => p.StStartDate.HasValue).Any() && Manager.UserHasAgencyAffiliations(idUser, statistics.Paths.Where(p => p.StStartDate.HasValue).Select(p => p.StStartDate.Value).Min(), statistics.Paths.Where(p => p.StStartDate.HasValue).Select(p => p.StStartDate.Value).Max());
            cells[CellType.AgencyEnd]     = loadAgencyInfo && statistics.Paths.Where(p => p.StEndDate.HasValue).Any() && Manager.UserHasAgencyAffiliations(idUser, statistics.Paths.Where(p => p.StEndDate.HasValue).Select(p => p.StStartDate.Value).Min(), statistics.Paths.Where(p => p.StEndDate.HasValue).Select(p => p.StStartDate.Value).Max());
            cells[CellType.AgencyCurrent] = loadAgencyInfo && Manager.UserHasAgencyAffiliations(idUser, nDate);

            cells[CellType.IdUser]           = settings.isRequiredField(ExportFieldType.IdUser, exportData);
            cells[CellType.IdCommunity]      = settings.isRequiredField(ExportFieldType.IdCommunity, exportData);
            cells[CellType.IdRole]           = settings.isRequiredField(ExportFieldType.IdRole, exportData);
            cells[CellType.IdAgency]         = settings.isRequiredField(ExportFieldType.IdAgency, exportData);
            cells[CellType.IdPath]           = settings.isRequiredField(ExportFieldType.IdPath, exportData);
            cells[CellType.CommunityName]    = settings.isRequiredField(ExportFieldType.CommunityName, exportData);
            cells[CellType.IdOrganization]   = settings.isRequiredField(ExportFieldType.IdOrganization, exportData);
            cells[CellType.OrganizationName] = settings.isRequiredField(ExportFieldType.OrganizationName, exportData);
            return(cells);
        }
示例#6
0
        private Dictionary <CellType, Boolean> GetAvaliableCells(DateTime nDate, ItemType type, Boolean isAutoEp, Boolean isTimeBased, dtoExportConfigurationSetting settings, ExporPathData exportData)
        {
            Dictionary <CellType, Boolean> cells = GetAllCells();

            cells[CellType.Auto] = isAutoEp;
            cells[CellType.Mark] = !isAutoEp;

            cells[CellType.QuizCells]   = false;
            cells[CellType.UserTaxCode] = settings.isRequiredField(ExportFieldType.TaxCodeInfo, exportData);
            cells[CellType.IdUser]      = settings.isRequiredField(ExportFieldType.IdUser, exportData);
            cells[CellType.IdRole]      = settings.isRequiredField(ExportFieldType.IdRole, exportData);
            cells[CellType.IdAgency]    = settings.isRequiredField(ExportFieldType.IdAgency, exportData);
            cells[CellType.IdPath]      = settings.isRequiredField(ExportFieldType.IdPath, exportData);
            switch (type)
            {
            case ItemType.SubActivity:
                cells[CellType.Time]             = false;
                cells[CellType.IdCommunity]      = false;
                cells[CellType.CommunityName]    = false;
                cells[CellType.IdOrganization]   = false;
                cells[CellType.OrganizationName] = false;
                break;

            default:
                cells[CellType.Time]             = isTimeBased;
                cells[CellType.IdCommunity]      = settings.isRequiredField(ExportFieldType.IdCommunity, exportData);
                cells[CellType.CommunityName]    = settings.isRequiredField(ExportFieldType.CommunityName, exportData);
                cells[CellType.IdOrganization]   = settings.isRequiredField(ExportFieldType.IdOrganization, exportData);
                cells[CellType.OrganizationName] = settings.isRequiredField(ExportFieldType.OrganizationName, exportData);
                break;
            }

            return(cells);
        }
示例#7
0
        public Dictionary <CellType, Boolean> GetAvaliableCells(DateTime nDate, List <dtoUserStatExtended> statistics, ItemType type, Boolean isAutoEp, Boolean isTimeBased, dtoExportConfigurationSetting settings, ExporPathData exportData)
        {
            Dictionary <CellType, Boolean> cells = GetAvaliableCells(nDate, type, isAutoEp, isTimeBased, settings, exportData);

            //cells[CellType.Deadline] = statistics.Users.Where(p => p.StDeadline.HasValue).Any();
            //cells[CellType.StartDate] = statistics.Users.Where(u => u.StStartDate.HasValue).Any();
            //cells[CellType.EndDate] =statistics.Users.Where(u => u.StEndDate.HasValue).Any();

            //cells[CellType.PathName] = true;
            //cells[CellType.FirstActivityOn] = true;

            //Boolean advancedInfo = settings.isRequiredField(ExportFieldType.QuestionnaireAdvancedInfo, exportData);
            //Boolean certificationInfo = settings.isRequiredField(ExportFieldType.QuestionnaireCertificationInfo, exportData);


            if (statistics.Any())
            {
                Boolean loadAgencyInfo = settings.isRequiredField(ExportFieldType.AgencyInfo, exportData);
                // cells[CellType.AgencyStart] = loadAgencyInfo && statistics.usersStat.Where(p => p.StStartDate.HasValue).Any() && Manager.UsersHasAgencyAffiliations(statistics.UserId.Select(u => u.UserId).ToList(), statistics.Users.Where(p => p.StStartDate.HasValue).Select(p => p.StStartDate.Value).Min(), statistics.Users.Where(p => p.StStartDate.HasValue).Select(p => p.StStartDate.Value).Max());
                // cells[CellType.AgencyEnd] = loadAgencyInfo && statistics.usersStat.Where(p => p.StEndDate.HasValue).Any() && Manager.UsersHasAgencyAffiliations(statistics.UserId.Select(u => u.UserId).ToList(), statistics.Users.Where(p => p.StEndDate.HasValue).Select(p => p.StStartDate.Value).Min(), statistics.Users.Where(p => p.StEndDate.HasValue).Select(p => p.StStartDate.Value).Max());
                cells[CellType.AgencyCurrent] = loadAgencyInfo && Manager.UsersHasAgencyAffiliations(statistics.Select(u => u.UserId).ToList(), nDate);
            }
            return(cells);
        }