Example #1
0
        public void ActionArchived(ActionId id)
        {
            var action = _actions[id];
            action.MarkAsArchived();

            Publish(new Dumb.ActionAdded(action.Freeze()));
        }
Example #2
0
 public ActionAssignedToProject(TenantId id, ActionId action, ProjectId newProject, DateTime timeUtc)
 {
     Id = id;
     Action = action;
     NewProject = newProject;
     TimeUtc = timeUtc;
 }
 public void ArchiveAction(ActionId actionId, ITimeProvider time)
 {
     var action = GetActionOrThrow(actionId);
     if (!action.Archived)
     {
         Apply(new ActionArchived(_aggState.Id, actionId, action.Project, time.GetUtcNow()));
     }
 }
Example #4
0
        public void ActionCompleted(ActionId actionId)
        {
            var action = _actions[actionId];
            var project = _projects[action.ProjectId];
            action.MarkAsCompleted();

            Publish(new Dumb.ActionUpdated(action.Freeze(), project.UIKey));
        }
Example #5
0
 public void ActionOutcomeChanged(ActionId actionId, string outcome)
 {
     var action = _actions[actionId];
     var project = _projects[action.ProjectId];
     action.OutcomeChanged(outcome);
     var immutable = action.Freeze();
     Publish(new Dumb.ActionUpdated(immutable, project.UIKey));
 }
Example #6
0
        public void DefineAction(Guid requestId, string actionName, ITimeProvider provider)
        {
            // filter request IDs
            var time = provider.GetUtcNow();
            var id = new ActionId(NewGuidIfEmpty(requestId));

            Apply(new ActionDefined(_state.Id, id, actionName, time));
        }
Example #7
0
        public void CaptureInboxEntry(Guid requestId, string name, ITimeProvider provider)
        {
            // filter request IDs
            var time = provider.GetUtcNow();
            var id = new ActionId(NewGuidIfEmpty(requestId));

            Apply(new InboxEntryCaptured(_state.Id, requestId, name));

            //Apply(new ActionCaptured(_state.Id, id, name, time));
        }
Example #8
0
        public void ActionDefined(ProjectId projectId, ActionId actionId, string outcome)
        {
            var action = new MutableAction(actionId, outcome, projectId);

            var project = _projects[projectId];
            project.Actions.Add(action);
            _actions.Add(actionId, action);

            Publish(new Dumb.ActionAdded(action.Freeze()));
        }
 public void ChangeActionOutcome(ActionId actionId, string outcome, ITimeProvider time)
 {
     ActionInfo actionInfo;
     if (!_aggState.Actions.TryGetValue(actionId, out actionInfo))
     {
         throw DomainError.Named("unknown action", "Unknown action {0}", actionId);
     }
     if (actionInfo.Outcome != outcome)
     {
         Apply(new ActionOutcomeChanged(_aggState.Id, actionId, actionInfo.Project, outcome, time.GetUtcNow()));
     }
 }
Example #10
0
        public bool LoggWeb(string token,ActionId action,string data,LoginYesTaskHandler loggYesTask,LoginNoTaskHandler loggNoTask)
        {
            string URL =loggUrl;

            SystemWebClient client = new SystemWebClient();

            if( !string.IsNullOrEmpty(token))
                URL = String.Format(URL+"?token={0}&action={1}&data={2}",token,(int)action,data);
            else {
                return false;
            }
            //Console.WriteLine(URL);

            client.DownloadStringCompleted+= delegate(object sender, DownloadStringCompletedEventArgs e) {

                if (e.Cancelled){
                    if(loggNoTask!= null) loggNoTask(null,"Wrong username or password.");
                    return ;
                }
                if (e.Error != null){
                    if(loggNoTask!= null) loggNoTask(null,"Wrong username or password.");
                    return ;
                }
            };

            try{
                client.DownloadStringAsync(new Uri(URL));

            }catch(Exception ex){
                string statusDesc = "";
                GetStatusCode(client,out statusDesc);
                Console.WriteLine(ex.Message);

                return false;
            }
            return true;
        }
Example #11
0
 public ImmutableAction(string uiKey, ActionId actionId, string outcome, bool completed, bool archived, ProjectId projectId, DateTime startDate, DateTime dueDate)
 {
     UIKey = uiKey;
     ActionId = actionId;
     Outcome = outcome;
     Completed = completed;
     Archived = archived;
     ProjectId = projectId;
     StartDate = startDate;
     DueDate = dueDate;
 }
