Free cookie consent management tool by TermsFeed Policy Generator

source: branches/ClientUserManagement/HeuristicLab.Services.UserManagement/3.3/Convert.cs @ 6810

Last change on this file since 6810 was 6810, checked in by ascheibe, 13 years ago

#1648

  • added a db layer for user management
  • added a user management clients project
  • worked on user management service
File size: 3.0 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using AN = System.Web.Security;
23using DA = HeuristicLab.Services.UserManagement.DataAccess;
24using DT = HeuristicLab.Services.UserManagement.DataTransfer;
25
26namespace HeuristicLab.Services.UserManagement {
27  public static class Convert {
28
29    #region Application
30    public static DT.Application ToDto(DA.aspnet_Application source) {
31      return new DT.Application() {
32        Id = source.ApplicationId,
33        Description = source.Description,
34        Name = source.ApplicationName
35      };
36    }
37
38    public static DA.aspnet_Application ToEntity(DT.Application source) {
39      return new DA.aspnet_Application() {
40        ApplicationId = source.Id,
41        ApplicationName = source.Name,
42        Description = source.Description
43      };
44    }
45    #endregion
46
47    #region User
48    public static DT.User ToDto(AN.MembershipUser source) {
49      return new DT.User() {
50        Comment = source.Comment,
51        LastActivityDate = source.LastActivityDate,
52        CreationDate = source.CreationDate,
53        Email = source.Email,
54        IsApproved = source.IsApproved,
55        IsLockedOut = source.IsLockedOut,
56        IsOnline = source.IsOnline,
57        LastLockoutDate = source.LastLockoutDate,
58        LastLoginDate = source.LastLockoutDate,
59        LastPasswordChangedDate = source.LastPasswordChangedDate,
60        PasswordQuestion = source.PasswordQuestion,
61        ProviderName = source.ProviderName,
62        ProviderUserKey = source.ProviderUserKey,
63        UserName = source.UserName
64      };
65    }
66
67    public static AN.MembershipUser ToEntity(DT.User source) {
68      return new AN.MembershipUser(source.ProviderName, source.UserName, source.ProviderUserKey, source.Email, source.PasswordQuestion, source.Comment, source.IsApproved, source.IsLockedOut, source.CreationDate, source.LastLoginDate, source.LastActivityDate, source.LastPasswordChangedDate, source.LastLockoutDate);
69    }
70    #endregion
71
72    #region Role
73    public static DT.Role ToDto(string source) {
74      return new DT.Role() {
75        RoleName = source
76      };
77    }
78
79    public static string ToEntity(DT.Role source) {
80      return source.RoleName;
81    }
82    #endregion
83  }
84}
Note: See TracBrowser for help on using the repository browser.