Esempio n. 1
0
 public static async Task <LG.Data.Models.Identity.UserEntity> Login(String username, String password)
 {
     return(await AuthenticationOperations.IdentityLogin(username, password));
 }
Esempio n. 2
0
        Login(String username, String password)
        {
            var result        = new LG.Data.Models.Identity.UserEntity();
            var serviceResult = await AuthenticationOperations.GetLogin(username, password);

            if (!serviceResult.ReturnStatus.IsError)
            {
                if (serviceResult.LoginInfo.RID.HasValue &&
                    serviceResult.LoginInfo.IsActive.HasValue &&
                    serviceResult.LoginInfo.IsActive.Value)
                {
                    var dataEntity = await LoadUserData(serviceResult.LoginInfo.RID.Value);

                    result = new LG.Data.Models.Identity.UserEntity
                    {
                        RolodexItemId   = serviceResult.LoginInfo.RID.Value,
                        RolodexItemType = AuthenticationDataTransformation.GetRolodexItemType(
                            dataEntity.GeneralInfo.BEntity.RTypeEnum.GetHashCode()),
                        IsActive  = dataEntity.GeneralInfo.BEntity.IsActive,
                        IsTesting = dataEntity.GeneralInfo.BEntity.IsTesting,
                        Person    = new LG.Data.Models.Shared.PersonInfo()
                        {
                            FName = dataEntity.GeneralInfo.PersonInfo.FName,
                            MName = dataEntity.GeneralInfo.PersonInfo.MName,
                            LName = dataEntity.GeneralInfo.PersonInfo.LName,
                            Dob   =
                                dataEntity.GeneralInfo.PersonInfo.Dob.HasValue
                                    ? dataEntity.GeneralInfo.PersonInfo.Dob.Value
                                    : new DateTime(1900, 1, 1),
                            Gender = dataEntity.GeneralInfo.PersonInfo.Gender.HasValue ? dataEntity.GeneralInfo.PersonInfo.Gender.Value : 1
                        }
                    };
                    if (dataEntity.GeneralInfo.BEntity.EmailAddresses.Any())
                    {
                        result.ListEmails = new List <LG.Data.Models.Shared.EmailAddress>();
                        foreach (var email
                                 in dataEntity.GeneralInfo.BEntity.EmailAddresses)
                        {
                            result.ListEmails.Add(
                                AuthenticationDataTransformation.GetEmailAddress(email));
                        }
                    }
                    if (dataEntity.GeneralInfo.BEntity.Phones.Any())
                    {
                        result.ListPhones = new List <LG.Data.Models.Shared.PhoneBase>();
                        foreach (var phone
                                 in dataEntity.GeneralInfo.BEntity.Phones)
                        {
                            result.ListPhones.Add(
                                AuthenticationDataTransformation.GetPhone(phone));
                        }
                    }
                    if (dataEntity.GeneralInfo.BEntity.Addresses.Any())
                    {
                        result.ListAddresses = new List <LG.Data.Models.Shared.Address>();
                        foreach (var address
                                 in dataEntity.GeneralInfo.BEntity.Addresses)
                        {
                            result.ListAddresses.Add(
                                AuthenticationDataTransformation.GetAddress(address));
                        }
                    }
                }
            }
            return(result);
        }