internal void Handle(GetDriverInfo input) { using (var dbConn = DatabaseManager.DbConn()) { var nInf = dbConn.ExecuteBpl(new DriverGetById { DriverId = input.DriverId }); if (nInf != null) { Log.Trace("User {0} found in local DB. Response.", input.DriverId); var contacts = dbConn.ExecuteBpl(new ContactGetById { ContactId = nInf.DriverId }); if (contacts != null) { foreach (var ci in contacts) { var ct = new Contact(); ct.Type = ci.Type; ct.Value = ci.Value; nInf.Contacts.Add(ct); } } Reply(nInf); return; } } //TK: If Tibo/Amdocs is down, uncomment following //r(input, new Result<Subscriber> { result = new Subscriber { Id = Mpcr.Core.Language.BplIdentity.Get(input.RegistrationCode) } }, false); //return; //2: If not found, ask Tibco if (OscarServer.UseBackendMasterData) { RequestDriverInfo(input.DriverId, true); } }
internal static Contact GetClientContact(BplIdentity id) { Contact result = null; try { using (var context = new PrincipalContext(ContextType.Domain, ADServer, ADUserContainer, ADUsername, ADPassword)) { using (var up = UserPrincipal.FindByIdentity(context, IdentityType.Name, (string)id.LocalId)) { if (up != null) { if (up.EmailAddress.NotEmpty()) { result = new Contact { Type = ContactTypes.Email, Value = up.EmailAddress }; } else { result = new Contact { Type = ContactTypes.MobilePhone, Value = up.VoiceTelephoneNumber }; } } else { Log.Warn("User {0} was not found", id); } } } } catch (Exception e) { Log.Exception(e, "Unable to get client contact."); } return result; }
/// <summary>Creates a new <see cref="LoginContact"/> instance.</summary> public LoginContact(Contact contact) { LoginName = contact.Value; //TODO: Escape all unsafe characters. LoginKind = contact.Type == ContactTypes.Email ? LoginKind.Email : LoginKind.Phone; }