예제 #1
0
        private static String GetImpersonationContext(bool isWindowsUser, String userNTAccount, Guid userGuid, Guid trackingGuid, Guid siteId, String lcid)
        {
            PSContextInfo contextInfo   = new PSContextInfo(isWindowsUser, userNTAccount, userGuid, trackingGuid, siteId, lcid);
            String        contextString = PSContextInfo.SerializeToString(contextInfo);

            return(contextString);
        }
예제 #2
0
 public override void OnAdSyncERPSynchronized(PSContextInfo contextInfo, AdSyncERPSynchronizedEventArgs e)
 {
     l.Source = "Application";
     try
     {
         // should base call come first or last?
         base.OnAdSyncERPSynchronized(contextInfo, e);
         l.WriteEntry("CtsAdminEventHandler trying update!");
         UpdateWorkResourceMetadata();
     }
     catch (Exception xcp)
     {
         l.WriteEntry("UpdateWorkResourceMetadata failed! " + xcp.InnerException.GetType().ToString() + ":" + xcp.Message);
     }
 }
예제 #3
0
        public override void OnPublished(PSContextInfo contextInfo, ProjectPostPublishEventArgs e)
        {
            if (contextInfo == null)
            {
                throw new ArgumentNullException(nameof(contextInfo));
            }

            if (e == null)
            {
                throw new ArgumentNullException(nameof(e));
            }

            using (var myLog = new EventLog("EPM Live", ".", "EPM Live Publisher"))
            {
                myLog.MaximumKilobytes = 32768;

                using (var mySite = new SPSite(contextInfo.SiteGuid))
                {
                    var act  = new Act(mySite.RootWeb);
                    int iAct = act.CheckFeatureLicense(ActFeature.ProjectServer);
                    if (iAct == 0)
                    {
                        using (var publisher = new Publisher(contextInfo, e))
                        {
                            publisher.doPublish();
                        }
                    }
                    else
                    {
                        using (var connection = new SqlConnection(CoreFunctions.getConnectionString(mySite.WebApplication.Id)))
                        {
                            using (var command = new SqlCommand("update publishercheck set webguid=@webguid,logtext=@logtext, checkbit=0,status=@status,percentcomplete=0,laststatusdate=getdate() where projectguid=@projectguid", connection))
                            {
                                command.Parameters.AddWithValue("@projectguid", e.ProjectGuid);
                                command.Parameters.AddWithValue("@webguid", mySite.OpenWeb().ID);
                                command.Parameters.AddWithValue("@status", 3);
                                command.Parameters.AddWithValue("@logtext", $"Activation Error: {act.translateStatus(iAct)}");
                            }
                        }
                    }
                }
            }
        }