Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/23/11 20:13:55 (13 years ago)
Author:
ascheibe
Message:

#1648 updated the database scheme and dto's

Location:
branches/ClientUserManagement
Files:
7 added
11 edited

Legend:

Unmodified
Added
Removed
  • branches/ClientUserManagement

    • Property svn:ignore
      •  

        old new  
        11*.suo
         2*.testsettings
         3HeuristicLab.Services.Access.vsmdi
  • branches/ClientUserManagement/HeuristicLab.Services.Access/3.3

    • Property svn:ignore
      •  

        old new  
        22bin
        33obj
         4HeuristicLab.Services.Access-3.3.csproj.user
  • branches/ClientUserManagement/HeuristicLab.Services.Access/3.3/AccessService.cs

    r6815 r6825  
    2424namespace HeuristicLab.Services.Access {
    2525  [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
    26   public class AccessService : IAccessService {
    27     #region IAccessService Members
     26  public class AccessService {
    2827
    29     public bool ClientExists(System.Guid id) {
    30       throw new System.NotImplementedException();
    31     }
    32 
    33     public DataTransfer.Client GetClient(System.Guid id) {
    34       throw new System.NotImplementedException();
    35     }
    36 
    37     public System.Collections.Generic.IEnumerable<DataTransfer.Client> GetClients() {
    38       throw new System.NotImplementedException();
    39     }
    40 
    41     public System.Guid AddClient(DataTransfer.Client client) {
    42       throw new System.NotImplementedException();
    43     }
    44 
    45     public void UpdateClient(DataTransfer.Client client) {
    46       throw new System.NotImplementedException();
    47     }
    48 
    49     public void DeleteClient(DataTransfer.Client client) {
    50       throw new System.NotImplementedException();
    51     }
    52 
    53     public DataTransfer.ClientLog GetLastClientLog(System.Guid clientId) {
    54       throw new System.NotImplementedException();
    55     }
    56 
    57     public System.Collections.Generic.IEnumerable<DataTransfer.ClientLog> GetClientLogs(System.Guid clientId) {
    58       throw new System.NotImplementedException();
    59     }
    60 
    61     public System.Collections.Generic.IEnumerable<DataTransfer.ClientLog> GetClientLogsSince(System.DateTime startDate) {
    62       throw new System.NotImplementedException();
    63     }
    64 
    65     public void AddClientLogEntry(DataTransfer.ClientLog log) {
    66       throw new System.NotImplementedException();
    67     }
    68 
    69     public void DeleteClientLogEntry(DataTransfer.ClientLog log) {
    70       throw new System.NotImplementedException();
    71     }
    72 
    73     public System.Collections.Generic.IEnumerable<DataTransfer.ClientGroup> GetClientGroups() {
    74       throw new System.NotImplementedException();
    75     }
    76 
    77     public System.Guid AddClientGroup(DataTransfer.ClientGroup group) {
    78       throw new System.NotImplementedException();
    79     }
    80 
    81     public void UpdateClientGroup(DataTransfer.ClientGroup group) {
    82       throw new System.NotImplementedException();
    83     }
    84 
    85     public void DeleteClientGroup(DataTransfer.ClientGroup group) {
    86       throw new System.NotImplementedException();
    87     }
    88 
    89     public void Login() {
    90       throw new System.NotImplementedException();
    91     }
    92 
    93     public System.Collections.Generic.IEnumerable<DataTransfer.User> GetUsers() {
    94       throw new System.NotImplementedException();
    95     }
    96 
    97     public DataTransfer.User AddUser(DataTransfer.User user) {
    98       throw new System.NotImplementedException();
    99     }
    100 
    101     public void DeleteUser(DataTransfer.User user) {
    102       throw new System.NotImplementedException();
    103     }
    104 
    105     public void UpdateUser(DataTransfer.User user) {
    106       throw new System.NotImplementedException();
    107     }
    108 
    109     public void AddUserToRole(DataTransfer.Role role, DataTransfer.User user) {
    110       throw new System.NotImplementedException();
    111     }
    112 
    113     public void RemoveUserFromRole(DataTransfer.Role role, DataTransfer.User user) {
    114       throw new System.NotImplementedException();
    115     }
    116 
    117     public void ResetPassword(DataTransfer.User user, string password) {
    118       throw new System.NotImplementedException();
    119     }
    120 
    121     public System.Collections.Generic.IEnumerable<DataTransfer.Role> GetRoles() {
    122       throw new System.NotImplementedException();
    123     }
    124 
    125     public DataTransfer.Role AddRole(DataTransfer.Role role) {
    126       throw new System.NotImplementedException();
    127     }
    128 
    129     public void UpdateRole(DataTransfer.Role role) {
    130       throw new System.NotImplementedException();
    131     }
    132 
    133     public void DeleteRole(DataTransfer.Role role) {
    134       throw new System.NotImplementedException();
    135     }
    136 
    137     public System.Collections.Generic.IEnumerable<DataTransfer.Role> GetUserRoles(DataTransfer.User user) {
    138       throw new System.NotImplementedException();
    139     }
    140 
    141     public System.Collections.Generic.IEnumerable<DataTransfer.UserGroup> GetUserGroups() {
    142       throw new System.NotImplementedException();
    143     }
    144 
    145     public DataTransfer.UserGroup AddUserGroup(DataTransfer.UserGroup group) {
    146       throw new System.NotImplementedException();
    147     }
    148 
    149     public void UpdateUserGroup(DataTransfer.UserGroup group) {
    150       throw new System.NotImplementedException();
    151     }
    152 
    153     public void DeleteUserGroup(DataTransfer.UserGroup group) {
    154       throw new System.NotImplementedException();
    155     }
    156 
    157     #endregion
    15828  }
    15929}
  • branches/ClientUserManagement/HeuristicLab.Services.Access/3.3/Convert.cs

    r6820 r6825  
    2020#endregion
    2121
     22using System;
     23using System.Linq;
    2224using DA = HeuristicLab.Services.Access.DataAccess;
    2325using DT = HeuristicLab.Services.Access.DataTransfer;
     26
    2427
    2528namespace HeuristicLab.Services.ClientManagement {
     
    3134        Id = source.Id,
    3235        Description = source.Description,
    33         Name = source.Name,
    34         Type = source.Type
     36        Name = source.Name
    3537      };
    3638    }
     
    4042        Id = source.Id,
    4143        Description = source.Description,
    42         Name = source.Name,
    43         Type = source.Type
    44       };
    45     }
    46     #endregion
    47 
    48     #region Group
    49     public static DT.ClientGroup ToDto(DA.Group source) {
     44        Name = source.Name
     45      };
     46    }
     47    #endregion
     48
     49    #region ClientGroup
     50    public static DT.ClientGroup ToDto(DA.ClientGroup source) {
    5051      return new DT.ClientGroup() {
    5152        Id = source.Id,
    5253        Description = source.Description,
    53         Name = source.Name,
    54         Type = source.Type
    55       };
    56     }
    57 
    58     public static DA.Group ToEntity(DT.ClientGroup source) {
    59       return new DA.Group() {
    60         Id = source.Id,
    61         Description = source.Description,
    62         Name = source.Name,
    63         Type = source.Type
     54        Name = source.Name
     55      };
     56    }
     57
     58    public static DA.ClientGroup ToEntity(DT.ClientGroup source) {
     59      return new DA.ClientGroup() {
     60        Id = source.Id,
     61        Description = source.Description,
     62        Name = source.Name,
     63
     64      };
     65    }
     66    #endregion
     67
     68    #region Country
     69    public static DT.Country ToDto(DA.Country source) {
     70      return new DT.Country() {
     71        Id = source.Id,
     72        Name = source.Name
     73      };
     74    }
     75
     76    public static DA.Country ToEntity(DT.Country source) {
     77      return new DA.Country() {
     78        Id = source.Id,
     79        Name = source.Name,
     80
     81      };
     82    }
     83    #endregion
     84
     85    #region OperatingSystem
     86    public static DT.OperatingSystem ToDto(DA.OperatingSystem source) {
     87      return new DT.OperatingSystem() {
     88        Id = source.Id,
     89        Name = source.Name
     90      };
     91    }
     92
     93    public static DA.OperatingSystem ToEntity(DT.OperatingSystem source) {
     94      return new DA.OperatingSystem() {
     95        Id = source.Id,
     96        Name = source.Name,
     97
     98      };
     99    }
     100    #endregion
     101
     102    #region ClientType
     103    public static DT.ClientType ToDto(DA.ClientType source) {
     104      return new DT.ClientType() {
     105        Id = source.Id,
     106        Name = source.Name
     107      };
     108    }
     109
     110    public static DA.ClientType ToEntity(DT.ClientType source) {
     111      return new DA.ClientType() {
     112        Id = source.Id,
     113        Name = source.Name,
     114
     115      };
     116    }
     117    #endregion
     118
     119    #region ClientConfiguration
     120    public static DT.ClientConfiguration ToDto(DA.ClientConfiguration source) {
     121      return new DT.ClientConfiguration() {
     122        Id = source.Id,
     123        Hash = source.Hash,
     124        Description = source.Description
     125      };
     126    }
     127
     128    public static DA.ClientConfiguration ToEntity(DT.ClientConfiguration source) {
     129      return new DA.ClientConfiguration() {
     130        Id = source.Id,
     131        Hash = source.Hash,
     132        Description = source.Description
     133      };
     134    }
     135    #endregion
     136
     137    #region Plugin
     138    public static DT.Plugin ToDto(DA.Plugin source) {
     139      return new DT.Plugin() {
     140        Id = source.Id,
     141        Name = source.Name,
     142        StrongName = source.StrongName,
     143        Version = source.Version
     144      };
     145    }
     146
     147    public static DA.Plugin ToEntity(DT.Plugin source) {
     148      return new DA.Plugin() {
     149        Id = source.Id,
     150        Name = source.Name,
     151        StrongName = source.StrongName,
     152        Version = source.Version
    64153      };
    65154    }
     
    72161        Description = source.Description,
    73162        Name = source.Name,
    74         Type = source.Type,
    75         Country = source.Country,
     163        ClientConfiguration = ToDto(source.ClientConfiguration),
    76164        HeuristicLabVersion = source.HeuristicLabVersion,
    77         IPAddress = source.IPAddress,
    78         MemorySize = source.MemorySize,
    79         NumberOfCores = source.NumberOfCores,
    80         OperatingSystem = source.OperatingSystem,
     165        Country = ToDto(source.Country),
     166        OperatingSystem = ToDto(source.OperatingSystem),
     167        MemorySize = source.MemorySize.GetValueOrDefault(),
     168        Timestamp = source.Timestamp.GetValueOrDefault(),
     169        NumberOfCores = source.NumberOfCores.GetValueOrDefault(),
    81170        ProcessorType = source.ProcessorType,
    82         ClientType = source.ClientType
     171        ClientType = ToDto(source.ClientType)
    83172      };
    84173    }
     
    89178        Description = source.Description,
    90179        Name = source.Name,
    91         Type = source.Type,
    92         Country = source.Country,
     180        ClientConfiguration = ToEntity(source.ClientConfiguration),
    93181        HeuristicLabVersion = source.HeuristicLabVersion,
    94         IPAddress = source.IPAddress,
     182        Country = ToEntity(source.Country),
     183        OperatingSystem = ToEntity(source.OperatingSystem),
    95184        MemorySize = source.MemorySize,
     185        Timestamp = source.Timestamp,
    96186        NumberOfCores = source.NumberOfCores,
    97         OperatingSystem = source.OperatingSystem,
    98187        ProcessorType = source.ProcessorType,
    99         ClientType = source.ClientType
     188        ClientType = ToEntity(source.ClientType)
    100189      };
    101190    }
     
    107196        Timestamp = source.Timestamp,
    108197        ResourceId = source.ResourceId,
    109         Exception = source.Exception,
    110198        Message = source.Message
    111199      };
     
    116204        Timestamp = source.Timestamp,
    117205        ResourceId = source.ResourceId,
     206        Message = source.Message
     207      };
     208    }
     209    #endregion
     210
     211    #region ClientError
     212    public static DT.ClientError ToDto(DA.ClientError source) {
     213      return new DT.ClientError() {
     214        Id = source.Id,
     215        Timestamp = source.Timestamp,
    118216        Exception = source.Exception,
    119         Message = source.Message
    120       };
     217        UserComment = source.UserComment,
     218        ConfigDump = source.ConfigDump,
     219        ClientId = source.ClientId.GetValueOrDefault(),
     220        UserId = source.UserId.GetValueOrDefault()
     221      };
     222    }
     223
     224    public static DA.ClientError ToEntity(DT.ClientError source) {
     225      return new DA.ClientError() {
     226        Id = source.Id,
     227        Timestamp = source.Timestamp,
     228        Exception = source.Exception,
     229        UserComment = source.UserComment,
     230        ConfigDump = source.ConfigDump,
     231        ClientId = source.ClientId,
     232        UserId = source.UserId
     233      };
     234    }
     235    #endregion
     236
     237    #region UserGroup
     238    public static DT.UserGroup ToDto(DA.UserGroup source) {
     239      return new DT.UserGroup() {
     240        Id = source.Id,
     241        Name = source.Name
     242      };
     243    }
     244
     245    public static DA.UserGroup ToEntity(DT.UserGroup source) {
     246      return new DA.UserGroup() {
     247        Id = source.Id,
     248        Name = source.Name
     249      };
     250    }
     251    #endregion
     252
     253    #region User
     254    public static DT.User ToDto(DA.User source, DA.aspnet_User aspUserSource, DA.aspnet_Membership aspMembershipSource) {
     255      return new DT.User() {
     256        Id = source.Id,
     257        FullName = source.FullName,
     258        Comment = aspMembershipSource.Comment,
     259        CreationDate = aspMembershipSource.CreateDate,
     260        Email = aspMembershipSource.Email,
     261        IsApproved = aspMembershipSource.IsApproved,
     262        LastActivityDate = aspUserSource.LastActivityDate,
     263        LastLoginDate = aspMembershipSource.LastLoginDate,
     264        LastPasswordChangedDate = aspMembershipSource.LastPasswordChangedDate,
     265        UserName = aspUserSource.UserName
     266      };
     267    }
     268
     269    public static void ToEntity(DT.User source, out DA.User accessUser, out DA.aspnet_User aspUser, out DA.aspnet_Membership aspMembership, out bool userExistsInASP) {
     270      userExistsInASP = false;
     271      accessUser = new DA.User();
     272      aspUser = new DA.aspnet_User();
     273      aspMembership = new DA.aspnet_Membership();
     274
     275      if (source.Id != Guid.Empty) {
     276        using (DA.ASPNETAuthenticationDataContext context = new DA.ASPNETAuthenticationDataContext()) {
     277          var userCol = context.aspnet_Users.Where(s => s.UserId == source.Id);
     278          var membershipCol = context.aspnet_Memberships.Where(s => s.UserId == source.Id);
     279          if (userCol.Count() > 0 && membershipCol.Count() > 0) {
     280            aspUser = userCol.First();
     281            aspMembership = membershipCol.First();
     282            userExistsInASP = true;
     283          }
     284        }
     285      }
     286
     287      accessUser.Id = source.Id;
     288      accessUser.FullName = source.FullName;
     289
     290      aspUser.UserId = source.Id;
     291      aspUser.LastActivityDate = source.LastActivityDate;
     292      aspUser.UserName = source.UserName;
     293
     294      aspMembership.UserId = source.Id;
     295      aspMembership.Comment = source.Comment;
     296      aspMembership.CreateDate = source.CreationDate;
     297      aspMembership.Email = source.Email;
     298      aspMembership.IsApproved = source.IsApproved;
     299      aspMembership.LastLoginDate = source.LastLoginDate;
     300      aspMembership.LastPasswordChangedDate = source.LastPasswordChangedDate;
    121301    }
    122302    #endregion
  • branches/ClientUserManagement/HeuristicLab.Services.Access/3.3/DataTransfer/Client.cs

    r6820 r6825  
    2020#endregion
    2121
     22using System;
    2223using System.Runtime.Serialization;
    2324
     
    2627  public class Client : Resource {
    2728    [DataMember]
    28     public string ProcessorType { get; set; }
     29    public ClientConfiguration ClientConfiguration { get; set; }
    2930    [DataMember]
    30     public int? NumberOfCores { get; set; }
    31     [DataMember]
    32     public int? MemorySize { get; set; }
    33     [DataMember]
    34     public string OperatingSystem { get; set; }
    35     [DataMember]
    36     public string IPAddress { get; set; }
     31    public ClientType ClientType { get; set; }
    3732    [DataMember]
    3833    public string HeuristicLabVersion { get; set; }
    3934    [DataMember]
    40     public string Country { get; set; }
     35    public Country Country { get; set; }
    4136    [DataMember]
    42     public string ClientType { get; set; }
     37    public HeuristicLab.Services.Access.DataTransfer.OperatingSystem OperatingSystem { get; set; }
     38    [DataMember]
     39    public int MemorySize { get; set; }
     40    [DataMember]
     41    public DateTime Timestamp { get; set; }
     42    [DataMember]
     43    public int NumberOfCores { get; set; }
     44    [DataMember]
     45    public string ProcessorType { get; set; }
    4346  }
    4447}
  • branches/ClientUserManagement/HeuristicLab.Services.Access/3.3/DataTransfer/ClientLog.cs

    r6815 r6825  
    3131    [DataMember]
    3232    public string Message { get; set; }
    33     [DataMember]
    34     public string Exception { get; set; }
    3533  }
    3634}
  • branches/ClientUserManagement/HeuristicLab.Services.Access/3.3/DataTransfer/Resource.cs

    r6815 r6825  
    2121
    2222using System;
    23 using System.Collections.Generic;
    2423using System.Runtime.Serialization;
    2524
     
    3332    [DataMember]
    3433    public string Description { get; set; }
    35     [DataMember]
    36     public string Type { get; set; }
    37     [DataMember]
    38     public IEnumerable<ClientGroup> ParentGroups { get; set; }
    3934  }
    4035}
  • branches/ClientUserManagement/HeuristicLab.Services.Access/3.3/DataTransfer/User.cs

    r6820 r6825  
    2626namespace HeuristicLab.Services.Access.DataTransfer {
    2727  [DataContract]
    28   public class User : AccessItem {
     28  public class User : UserGroupBase {
    2929    [DataMember]
    3030    public string UserName { get; set; }
  • branches/ClientUserManagement/HeuristicLab.Services.Access/3.3/DataTransfer/UserGroup.cs

    r6820 r6825  
    2020#endregion
    2121
    22 using System;
    2322using System.Runtime.Serialization;
    2423
    2524namespace HeuristicLab.Services.Access.DataTransfer {
    2625  [DataContract]
    27   public class UserGroup : AccessItem {
     26  public class UserGroup : UserGroupBase {
    2827    [DataMember]
    2928    public string Name { get; set; }
    30     [DataMember]
    31     public Guid ParentUserGroup { get; set; }
    3229  }
    3330}
  • branches/ClientUserManagement/HeuristicLab.Services.Access/3.3/HeuristicLab.Services.Access-3.3.csproj

    r6821 r6825  
    4545    <Reference Include="System.Core" />
    4646    <Reference Include="System.Data" />
     47    <Reference Include="System.Data.Linq" />
    4748    <Reference Include="System.Runtime.Serialization" />
    4849    <Reference Include="System.ServiceModel" />
     
    5354    <Compile Include="Convert.cs" />
    5455    <Compile Include="DataTransfer\Client.cs" />
     56    <Compile Include="DataTransfer\ClientConfiguration.cs" />
     57    <Compile Include="DataTransfer\ClientError.cs" />
    5558    <Compile Include="DataTransfer\ClientLog.cs" />
    5659    <Compile Include="DataTransfer\AccessItem.cs" />
    5760    <Compile Include="DataTransfer\ClientGroup.cs" />
     61    <Compile Include="DataTransfer\ClientType.cs" />
     62    <Compile Include="DataTransfer\Country.cs" />
     63    <Compile Include="DataTransfer\OperatingSystem.cs" />
     64    <Compile Include="DataTransfer\Plugin.cs" />
    5865    <Compile Include="DataTransfer\Resource.cs" />
    5966    <Compile Include="DataTransfer\Role.cs" />
    6067    <Compile Include="DataTransfer\User.cs" />
    6168    <Compile Include="DataTransfer\UserGroup.cs" />
     69    <Compile Include="DataTransfer\UserGroupBase.cs" />
    6270    <Compile Include="IAccessService.cs" />
    6371    <Compile Include="Properties\AssemblyInfo.cs" />
  • branches/ClientUserManagement/HeuristicLab.Services.Access/3.3/IAccessService.cs

    r6815 r6825  
    7272
    7373    [OperationContract]
     74    IEnumerable<ClientGroup> GetParentGroups(Guid id);
     75
     76    [OperationContract]
    7477    Guid AddClientGroup(ClientGroup group);
    7578
Note: See TracChangeset for help on using the changeset viewer.