Esempio n. 1
0
        public static void GetConsultationReferenceFromBookingSummary(CrmServiceClient client, tcm.WebRioSsoConfig configuration)
        {
            if (client == null)
            {
                return;
            }
            if (configuration == null)
            {
                return;
            }

            RetrieveRequest request = new RetrieveRequest
            {
                ColumnSet = new ColumnSet("tc_name"),
                Target    = new Microsoft.Xrm.Sdk.EntityReference("tc_bookingsummary", new Guid(configuration.BookingSummaryId))
            };
            var response = (RetrieveResponse)client.ExecuteCrmOrganizationRequest(request, "Fetching booking summary record for Web Rio");

            if (response == null)
            {
                return;
            }
            var bookingSummary = response.Entity;

            if (bookingSummary == null || !bookingSummary.Contains("tc_name") || bookingSummary["tc_name"] == null)
            {
                return;
            }
            configuration.ConsultationReference = bookingSummary["tc_name"].ToString();
        }
Esempio n. 2
0
        public static void GetInitialsFrom(CrmServiceClient client, tcm.WebRioSsoConfig configuration)
        {
            if (client == null)
            {
                return;
            }
            if (configuration == null)
            {
                return;
            }

            RetrieveRequest request = new RetrieveRequest
            {
                ColumnSet = new ColumnSet("tc_initials"),
                Target    = new Microsoft.Xrm.Sdk.EntityReference("opportunity", new Guid(configuration.TravelPlannerId))
            };
            var response = (RetrieveResponse)client.ExecuteCrmOrganizationRequest(request, "Fetching travel planner record for Web Rio");

            if (response == null)
            {
                return;
            }
            var travelPlanner = response.Entity;

            if (travelPlanner == null || !travelPlanner.Contains("tc_initials") || travelPlanner["tc_initials"] == null)
            {
                return;
            }
            configuration.Initials = travelPlanner["tc_initials"].ToString();
        }
        public void ExecuteCrmOrganizationRequestTest()
        {
            OrganizationRequest orgReq = new OrganizationRequest();

            BCrmServiceClient.MockCrmCommandExecute();
            OrganizationResponse orgRes = crmaction.ExecuteCrmOrganizationRequest(orgReq);

            Assert.IsNotNull(orgRes);
        }
