/// <summary> /// Converts Data User Account to Core User Account. /// </summary> /// <param name="dataUserAccount">Data User Account to be converted.</param> /// <returns>Converted Core User Account.</returns> public static DCO.Objects.UserAccount ConvertToCoreUserAccount(DDO.Objects.UserAccount dataUserAccount) { if (dataUserAccount == null) { return(null); } DCO.Objects.UserAccount coreUserAccount = new DCO.Objects.UserAccount(); coreUserAccount.UserID = dataUserAccount.UserID; coreUserAccount.Username = dataUserAccount.Username; coreUserAccount.Password = dataUserAccount.Password; coreUserAccount.UserType = convertToCoreUserType(dataUserAccount.UserType); coreUserAccount.UserInfo = new Contract.User.UserInfo(); if (dataUserAccount.UserInfo != null) { coreUserAccount.UserInfo.FirstName = dataUserAccount.UserInfo.FirstName; coreUserAccount.UserInfo.LastName = dataUserAccount.UserInfo.LastName; coreUserAccount.UserInfo.Age = dataUserAccount.UserInfo.Age; coreUserAccount.UserInfo.BirthDate = dataUserAccount.UserInfo.BirthDate; } return(coreUserAccount); }
/// <summary> /// Converts a Core User Account to a Data User Account. /// </summary> /// <param name="coreUserAccount">Core User Account to be converted.</param> /// <returns>Converted Data User Account.</returns> public static DDO.Objects.UserAccount ConvertToDataUserAccount(DCO.Objects.UserAccount coreUserAccount) { if (coreUserAccount == null) { return(null); } DDO.Objects.UserAccount dataUserAccount = new DDO.Objects.UserAccount(); dataUserAccount.UserID = coreUserAccount.UserID; dataUserAccount.Username = coreUserAccount.Username; dataUserAccount.Password = coreUserAccount.Password; dataUserAccount.UserType = convertToDataUserType(coreUserAccount.UserType); dataUserAccount.UserInfo = new DDO.Objects.UserInfo(); if (coreUserAccount.UserInfo != null) { dataUserAccount.UserInfo.FirstName = coreUserAccount.UserInfo.FirstName; dataUserAccount.UserInfo.LastName = coreUserAccount.UserInfo.LastName; dataUserAccount.UserInfo.Age = coreUserAccount.UserInfo.Age; dataUserAccount.UserInfo.BirthDate = coreUserAccount.UserInfo.BirthDate; } return(dataUserAccount); }