public VersionData Increment(UserReference user)
 {
     var next = new VersionData(user)
     {
         Id = Id + 1
     };
     return next;
 }
 public SimulationVersionSnapshot Clone(UserReference user)
 {
     return _clone.Clone();
 }
예제 #3
0
        public static void InsertInitialPlan()
        {
            var user = new UserReference
            {
                Id = "user/1",
                Name = "Howie"
            };

            var plan = new Plan("6", user);

            var current = plan.Edit(user);

            current.Add(new Action
            {
                Id = "action/1",
                Position = new Position
                {
                    Latitude = -26.130315,
                    Longitude = 28.086010
                }
            });

            current.Add(new Action
            {
                Id = "action/2",
                Position = new Position
                {
                    Latitude = -26.135930,
                    Longitude = 28.094081
                }
            });
            current.Add(new ResourceType
            {
                Id = "resourceType/1",
                Quantity = 2,
                Resources = new List<Resource>
                        {
                            new Resource
                            {
                                Id = "resource/1"
                            },

                            new Resource
                            {
                                Id = "resource/2"
                            }
                        }
            });

            current.Name = "Test Plan 1";

            current.Depot = new Depot
            {
                Id = "depot/1",

                Position = new Position
                {
                    Latitude = -26.141512,
                    Longitude = 28.106698
                }
            };

            var store = new DocumentStore
            {
                Url = "http://localhost:8092"
            };

            store.Initialize();

            var storage = new RavenPlanStorage(store);

            storage.Store(plan);
        }
예제 #4
0
        private static void Post(string id, PlanModel model)
        {
            var store = new DocumentStore
            {
                Url = "http://localhost:8092"
            };

            store.Initialize();

            var storage = new RavenPlanStorage(store);

            var user = new UserReference { Id = "1", Name = "TEst" };

            var plan = storage.Get("6");

            var current = plan.Edit(user);

            current.Name = model.Name;

            storage.Store(plan);
        }
 public VersionData(UserReference user)
 {
     User = user;
     Timestamp = DateTime.UtcNow;
 }