Esempio n. 4
0
        public static Entity GetOpportunity(CrmServiceClient client, ILogger logger, string opportunityId)
        {
            if (string.IsNullOrEmpty(opportunityId))
            {
                return(null);
            }
            var query = new QueryExpression(EntityName.Opportunity)
            {
                ColumnSet =
                    new ColumnSet(Opportunity.CustomerId, Opportunity.Initials, Opportunity.Name,
                                  Opportunity.EarliestDepartureDate, Opportunity.LatestDepartureDate, Opportunity.Duration,
                                  Opportunity.DeparturePoint1, Opportunity.DeparturePoint2, Opportunity.DeparturePoint3,
                                  Opportunity.DestinationCountry1, Opportunity.Region1, Opportunity.DestinationAirport1,
                                  Opportunity.Hotel1, Opportunity.DestinationCountry2, Opportunity.Region2,
                                  Opportunity.DestinationAirport2, Opportunity.Hotel2, Opportunity.DestinationCountry3,
                                  Opportunity.Region3, Opportunity.Hotel3, Opportunity.DestinationAirport3, Opportunity.Exclude1,
                                  Opportunity.Exclude2, Opportunity.Exclude3, Opportunity.HowDoYouWantToSearch)
            };

            query.LinkEntities.Add(new LinkEntity(EntityName.Opportunity, EntityName.Contact, Opportunity.CustomerId,
                                                  Contact.ContactId,
                                                  JoinOperator.Inner));
            query.LinkEntities[0].Columns.AddColumns(Contact.ContactId, Crm.Common.Constants.Attributes.Customer.SourceSystemId, Crm.Common.Constants.Attributes.Customer.Salutation,
                                                     Crm.Common.Constants.Attributes.Customer.FirstName,
                                                     Crm.Common.Constants.Attributes.Customer.MiddleName,
                                                     Crm.Common.Constants.Attributes.Customer.LastName, Crm.Common.Constants.Attributes.Customer.Birthdate, Crm.Common.Constants.Attributes.Customer.Address1FlatOrUnitNumber,
                                                     Crm.Common.Constants.Attributes.Customer.Address1HouseNumberOrBuilding,
                                                     Crm.Common.Constants.Attributes.Customer.Address1Town, Crm.Common.Constants.Attributes.Customer.Address1CountryId, Crm.Common.Constants.Attributes.Customer.Address1County, Crm.Common.Constants.Attributes.Customer.Address1PostalCode,
                                                     Crm.Common.Constants.Attributes.Customer.Address2FlatOrUnitNumber, Crm.Common.Constants.Attributes.Customer.Address2HouseNumberOrBuilding, Crm.Common.Constants.Attributes.Customer.Address2Town,
                                                     Crm.Common.Constants.Attributes.Customer.Address2CountryId, Crm.Common.Constants.Attributes.Customer.Address2County, Crm.Common.Constants.Attributes.Customer.Address2PostalCode,
                                                     Crm.Common.Constants.Attributes.Customer.Telephone1Type,
                                                     Crm.Common.Constants.Attributes.Customer.Telephone1, Crm.Common.Constants.Attributes.Customer.Telephone2Type, Crm.Common.Constants.Attributes.Customer.Telephone2, Crm.Common.Constants.Attributes.Customer.Telephone3Type,
                                                     Crm.Common.Constants.Attributes.Customer.Telephone3, Crm.Common.Constants.Attributes.Customer.EmailAddress1Type,
                                                     Crm.Common.Constants.Attributes.Customer.EmailAddress1, Crm.Common.Constants.Attributes.Customer.EmailAddress2Type, Crm.Common.Constants.Attributes.Customer.EmailAddress2, Crm.Common.Constants.Attributes.Customer.EmailAddress3Type,
                                                     Crm.Common.Constants.Attributes.Customer.EmailAddress3);
            query.LinkEntities[0].EntityAlias = AliasName.ContactQueryAliasName;
            query.Criteria.Conditions.Add(new ConditionExpression(Opportunity.OpportunityId, ConditionOperator.Equal,
                                                                  opportunityId));
            var req = new RetrieveMultipleRequest
            {
                Query = query
            };
            var response =
                (RetrieveMultipleResponse)
                client.ExecuteCrmOrganizationRequest(req,
                                                     $"Requesting {query.EntityName}");
            var opportunity = response?.EntityCollection?.Entities?.FirstOrDefault();

            if (opportunity != null)
            {
                logger.LogInformation("Opportunity retrieved");
            }
            return(opportunity);
        }
Esempio n. 5
0
        private static RetrieveMultipleResponse ExecuteQuery(QueryByAttribute query, CrmServiceClient client)
        {
            var req = new RetrieveMultipleRequest
            {
                Query = query
            };
            var response =
                (RetrieveMultipleResponse)
                client.ExecuteCrmOrganizationRequest(req,
                                                     $"Requesting {query.EntityName}");

            return(response);
        }
