public void GetFullDWGPathTest() { DateTime date = Convert.ToDateTime("12/30/2015 1:42 AM"); TimeSpan ts = new TimeSpan(0, 0, 0, 12); date.Add(new TimeSpan(0, 0, 0, 12)); date = date.AddSeconds(12); commands.GetFullDWGPath(date, 1); using (PGAContext context = commands.DbPgaContextConnection()) { var settingses = from p in context.Settings select p; foreach (var val in settingses) { if (val.DateStamp == date) { Debug.WriteLine(val.DateStamp.Value.Ticks); Debug.WriteLine(date.Ticks); } } } Assert.AreEqual(1, 1); }
public static PGAContext GetSql4Connection() { var connectionString = string.Format( "DataSource=\"{0}\"; Password='******'", GetAppPath(), "PGA"); var conn = new SqlCeConnection(connectionString); var context = new PGAContext(conn); return(context); }
public void PreparePolylineFiles(DateTime time) { if (System.ComponentModel.DesignerProperties.GetIsInDesignMode(this)) { return; } Polylines.Clear(); try { using (PGAContext context = GetDataBasePath.GetSql4Connection()) { var points = from p in context.PolylineDWGS where (p.DateStamp == Convert.ToDateTime(DateSelected)) select p; //string command; //var i = 1; foreach (var val in points) { Files stack = new Files(); stack.Order = Order(val.DrawingName); stack.FileName = val.DrawingName; stack.SourceFile = val.SourcePath; stack.DestFile = val.DestinationPath; stack.time = Convert.ToDateTime(val.DateStamp); Polylines.Add(stack); } //context.SubmitChanges(); } } catch (Exception ex) { PGA.MessengerManager.MessengerManager.LogException(ex); } }
public void PullPointCloudFiles(DateTime time) { try { if (System.ComponentModel.DesignerProperties.GetIsInDesignMode(this)) { return; } using (PGAContext context = GetDataBasePath.GetSql4Connection()) { var points = from p in context.PointCloud where (p.DateStamp == Convert.ToDateTime(DateSelected)) select p; string command; // var i = 1; foreach (var val in points) { var stack = new DrawingStack(); command = string.Format( "{0},{1},{2},{3},{4}", Order(val.DrawingName), val.DrawingName, val.SourcePath, val.DestinationPath, val.DateStamp); stack.Function = command; context.DrawingStack.InsertOnSubmit(stack); // PointClouds.Add(stack); } context.SubmitChanges(); } } catch (Exception ex) { PGA.MessengerManager.MessengerManager.LogException(ex); } }
public ApplicationService(PGAContext ctx) { _ctx = ctx; }
public UserService(PGAContext ctx) { _ctx = ctx; }
public AuthController(PGAContext ctx) { _ctx = ctx; }
private static PGAContext GetContextWithData() { /* Initialize an in-memory Db context, we are not using the context linked to the * SQL server as that falls under integration tests */ var options = new DbContextOptionsBuilder <PGAContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options; var context = new PGAContext(options); /* Add seed data to in-memory context */ Programme programme1 = new Programme() { Id = 1, ProgrammeName = "Masters by reasearch" }; Programme programme2 = new Programme() { Id = 2, ProgrammeName = "Masters by course work" }; context.Add(programme1); context.Add(programme2); Position position1 = new Position() { Id = 1, PositionName = "Supervisor" }; Position position2 = new Position() { Id = 2, PositionName = "PGO" }; Position position3 = new Position() { Id = 3, PositionName = "PGC" }; context.Add(position1); context.Add(position2); context.Add(position3); Users supervisor = new Users() { Id = 1, FirstName = "Fred", Position = position1 }; context.Add(supervisor); Application application = new Application() { Id = 1, FirstName = "Jon", LastName = "Doe", Programme = programme1, Supervisor = supervisor }; context.Add(application); ApplicationFiles file1 = new ApplicationFiles() { Application = application, Id = 1, Title = "FirstDoc" }; ApplicationFiles file2 = new ApplicationFiles() { Application = application, Id = 2, Title = "SecondDoc" }; context.Add(file1); context.Add(file2); List <ApplicationFiles> docs = new List <ApplicationFiles>(new ApplicationFiles[] { file1, file2 }); application.ApplicationFiles = docs; context.SaveChanges(); return(context); }
public ProgrammeService(PGAContext ctx) { _ctx = ctx; }