Exemple #1
0
        private void ProcessAc(LmsCompany lmsCompany)
        {
            IAdobeConnectProxy provider = IoC.Resolve <IAdobeConnectAccountService>().GetProvider(lmsCompany);

            var stopwatch = Stopwatch.StartNew();

            var result = provider.GetAllPrincipals();

            stopwatch.Stop();
            var acTime = stopwatch.Elapsed;

            if (!result.Success)
            {
                _log.WriteLine("    GetAllPrincipals Issue:" + result.Status.Code);
                return;
            }

            stopwatch = Stopwatch.StartNew();

            var table = new AcCacheDataSet.AcCachePrincipalDataTable();

            foreach (Principal p in result.Values)
            {
                AddToTable(table, p, lmsCompany.Id);
            }
            BatchBulkCopy(table, "AcCachePrincipal", 500);

            stopwatch.Stop();
            var dbTime = stopwatch.Elapsed;

            _log.WriteLine("    PrincipalCount: " + result.Values.Count() + ". AC fetch time: " + acTime.ToString() + ". DB save time: " + dbTime.ToString());
        }
Exemple #2
0
        private static void AddToTable(AcCacheDataSet.AcCachePrincipalDataTable table, Principal source, int lmsCompanyId)
        {
            var dest = table.NewAcCachePrincipalRow();

            dest.lmsCompanyId = lmsCompanyId;

            dest.accountId   = source.AccountId;
            dest.displayId   = source.DisplayId;
            dest.email       = source.Email;
            dest.firstName   = source.FirstName;
            dest.hasChildren = source.HasChildren;
            dest.isHidden    = source.IsHidden;
            dest.isPrimary   = source.IsPrimary;
            dest.lastName    = source.LastName;
            dest.login       = source.Login;
            dest.name        = source.Name;
            dest.principalId = source.PrincipalId;
            dest.type        = source.Type;

            table.Rows.Add(dest);
        }