public ActionResult Edit(int id)
        {
            var context = new Context();

            if (!Request.IsAjaxRequest())
            {
                var log  = new SysLogModel(context: context);
                var html = RegistrationUtilities.Editor(
                    context: context,
                    ss: SiteSettingsUtilities.RegistrationsSiteSettings(context: context),
                    registrationId: id,
                    clearSessions: true);
                ViewBag.HtmlBody = html;
                log.Finish(context: context, responseSize: html.Length);
                return(View());
            }
            else
            {
                var log  = new SysLogModel(context: context);
                var json = RegistrationUtilities.EditorJson(
                    context: context,
                    ss: SiteSettingsUtilities.RegistrationsSiteSettings(context: context),
                    registrationId: id);
                log.Finish(context: context, responseSize: json.Length);
                return(Content(json));
            }
        }
        public string GridRows(Context context)
        {
            var log  = new SysLogModel(context: context);
            var json = RegistrationUtilities.GridRows(context: context);

            log.Finish(context: context, responseSize: json.Length);
            return(json);
        }
        public string Create(Context context)
        {
            var log  = new SysLogModel(context: context);
            var json = RegistrationUtilities.Create(
                context: context,
                ss: SiteSettingsUtilities.RegistrationsSiteSettings(context: context));

            log.Finish(context: context, responseSize: json.Length);
            return(json);
        }
        public string New(Context context, long id = 0)
        {
            var log  = new SysLogModel(context: context);
            var html = RegistrationUtilities.EditorNew(
                context: context,
                ss: SiteSettingsUtilities.RegistrationsSiteSettings(context: context));

            log.Finish(context: context, responseSize: html.Length);
            return(html);
        }
        /// <summary>
        /// Fixed:
        /// </summary>
        public string Approval(Context context, int id)
        {
            var log  = new SysLogModel(context: context);
            var json = RegistrationUtilities.Approval(context: context,
                                                      ss: SiteSettingsUtilities.RegistrationsSiteSettings(context: context),
                                                      registrationId: id);

            log.Finish(context: context, responseSize: json.Length);
            return(json);
        }
        public string BulkDelete(long id)
        {
            var context = new Context();
            var log     = new SysLogModel(context: context);
            var json    = RegistrationUtilities.BulkDelete(
                context: context,
                ss: SiteSettingsUtilities.RegistrationsSiteSettings(context: context));

            log.Finish(context: context, responseSize: json.Length);
            return(json);
        }
        public ActionResult New(long id = 0)
        {
            var context = new Context();
            var log     = new SysLogModel(context: context);
            var html    = RegistrationUtilities.EditorNew(
                context: context,
                ss: SiteSettingsUtilities.RegistrationsSiteSettings(context: context));

            ViewBag.HtmlBody = html;
            log.Finish(context: context, responseSize: html.Length);
            return(View());
        }
        public string DeleteComment(int id)
        {
            var context = new Context();
            var log     = new SysLogModel(context: context);
            var json    = RegistrationUtilities.Update(
                context: context,
                ss: SiteSettingsUtilities.RegistrationsSiteSettings(context: context),
                registrationId: id);

            log.Finish(context: context, responseSize: json.Length);
            return(json);
        }
 public string Index(Context context)
 {
     if (!context.Ajax)
     {
         var log  = new SysLogModel(context: context);
         var html = RegistrationUtilities.Index(
             context: context,
             ss: SiteSettingsUtilities.RegistrationsSiteSettings(context: context));
         log.Finish(context: context, responseSize: html.Length);
         return(html);
     }
     else
     {
         var log  = new SysLogModel(context: context);
         var json = RegistrationUtilities.IndexJson(
             context: context,
             ss: SiteSettingsUtilities.RegistrationsSiteSettings(context: context));
         log.Finish(context: context, responseSize: json.Length);
         return(json);
     }
 }
Пример #10
0
        private static string GetRegistrationExtendedAttribute(string extendedAttributeName, string teamSystemName)
        {
            Debug.Assert(teamSystemName != null, "TFS server name cannot be null!");
            Debug.Assert(teamSystemName.Length > 0, "TFS server name cannot be empty!");

            Debug.Assert(extendedAttributeName != null, "ExtendedAttributeName name cannot be null!");
            Debug.Assert(extendedAttributeName.Length > 0, "ExtendedAttributeName name cannot be empty!");

            string value = null;

            // Copied from estudio\bis\proxy\BisServices.cs
            IRegistration regProxy = (IRegistration)GetProxy(teamSystemName, typeof(IRegistration));

            RegistrationEntry[] regEntries =
                regProxy.GetRegistrationEntries(BisData.Tool);

            Debug.Assert(regEntries.Length == 1, "Only one registration entry must exist for the tool!");
            RegistrationEntry toolEntry = regEntries[0];

            foreach (RegistrationExtendedAttribute attr in toolEntry.RegistrationExtendedAttributes)
            {
                if (0 == RegistrationUtilities.Compare(attr.Name, extendedAttributeName))
                {
                    value = attr.Value;
                    break;
                }
            }

            // The value MUST be found!
            if (value == null)
            {
                Logger.Write(LogSource.WorkItemTracking, TraceLevel.Error, "Could not get tool entry for WI");
                throw new ConverterException(VSTSResource.ErrorBisMiddleTierNotRegistered);
            }

            return(value);
        }
 public string Edit(Context context, int id)
 {
     if (!context.Ajax)
     {
         var log  = new SysLogModel(context: context);
         var html = RegistrationUtilities.Editor(
             context: context,
             ss: SiteSettingsUtilities.RegistrationsSiteSettings(context: context),
             registrationId: id,
             clearSessions: true);
         log.Finish(context: context, responseSize: html.Length);
         return(html);
     }
     else
     {
         var log  = new SysLogModel(context: context);
         var json = RegistrationUtilities.EditorJson(
             context: context,
             ss: SiteSettingsUtilities.RegistrationsSiteSettings(context: context),
             registrationId: id);
         log.Finish(context: context, responseSize: json.Length);
         return(json);
     }
 }
        public ActionResult Index()
        {
            var context = new Context();

            if (!Request.IsAjaxRequest())
            {
                var log  = new SysLogModel(context: context);
                var html = RegistrationUtilities.Index(
                    context: context,
                    ss: SiteSettingsUtilities.RegistrationsSiteSettings(context: context));
                ViewBag.HtmlBody = html;
                log.Finish(context: context, responseSize: html.Length);
                return(View());
            }
            else
            {
                var log  = new SysLogModel(context: context);
                var json = RegistrationUtilities.IndexJson(
                    context: context,
                    ss: SiteSettingsUtilities.RegistrationsSiteSettings(context: context));
                log.Finish(context: context, responseSize: json.Length);
                return(Content(json));
            }
        }