Example #12
0
 public Task <bool> ExecuteActionAsync(ActionId actionId, CancellationToken cancellationToken = default)
 => ExecuteActionAsync(actionId.ToString(), cancellationToken);
        public void CompleteAction(ActionId actionId, ITimeProvider provider)
        {
            var actionInfo = GetActionOrThrow(actionId);

            if (actionInfo.Completed)
                return;// idempotency

            Apply(new ActionCompleted(_aggState.Id,
                actionId,
                actionInfo.Project,
                actionInfo.Outcome,
                provider.GetUtcNow()));
        }
Example #14
0
 public void DeferredUtil(ActionId actionId, DateTime deferUntil)
 {
     var action = _actions[actionId];
     action.DeferUntilDate(deferUntil);
 }
Example #15
0
 public bool    run(ActionId in_id, object in_obj)
 {
     return(run(in_id, in_obj, ActionPriority.eNONE));
 }
Example #16
0
 public void DueDateAssigned(ActionId actionId, DateTime newDueDate)
 {
     _actions[actionId].DueDateAssigned(newDueDate);
 }
Example #17
0
 public ActionInfo(ActionId id, string name)
 {
     Id = id;
     Outcome = name;
 }
Example #18
0
 public void LoggWebThread(ActionId action)
 {
     LoggWebThread(action,"");
 }
Example #19
0
        public void LoggWebThread(ActionId action,string data)
        {
            if((MainClass.Settings.Account == null) || (String.IsNullOrEmpty(MainClass.Settings.Account.Token))){
                return;
            }

            this.token = MainClass.Settings.Account.Token;
            this.action = action;
            this.data = data;

            Thread runLog = new Thread(new ThreadStart(LoggWeb));
            //filllStartPageThread.Priority = ThreadPriority.Normal;
            runLog.Name = "FilllStartPage";
            runLog.IsBackground = true;
            runLog.Start();
        }
Example #20
0
        public bool LoggWebString(ActionId action,string str,LoginYesTaskHandler loggYesTask,LoginNoTaskHandler loggNoTask)
        {
            if((MainClass.Settings.Account == null) || (String.IsNullOrEmpty(MainClass.Settings.Account.Token))){
                return false;
            }
            string token =MainClass.Settings.Account.Token;

            string URL =loggUrl;

            SystemWebClient client = new SystemWebClient();

            if( !string.IsNullOrEmpty(token))
                URL = String.Format(URL+"?token={0}&action={1}",token,(int)action);
            else {
                return false;
            }

            //Console.WriteLine(URL);

            /*client.UploadStringCompleted+= delegate(object sender, UploadStringCompletedEventArgs e) {

                if (e.Cancelled){
                    Console.WriteLine("e.Cancelled->"+e.Cancelled);
                    if(loggNoTask!= null) loggNoTask(null,"Wrong username or password.");
                    return;
                }
                if (e.Error != null){
                    Console.WriteLine("e.Error->"+e.Error);
                    if(loggNoTask!= null) loggNoTask(null,"Wrong username or password.");
                    return;
                }
                string result = e.Result;
                Console.WriteLine("e.Result->"+e.Result);
            };*/

            string data = str;
            try{
                string resp = client.UploadString(new Uri(URL),data);
                Console.WriteLine(resp);
                if(loggYesTask!= null) loggYesTask(null,null);

            }catch(Exception ex){
                string statusDesc = "";
                GetStatusCode(client,out statusDesc);
                Console.WriteLine(ex.Message);
                if(loggNoTask!= null) loggNoTask(null,ex.Message);

                return false;
            }
            return true;
        }
