Some more Migration stuff.

This commit is contained in:
Thomas Hounsell 2015-09-12 15:23:13 +01:00
parent 470347a152
commit 27e7bd9db8
9 changed files with 90 additions and 11 deletions

1
.gitignore vendored
View File

@ -18,6 +18,7 @@ smtp.config
# Publish Profiles
[Pp]roperties/[Pp]ublish[Pp]rofiles/
*.pubxml
# VS Configuration
.vs/

View File

@ -399,6 +399,7 @@
<Content Include="Scripts\Chart.js" />
<Content Include="Scripts\Chart.min.js" />
<Content Include="App_Code\PaginationHelpers.cshtml" />
<None Include="Properties\PublishProfiles\Milestone 1 [DEV].pubxml" />
<None Include="Scripts\jquery-2.1.4.intellisense.js" />
<Content Include="Scripts\jquery-2.1.4.js" />
<Content Include="Scripts\jquery-2.1.4.min.js" />

View File

@ -18,12 +18,4 @@ public enum TypeOfSource
Logging,
PrivateLeak
}
public enum LevelOfFlight
{
None = 0,
Low = 1,
Medium = 2,
High = 3
}
}

View File

@ -24,7 +24,7 @@ public class BuildModel
public TypeOfSource SourceType { get; set; }
public string SourceDetails { get; set; }
public DateTime? LeakDate { get; set; }
public LevelOfFlight FlightLevel { get; set; }
public MongoLevelOfFlight FlightLevel { get; set; }
public bool IsLeaked
{
@ -107,4 +107,14 @@ public void InsertAll(IEnumerable<BuildModel> items)
task.Wait();
}
}
public enum MongoLevelOfFlight
{
None = 0,
WIS = 1,
WIF = 2,
OSG = 3,
MSIT = 4,
Canary = 5
}
}

View File

@ -0,0 +1,31 @@
using MongoDB.Bson.Serialization.Attributes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RedisMongoMigration.Mongo
{
public class MongoMember
{
[BsonId]
public Guid Id { get; set; }
public string UserName { get; set; }
public byte[] PassHash { get; set; }
public byte[] PassSalt { get; set; }
public string EmailAddress { get; set; }
public bool IsApproved { get; set; }
public bool IsLockedOut { get; set; }
public DateTime CreationDate { get; set; }
public DateTime LastActivityDate { get; set; }
public DateTime LastLockoutDate { get; set; }
public DateTime LastLoginDate { get; set; }
public DateTime LockoutWindowStart { get; set; }
public int LockoutWindowAttempts { get; set; }
}
}

View File

@ -0,0 +1,19 @@
using MongoDB.Bson.Serialization.Attributes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RedisMongoMigration.Mongo
{
public class MongoRole
{
[BsonId]
public Guid Id { get; set; }
public string RoleName { get; set; }
public Guid[] Users { get; set; }
}
}

View File

@ -7,6 +7,8 @@
using MBuildModel = RedisMongoMigration.Mongo.BuildModel;
using MBuild = RedisMongoMigration.Mongo.Build;
using RBuild = RedisMongoMigration.Redis.Build;
using MongoLevelOfFlight = RedisMongoMigration.Mongo.MongoLevelOfFlight;
using RedisLevelOfFlight = RedisMongoMigration.Redis.RedisLevelOfFlight;
namespace RedisMongoMigration
{
@ -33,12 +35,25 @@ static void Main(string[] args)
SourceType = b.SourceType,
SourceDetails = b.SourceDetails,
LeakDate = b.LeakDate,
FlightLevel = b.FlightLevel
FlightLevel = ExchangeFlights(b.FlightLevel)
};
MBuild m = new MBuild();
m.InsertAll(newBuilds);
Console.WriteLine("Builds: Complete");
Console.ReadKey();
}
static MongoLevelOfFlight ExchangeFlights(RedisLevelOfFlight flight)
{
switch (flight)
{
case RedisLevelOfFlight.Low:
return MongoLevelOfFlight.WIS;
case RedisLevelOfFlight.High:
return MongoLevelOfFlight.OSG;
default:
return MongoLevelOfFlight.None;
}
}
}
}

View File

@ -28,7 +28,7 @@ public class Build : IHasId<long>
public TypeOfSource SourceType { get; set; }
public string SourceDetails { get; set; }
public DateTime? LeakDate { get; set; }
public LevelOfFlight FlightLevel { get; set; }
public RedisLevelOfFlight FlightLevel { get; set; }
public bool IsLeaked
{
@ -81,4 +81,12 @@ public static IEnumerable<Build> Select()
}
}
}
public enum RedisLevelOfFlight
{
None = 0,
Low = 1,
Medium = 2,
High = 3
}
}

View File

@ -74,6 +74,8 @@
<ItemGroup>
<Compile Include="Build.cs" />
<Compile Include="Mongo\Build.cs" />
<Compile Include="Mongo\MongoMember.cs" />
<Compile Include="Mongo\MongoRole.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Redis\Build.cs" />