Esempio n. 6
0
        private List <Entity> GetStores(bool loadAllBudgetStores)
        {
            QueryBase query;

            if (!loadAllBudgetStores)
            {
                var request = $@"<fetch distinct='true' >
									<entity name='{EntityName.Store}' >
										<attribute name='{Attributes.Store.StoreId}' />
										<attribute name='{Attributes.Store.Abta}' />
										<attribute name='{Attributes.Store.ClusterId}' />
										<attribute name='{Attributes.Store.UkRegionId}' />
										<attribute name='{Attributes.Store.Name}' />
										<attribute name='{Attributes.Store.BudgetCentre}' />
										<attribute name='{Attributes.Store.StoreClosed}' />
										<filter type='or' >
											<filter type='and' >
												<condition attribute='{Attributes.Store.StoreClosed}' operator='eq' value='0' />
												<condition entityname='assigned' attribute='{Attributes.User.UserId}' operator='eq' value='{_myGuid}' />
											</filter>
											<filter type='and' >
												<condition attribute='{Attributes.Store.StoreClosed}' operator='eq' value='1' />
												<condition entityname='admin_regular_user' attribute='{Attributes.User.UserId}' operator='eq' value='{_myGuid}' />
											</filter>
											<filter type='and' >
												<condition attribute='{Attributes.Store.StoreClosed}' operator='eq' value='1' />
												<condition entityname='admin_primary_user' attribute='{Attributes.User.UserId}' operator='eq' value='{_myGuid}' />
											</filter>
										</filter>
										<link-entity name='{EntityRelationName.StoreUser}' from='{Attributes.Store.StoreId}' to='{Attributes.Store.StoreId}' link-type='outer' alias='assigned' intersect='true' />
										<link-entity name='{EntityName.Store}' from='{Attributes.Store.StoreId}' to='{Attributes.Store.AdminHostBudgetCenter}' link-type='outer' alias='admin_regular' >
											<link-entity name='{EntityRelationName.StoreUser}' from='{Attributes.Store.StoreId}' to='{Attributes.Store.StoreId}' link-type='outer' alias='admin_regular_user' intersect='true' />
										</link-entity>
										<link-entity name='{EntityName.Store}' from='{Attributes.Store.StoreId}' to='{Attributes.Store.AdminHostBudgetCenter}' link-type='outer' alias='admin_primary' >
											<link-entity name='{EntityName.User}' from='{Attributes.User.PrimaryStoreId}' to='{Attributes.Store.StoreId}' link-type='outer' alias='admin_primary_user' />
										</link-entity>
										<order attribute='{Attributes.Store.StoreClosed}' />
										<order attribute='{Attributes.Store.Name}' />
									</entity>
								</fetch>"                                ;
                query = new FetchExpression(request);
            }
            else
            {
                query = new QueryExpression
                {
                    EntityName = EntityName.Store,
                    ColumnSet  = _storeColumnSet
                };
            }
            var req = new RetrieveMultipleRequest
            {
                Query = query
            };

            return(((RetrieveMultipleResponse)_crmService.ExecuteCrmOrganizationRequest(req)).EntityCollection.Entities.ToList());
        }
        private DataCollection <Entity> getAllPluginAssemblies()
        {
            QueryExpression userSettingsQuery = new QueryExpression("pluginassembly");

            userSettingsQuery.ColumnSet.AllColumns = false;
            userSettingsQuery.ColumnSet.AddColumn("name");

            userSettingsQuery.Criteria = new FilterExpression
            {
                FilterOperator = LogicalOperator.And,
                Conditions     =
                {
                    new ConditionExpression
                    {
                        AttributeName = "name",
                        Operator      = ConditionOperator.DoesNotBeginWith,
                        Values        = { "Microsoft" }
                    }
                }
            };

            var retrieveRequest = new RetrieveMultipleRequest()
            {
                Query = userSettingsQuery
            };

            EntityCollection EntCol = null;

            if (_svcClient.IsReady)
            {
                var response = _svcClient.ExecuteCrmOrganizationRequest(retrieveRequest) as RetrieveMultipleResponse;

                EntCol = response.EntityCollection;
            }

            return(EntCol?.Entities);
        }
Esempio n. 8
0
        public void CreateEntity(CrmServiceClient services, DxEntity entity)
        {
            try
            {
                CreateEntityRequest createrequest = new CreateEntityRequest
                {
                    Entity = new EntityMetadata
                    {
                        SchemaName            = entity.PSchema,
                        DisplayName           = new Microsoft.Xrm.Sdk.Label(entity.PName, 3082),
                        DisplayCollectionName = new Microsoft.Xrm.Sdk.Label(entity.PNamePlural, 3082),
                        Description           = new Microsoft.Xrm.Sdk.Label(entity.PDescription, 3082),
                        OwnershipType         = entity.POwnershipType,
                        IsActivity            = entity.IsActivity,
                        IsConnectionsEnabled  = entity.IsConnectionsEnabled,
                        // IsActivityParty = true envio de correo
                    },

                    PrimaryAttribute = new StringAttributeMetadata
                    {
                        SchemaName    = entity.DxAttribute.PSchemaName,
                        RequiredLevel = entity.DxAttribute.PRequiredLevel,
                        MaxLength     = 100,
                        FormatName    = entity.DxAttribute.PFormatName,
                        DisplayName   = new Microsoft.Xrm.Sdk.Label(entity.DxAttribute.PDisplayName, 3082),
                        Description   = new Microsoft.Xrm.Sdk.Label(entity.PDescription, 3082)
                    }
                };
                OrganizationResponse organizationResponse = services.ExecuteCrmOrganizationRequest(createrequest);
                new Util().CreateLog(string.Format("Entity created at {0} {1} with id {2}",
                                                   DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(),
                                                   ((CreateEntityResponse)organizationResponse).EntityId));
            }
            catch (System.Exception exception)
            {
                var error = exception.Message;
                throw;
            }
        }
