Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Next »

In NOAH 3 it was only possible to edit Actions within the same calendar day they were created. This has been changed in Noah 4, by default Noah will allow Actions to be edited beyond the calendar day they were created. However this only applies to Noah 4 modules and there are two exceptions to this rule:

1.      This feature can be disabled by the Business System. If this feature is disabled then the ‘EditOldActionsAllowed’ property of the ModuleAPI returns false.

2.      The Action cannot be edited if it is referenced by another Action.

 

In the following two examples we will assume that the Action we are editing isn’t referenced by another Action and the Business System allows Actions to be edited beyond the current calendar day.

Example 1) what happens in Noah 4 if an Action from the current calendar day is edited?
In this case the Noah 4 behavior is identical to NOAH 3.

Example 2) what will happen if an Action not belonging to the current calendar day is edited?
In this case Noah 4 will create an ‘Archived Action’ which is a clone of the unmodified Action. Noah 4 will create a new Action with the updated information and also a new action id. The new Action with the updated information will be added to the Session of the edited Action.

 Archived Actions cannot be edited themselves.

 

In the following example we will assume that either the Action we are editing is referenced by another Action and/or the Business System doesn’t allow Actions to be edited beyond the current calendar day.

Example 3) what will happen if an attempt to edit the Action is made?
In this case Noah 4 will create an ‘Archived Action’ which is a clone of the unmodified Action. This ‘Archived Action’ will no longer be accessible via the Session to which it originally belonged. Next Noah 4 will create a new Action reflecting the content of the unmodified Action apart from action id and the updated information. This new Action with the updated information will now be added to the Session of the edited Action.

How is an ‘Archived Action’ accessed?
Archived Actions should be seen as children of an edited Action, the Parent Action. Noah 4 has made two new methods available via the Action object in the ModuleAPI. These  are the ‘
GetArchivedActionsCount’ method which will return the number of Archived actions an Action has and the ‘GetArchivedActions’ method which will return a read only collection containing the Archived Actions an Action has.

How will I be able to access Archived Actions when the parent Action is removed from the database?
You won’t,  all Archived Actions are removed when the parent Action is removed.

 

Code samples for working with Archived Actions


Example 1) Get archived actions

In this example we assume that we have an instantiated ModuleAPI object named myModuleAPI that is connected to Noah.

The code in this sample will iterate over all actions for the selected patient and retrieve available archived actions.

public void GetArchivedActions()

{

// myModuleAPI is the modules only instance of the Himsa.Noah.Modules.ModuleAPI

// class. Does the ModuleAPI object have a selected patient?

if (myModuleAPI == null || myModuleAPI.CurrentPatient == null) return;


       foreach (Himsa.Noah.Modules.Session session in myModuleAPI.CurrentPatient.Sessions)

      {

        // Does this session object have any action objects?

        if ((null == session.Actions) || (session.Actions.Count == 0)) continue;


        Console.WriteLine("Session with Id='{0}', Date='{1}'", session.Id,

        session.CreateDate.ToShortDateString());

       

        foreach (Himsa.Noah.Modules.Action action in session.Actions)

        {

              // Does this action object have any archived actions?

              if (action.GetArchivedActionsCount() > 0)

              {   // Show the action

 Console.WriteLine(string.Format("\tAction with Id='{0}',Description='{1}'

 has archived actions", action.Id, action.Description));

               

                  // Show all archived actions of the current action object

                  foreach (Himsa.Noah.Modules.Action archivedAction in

          action.GetArchivedActions())

                  {

                      Console.WriteLine("\t\tArchivedAction with Id='{0}',

        Description='{1}'", archivedAction.Id, archivedAction.Description);

                  }

             }

            else

            {

                  Console.WriteLine("\tAction with Id='{0}', Description='{1}' does not

                  have any archived actions", action.Id, action.Description);

              }

         }

     }

}


Example 2) Update an action which result in an archived action

In this example we assume that we have an instantiated ModuleAPI object named myModuleAPI that is connected to Noah.

The code in this sample will iterate over all actions for the selected patient which belong to a Session that is different from today and modify the description for all actions.

public void ModifyOldAction()

{

   // myModuleAPI is the modules only instance of the Himsa.Noah.Modules.ModuleAPI class.

// Does the ModuleAPI object have a selected patient?

if (myModuleAPI == null || myModuleAPI.CurrentPatient == null ||

    myModuleAPI.EditOldActionsAllowed == false)

            return;


      foreach (Himsa.Noah.Modules.Session session in myModuleAPI.CurrentPatient.Sessions)

      {

      // Skip sessions from today.

      if (session.CreateDate.Day == DateTime.Now.Day)

             continue;


      // Does this session object have any action objects?

      if ((null == session.Actions) || (session.Actions.Count == 0))

             continue;


// We are here because we have an Action object from a date that is different

//from today.

Console.WriteLine("Session with Id='{0}', Date='{1}'", session.Id,

session.CreateDate.ToShortDateString());


       foreach (Himsa.Noah.Modules.Action action in session.Actions)

       {

          // Modifying an Action object that was created prior of today results in the

  // creation of an archived action.

          action.Description = string.Format("I have {0} archived actions",

          action.GetArchivedActionsCount());

          Console.WriteLine("\tAction with Id='{0}', Description='{1}'", action.Id,

                  action.Description);

         }

    }

}

  • No labels