private void AddControl(int position, int id, RegistrationEntry data = null) { var control = (RegistrationInfo)LoadControl("~/Controls/RegistrationInfo.ascx"); control.ID = "ucRegistrationInfo" + id; control.Fill(_dropDownData, _sluziaci); control.CheckBoxesPostBack = false; if (data != null) { control.Data = data; } _controls.Insert(position, control); var tabPanel = new TabPanel(); tabPanel.HeaderText = "Tab number " + id; tabPanel.ID = "tabPanel" + id; _tabPanels.Insert(position, tabPanel); tabPanel.Controls.Add(control); tabPanel.Visible = true; tabContainer.Tabs.AddAt(position + TabsBefore, tabPanel); ResetActiveTab(position + TabsBefore); }
public void Process(IndexReader indexReader, string readerName, int perSegmentDocumentNumber, int perIndexDocumentNumber, Document document, string id, NuGetVersion version) { // main index docid if (id == null || version == null) { return; } List<RegistrationEntry> versions; if (!_registrations.TryGetValue(id, out versions)) { versions = new List<RegistrationEntry>(); _registrations.Add(id, versions); } var entry = new RegistrationEntry(perIndexDocumentNumber, version, GetListed(document)); versions.Add(entry); }
public virtual void Unregister(UnregisterInfo unregisterInfo) { if (unregisterInfo == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("unregisterinfo", System.ServiceModel.SR.GetString("PeerNullRegistrationInfo")); } this.ThrowIfClosed("Unregister"); if ((!unregisterInfo.HasBody() || string.IsNullOrEmpty(unregisterInfo.MeshId)) || (unregisterInfo.RegistrationId == Guid.Empty)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("unregisterInfo", System.ServiceModel.SR.GetString("PeerInvalidMessageBody", new object[] { unregisterInfo })); } RegistrationEntry entry = null; MeshEntry meshEntry = this.GetMeshEntry(unregisterInfo.MeshId, false); LiteLock liteLock = null; try { LiteLock.Acquire(out liteLock, meshEntry.Gate, true); if (!meshEntry.EntryTable.TryGetValue(unregisterInfo.RegistrationId, out entry)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("unregisterInfo", System.ServiceModel.SR.GetString("PeerInvalidMessageBody", new object[] { unregisterInfo })); } meshEntry.EntryTable.Remove(unregisterInfo.RegistrationId); meshEntry.EntryList.Remove(entry); meshEntry.Service2EntryTable.Remove(entry.Address.ServicePath); entry.State = RegistrationState.Deleted; } finally { LiteLock.Release(liteLock); } }
public virtual RegisterResponseInfo Register(Guid clientId, string meshId, PeerNodeAddress address) { Guid registrationId = Guid.NewGuid(); DateTime expires = DateTime.UtcNow + this.RefreshInterval; RegistrationEntry entry = null; MeshEntry meshEntry = null; lock (this.ThisLock) { entry = new RegistrationEntry(clientId, registrationId, meshId, expires, address); meshEntry = this.GetMeshEntry(meshId); if (meshEntry.Service2EntryTable.ContainsKey(address.ServicePath)) { PeerExceptionHelper.ThrowInvalidOperation_DuplicatePeerRegistration(address.ServicePath); } LiteLock liteLock = null; try { LiteLock.Acquire(out liteLock, meshEntry.Gate, true); meshEntry.EntryTable.Add(registrationId, entry); meshEntry.EntryList.Add(entry); meshEntry.Service2EntryTable.Add(address.ServicePath, entry); } finally { LiteLock.Release(liteLock); } } return(new RegisterResponseInfo(registrationId, this.RefreshInterval)); }
public void Process(IndexReader indexReader, string readerName, int perSegmentDocumentNumber, int perIndexDocumentNumber, Document document, string id, NuGetVersion version) { // main index docid if (id == null || version == null) { return; } List <RegistrationEntry> versions; if (!_registrations.TryGetValue(id, out versions)) { versions = new List <RegistrationEntry>(); _registrations.Add(id, versions); } var entry = new RegistrationEntry(perIndexDocumentNumber, version, GetListed(document)); versions.Add(entry); }
public static List <string> GetUbytovanie(RegistrationEntry data) { var ubytovanie = new List <string>(); ubytovanie.Add("piatok-sobota" + (data.TichaTriedaPiatokSobota ? " (tichá trieda)" : "")); ubytovanie.Add("sobota-nedeľa" + (data.TichaTriedaSobotaNedela ? " (tichá trieda)" : "")); return(ubytovanie); }
public static string GetMultiple(RegistrationEntry data, string payerEmail, int totalPeople) { return (MailHeader + GetParticipantInfo(data) + string.Format("<br/><b>Na konferenciu Ťa zaregistroval(a) a zaplatil(a) za teba {0}.</b><br/>", payerEmail) + LivingConditions(totalPeople) + MailFooter); }
public virtual ResolveResponseInfo Resolve(ResolveInfo resolveInfo) { if (resolveInfo == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("resolveInfo", System.ServiceModel.SR.GetString("PeerNullResolveInfo")); } this.ThrowIfClosed("Resolve"); if (!resolveInfo.HasBody()) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("resolveInfo", System.ServiceModel.SR.GetString("PeerInvalidMessageBody", new object[] { resolveInfo })); } int num = 0; int num2 = 0; int maxAddresses = resolveInfo.MaxAddresses; ResolveResponseInfo info = new ResolveResponseInfo(); List <PeerNodeAddress> list = new List <PeerNodeAddress>(); List <RegistrationEntry> entryList = null; MeshEntry meshEntry = this.GetMeshEntry(resolveInfo.MeshId, false); if (meshEntry != null) { LiteLock liteLock = null; try { LiteLock.Acquire(out liteLock, meshEntry.Gate); entryList = meshEntry.EntryList; if (entryList.Count <= maxAddresses) { foreach (RegistrationEntry entry3 in entryList) { list.Add(entry3.Address); } } else { Random random = new Random(); while (num < maxAddresses) { num2 = random.Next(entryList.Count); RegistrationEntry entry = entryList[num2]; PeerNodeAddress item = entry.Address; if (!list.Contains(item)) { list.Add(item); } num++; } } } finally { LiteLock.Release(liteLock); } } info.Addresses = list.ToArray(); return(info); }
public IMessages FromAny() { _entry = new RegistrationEntry { PublisherHashCode = -1 }; return(this); }
public IMessages From(object publisher) { _entry = new RegistrationEntry { PublisherHashCode = publisher.GetHashCode(), }; return(this); }
public static string GetMultiple(RegistrationEntry data, string payerEmail, int totalPeople) { return MailHeader + GetParticipantInfo(data) + string.Format("<br/><b>Na konferenciu Ťa zaregistroval(a) a zaplatil(a) za teba {0}.</b><br/>", payerEmail) + LivingConditions(totalPeople) + MailFooter; }
public static RegistrationResult WriteData(List <RegistrationEntry> data, List <Email> emails, string payerEmail, float amountToPay, float donation, int idCurrency, bool needHelp) { var success = false; var badEmails = new List <string>(); try { using (var transaction = new TransactionScope()) { using (var sqlConnection = new SqlConnection(ConnectionString)) { using (var command = sqlConnection.CreateCommand()) { command.PrepareStoredProcedure(sqlConnection, "AddUsers4"); command.AddParameterUserDefined("@users", "dbo.ListOfUsers", RegistrationEntry.GetDataTable(data)); command.AddParameterUserDefined("@emails", "dbo.ListOfEmails", Email.GetDataTable(emails)); command.AddParameterString("@payerEmail", payerEmail); command.AddParameterFloat("@amount", amountToPay); command.AddParameterFloat("@donation", donation); command.AddParameterInt("@idCurrency", idCurrency); command.AddParameterBool("@needHelp", needHelp); sqlConnection.Open(); using (var reader = command.ExecuteReader()) { if (reader.Read()) { success = reader.GetInt32(0) > 0; } reader.NextResult(); if (!success) { while (reader.Read()) { badEmails.Add(reader.GetString(0)); } } } } } transaction.Complete(); } } catch (Exception ex) { } return(new RegistrationResult { Success = success, AlreadyRegisteredEmails = badEmails }); }
public static string GetSingle(RegistrationEntry data, string toPay, int totalPeople) { var registrationFee = Common.FormatMoney(data.RegistrationFee); return MailHeader + GetParticipantInfo(data) + "<br/>Prosím pošli sumu <b>" + toPay + "</b> bankovým prevodom:<br/>" + GetPaymentInfo(string.Format("{0} {1} (uveď bez diakritiky)", data.Meno, data.Priezvisko), toPay) + LivingConditions(totalPeople) + MailFooter; }
public static string GetSingle(RegistrationEntry data, string toPay, int totalPeople) { var registrationFee = Common.FormatMoney(data.RegistrationFee); return (MailHeader + GetParticipantInfo(data) + "<br/>Prosím pošli sumu <b>" + toPay + "</b> bankovým prevodom:<br/>" + GetPaymentInfo(string.Format("{0} {1} (uveď bez diakritiky)", data.Meno, data.Priezvisko), toPay) + LivingConditions(totalPeople) + MailFooter); }
public static string GetMultiple(RegistrationEntry data, string payerEmail) { var ubytovanie = GetUbytovanie(data); var strava = GetStrava(data); return MailHeader + GetParticipantInfo(data) + string.Format("<br/><b>Na konferenciu Ťa zaregistroval(a) a zaplatil(a) za teba {0}.</b><br/>", payerEmail) + SportRegistration + MailFooter1 + MailFooter2 + MailFooter3; }
private IRegistrationEntry GetOrCreateRegistrationalEntry(Type serviceType) { Type key = GetRegistrationKey(serviceType); var entry = this.explicitRegistrations.GetValueOrDefault(key); if (entry == null) { this.explicitRegistrations[key] = entry = RegistrationEntry.Create(serviceType, this); } return(entry); }
private bool validateForm() { Gdk.Color redColor = new Gdk.Color(); Gdk.Color.Parse("red", ref redColor); Gdk.Color whiteColor = new Gdk.Color(); Gdk.Color.Parse("white", ref whiteColor); if (String.IsNullOrEmpty(VehicleOwnerEntry.Text)) { VehicleOwnerEntry.ModifyBase(StateType.Normal, redColor); return(false); } else { VehicleOwnerEntry.ModifyBase(StateType.Normal, whiteColor); } if (String.IsNullOrEmpty(RegistrationEntry.Text)) { RegistrationEntry.ModifyBase(StateType.Normal, redColor); return(false); } else { RegistrationEntry.ModifyBase(StateType.Normal, whiteColor); } if (String.IsNullOrEmpty(VehicleTypeEntry.Text)) { VehicleTypeEntry.ModifyBase(StateType.Normal, redColor); return(false); } else { VehicleTypeEntry.ModifyBase(StateType.Normal, whiteColor); } if (String.IsNullOrEmpty(DescriptionTextView.Buffer.Text)) { DescriptionTextView.ModifyBase(StateType.Normal, redColor); return(false); } else { DescriptionTextView.ModifyBase(StateType.Normal, whiteColor); } return(true); }
public static string GetSingle(RegistrationEntry data, float toPay, CurrencyInfo currency) { return (MailHeader + GetParticipantInfo(data) + "<br/>Tvoja celková čiastka za konferenciu je <b>v hodnote " + currency.FormatMoney(toPay) + "</b>, táto čiastka obsahuje konferenčný poplatok " + "a pripočítaný je aj tvoj sponzorský príspevok, ak si ho zvolil(a).<br/> POZOR! Registračný poplatok závisí od dátumu zaplatenia (datum odoslania penazí z účtu), nie od dátumu registrácie. " + "Registácia, ktorá nebude zaplatená do 15.2.2017 bude zrušená. <br/>" + GetPaymentInfo(data, toPay, currency) + SportRegistration + MailFooter1 + MailFooter2 + MailFooter3); }
public static string GetMultiple(RegistrationEntry data, string payerEmail) { var ubytovanie = GetUbytovanie(data); var strava = GetStrava(data); return (MailHeader + GetParticipantInfo(data) + string.Format("<br/><b>Na konferenciu Ťa zaregistroval(a) a zaplatil(a) za teba {0}.</b><br/>", payerEmail) + SportRegistration + MailFooter1 + MailFooter2 + MailFooter3); }
public static string GetParticipantInfo(RegistrationEntry data) { var ubytovanie = GetUbytovanie(data); var strava = GetStrava(data); return string.Format("<br/>Milá/milý {0} {1},<br/>", data.Meno, data.Priezvisko) + "vítame Ťa medzi prihlásenými účastníkmi Mládežníckej konferencie.<br/>" + "<br/><b>Máš objednané:</b><br/>" + (ubytovanie.Count > 0 ? "<b>Ubytovanie:</b> " + string.Join(", ", ubytovanie) + " - k ubytovaniu je potrebný vlastný spacák a karimatka<br/>" : "") + (strava.Count > 0 ? "<b>Strava:</b> " + string.Join(", ", strava) + "<br/>" : "") + (data.IdTricko > 0 ? "<b>Tričko:</b> " + data.Tricko + "<br/>" : "") + (data.Sluziaci ? "V registračnom formulári si zaškrtol/zaškrtla, že si ochotný/ochotná slúžiť a byť k dispozícii pre rôzne úlohy počas celého " + "času trvania konferencie. Ohľadom možnosti služby Ťa budeme kontaktovať.<br/>" : ""); }
public static string GetParticipantInfo(RegistrationEntry data) { var ubytovanie = GetUbytovanie(data); var strava = GetStrava(data); return (string.Format("<br/>Milá/milý {0} {1},<br/>", data.Meno, data.Priezvisko) + "vítame Ťa medzi prihlásenými účastníkmi Mládežníckej konferencie.<br/>" + "<br/><b>Máš objednané:</b><br/>" + (ubytovanie.Count > 0 ? "<b>Ubytovanie:</b> " + string.Join(", ", ubytovanie) + " - k ubytovaniu je potrebný vlastný spacák a karimatka<br/>" : "") + (strava.Count > 0 ? "<b>Strava:</b> " + string.Join(", ", strava) + "<br/>" : "") + (data.IdTricko > 0 ? "<b>Tričko:</b> " + data.Tricko + "<br/>" : "") + (data.Sluziaci ? "V registračnom formulári si zaškrtol/zaškrtla, že si ochotný/ochotná slúžiť a byť k dispozícii pre rôzne úlohy počas celého " + "času trvania konferencie. Ohľadom možnosti služby Ťa budeme kontaktovať.<br/>" : "")); }
public static string GetSingle(RegistrationEntry data, string toPay) { var registrationFee = Common.FormatMoney(data.RegistrationFee, data.IdCurrency); return (MailHeader + GetParticipantInfo(data) + "<br/>Tvoja celková čiastka za konferenciu je <b>v hodnote " + toPay + "</b>, táto čiastka obsahuje konferenčný poplatok (" + registrationFee + ") " + "a pripočítaný je aj tvoj sponzorský príspevok, ak si ho zvolil(a).<br/>" + GetPaymentInfo(string.Format("{0} {1} (uveď bez diakritiky)", data.Meno, data.Priezvisko), toPay, data.IdCurrency) + SportRegistration + MailFooter1 + MailFooter2 + MailFooter3); }
public static RegistrationResult WriteData(List <RegistrationEntry> data, List <Email> emails, string payerEmail, float donation, CurrencyInfo currency) { var success = false; var badEmails = new List <string>(); using (var transaction = new TransactionScope()) { using (var connection = CreateConnection()) { using (var command = CreateCommand(connection, "AddUsers4")) { command.AddParameterUserDefined("@users", "dbo.ListOfUsers4", RegistrationEntry.GetDataTable(data)); command.AddParameterUserDefined("@emails", "dbo.ListOfEmails", Email.GetDataTable(emails)); command.AddParameterString("@payerEmail", payerEmail); command.AddParameterFloat("@donation", donation); command.AddParameterInt("@idCurrency", currency.Id); using (var reader = command.ExecuteReader()) { if (reader.Read()) { success = reader.GetInt32(0) > 0; } reader.NextResult(); if (!success) { while (reader.Read()) { badEmails.Add(reader.GetString(0)); } } } } } transaction.Complete(); } return(new RegistrationResult { Success = success, AlreadyRegisteredEmails = badEmails }); }
public virtual RefreshResponseInfo Refresh(RefreshInfo refreshInfo) { if (refreshInfo == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("refreshInfo", SR.GetString(SR.PeerNullRefreshInfo)); } ThrowIfClosed("Refresh"); if (!refreshInfo.HasBody() || String.IsNullOrEmpty(refreshInfo.MeshId) || refreshInfo.RegistrationId == Guid.Empty) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("refreshInfo", SR.GetString(SR.PeerInvalidMessageBody, refreshInfo)); } RefreshResult result = RefreshResult.RegistrationNotFound; RegistrationEntry entry = null; MeshEntry meshEntry = GetMeshEntry(refreshInfo.MeshId, false); LiteLock ll = null; if (meshEntry != null) { try { LiteLock.Acquire(out ll, meshEntry.Gate); if (!meshEntry.EntryTable.TryGetValue(refreshInfo.RegistrationId, out entry)) { return(new RefreshResponseInfo(RefreshInterval, result)); } lock (entry) { if (entry.State == RegistrationState.OK) { entry.Expires = DateTime.UtcNow + RefreshInterval; result = RefreshResult.Success; } } } finally { LiteLock.Release(ll); } } return(new RefreshResponseInfo(RefreshInterval, result)); }
protected void btnAddUser_Click(object sender, EventArgs e) { var position = tabContainer.ActiveTabIndex - TabsBefore; if (position < 0) { position = 0; } if (position >= _data.Count) { position = _data.Count - 1; } var id = _indices.Max() + 1; var data = new RegistrationEntry(_controls[position].Data); _data.Insert(position + 1, data); _indices.Insert(position + 1, id); AddControl(position + 1, id, data); }
public virtual RefreshResponseInfo Refresh(RefreshInfo refreshInfo) { if (refreshInfo == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("refreshInfo", System.ServiceModel.SR.GetString("PeerNullRefreshInfo")); } this.ThrowIfClosed("Refresh"); if ((!refreshInfo.HasBody() || string.IsNullOrEmpty(refreshInfo.MeshId)) || (refreshInfo.RegistrationId == Guid.Empty)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("refreshInfo", System.ServiceModel.SR.GetString("PeerInvalidMessageBody", new object[] { refreshInfo })); } RefreshResult registrationNotFound = RefreshResult.RegistrationNotFound; RegistrationEntry entry = null; MeshEntry meshEntry = this.GetMeshEntry(refreshInfo.MeshId, false); LiteLock liteLock = null; if (meshEntry != null) { try { LiteLock.Acquire(out liteLock, meshEntry.Gate); if (!meshEntry.EntryTable.TryGetValue(refreshInfo.RegistrationId, out entry)) { return(new RefreshResponseInfo(this.RefreshInterval, registrationNotFound)); } lock (entry) { if (entry.State == RegistrationState.OK) { entry.Expires = DateTime.UtcNow + this.RefreshInterval; registrationNotFound = RefreshResult.Success; } } } finally { LiteLock.Release(liteLock); } } return(new RefreshResponseInfo(this.RefreshInterval, registrationNotFound)); }
public virtual RegisterResponseInfo Register(Guid clientId, string meshId, PeerNodeAddress address) { Guid registrationId = Guid.NewGuid(); DateTime expiry = DateTime.UtcNow + RefreshInterval; RegistrationEntry entry = null; MeshEntry meshEntry = null; lock (ThisLock) { entry = new RegistrationEntry(clientId, registrationId, meshId, expiry, address); meshEntry = GetMeshEntry(meshId); if (meshEntry.Service2EntryTable.ContainsKey(address.ServicePath)) { PeerExceptionHelper.ThrowInvalidOperation_DuplicatePeerRegistration(address.ServicePath); } LiteLock ll = null; try { // meshEntry.gate can be held by this thread for write if this is coming from update // else MUST not be held at all. if (!meshEntry.Gate.IsWriterLockHeld) { LiteLock.Acquire(out ll, meshEntry.Gate, true); } meshEntry.EntryTable.Add(registrationId, entry); meshEntry.EntryList.Add(entry); meshEntry.Service2EntryTable.Add(address.ServicePath, entry); } finally { if (ll != null) { LiteLock.Release(ll); } } } return(new RegisterResponseInfo(registrationId, RefreshInterval)); }
public static List <string> GetStrava(RegistrationEntry data) { var strava = new List <string>(); if (data.PiatokVecera) { strava.Add("piatok večera"); } if (data.PiatokVecera2) { strava.Add("piatok druhá večera"); } if (data.SobotaRanajky) { strava.Add("sobota raňajky"); } if (data.SobotaObed) { strava.Add("sobota obed"); } if (data.SobotaVecera) { strava.Add("sobota večera"); } if (data.SobotaVecera2) { strava.Add("sobota druhá večera"); } if (data.NedelaRanajky) { strava.Add("nedeľa raňajky"); } if (data.NedelaObed) { strava.Add("nedeľa obed"); } return(strava); }
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 virtual void Unregister(UnregisterInfo unregisterInfo) { if (unregisterInfo == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("unregisterinfo", SR.GetString(SR.PeerNullRegistrationInfo)); } ThrowIfClosed("Unregister"); if (!unregisterInfo.HasBody() || String.IsNullOrEmpty(unregisterInfo.MeshId) || unregisterInfo.RegistrationId == Guid.Empty) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("unregisterInfo", SR.GetString(SR.PeerInvalidMessageBody, unregisterInfo)); } RegistrationEntry registration = null; MeshEntry meshEntry = GetMeshEntry(unregisterInfo.MeshId, false); //there could be a ---- that two different threads could be working on the same entry //we wont optimize for that case. LiteLock ll = null; try { LiteLock.Acquire(out ll, meshEntry.Gate, true); if (!meshEntry.EntryTable.TryGetValue(unregisterInfo.RegistrationId, out registration)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("unregisterInfo", SR.GetString(SR.PeerInvalidMessageBody, unregisterInfo)); } meshEntry.EntryTable.Remove(unregisterInfo.RegistrationId); meshEntry.EntryList.Remove(registration); meshEntry.Service2EntryTable.Remove(registration.Address.ServicePath); registration.State = RegistrationState.Deleted; } finally { LiteLock.Release(ll); } }
public RegistrationEntry(RegistrationEntry source) { IdZbor = source.IdZbor; InyZbor = source.InyZbor; }
/// <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); }
// // Gets web service URL for the given TFS server // private static void GetMiddleTierUrls( string teamSystemName, // TFS server name out string serverUrl, // Server URL out string configurationSettingsUrl) // Configuration Settings URL { Debug.Assert(teamSystemName != null, "TFS server name cannot be null!"); Debug.Assert(teamSystemName.Length > 0, "TFS server name cannot be empty!"); // // Get registration info from BIS. If there's an connectivity issue (or similar exception) // with BIS, we shouldn't catch and change the exception, we should let the BIS error // bubble up since there's not much can do to handle that situation. Their exception // should best describe the situation. // TeamFoundationServer tfs = TeamFoundationServerFactory.GetServer(teamSystemName); IRegistration regProxy = (IRegistration)tfs.GetService(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]; // Find the right service interface ServiceInterface si = null; ServiceInterface configurationServiceInterface = null; int foundCount = 0; for (int i = 0; i < toolEntry.ServiceInterfaces.Length; i++) { string name = toolEntry.ServiceInterfaces[i].Name; if (si == null && TFStringComparer.ServiceInterface.Equals(name, ServiceInterfaces.WorkItem)) { si = toolEntry.ServiceInterfaces[i]; foundCount++; } else if (configurationServiceInterface == null && TFStringComparer.ServiceInterface.Equals(name, BisData.ConfigurationServerUrl)) { configurationServiceInterface = toolEntry.ServiceInterfaces[i]; foundCount++; } if (foundCount == 2) { break; } } // // If either of these two situations occur, our middle tier location did not get properly registered // and we should call attention to that since the app cannot continue and corrective action should // be take by the admin. // if (si == null) { Logger.Write(LogSource.WorkItemTracking, TraceLevel.Error, "Could not get service interface for WI"); throw new ConverterException(VSTSResource.ErrorBisMiddleTierNotRegistered); } serverUrl = si.Url; if (String.IsNullOrEmpty(serverUrl)) { Logger.Write(LogSource.WorkItemTracking, TraceLevel.Error, "Could not get service interface URL for WI"); throw new ConverterException(VSTSResource.ErrorBisMiddleTierNotRegistered); } if (configurationServiceInterface == null) { Logger.Write(LogSource.WorkItemTracking, TraceLevel.Error, "Could not get config service interface for WI"); throw new ConverterException(VSTSResource.ErrorBisMiddleTierNotRegistered); } configurationSettingsUrl = configurationServiceInterface.Url; if (String.IsNullOrEmpty(configurationSettingsUrl)) { Logger.Write(LogSource.WorkItemTracking, TraceLevel.Error, "Could not get config service interface URL for WI"); throw new ConverterException(VSTSResource.ErrorBisMiddleTierNotRegistered); } }
public static string GetPaymentInfo(RegistrationEntry data, float toPay, CurrencyInfo currency) { return(GetPaymentInfo(string.Format("<b>{0} {1}</b> (uveď bez diakritiky)", data.Meno, data.Priezvisko), toPay, currency)); }
public virtual RegisterResponseInfo Register(Guid clientId, string meshId, PeerNodeAddress address) { Guid registrationId = Guid.NewGuid(); DateTime expiry = DateTime.UtcNow + RefreshInterval; RegistrationEntry entry = null; MeshEntry meshEntry = null; lock (ThisLock) { entry = new RegistrationEntry(clientId, registrationId, meshId, expiry, address); meshEntry = GetMeshEntry(meshId); if (meshEntry.Service2EntryTable.ContainsKey(address.ServicePath)) PeerExceptionHelper.ThrowInvalidOperation_DuplicatePeerRegistration(address.ServicePath); LiteLock ll = null; try { // meshEntry.gate can be held by this thread for write if this is coming from update // else MUST not be held at all. if (!meshEntry.Gate.IsWriterLockHeld) { LiteLock.Acquire(out ll, meshEntry.Gate, true); } meshEntry.EntryTable.Add(registrationId, entry); meshEntry.EntryList.Add(entry); meshEntry.Service2EntryTable.Add(address.ServicePath, entry); } finally { if (ll != null) LiteLock.Release(ll); } } return new RegisterResponseInfo(registrationId, RefreshInterval); }
public static string GetParticipantInfo(RegistrationEntry data) { return string.Format("<br/>Milá/milý {0} {1},<br/>", data.Meno, data.Priezvisko) + "vítame Ťa medzi prihlásenými účastníkmi kempu mládeže.<br/>"; }
public static List<string> GetStrava(RegistrationEntry data) { var strava = new List<string>(); if (data.PiatokVecera) strava.Add("piatok večera"); if (data.PiatokVecera2) strava.Add("piatok druhá večera"); if (data.SobotaRanajky) strava.Add("sobota raňajky"); if (data.SobotaObed) strava.Add("sobota obed"); if (data.SobotaVecera) strava.Add("sobota večera"); if (data.SobotaVecera2) strava.Add("sobota druhá večera"); if (data.NedelaRanajky) strava.Add("nedeľa raňajky"); if (data.NedelaObed) strava.Add("nedeľa obed"); return strava; }
public static List<string> GetUbytovanie(RegistrationEntry data) { var ubytovanie = new List<string>(); if (data.UbytovaniePiatokSobota) ubytovanie.Add("piatok-sobota" + (data.TichaTriedaPiatokSobota ? " (tichá trieda)" : "")); if (data.UbytovanieSobotaNedela) ubytovanie.Add("sobota-nedeľa" + (data.TichaTriedaSobotaNedela ? " (tichá trieda)" : "")); return ubytovanie; }
public static string GetParticipantInfo(RegistrationEntry data) { return (string.Format("<br/>Milá/milý {0} {1},<br/>", data.Meno, data.Priezvisko) + "vítame Ťa medzi prihlásenými účastníkmi kempu mládeže.<br/>"); }
public static string GetSingle(RegistrationEntry data, string toPay) { var registrationFee = Common.FormatMoney(data.RegistrationFee, data.IdCurrency); return MailHeader + GetParticipantInfo(data) + "<br/>Tvoja celková čiastka za konferenciu je <b>v hodnote " + toPay + "</b>, táto čiastka obsahuje konferenčný poplatok (" + registrationFee + ") " + "a pripočítaný je aj tvoj sponzorský príspevok, ak si ho zvolil(a).<br/>" + GetPaymentInfo(string.Format("{0} {1} (uveď bez diakritiky)", data.Meno, data.Priezvisko), toPay, data.IdCurrency) + SportRegistration + MailFooter1 + MailFooter2 + MailFooter3; }
public virtual RegisterResponseInfo Register(Guid clientId, string meshId, PeerNodeAddress address) { Guid registrationId = Guid.NewGuid(); DateTime expires = DateTime.UtcNow + this.RefreshInterval; RegistrationEntry entry = null; MeshEntry meshEntry = null; lock (this.ThisLock) { entry = new RegistrationEntry(clientId, registrationId, meshId, expires, address); meshEntry = this.GetMeshEntry(meshId); if (meshEntry.Service2EntryTable.ContainsKey(address.ServicePath)) { PeerExceptionHelper.ThrowInvalidOperation_DuplicatePeerRegistration(address.ServicePath); } LiteLock liteLock = null; try { LiteLock.Acquire(out liteLock, meshEntry.Gate, true); meshEntry.EntryTable.Add(registrationId, entry); meshEntry.EntryList.Add(entry); meshEntry.Service2EntryTable.Add(address.ServicePath, entry); } finally { LiteLock.Release(liteLock); } } return new RegisterResponseInfo(registrationId, this.RefreshInterval); }