Esempio n. 9
0
        public static string GetWebRioPrivateKey(CrmServiceClient client)
        {
            if (client == null)
            {
                return(null);
            }

            var query = @"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>
                              <entity name='tc_secureconfiguration'>
                                <attribute name='tc_secureconfigurationid' />
                                <attribute name='tc_name' />
                                <attribute name='tc_value' />
                                <order attribute='tc_name' descending='false' />
                                <filter type='and'>
                                  <condition attribute='tc_name' operator='eq' value='Tc.Wr.JwtPrivateKey' />
                                  <condition attribute = 'statecode' operator= 'eq' value = '0' />
                                </filter>
                              </entity>
                            </fetch>";

            var response = (RetrieveMultipleResponse)client.ExecuteCrmOrganizationRequest(new RetrieveMultipleRequest {
                Query = new FetchExpression(query)
            }, "Fetching secure configuration records for Web Rio");

            if (response == null)
            {
                return(null);
            }
            var configRecords = response.EntityCollection;

            if (configRecords == null || configRecords.Entities == null || configRecords.Entities.Count == 0)
            {
                return(null);
            }
            return(configRecords.Entities[0][SecureConfiguration.Value].ToString());
        }
Esempio n. 10
0
        public static void GetWebRioSsoConfiguration(CrmServiceClient client, tcm.WebRioSsoConfig configuration)
        {
            if (client == null)
            {
                return;
            }
            if (configuration == null)
            {
                return;
            }

            var query = @"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>
                            <entity name = 'tc_configuration' >
                                <attribute name = 'tc_configurationid' />
                                <attribute name = 'tc_name' />
                                <attribute name = 'tc_value' />
                                <attribute name = 'tc_longvalue' />
                                <attribute name = 'tc_group' />
                                <order attribute = 'tc_name' descending = 'false' />
                                <filter type = 'and' >
                                    <condition attribute = 'tc_group' operator= 'eq' value = 'WebRio' />
                                    <condition attribute = 'statecode' operator= 'eq' value = '0' />
                                </filter >
                            </entity >
                        </fetch > ";

            var response = (RetrieveMultipleResponse)client.ExecuteCrmOrganizationRequest(new RetrieveMultipleRequest {
                Query = new FetchExpression(query)
            }, "Fetching cnfiguration records for Web Rio");

            if (response == null)
            {
                return;
            }
            var configRecords = response.EntityCollection;

            if (configRecords == null || configRecords.Entities == null || configRecords.Entities.Count == 0)
            {
                return;
            }

            foreach (var item in configRecords.Entities)
            {
                if (!item.Contains(Configuration.Name))
                {
                    continue;
                }
                if (!item.Contains(Configuration.Value))
                {
                    continue;
                }

                var key   = item[Configuration.Name] != null ? item[Configuration.Name].ToString() : null;
                var value = item[Configuration.Value] != null ? item[Configuration.Value].ToString() : null;

                if (string.IsNullOrWhiteSpace(key) || string.IsNullOrWhiteSpace(value))
                {
                    return;
                }

                if (key.Equals(Er.Configuration.WebRioAdminApi, StringComparison.OrdinalIgnoreCase))
                {
                    configuration.AdminApi = value;
                }
                else if (key.Equals(Er.Configuration.WebRioOpenConsultationApi, StringComparison.OrdinalIgnoreCase))
                {
                    configuration.OpenConsultationApi = value;
                }
                else if (key.Equals(Er.Configuration.WebRioNewConsultationApi, StringComparison.OrdinalIgnoreCase))
                {
                    configuration.NewConsultationApi = value;
                }
                else if (key.Equals(Er.Configuration.WebRioServiceUrl, StringComparison.OrdinalIgnoreCase))
                {
                    configuration.ServiceUrl = value;
                }
                else if (key.Equals(Er.Configuration.WebRioExpirySecondsFromNow, StringComparison.OrdinalIgnoreCase))
                {
                    configuration.ExpirySeconds = value;
                }
                else if (key.Equals(Er.Configuration.WebRioNotBeforeTimeSecondsFromNow, StringComparison.OrdinalIgnoreCase))
                {
                    configuration.NotBeforeTime = value;
                }
                else
                {
                    continue;
                }
            }
        }
