示例#1
0
        public ActionResult HandleCompleteTask(
            [System.Web.Http.FromBody] Guid task,
            [System.Web.Http.FromBody] string localTimestamp)
        {
            DateTimeOffset timestamp = DateTimeOffset.Now;
            TaskId         taskId    = (TaskId)Guid.NewGuid();
            var            command   = new MarkTaskCompleted(taskId, User.Identity.Name, timestamp);

            Wiring.Proxy.SendCommand(command);

            return(CommandWrapped(command));
        }
示例#2
0
        static void GenerateDesmondPlan()
        {
            var days = CultureInfo.CurrentCulture.DateTimeFormat.DayNames;

            var planId  = PlanId.Create();
            var newPLan = new CreateCollaborativePlan(planId, "Desmonds åtaganden", "Saker som Desmond ska göra för att få veckopeng", Thread.CurrentPrincipal.Identity.Name);

            Wiring.Proxy.SendCommand(newPLan);

            Wiring.Proxy.SendCommand(new AddCollaborator(planId, "jonas(guest)", "Admin"));
            Wiring.Proxy.SendCommand(new AddCollaborator(planId, "jenny(guest)", "Collaborator"));
            Wiring.Proxy.SendCommand(new AddCollaborator(planId, "desmond(guest)", "Auditor"));

            foreach (var taskTitle in "Städa rummet (Varje vecka),Gå igenom läsläxa(Varje vecka på Onsdag),Packa gympakläder(Varje vecka på Torsdag),Kolla naglar(Varje vecka på Söndag)".Split(','))
            {
                Console.WriteLine(taskTitle);

                var reccurence = (taskTitle.Contains("Varje vecka"))
                                ? Reccurence.Weekly
                                : Reccurence.Daily;

                var taskId      = TaskId.Create();
                var taskCommand = new CreateTask(planId, taskId, taskTitle, reccurence);
                Wiring.Proxy.SendCommand(taskCommand);
                Wiring.Proxy.SendCommand(new AssociateTaskToPlan(planId, taskId));
                Thread.Sleep(200); // Power nap to allow cool down...

                var complete = new MarkTaskCompleted(taskId, "jonas(guest)", DateTimeOffset.Now);
                Wiring.Proxy.SendCommand(complete);
                Thread.Sleep(200); // Power nap to allow cool down...

                // Check for day names in the culture,



                // Check if we can generate and reccurence policy, ie "Every week on Tuesdays" => "Every [interval] on [dayName]"
            }
        }