示例#1
0
 public BaseStatistic(litePerson person, StatusStatistic status, DateTime?startDate, DateTime?endDate, Int32 idCreatedBy,
                      DateTime?createdOn, String creatorIpAddress, String creatorProxyIpAddress)
 {
     base.UpdateMetaInfo(idCreatedBy, creatorIpAddress, creatorProxyIpAddress, (createdOn.HasValue? createdOn.Value : DateTime.Now));
     Person    = person;
     Status    = Status;
     StartDate = StartDate;
     EndDate   = EndDate;
 }
示例#2
0
        private static String GetStatus(StatusStatistic status, Dictionary <EduPathTranslations, String> translations)
        {
            switch (status)
            {
            case StatusStatistic.Started:
                return(translations[EduPathTranslations.Started]);

            case StatusStatistic.Completed:
                return(translations[EduPathTranslations.Completed]);

            case StatusStatistic.Passed:
                return(translations[EduPathTranslations.Passed]);

            case StatusStatistic.CompletedPassed:
                return(translations[EduPathTranslations.CompletedPassed]);

            default:
                return(translations[EduPathTranslations.NotStarted]);
            }
        }
示例#3
0
        public static string ImgStatus(string BaseUrl, StatusStatistic StatusStat)
        {
            switch (StatusStat)
            {
            case StatusStatistic.Passed:
                return(BaseUrl + "Modules/Moocs/img/");        //tondo o batteria grigia

            case StatusStatistic.Completed:
                return(BaseUrl + "Modules/Moocs/img/");        //tondo o batteria gialla piena

            case StatusStatistic.Started:
                return(BaseUrl + "Modules/Moocs/img/");        //tondo o batteria gialla mezza piena

            case StatusStatistic.Browsed:
                return(BaseUrl + "Modules/Moocs/img/");        //tondo o batteria grigia

            case StatusStatistic.None:
                return(BaseUrl + "Modules/Moocs/img/");        //tondo o batteria grigia

            default:
                return("");
            }
        }
示例#4
0
 public dtoStatusCompletion(StatusStatistic Status, Int64 Completion)
 {
     this.Status     = Status;
     this.Completion = Completion;
 }
示例#5
0
 public PathStatistic(Path oPath, litePerson person, StatusStatistic Status, DateTime?StartDate, DateTime?EndDate, Int32 idCreatedBy,
                      DateTime?CreatedOn, String CreatorIpAddress, String CreatorProxyIpAddress)
     : base(person, Status, StartDate, EndDate, idCreatedBy, CreatedOn, CreatorIpAddress, CreatorProxyIpAddress)
 {
     this.Path = oPath;
 }
示例#6
0
 public UnitStatistic(Unit oUnit, litePerson person, StatusStatistic Status, DateTime?StartDate, DateTime?EndDate, Int32 idPerson,
                      DateTime?CreatedOn, String CreatorIpAddress, String CreatorProxyIpAddress)
     : base(person, Status, StartDate, EndDate, idPerson, CreatedOn, CreatorIpAddress, CreatorProxyIpAddress)
 {
     this.Unit = oUnit;
 }
 public SubActivityStatistic(SubActivity oSubActivity, litePerson person, StatusStatistic Status, DateTime?StartDate, DateTime?EndDate, Int32 idCreatedBy,
                             DateTime?CreatedOn, String CreatorIpAddress, String CreatorProxyIpAddress)
     : base(person, Status, StartDate, EndDate, idCreatedBy, CreatedOn, CreatorIpAddress, CreatorProxyIpAddress)
 {
     this.SubActivity = oSubActivity;
 }