Esempio n. 11
0
        public static tcm.Customer GetCustomerDataForWebRioNewConsultation(CrmServiceClient client, string customerId)
        {
            var query = @"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>
                              <entity name='contact'>
                                <attribute name='telephone1' />
                                <attribute name='lastname' />
                                <attribute name='firstname' />
                                <attribute name='tc_emailaddress1type' />
                                <attribute name='emailaddress1' />
                                <attribute name='tc_telephone1type' />
                                <attribute name='tc_address1_town' />
                                <attribute name='tc_address1_street' />
                                <attribute name='tc_address1_postalcode' />
                                <attribute name='tc_address1_housenumberorbuilding' />
                                <attribute name='tc_address1_flatorunitnumber' />
                                <attribute name='tc_address1_county' />
                                <attribute name='tc_address1_countryid' />
                                <attribute name='tc_address1_additionalinformation' />
                                <attribute name='contactid' />
                                <attribute name='telephone3' />
                                <attribute name='telephone2' />
                                <attribute name='tc_telephone3type' />
                                <attribute name='tc_telephone2type' />
                                <attribute name='tc_sourcesystemid' />
                                <attribute name='tc_salutation' />
                                <attribute name='middlename' />
                                <attribute name='birthdate' />
                                <attribute name='tc_emailaddress3type' />
                                <attribute name='emailaddress3' />
                                <attribute name='tc_emailaddress2type' />
                                <attribute name='emailaddress2' />
                                <filter type='and'>
                                  <condition attribute='contactid' operator='eq' value='{0}' />
                                </filter>
                                <link-entity name='tc_country' from='tc_countryid' to='tc_address1_countryid' visible='false' link-type='outer' alias='a1'>
                                  <attribute name='tc_iso_code' />
                                </link-entity>
                                <link-entity name='tc_country' from='tc_countryid' to='tc_address2_countryid' visible='false' link-type='outer' alias='a2'>
                                  <attribute name='tc_iso_code' />
                                </link-entity>
                              </entity>
                            </fetch>";

            query = string.Format(query, customerId);
            var response = (RetrieveMultipleResponse)client.ExecuteCrmOrganizationRequest(new RetrieveMultipleRequest {
                Query = new FetchExpression(query)
            }, "Fetching customer record for Web Rio");

            if (response == null)
            {
                return(null);
            }
            var customerRecords = response.EntityCollection;

            if (customerRecords == null || customerRecords.Entities == null || customerRecords.Entities.Count == 0)
            {
                return(null);
            }
            var customerRecord = customerRecords.Entities[0];

            var customer = new tcm.Customer();

            customer.CustomerIdentifier = new tcm.CustomerIdentifier
            {
                CustomerId = GetStringValue(customerRecord, "tc_sourcesystemid")
            };
            customer.CustomerIdentity = new Models.CustomerIdentity
            {
                Birthdate  = GetStringValue(customerRecord, "birthdate"),
                FirstName  = GetStringValue(customerRecord, "firstname"),
                LastName   = GetStringValue(customerRecord, "lastname"),
                MiddleName = GetStringValue(customerRecord, "middlename"),
                Salutation = GetStringValue(customerRecord, "tc_salutation"),
            };
            customer.Address = new tcm.Address[]
            {
                new tcm.Address {
                    AdditionalAddressInfo = GetStringValue(customerRecord, "tc_address1_additionalinformation"),
                    County              = GetStringValue(customerRecord, "tc_address1_county"),
                    FlatNumberUnit      = GetStringValue(customerRecord, "tc_address1_flatorunitnumber"),
                    HouseNumberBuilding = GetStringValue(customerRecord, "tc_address1_housenumberorbuilding"),
                    PostalCode          = GetStringValue(customerRecord, "tc_address1_postalcode"),
                    Street              = GetStringValue(customerRecord, "tc_address1_street"),
                    Town    = GetStringValue(customerRecord, "tc_address1_town"),
                    Country = GetStringValue(customerRecord, "tc_iso_code", "a1")
                },
                new tcm.Address {
                    AdditionalAddressInfo = GetStringValue(customerRecord, "tc_address2_additionalinformation"),
                    County              = GetStringValue(customerRecord, "tc_address2_county"),
                    FlatNumberUnit      = GetStringValue(customerRecord, "tc_address2_flatorunitnumber"),
                    HouseNumberBuilding = GetStringValue(customerRecord, "tc_address2_housenumberorbuilding"),
                    PostalCode          = GetStringValue(customerRecord, "tc_address2_postalcode"),
                    Street              = GetStringValue(customerRecord, "tc_address2_street"),
                    Town    = GetStringValue(customerRecord, "tc_address2_town"),
                    Country = GetStringValue(customerRecord, "tc_iso_code", "a2")
                }
            };

            customer.Email = new tcm.Email[]
            {
                new tcm.Email {
                    Address     = GetStringValue(customerRecord, "emailaddress1")
                    , EmailType = GetStringValue(customerRecord, "tc_emailaddress1type")
                },
                new tcm.Email {
                    Address     = GetStringValue(customerRecord, "emailaddress2")
                    , EmailType = GetStringValue(customerRecord, "tc_emailaddress2type")
                },
                new tcm.Email {
                    Address     = GetStringValue(customerRecord, "emailaddress3")
                    , EmailType = GetStringValue(customerRecord, "tc_emailaddress3type")
                }
            };

            customer.Phone = new tcm.Phone[]
            {
                new tcm.Phone {
                    Number      = GetStringValue(customerRecord, "telephone1")
                    , PhoneType = GetStringValue(customerRecord, "tc_telephone1type")
                },
                new tcm.Phone {
                    Number      = GetStringValue(customerRecord, "telephone2")
                    , PhoneType = GetStringValue(customerRecord, "tc_telephone2type")
                },
                new tcm.Phone {
                    Number      = GetStringValue(customerRecord, "telephone3")
                    , PhoneType = GetStringValue(customerRecord, "tc_telephone3type")
                }
            };

            return(customer);
        }