Пример #13
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="cfg">Configuration</param>
        public TfsCore(TfsMigrationDataSource cfg)
        {
            m_rwLock = new ReaderWriterLock();
            m_cfg    = cfg;
            //m_missingArea = missingArea;
            //m_missingIteration = missingIteration;

            m_srv = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(cfg.ServerName));
            m_srv.EnsureAuthenticated();
            TraceManager.TraceInformation("Authenticated User for Uri {0} is '{1}'", m_srv.Uri, m_srv.AuthorizedIdentity.DisplayName);

            //// Verify whether the user is in the service account group. Throw an exception if it is not.
            //// TODO: move this to proper location
            //IGroupSecurityService gss = (IGroupSecurityService)m_srv.GetService(typeof(IGroupSecurityService));
            //Identity serviceAccountIdentity = gss.ReadIdentity(SearchFactor.ServiceApplicationGroup, null, QueryMembership.None);
            //if (!gss.IsMember(serviceAccountIdentity.Sid, m_srv.AuthenticatedUserIdentity.Sid))
            //{
            //    throw new MigrationException(
            //        string.Format(TfsWITAdapterResources.UserNotInServiceAccountGroup, m_srv.AuthenticatedUserName, m_srv.Name));
            //}

            m_store = CreateWorkItemStore();
            m_name  = string.Format(
                CultureInfo.InvariantCulture,
                "{0} ({1})",
                m_store.TeamProjectCollection.Name,
                m_cfg.Project);

            Project p = m_store.Projects[cfg.Project];

            m_projectUri = p.Uri.ToString();
            m_projectId  = p.Id;

            //// Check existence of default area and iteration, if any
            //if (!string.IsNullOrEmpty(cfg.DefaultArea))
            //{
            //    m_defaultAreaId = GetNode(Node.TreeType.Area, cfg.DefaultArea, false);
            //}
            //else
            //{
            //    m_defaultAreaId = p.Id;
            //}
            //if (!string.IsNullOrEmpty(cfg.DefaultIteration))
            //{
            //    m_defaultIterationId = GetNode(Node.TreeType.Iteration, cfg.DefaultIteration, false);
            //}
            //else
            //{
            //    m_defaultIterationId = p.Id;
            //}
            /// TODO: replace the code below with configuration in consideration
            m_defaultAreaId      = p.Id;
            m_defaultIterationId = p.Id;

            // Obtain registration info
            IRegistration regSvc = (IRegistration)m_store.TeamProjectCollection.GetService(typeof(IRegistration));

            RegistrationEntry[] res = regSvc.GetRegistrationEntries(ToolNames.WorkItemTracking);

            if (res.Length != 1)
            {
                throw new MigrationException(TfsWITAdapterResources.ErrorMalformedRegistrationData, cfg.ServerName);
            }

            RegistrationEntry e = res[0];

            // Extract all data from the registration entry.
            for (int i = 0; i < e.ServiceInterfaces.Length; i++)
            {
                ServiceInterface si = e.ServiceInterfaces[i];

                if (TFStringComparer.ServiceInterface.Equals(si.Name, ServiceInterfaces.WorkItem))
                {
                    m_witUrl = si.Url;
                }
                else if (TFStringComparer.ServiceInterface.Equals(si.Name, "ConfigurationSettingsUrl"))
                {
                    m_configUrl = si.Url;
                }
            }

            for (int i = 0; i < e.RegistrationExtendedAttributes.Length; i++)
            {
                RegistrationExtendedAttribute a = e.RegistrationExtendedAttributes[i];

                if (RegistrationUtilities.Compare(a.Name, "AttachmentServerUrl") == 0)
                {
                    m_attachUrl = a.Value;
                    break;
                }
            }

            if (string.IsNullOrEmpty(m_witUrl) || string.IsNullOrEmpty(m_configUrl) ||
                string.IsNullOrEmpty(m_attachUrl))
            {
                throw new MigrationException(TfsWITAdapterResources.ErrorMalformedRegistrationData,
                                             m_cfg.ServerName);
            }

            m_attachUrl = CombineUrl(m_attachUrl, m_witUrl);
        }