}//END getItem method #endregion #region project alert Save methods // ===================================================================================== /// <summary> /// This class saves items to the Alert ResultData table. /// </summary> /// <param name="Alert">EvAlert: A Project Alert ResultData object</param> /// <returns>EvEventCodes: an event code for saving items</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Update the Alert object's state /// /// 2. Execute the method for adding items, if the Alert's Guid is empty /// /// 3. Else, execute the method for updating items. /// /// 4. Return the event code for the execution. /// </remarks> // ------------------------------------------------------------------------------------- public EvEventCodes saveAlert(EvAlert Alert) { this.LogMethod("saveItem method "); this.LogDebug("Guid: " + Alert.Guid); this.LogDebug("AlertId: " + Alert.AlertId); this.LogDebug("TypeId: " + Alert.TypeId); this.LogDebug("Action: " + Alert.Action); // // Define the local variables. // EvEventCodes iReturn = EvEventCodes.Ok; // // Update the _ProjectAlert record state to reflect the requested action. // this.updateState(Alert); // // If the _ProjectAlert FormUid is zero or empty, then create a new alert record. // if (Alert.Guid == Guid.Empty) { iReturn = this._dalProjectAlerts.addItem(Alert); this.LogDebug(this._dalProjectAlerts.Status); return(iReturn); } // // Update the alert record. // iReturn = this._dalProjectAlerts.updateItem(Alert); this.LogDebug(this._dalProjectAlerts.Status); return(iReturn); }//END saveAlert method
}//END getItem method // ===================================================================================== /// <summary> /// This class retrieves an Alert ResultData table based on AlertId. /// </summary> /// <param name="AlertId">string: an Alert identifier</param> /// <returns>EvAlert: The Project alert ResultData object</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Execute the method for retrieving the Alert ResultData object /// /// 2. Return the Alert ResultData object. /// </remarks> // ------------------------------------------------------------------------------------- public EvAlert getItem(string AlertId) { this.LogMethod("getItem method "); this.LogDebug("AlertId: " + AlertId); EvAlert _ProjectAlert = _dalProjectAlerts.getItem(AlertId); this.LogDebug(this._dalProjectAlerts.Status); return(_ProjectAlert); }//END getItem method
} //End FilterLists method. #endregion #region trial alert retrieval queries // ===================================================================================== /// <summary> /// This class retrieves an Alert ResultData table based on Alert's Guid. /// </summary> /// <param name="AlertGuid">Guid: (Mandatory) the alert's global Unique identifier.</param> /// <returns>EvAlert: The Project alert ResultData object</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Execute the method for retrieving the Alert object /// /// 2. Return the Alert object. /// </remarks> // ------------------------------------------------------------------------------------- public EvAlert getItem(Guid AlertGuid) { this.LogMethod("getItem method. "); this.LogDebug("AlertGuid: " + AlertGuid); EvAlert _ProjectAlert = this._dalProjectAlerts.getItem(AlertGuid); this.LogDebug(this._dalProjectAlerts.Status); return(_ProjectAlert); }//END getItem method
}//END updateState method. #endregion #region project alert Processing update // ===================================================================================== /// <summary> /// This class acknowledges items from the Alert ResultData table. /// </summary> /// <param name="RecordId">string: (Mandatoy) A record identifier</param> /// <param name="TypeId">EvAlert.AlertTypes: (Mandatoy) An alert QueryType identifier</param> /// <param name="UserCommonName">string: (Mandatoy) User's Common Name</param> /// <returns>EvEventCodes: an event code for acknowleging items</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Retrieve a list of alert object. /// /// 2. Exit, if the Alerts list is empty. /// /// 3. Else, extract the first row to the Alert object. /// /// 4. Update the Alert state and execute the method for acknowledging items. /// /// 5. Return an event code for acknowledging items. /// </remarks> // ------------------------------------------------------------------------------------- public EvEventCodes AcknowledgeAlert( String RecordId, EvAlert.AlertTypes TypeId, String UserCommonName) { this.LogMethod("AcknowledgeAlert method."); this.LogDebug("RecordId: " + RecordId); this.LogDebug("TypeId: " + TypeId); // // Define the local variables. // EvEventCodes iReturn = EvEventCodes.Ok; // // Retrieve the Records Alerts. // ArrayList alertList = this._dalProjectAlerts.getViewByRecord(RecordId, TypeId, EvAlert.AlertStates.Raised); // // No alerts to be Acknowledged. // if (alertList.Count == 0) { return(EvEventCodes.Ok); } EvAlert alert = (EvAlert)alertList [0]; alert.State = EvAlert.AlertStates.Acknowledged; alert.Action = EvAlert.AlertSaveActionCodes.Acknowledge_Alert; alert.UserCommonName = UserCommonName; // // Update the _ProjectAlert record state to reflect the requested action. // updateState(alert); // // Update the _ProjectAlert record. // iReturn = this._dalProjectAlerts.updateItem(alert); this.LogDebug(this._dalProjectAlerts.Status); return(iReturn); }//END AcknowledgeAlert method
}//END getListObject method. // ============================================================================== /// <summary> /// This method returns a client application ResultData object /// </summary> /// <param name="Page">Evado.Model.UniForm.Page.</param> // ------------------------------------------------------------------------------ private void getListObject_Selection_Group ( Evado.Model.UniForm.Page Page ) { this.LogMethod ( "getListObject_Selection_Group" ); // // Initialise the methods variables and objects. // Evado.Model.UniForm.Field groupField = new Model.UniForm.Field ( ); Evado.Model.UniForm.Command command = new Model.UniForm.Command ( ); List<EvOption> optionList = new List<EvOption>(); // // Create the new pageMenuGroup. // Evado.Model.UniForm.Group pageGroup = Page.AddGroup ( EvLabels.Alert_List_Selection_Group_Title, Evado.Model.UniForm.EditAccess.Enabled ); pageGroup.Layout = Evado.Model.UniForm.GroupLayouts.Full_Width; // // generate the alert state option list. // optionList = EvAlert.getTypeList ( ); // // create the alert type selection // groupField = pageGroup.createSelectionListField ( EuAlerts.CONST_ALERT_TYPE, EvLabels.Alert_List_Alert_Type_Field_Label, this.Session.AlertType.ToString(), optionList ); groupField.Layout = EuRecordGenerator.ApplicationFieldLayout; groupField.AddParameter ( Evado.Model.UniForm.FieldParameterList.Snd_Cmd_On_Change, 1 ); // // generate the alert types option list. // optionList = EvAlert.getStateList ( ); // // create the alert type selection field. // groupField = pageGroup.createSelectionListField ( EuAlerts.CONST_ALERT_STATE, EvLabels.Alert_List_Alert_State_Field_Label, this.Session.AlertState.ToString ( ), optionList ); groupField.Layout = EuRecordGenerator.ApplicationFieldLayout; groupField.AddParameter ( Evado.Model.UniForm.FieldParameterList.Snd_Cmd_On_Change, 1 ); // // Add the selection groupCommand // command = pageGroup.addCommand ( EvLabels.Alert_List_Selection_Command_Title, EuAdapter.APPLICATION_ID, EuAdapterClasses.Alert.ToString ( ), Evado.Model.UniForm.ApplicationMethods.Custom_Method ); command.setCustomMethod ( Evado.Model.UniForm.ApplicationMethods.List_of_Objects ); }//END getListObject_Selection_Group method
} //END CloseAlert method #endregion #region Static method: Raise alert method. // ===================================================================================== /// <summary> /// This class raises items on the Alert ResultData object. /// </summary> /// <param name="ProjectId">string: A Project identifier</param> /// <param name="OrgId">string: an organization identifier</param> /// <param name="RecordId">string: A Record identifier</param> /// <param name="Message">string: An alert's message</param> /// <param name="FromUserName">string: a user name whose alert is sent from</param> /// <param name="ToUserName">string: a user name whose alert is sent to</param> /// <param name="TypeId">EvAlert.AlertTypes: An alert QueryType</param> /// <returns>EvEventCodes: an event code for raising items</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Update the FirstSubject's value based on the RecordTypeId. /// /// 2. Set the Alert object's values and execute the method for adding Alert object's values to database. /// /// 3. Return the event code for raising items. /// </remarks> // ------------------------------------------------------------------------------------- public static EvEventCodes RaiseAlert( String ProjectId, String OrgId, String RecordId, String Message, String FromUserName, String ToUserName, EvAlert.AlertTypes TypeId) { // // Define the local variables. // EvEventCodes iReturn = EvEventCodes.Ok; Evado.Dal.Digital.EvAlerts dalProjectAlerts = new Evado.Dal.Digital.EvAlerts( ); EvAlert alert = new EvAlert( ); string subject = String.Empty; // // Update the milestone's values based on the RecordTypeId. // switch (TypeId) { case EvAlert.AlertTypes.Trial_Record: { subject = String.Format( EvLabels.Alert_Data_Record_Alert_Message, RecordId, DateTime.Now.ToString("dd MMM yyyy")); break; } case EvAlert.AlertTypes.Adverse_Event_Report: { subject = String.Format( EvLabels.Alert_Adverse_Event_Alert_Subject, RecordId, DateTime.Now.ToString("dd MMM yyyy")); break; } case EvAlert.AlertTypes.Serious_Adverse_Event_Report: { subject = String.Format( EvLabels.Alert_Serious_Adverse_Event_Alert_Subject, RecordId, DateTime.Now.ToString("dd MMM yyyy")); break; } case EvAlert.AlertTypes.Concomitant_Medication: { subject = String.Format( EvLabels.Alert_Concomitant_Medication_Alert_Subject, RecordId, DateTime.Now.ToString("dd MMM yyyy")); break; } case EvAlert.AlertTypes.Subject_Record: { subject = String.Format( EvLabels.Alert_Subject_Alert_Subject, RecordId, DateTime.Now.ToString("dd MMM yyyy")); break; } } // // Update the Alert object's values. // alert.ProjectId = ProjectId; alert.ToOrgId = OrgId; alert.RecordId = RecordId; alert.Subject = subject; alert.NewMessage = Message; alert.UserCommonName = FromUserName; alert.ToUser = ToUserName; alert.FromUser = FromUserName; alert.Action = EvAlert.AlertSaveActionCodes.Raise_Alert; alert.TypeId = TypeId; // // Add the Alert object's values to the database // iReturn = dalProjectAlerts.addItem(alert); EvApplicationEvent applicationEvent = new EvApplicationEvent( EvApplicationEvent.EventType.Action, EvEventCodes.Ok, "Evado.Bll.Clinical.EvAlerts", dalProjectAlerts.Status, FromUserName); EvApplicationEvents.NewEvent(applicationEvent); return(iReturn); }//END RaiseAlert method
}//END saveAlert method // ===================================================================================== /// <summary> /// This class updates the state of the Alert object. /// </summary> /// <param name="Alert">EvAlert: The ProjectAlert object.</param> /// <remarks> /// This method consists of the following steps: /// /// 1. Update the Alert object's values based on the Save action code. /// </remarks> // ------------------------------------------------------------------------------------- private void updateState(EvAlert Alert) { this.LogMethod("updateState, Action: " + Alert.Action); // // Set the DateTime strings for the update. // string stDateTimeNow = DateTime.Now.ToString("MMM dd yyyy HH:mm"); // // Update _ProjectAlert state for Saved action. // if (Alert.Action == EvAlert.AlertSaveActionCodes.Raise_Alert) { Alert.State = EvAlert.AlertStates.Raised; Alert.FromUser = Alert.UserCommonName; Alert.Raised = DateTime.Now; this.LogDebug("Raised"); } // // Update _ProjectAlert states for recieve action. // else if (Alert.Action == EvAlert.AlertSaveActionCodes.Acknowledge_Alert) { Alert.State = EvAlert.AlertStates.Acknowledged; Alert.AcknowledgedByUserId = Alert.UpdatedByUserId; Alert.AcknowledgedBy = Alert.UserCommonName; Alert.Acknowledged = DateTime.Now; this.LogDebug("Acknowledged."); } // // Update _ProjectAlert states for Raise action. // else if (Alert.Action == EvAlert.AlertSaveActionCodes.Close_Alert && Alert.State == EvAlert.AlertStates.Raised) { Alert.State = EvAlert.AlertStates.Closed; Alert.AcknowledgedByUserId = Alert.UpdatedByUserId; Alert.AcknowledgedBy = Alert.UserCommonName; Alert.Acknowledged = DateTime.Now; Alert.ClosedBy = Alert.UserCommonName; Alert.ClosedByUserId = Alert.UpdatedByUserId; Alert.Closed = DateTime.Now; this.LogDebug("Notification - Alert Closed."); } // // Update _ProjectAlert states for Raise action. // else if (Alert.Action == EvAlert.AlertSaveActionCodes.Close_Alert) { Alert.State = EvAlert.AlertStates.Closed; Alert.ClosedBy = Alert.UserCommonName; Alert.ClosedByUserId = Alert.UpdatedByUserId; Alert.Closed = DateTime.Now; this.LogDebug("Alert Closed."); } // // If a new comment has been added then append to the comments newField // if (Alert.NewMessage != String.Empty) { string sMessage = "\r\n" + Alert.NewMessage + "\r\nBy: " + Alert.UserCommonName + " at: " + stDateTimeNow + "\r\n__________________________________________________" + "\r\n" + Alert.Message; Alert.Message = sMessage; } this.LogDebug("Alert State: " + Alert.State); this.LogValue("Alert Status update completed"); }//END updateState method.