Esempio n. 12
0
        public static tcm.SsoLogin GetSsoLoginDetails(CrmServiceClient client, Guid userId)
        {
            if (userId == Guid.Empty)
            {
                return(null);
            }
            if (client == null)
            {
                return(null);
            }

            var query = @"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>
                              <entity name='tc_externallogin'>
                                <attribute name='tc_externalloginid' />
                                <attribute name='tc_initials' />
                                <attribute name='tc_employeeid' />
                                <attribute name='tc_branchcode' />
                                <attribute name='tc_abtanumber' />
                                <filter type='and'>
                                  <condition attribute='ownerid' operator='eq' value='{0}' />
                                    <condition attribute = 'statecode' operator= 'eq' value = '0' />
                                </filter>
                              </entity>
                            </fetch>";

            query = string.Format(query, userId.ToString());
            var response = (RetrieveMultipleResponse)client.ExecuteCrmOrganizationRequest(new RetrieveMultipleRequest {
                Query = new FetchExpression(query)
            }, "Fetching secure configuration records for Web Rio");

            if (response == null)
            {
                return(null);
            }
            var loginRecords = response.EntityCollection;

            if (loginRecords == null || loginRecords.Entities == null || loginRecords.Entities.Count == 0)
            {
                return(null);
            }

            var loginRecord = loginRecords[0];
            var login       = new tcm.SsoLogin();

            if (loginRecord.Contains(ExternalLogin.AbtaNumber) && loginRecord[ExternalLogin.AbtaNumber] != null)
            {
                login.AbtaNumber = loginRecord[ExternalLogin.AbtaNumber].ToString();
            }
            if (loginRecord.Contains(ExternalLogin.BranchCode) && loginRecord[ExternalLogin.BranchCode] != null)
            {
                login.BranchCode = loginRecord[ExternalLogin.BranchCode].ToString();
            }
            if (loginRecord.Contains(ExternalLogin.EmployeeId) && loginRecord[ExternalLogin.EmployeeId] != null)
            {
                login.EmployeeId = loginRecord[ExternalLogin.EmployeeId].ToString();
            }
            if (loginRecord.Contains(ExternalLogin.Initials) && loginRecord[ExternalLogin.Initials] != null)
            {
                login.Initials = loginRecord[ExternalLogin.Initials].ToString();
            }

            return(login);
        }