Example #1
0
        /// <summary>
        /// Actualisation de toutes les caractéristiques
        /// </summary>
        public void UpdateStatistics()
        {
            // calcul de toutes les caractéristiques de base
            BaseStatistics.Clear();
            foreach (var function in StatisticsComputer)
            {
                BaseStatistics.Add(function.Key, function.Value(Unit));
            }

            // répercution sur les caractéristiques courantes
            CurrentStatistics = BaseStatistics;
        }
Example #2
0
        private static void PopulateBaseItem(BaseStatistics stats, Organization org, string topReseller)
        {
            PackageInfo package;
            UserInfo    user;

            try
            {
                package = PackageController.GetPackage(org.PackageId);
            }
            catch (Exception ex)
            {
                throw new ApplicationException(string.Format("Could not get package {0}", org.PackageId), ex);
            }


            try
            {
                user = UserController.GetUser(package.UserId);
            }
            catch (Exception ex)
            {
                throw new ApplicationException(string.Format("Could not get user {0}", package.UserId), ex);
            }

            stats.HostingSpace     = package.PackageName;
            stats.OrganizationID   = org.OrganizationId;
            stats.OrganizationName = org.Name;

            stats.CustomerName    = UserController.GetUser(package.UserId).Username;
            stats.CustomerCreated = user.Created;
            stats.ResellerName    = UserController.GetUser(user.OwnerId).Username;
            stats.TopResellerName = topReseller;

            stats.OrganizationCreated = org.CreatedDate;
            stats.HostingSpaceCreated = package.PurchaseDate;
        }