示例#8
0
        /// <summary>
        /// Recupera le statistiche dell'utente CORRENTE per i moocs della comunità CORRENTE.
        /// </summary>
        /// <returns></returns>
        /// <remarks>
        /// ToDo: usare oggetto di dominio in OUTPUT
        /// ToDo: Ottimizzare la 50.000 chiamate a roba vecchia...
        /// </remarks>
        public dtoMoocInfoResponse Get()
        {
            //dtoNoticeBoardPlainListResponse response = new dtoNoticeBoardPlainListResponse();
            //response.ErrorInfo = base.LastError;

            //ContextHelper.APIContext.
            IList <dtoEPitemList> paths    = new List <dtoEPitemList>();
            dtoMoocInfoResponse   response = new dtoMoocInfoResponse();

            response.Moocs = new List <dtoCokadeInfo>();

            COL_Persona UtenteCorrente = new COL_Persona(base.AppContext.UserContext.CurrentUserID);


            int usrId = base.AppContext.UserContext.CurrentUserID;
            int comId = base.AppContext.UserContext.CurrentCommunityID;

            try
            {
                paths = ServiceEP.GetMyEduPaths(usrId,
                                                comId,
                                                UtenteCorrente.GetIDRuoloForComunita(comId),
                                                EpViewModeType.View, true);
            }
            catch (Exception ex)
            {
                string exception = ex.ToString();
            }


            //Me.CurrentContext.UserContext.CurrentUserID, CurrentCommunityID, CurrentCommRoleID, Me.ViewModeType, PreloadIsMooc)


            foreach (dtoEPitemList path in paths)
            {
                dtoStatWithWeight statForBar = ServiceEP.ServiceStat.GetPassedCompletedWeight_byActivity(path.Id, usrId,
                                                                                                         DateTime.Now);


                lm.Comol.Modules.EduPath.Domain.DTO.dtoCokadeInfo mooc = new dtoCokadeInfo();
                mooc.CommunityId        = comId;
                mooc.PathId             = path.Id;
                mooc.PathName           = path.Name;
                mooc.Info               = new dtoCokadeMoocInfo();
                mooc.Info.Completion    = statForBar.Completion;
                mooc.Info.MinCompletion = statForBar.MinCompletion;
                mooc.Info.mType         = path.moocType;
                StatusStatistic moocStatus = ServiceStat.GetEpUserStatus(path.Id, usrId);

                mooc.Info.mookCompleted = CheckStatusStatistic(moocStatus, StatusStatistic.Completed) ||
                                          CheckStatusStatistic(moocStatus, StatusStatistic.CompletedPassed) ||
                                          CheckStatusStatistic(moocStatus, StatusStatistic.Passed);

                response.Moocs.Add(mooc);
            }

            response.IsCommunityCokade = ServiceEP.CokadeEnabled(comId);

            if (response.IsCommunityCokade)
            {
                IList <dtoCokadeInfo> MoocsType2 = response.Moocs.Where(c => c.Info.mType == MoocType.Cockade).ToList();
                response.CokadeCompleted     = MoocsType2.All(m => m.Info.mookCompleted);
                response.CokadeCompletedGold = MoocsType2.All(m => m.Info.mookCompleted && m.Info.Completion >= 100);
            }

            return(response);
        }
示例#9
0
 private bool CheckStatusStatistic(StatusStatistic actual, StatusStatistic expected)
 {
     return((actual & expected) == expected);
 }
 public Boolean ExecuteAction(long idPath, long idSubActivity, StatusStatistic status)
 {
     return(Service.ExecuteSubActivityInternal(idSubActivity, UserContext.CurrentUserID, status));
 }
示例#11
0
        private void DownloadCertification(Int32 idCommunity, long idPath, dtoSubActivityCertificate item, Guid uniqueId, Int32 idUser)
        {
            // find if user complete action
            StatusStatistic status = Service.ServiceStat.GetSubActivityStatisticsStatus(item.Id, idUser, DateTime.Now);


            //dtoSubActListUserStat stat = Service.ServiceStat.GetSubActUserStat(item.Id, idUser, DateTime.Now);
            Boolean saveExecution = !Service.ServiceStat.CheckStatusStatistic(status, StatusStatistic.CompletedPassed);    //(stat == null || !(from s in stat.usersStat where s.Completion == 100 select s).Any());

            // Check if associated template is valid

            List <Certification> certifications = GetAvailableCertifications(item, idCommunity, idUser);
            Certification        certification  = null;

            if (uniqueId != Guid.Empty)
            {
                certification = certifications.Where(c => c.FileUniqueId == uniqueId).FirstOrDefault();
            }

            lm.Comol.Core.Certifications.CertificationType type = lm.Comol.Core.Certifications.CertificationType.RuntimeProduced;
            if (item.AutoGenerated)
            {
                type = lm.Comol.Core.Certifications.CertificationType.AutoProduced;
            }
            else
            {
                if (idUser == UserContext.CurrentUserID)
                {
                    type = lm.Comol.Core.Certifications.CertificationType.UserRequired;
                }
                else
                {
                    type = lm.Comol.Core.Certifications.CertificationType.ManagerProduced;
                }
            }


            if (certifications == null || certifications.Count == 0)
            {
                Boolean isValid = ServiceTemplates.isValidTemplate(item.IdTemplate, item.IdTemplateVersion);
                if (isValid && isActionActive(idPath, idUser, item, DateTime.Now))
                {
                    View.GenerateAndDownload(idPath, item.Id, item.AllowWithEmptyPlaceHolders, idUser, GetUserCertificationFileName(View.GetDefaulFileName(), idUser), type, item.SaveCertificate, saveExecution);
                }
                else if (!isValid)
                {
                    View.DisplayUnselectedTemplate();
                }
                else
                {
                    View.DisplayUnavailableAction(item.Name);
                }
            }
            else if (certification != null || certifications.Where(c => c.Deleted == BaseStatusDeleted.None && c.Status == CertificationStatus.Valid).Any())
            {
                if (saveExecution)
                {
                    ExecuteAction(idPath, item.Id, StatusStatistic.CompletedPassed);
                }
                if (certification == null)
                {
                    certification = GetAvailableUserCertification(certifications, View.PreloadForManager, View.PreloadReferenceTime);
                }
                View.DownloadCertification(item.AllowWithEmptyPlaceHolders, idUser, GetUserCertificationFileName(View.GetDefaulFileName(), idUser), lm.Comol.Core.Certifications.CertificationType.AutoProduced, item.SaveCertificate, saveExecution, certification.FileUniqueId, certification.FileExtension);
            }
        }
示例#12
0
 public static Boolean CheckStatusStatistic(StatusStatistic Actual, StatusStatistic Expected)
 {
     return((Actual & Expected) == Expected);
 }