Ejemplo n.º 1
0
        /// <summary>
        /// Подписка на изменение Статуса
        /// </summary>
        /// <param name="nameStatus">Статуса</param>
        public static void SubscribeStatusing(Statusing nameStatus)
        {
            IHubContext context = GlobalHost.ConnectionManager.GetHubContext <SignalRinventory>();

            Loggers.Log4NetLogger.Info(new Exception("Модель Статуса рассылка пошла: " + nameStatus.Name));
            SerializeJson json = new SerializeJson();

            context.Clients.All.SubscribeStatusing(json.JsonLibaryIgnoreDate(nameStatus));
        }
        private void UpdatePublisherCheckPercentCompleteFive(int pubType, DateTime dtStart)
        {
            if (dtStart == null)
            {
                throw new ArgumentNullException(nameof(dtStart));
            }

            using (var pubSite = new SPSite(publishSiteUrl))
            {
                mySiteToPublish = pubSite.OpenWeb();

                pCf = new CustomFields
                {
                    Url = $"{mySite.Url}/_vti_bin/psi/customfields.asmx",
                    UseDefaultCredentials = true
                };
                cfDs = new CustomFieldDataSet();

                psiLookupTable = new LookupTable
                {
                    Url = $"{mySite.Url}/_vti_bin/psi/lookuptable.asmx",
                    UseDefaultCredentials = true
                };

                pResource = new Resource
                {
                    Url = $"{mySite.Url}/_vti_bin/psi/resource.asmx",
                    UseDefaultCredentials = true
                };

                pService = new Project
                {
                    Url = $"{mySite.Url}/_vti_bin/psi/project.asmx",
                    UseDefaultCredentials = true
                };

                Statusing = new Statusing
                {
                    Url = $"{mySite.Url}/_vti_bin/psi/statusing.asmx",
                    UseDefaultCredentials = true
                };

                pWssInterop = new WssInterop
                {
                    Url = $"{mySite.Url}/_vti_bin/psi/wssinterop.asmx",
                    UseDefaultCredentials = true
                };

                linkProjectWss();

                var          trackingGuid = Guid.NewGuid();
                const string Lcid         = "1033";
                StatusingDerived.SetImpersonationContext(true, contextInfo.UserName, contextInfo.UserGuid, trackingGuid, contextInfo.SiteGuid, Lcid);

                workspaceSynch = new ProjectWorkspaceSynch(mySiteGuid, publishSiteUrl, projectGuid, contextInfo.UserName);
                workspaceSynch.setUpGroups();
                workspaceSynch.processTaskCenter();
                workspaceSynch.processProjectCenter();
                workspaceSynch.processResources();

                using (var sqlCommand1 = new SqlCommand(
                           "UPDATE publishercheck set percentcomplete=5,laststatusdate=getdate() where projectguid=@projectguid",
                           cn))
                {
                    sqlCommand1.Parameters.AddWithValue("@projectguid", eventArgs.ProjectGuid);
                    sqlCommand1.ExecuteNonQuery();
                }

                loadFields();

                LoadCurrentTasks(pubType, dtStart);
            }
        }