Example #21
0
 public override string ToString()
 {
     return(ActionId.ToString());
 }
 private bool CanDoAction(ActionId actionId)
 {
Example #23
0
 public void AddAction(ActionId action)
 {
     _actions.Add(action);
 }
 public ActionDetailAttribute(ActionId id, String name, String des, String url) : this((Int32)id, name, des, url)
 {
 }
Example #25
0
 public void RemoveAction(ActionId action)
 {
     _actions.Remove(action);
 }
        public void DefineAction(RequestId requestId, ProjectId projectId, string outcome, ITimeProvider provider)
        {
            // filter request IDs
            var time = provider.GetUtcNow();

            ProjectInfo projectInfo;
            if (!_aggState.Projects.TryGetValue(projectId, out projectInfo))
            {
                throw DomainError.Named("unknown-project", "Unknown project {0}", projectId);
            }

            var actionId = new ActionId(NewGuidIfEmpty(requestId));
            Apply(new ActionDefined(_aggState.Id, actionId, projectId, outcome , time));
        }
Example #27
0
 public MutableAction(ActionId action, string outcome, ProjectId project)
 {
     Id = action;
     Outcome = outcome;
     Completed = false;
     Archived = false;
     ProjectId = project;
 }
        public void ProvideDueDateForAction(ActionId actionId, DateTime newDueDate)
        {
            var action = GetActionOrThrow(actionId);

            if (newDueDate == action.DueDate)
                return;

            if (newDueDate == DateTime.MinValue)
            {
                Apply(new DueDateRemovedFromAction(_aggState.Id, actionId, action.DueDate));
                return;
            }

            if (action.DeferUntil != DateTime.MinValue && newDueDate < action.DeferUntil)
            {
                throw DomainError.Named("", "New due date is earlier than start date");
            }

            if (action.DueDate == DateTime.MinValue)
            {
                Apply(new DueDateAssignedToAction(_aggState.Id, actionId, newDueDate));
                return;
            }

            Apply(new ActionDueDateMoved(_aggState.Id, actionId, action.DueDate, newDueDate));
        }
Example #29
0
        public void DeferredUtil(ActionId actionId, DateTime deferUntil)
        {
            var action = _actions[actionId];

            action.DeferUntilDate(deferUntil);
        }
 public ActionDetailAttribute(ActionId id, String name, String des = "") : this((Int32)id, name, des, name)
 {
 }
Example #31
0
 /*
  *  @brief	指定したアクション実行(強制的に変更可能)
  */
 public bool    run(ActionId in_id)
 {
     return(run(in_id, null));
 }
Example #32
0
 public bool    runFromPrority(ActionId in_id)
 {
     return(runFromPrority(in_id, null));
 }
Example #33
0
 public void DueDateAssigned(ActionId actionId, DateTime newDueDate)
 {
     _actions[actionId].DueDateAssigned(newDueDate);
 }
Example #34
0
 public CompleteActionClicked(ActionId id)
 {
     Id = id;
 }
        public void DeferActionUntil(ActionId actionId, DateTime newStartDate)
        {
            var action = GetActionOrThrow(actionId);

            if (newStartDate == action.DeferUntil)
                return;

            if (newStartDate == DateTime.MinValue)
            {
                Apply(new ActionIsNoLongerDeferred(_aggState.Id, actionId, action.DeferUntil));
                return;
            }

            if (action.DueDate != DateTime.MinValue && newStartDate > action.DueDate)
            {
                throw DomainError.Named("", "New defer date is later than due date");
            }

            if (action.DeferUntil == DateTime.MinValue)
            {
                Apply(new ActionDeferredUntil(_aggState.Id, actionId, newStartDate));
                return;
            }

            Apply(new ActionDeferDateShifted(_aggState.Id, actionId, action.DeferUntil, newStartDate));
        }
        private bool IsIdsMatch(IPostAction templateDefinedPostAction)
        {
            if (templateDefinedPostAction.ActionId != ActionId)
            {
                string errorMsg = string.Format(StringRes.PostActionIdsNotMatchError, templateDefinedPostAction.ActionId.ToString(), ActionId.ToString(), RelatedTemplate);
                if (!ContinueOnError)
                {
                    throw new Exception(errorMsg);
                }
                else
                {
                    AppHealth.Current.Error.TrackAsync(errorMsg).FireAndForget();
                    return(false);
                }
            }

            return(true);
        }
        public void DefineSingleActionProject(RequestId requestId, StuffId stuffId, ITimeProvider provider)
        {
            // filter request IDs
            var time = provider.GetUtcNow();
            var projectId = new ProjectId(NewGuidIfEmpty(requestId));

            // generate actionId
            var actionId = new ActionId(Guid.NewGuid());

            // make sure Stuff exists in the Inbox
            StuffInfo stuffInfo;
            if (!_aggState.StuffInInbox.TryGetValue(stuffId, out stuffInfo))
            {
                throw DomainError.Named("unknown stuff", "Unknown stuff {0}", stuffId);
            }
            // TODO: May be able to use this to change the stuff description and then let that cascade down
            // as both the Project AND Action Outcome in case you wanted to use a different name than from original desc
            // With current design it may be better to kick off a "RENAME" command or Apply Renamed event for that purpose though.
            //if (stuffInfo.Description != stuffDescription)
            //{
            //    Apply(new StuffDescriptionChanged(_aggState.Id, stuffId, newDescriptionOfStuff, time.GetUtcNow()));
            //}

            // TODO: Not sure if it best to just reuse existing Events and projections (probably)
            // or if I should create a new composite event for this new command msg.
            // Thinking the former, not latter is way to go.
            Apply(new ProjectDefined(_aggState.Id, projectId, stuffInfo.Description, ProjectType.List, time));
            Apply(new ActionDefined(_aggState.Id, actionId, projectId, stuffInfo.Description, time));
            //Apply(new SingleActionProjectDefined(_aggState.Id, etc.)

            // Archive the Stuff from the Inbox now that is has transitioned from "Stuff" to a defined "Action"
            Apply(new StuffArchived(_aggState.Id, stuffId, time));
        }
 public ActionInfo(ActionId id, string name, ProjectId owner)
 {
     Id = id;
     Outcome = name;
     Project = owner;
 }
 ActionInfo GetActionOrThrow(ActionId id)
 {
     ActionInfo actionInfo;
     if (!_aggState.Actions.TryGetValue(id, out actionInfo))
     {
         throw DomainError.Named("unknown action", "Unknown action {0}", id);
     }
     return actionInfo;
 }
Example #40
0
        public void ActionMoved(ActionId actionId, ProjectId oldProjectId, ProjectId newProjectId)
        {
            var action = _actions[actionId];
            Publish(new Dumb.ActionRemoved(action.Freeze()));

            action.MoveToProject(newProjectId);

            Publish(new Dumb.ActionAdded(action.Freeze()));

            _projects[oldProjectId].Actions.Remove(action);
            _projects[newProjectId].Actions.Add(action);
        }
Example #41
0
 public ChangeActionOutcome(ActionId actionId, string outcome)
 {
     ActionId = actionId;
     Outcome = outcome;
 }
Example #42
0
 void System.Xml.Serialization.IXmlSerializable.WriteXml(System.Xml.XmlWriter writer)
 {
     writer.WriteAttributeString("ActionId", ActionId.ToString());
     writer.WriteAttributeString("Success", Success.ToString());
     writer.WriteAttributeString("AffectedRows", AffectedRows.ToString());
     writer.WriteAttributeString("RowVersion", RowVersion.ToString());
     writer.WriteStartElement("FailureMessage");
     if (!string.IsNullOrEmpty(FailureMessage))
     {
         writer.WriteValue(FailureMessage);
     }
     writer.WriteEndElement();
     writer.WriteStartElement("Result");
     if (Result != null)
     {
         writer.WriteValue(Result);
     }
     writer.WriteEndElement();
     writer.WriteStartElement("Parameters", Namespaces.Data);
     if (Parameters != null)
     {
         foreach (System.Xml.Serialization.IXmlSerializable parameter in Parameters)
         {
             writer.WriteStartElement("Parameter", Namespaces.Data);
             if (parameter != null)
             {
                 parameter.WriteXml(writer);
             }
             writer.WriteEndElement();
         }
     }
     writer.WriteEndElement();
     writer.WriteStartElement("AlternativeActions", Namespaces.Data);
     foreach (System.Xml.Serialization.IXmlSerializable parameter in AlternativeActions)
     {
         writer.WriteStartElement("PersistenceActionResult", Namespaces.Data);
         if (parameter != null)
         {
             parameter.WriteXml(writer);
         }
         writer.WriteEndElement();
     }
     writer.WriteEndElement();
     writer.WriteStartElement("BeforeActions", Namespaces.Data);
     foreach (System.Xml.Serialization.IXmlSerializable parameter in BeforeActions)
     {
         writer.WriteStartElement("PersistenceActionResult", Namespaces.Data);
         if (parameter != null)
         {
             parameter.WriteXml(writer);
         }
         writer.WriteEndElement();
     }
     writer.WriteEndElement();
     writer.WriteStartElement("AfterActions", Namespaces.Data);
     foreach (System.Xml.Serialization.IXmlSerializable parameter in AfterActions)
     {
         writer.WriteStartElement("PersistenceActionResult", Namespaces.Data);
         if (parameter != null)
         {
             parameter.WriteXml(writer);
         }
         writer.WriteEndElement();
     }
     writer.WriteEndElement();
 }