public Community ProvisionPhones(Community community) { Community book = community; if (book.Book == null && book.Id.HasValue) { Community byId = CommunityBc.Instance.GetById(book.Id.Value); book.Book = byId.Book; if (book.Address == null || book.Address.Country == null || !book.Address.Country.Id.HasValue) { book.Address = byId.Address; } } List <Publication> books = AccountBc.Instance.GetBooks(); if (books.Any <Publication>((Publication b) => { long id = (long)b.Id; long?nullable = book.Book.Id; return(id == nullable.GetValueOrDefault() & nullable.HasValue); })) { book.Book.Number = books.First <Publication>((Publication b) => { long id = (long)b.Id; long?nullable = book.Book.Id; return(id == nullable.GetValueOrDefault() & nullable.HasValue); }).Name; } book = MarchexBc.ProvisionPhones(book); return(book); }
public ServiceProvider ProvisionPhones(ServiceProvider serviceProvider) { ServiceProvider book = serviceProvider; if (book.Book == null && book.Id.HasValue) { ServiceProvider byId = ServiceProviderBc.Instance.GetById(book.Id.Value); book.Book = byId.Book; if (book.Address == null || book.Address.Country == null || !book.Address.Country.Id.HasValue) { book.Address = byId.Address; } } List <Publication> books = AccountBc.Instance.GetBooks(); if (books.Any <Publication>((Publication b) => { long id = (long)b.Id; long?nullable = book.Book.Id; return(id == nullable.GetValueOrDefault() & nullable.HasValue); })) { book.Book.Number = books.First <Publication>((Publication b) => { long id = (long)b.Id; long?nullable = book.Book.Id; return(id == nullable.GetValueOrDefault() & nullable.HasValue); }).Name; } book = MarchexBc.ProvisionPhones(book); return(book); }
private void ValidateCallTrackingPhones(Guid userId) { List <Book> books = this.GetBooks(new Guid?(userId)); List <CallTrackingPhone> all = this._callTrackingDac.GetAll(books); List <CallTrackingPhone> callTrackingPhones = new List <CallTrackingPhone>(); List <CallTrackingPhone> callTrackingPhones1 = new List <CallTrackingPhone>(); foreach (CallTrackingPhone callTrackingPhone in all) { if (!callTrackingPhone.IsDisconnected && !callTrackingPhone.DisconnectDate.HasValue && callTrackingPhone.EndDate.HasValue && callTrackingPhone.EndDate.Value.Date < DateTime.UtcNow.Date) { callTrackingPhones.Add(callTrackingPhone); Logger.InfoFormat(LogMessages.BcsAdmin.Components.PhoneDisconnected, new object[] { callTrackingPhone.Id, callTrackingPhone.CommunityId, callTrackingPhone.Phone, callTrackingPhone.ProvisionPhone }); } if (!callTrackingPhone.IsDisconnected || !callTrackingPhone.DisconnectDate.HasValue || !(callTrackingPhone.DisconnectDate.Value.AddDays(180).Date < DateTime.UtcNow.Date) || !MarchexBc.DisconnectCallTracking(callTrackingPhone)) { continue; } callTrackingPhones1.Add(callTrackingPhone); Logger.InfoFormat(LogMessages.BcsAdmin.Components.PhoneDeleted, new object[] { callTrackingPhone.Id, callTrackingPhone.CommunityId, callTrackingPhone.Phone, callTrackingPhone.ProvisionPhone }); } this._callTrackingDac.DisconnectCallTrackingPhones(userId, callTrackingPhones); this._callTrackingDac.DeleteCallTrackingPhones(userId, callTrackingPhones1); }