- Timestamp:
- 11/24/10 20:37:39 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/UserManagement/HeuristicLab.Services.Authentication/Convert.cs
r4740 r4926 8 8 9 9 #region User 10 11 /// <summary>12 /// converts data transfer object to data access objet13 /// </summary>14 /// <param name="source">data transfer object</param>15 /// <returns>data access object</returns>16 public static aspnet_User ToEntity(User source)17 {18 if (source == null) return null;19 return new aspnet_User()20 {21 ApplicationId = source.ApplicationId,22 UserId = source.Id,23 UserName = source.Name,24 //LoweredUserName = source.LoweredUserName,25 //IsAnonymous = source.IsAnonymous,26 LastActivityDate = source.LastActivityDate27 };28 }29 30 ///// <summary>31 ///// converts data transfer object to data access objet32 ///// </summary>33 ///// <param name="source">data transfer object</param>34 ///// <returns>data access object</returns>35 //public static aspnet_Membership ToEntity(User source) {36 // if (source == null) return null;37 // return new aspnet_Membership() {38 // ApplicationId = source.ApplicationId,39 // UserId = source.Id,40 // Password = source.Password,41 // PasswordFormat = 1,42 // PasswordSalt = source.PasswordSalt,43 // Email = source.Email,44 // IsApproved = source.IsApproved,45 // IsLockedOut = source.IsLookedOut,46 // CreateDate = source.CreateDate,47 // LastLoginDate = source.LastLoginDate,48 // LastPasswordChangedDate = source.LastPasswordChangeDate,49 // LastLockoutDate = source.LastLockoutDate,50 // FailedPasswordAttemptCount = 0,51 // FailedPasswordAttemptWindowStart = new System.DateTime(1900, 01, 01),52 // FailedPasswordAnswerAttemptCount = 0,53 // FailedPasswordAnswerAttemptWindowStart = new System.DateTime(1900, 01, 01),54 // Comment = source.Comment55 // };56 //}57 10 58 11 /// <summary> … … 94 47 if ((source != null) && (userTarget != null) && (membershipTarget != null)) 95 48 { 96 userTarget.ApplicationId = source.ApplicationId;97 membershipTarget.ApplicationId = source.ApplicationId;98 userTarget.UserId = source.Id;99 membershipTarget.UserId = source.Id;100 userTarget.UserName = source.Name;101 userTarget.LoweredUserName = source.Name;102 userTarget.IsAnonymous = false;103 userTarget.LastActivityDate = source.LastActivityDate;104 membershipTarget.Password = source.Password;105 membershipTarget.PasswordFormat = 1;106 membershipTarget.PasswordSalt = source.PasswordSalt;107 membershipTarget.Email = source.Email;108 membershipTarget.IsApproved = source.IsApproved;109 membershipTarget.IsLockedOut = source.IsLookedOut;110 membershipTarget.CreateDate = source.CreateDate;111 membershipTarget.LastLoginDate = source.LastLoginDate;112 membershipTarget.LastPasswordChangedDate = source.LastPasswordChangeDate;113 membershipTarget.LastLockoutDate = source.LastLockoutDate;114 membershipTarget.FailedPasswordAttemptCount = 0;115 membershipTarget.FailedPasswordAttemptWindowStart = new System.DateTime(1900, 01, 01);116 membershipTarget.FailedPasswordAnswerAttemptCount = 0;117 membershipTarget.FailedPasswordAnswerAttemptWindowStart = new System.DateTime(1900, 01, 01);118 membershipTarget.Comment = source.Comment;49 userTarget.ApplicationId = source.ApplicationId; 50 membershipTarget.ApplicationId = source.ApplicationId; 51 userTarget.UserId = source.Id; 52 membershipTarget.UserId = source.Id; 53 userTarget.UserName = source.Name; 54 userTarget.LoweredUserName = source.Name; 55 userTarget.IsAnonymous = false; 56 userTarget.LastActivityDate = source.LastActivityDate; 57 membershipTarget.Password = source.Password; 58 membershipTarget.PasswordFormat = 1; 59 membershipTarget.PasswordSalt = source.PasswordSalt; 60 membershipTarget.Email = source.Email; 61 membershipTarget.IsApproved = source.IsApproved; 62 membershipTarget.IsLockedOut = source.IsLookedOut; 63 membershipTarget.CreateDate = source.CreateDate; 64 membershipTarget.LastLoginDate = source.LastLoginDate; 65 membershipTarget.LastPasswordChangedDate = source.LastPasswordChangeDate; 66 membershipTarget.LastLockoutDate = source.LastLockoutDate; 67 membershipTarget.FailedPasswordAttemptCount = 0; 68 membershipTarget.FailedPasswordAttemptWindowStart = new System.DateTime(1900, 01, 01); 69 membershipTarget.FailedPasswordAnswerAttemptCount = 0; 70 membershipTarget.FailedPasswordAnswerAttemptWindowStart = new System.DateTime(1900, 01, 01); 71 membershipTarget.Comment = source.Comment; 119 72 120 73 } … … 127 80 #region Application 128 81 129 /// //<summary>130 /// // converts data transfer object to data access objet131 /// //</summary>132 /// // <param name="source">data transferobject</param>133 /// // <returns>data accessobject</returns>134 //public static aspnet_Application ToEntity(Application source)135 //{136 //if (source == null) return null;137 // return new aspnet_Application()138 //{139 // ApplicationId = source.ApplicationId,140 // ApplicationName = source.ApplicationName,141 //LoweredApplicationName = source.LoweredApplicationName,142 //Description = source.Description143 //};144 //}82 /// <summary> 83 /// converts data access object to data transfer object 84 /// </summary> 85 /// <param name="source">data access object</param> 86 /// <returns>data transfer object</returns> 87 public static Application ToDataTransfer(aspnet_Application source) 88 { 89 if (source == null) return null; 90 return new Application() 91 { 92 Id = source.ApplicationId, 93 Name = source.ApplicationName, 94 LoweredApplicationName = source.LoweredApplicationName, 95 Description = source.Description 96 }; 97 } 145 98 146 ///// <summary> 147 ///// converts data access object to data transfer object 148 ///// </summary> 149 ///// <param name="source">data access object</param> 150 ///// <returns>data transfer object</returns> 151 //public static Application ToDataTransfer(aspnet_Application source) 152 //{ 153 // if (source == null) return null; 154 // return new Application() 155 // { 156 // ApplicationId = source.ApplicationId, 157 // ApplicationName = source.ApplicationName, 158 // LoweredApplicationName = source.LoweredApplicationName, 159 // Description = source.Description 160 // }; 161 //} 99 /// <summary> 100 /// converts data transfer object to data access object 101 /// </summary> 102 /// <param name="source">data transfer object</param> 103 /// <param name="target">data access object</param> 104 public static void ToEntity(Application source, aspnet_Application target) 105 { 106 if ((source != null) && (target != null)) 107 { 108 target.ApplicationId = source.Id; 109 target.ApplicationName = source.Name; 110 target.LoweredApplicationName = source.LoweredApplicationName; 111 target.Description = source.Description; 112 } 162 113 163 ///// <summary> 164 ///// converts data transfer object to data access object 165 ///// </summary> 166 ///// <param name="source">data transfer object</param> 167 ///// <param name="target">data access object</param> 168 //public static void ToEntity(Application source, aspnet_Application target) 169 //{ 170 // if ((source != null) && (target != null)) 171 // { 172 // target.ApplicationId = source.ApplicationId; 173 // target.ApplicationName = source.ApplicationName; 174 // target.LoweredApplicationName = source.LoweredApplicationName; 175 // target.Description = source.Description; 176 // } 177 178 //} 179 180 #endregion 181 182 #region Membership 183 184 ///// <summary> 185 ///// converts data transfer object to data access objet 186 ///// </summary> 187 ///// <param name="source">data transfer object</param> 188 ///// <returns>data access object</returns> 189 //public static aspnet_Membership ToEntity(Membership source) 190 //{ 191 // if (source == null) return null; 192 // return new aspnet_Membership() 193 // { 194 // ApplicationId = source.ApplicationId, 195 // UserId = source.UserId, 196 // Password = source.Password, 197 // PasswordAnswer = source.PasswordAnswer, 198 // PasswordSalt = source.PasswordSalt, 199 // PasswordQuestion = source.PasswordQuestion, 200 201 // Email = source.Email, 202 // LoweredEmail = source.LoweredEmail, 203 // IsApproved = source.IsApproved, 204 // IsLockedOut = source.IsLockedOut, 205 // CreateDate = source.CreateDate, 206 // LastLoginDate = source.LastLoginDate, 207 // LastPasswordChangedDate = source.LastPasswordChangedDate, 208 // LastLockoutDate = source.LastLockoutDate, 209 // Comment = source.Comment 210 211 212 // }; 213 //} 214 215 ///// <summary> 216 ///// converts data access object to data transfer object 217 ///// </summary> 218 ///// <param name="source">data access object</param> 219 ///// <returns>data transfer object</returns> 220 //public static Membership ToDataTransfer(aspnet_Membership source) 221 //{ 222 // if (source == null) return null; 223 // return new Membership() 224 // { 225 // ApplicationId = source.ApplicationId, 226 // UserId = source.UserId, 227 // Password = source.Password, 228 // PasswordAnswer = source.PasswordAnswer, 229 // PasswordSalt = source.PasswordSalt, 230 // PasswordQuestion = source.PasswordQuestion, 231 232 // Email = source.Email, 233 // LoweredEmail = source.LoweredEmail, 234 // IsApproved = source.IsApproved, 235 // IsLockedOut = source.IsLockedOut, 236 // CreateDate = source.CreateDate, 237 // LastLoginDate = source.LastLoginDate, 238 // LastPasswordChangedDate = source.LastPasswordChangedDate, 239 // LastLockoutDate = source.LastLockoutDate, 240 // Comment = source.Comment 241 // }; 242 //} 243 244 ///// <summary> 245 ///// converts data transfer object to data access object 246 ///// </summary> 247 ///// <param name="source">data transfer object</param> 248 ///// <param name="target">data access object</param> 249 //public static void ToEntity(Membership source, aspnet_Membership target) 250 //{ 251 // if ((source != null) && (target != null)) 252 // { 253 // target.ApplicationId = source.ApplicationId; 254 // target.UserId = source.UserId; 255 // target.Password = source.Password; 256 // target.PasswordAnswer = source.PasswordAnswer; 257 // target.PasswordSalt = source.PasswordSalt; 258 // target.PasswordQuestion = source.PasswordQuestion; 259 260 // target.Email = source.Email; 261 // target.LoweredEmail = source.LoweredEmail; 262 // target.IsApproved = source.IsApproved; 263 // target.IsLockedOut = source.IsLockedOut; 264 // target.CreateDate = source.CreateDate; 265 // target.LastLoginDate = source.LastLoginDate; 266 // target.LastPasswordChangedDate = source.LastPasswordChangedDate; 267 // target.LastLockoutDate = source.LastLockoutDate; 268 // target.Comment = source.Comment; 269 // } 270 271 //} 114 } 272 115 273 116 #endregion … … 275 118 #region Role 276 119 277 /// //<summary>278 /// // converts data transfer object to data access objet279 /// //</summary>280 /// // <param name="source">data transferobject</param>281 /// // <returns>data accessobject</returns>282 //public static aspnet_Role ToEntity(Role source)283 //{284 //if (source == null) return null;285 // return new aspnet_Role()286 //{287 //ApplicationId = source.ApplicationId,288 // RoleId = source.RoleId,289 // RoleName = source.RoleName,290 // LoweredRoleName = source.LoweredRoleName,291 // Description = source.Description292 //};293 //}120 /// <summary> 121 /// converts data access object to data transfer object 122 /// </summary> 123 /// <param name="source">data access object</param> 124 /// <returns>data transfer object</returns> 125 public static Role ToDataTransfer(aspnet_Role source) 126 { 127 if (source == null) return null; 128 return new Role() 129 { 130 ApplicationId = source.ApplicationId, 131 Id = source.RoleId, 132 Name = source.RoleName, 133 Description = source.Description, 134 LoweredRoleName = source.LoweredRoleName, 135 }; 136 } 294 137 295 ///// <summary> 296 ///// converts data access object to data transfer object 297 ///// </summary> 298 ///// <param name="source">data access object</param> 299 ///// <returns>data transfer object</returns> 300 //public static Role ToDataTransfer(aspnet_Role source) 301 //{ 302 // if (source == null) return null; 303 // return new Role() 304 // { 305 // ApplicationId = source.ApplicationId, 306 // RoleId = source.RoleId, 307 // RoleName = source.RoleName, 308 // LoweredRoleName = source.LoweredRoleName, 309 // Description = source.Description 310 // }; 311 //} 138 /// <summary> 139 /// converts data transfer object to data access object 140 /// </summary> 141 /// <param name="source">data transfer object</param> 142 /// <param name="target">data access object</param> 143 public static void ToEntity(Role source, aspnet_Role target) 144 { 145 if ((source != null) && (target != null)) 146 { 147 target.ApplicationId = source.ApplicationId; 148 target.RoleId = source.Id; 149 target.RoleName = source.Name; 150 target.LoweredRoleName = source.LoweredRoleName; 151 target.Description = source.Description; 152 } 312 153 313 ///// <summary> 314 ///// converts data transfer object to data access object 315 ///// </summary> 316 ///// <param name="source">data transfer object</param> 317 ///// <param name="target">data access object</param> 318 //public static void ToEntity(Role source, aspnet_Role target) 319 //{ 320 // if ((source != null) && (target != null)) 321 // { 322 // target.ApplicationId = source.ApplicationId; 323 // target.RoleId = source.RoleId; 324 // target.RoleName = source.RoleName; 325 // target.LoweredRoleName = source.LoweredRoleName; 326 // target.Description = source.Description; 327 // } 328 329 //} 154 } 330 155 331 156 #endregion
Note: See TracChangeset
for help on using the changeset viewer.