示例#1
0
    // ==================================================================================
    /// <summary>
    /// This method appendes the page command to the debug log for the class and adds
    /// a new line at the end of the text.
    /// </summary>
    /// <param name="Value">String:  debug text.</param>
    // ----------------------------------------------------------------------------------
    public void LogAction ( Evado.UniForm.Model.Command PageCommand, bool WithParameters )
    {
      //
      // get the command values.
      //
      string Value = "PageCommand: " + PageCommand.getAsString ( false, WithParameters );

      //
      // Append the value to the text log.
      //
      this._AdapterLog.AppendLine (
        DateTime.Now.ToString ( "dd-MM-yy hh:mm:ss" ) + " ACTION:  " + Value );

      //
      // create the aplplication event
      //
      EvApplicationEvent applicationEvent = new EvApplicationEvent (
        EvApplicationEvent.EventType.Action,
        EvEventCodes.Ok,
        this.ClassNameSpace,
        Value,
        this.Session.UserProfile.UserId );

      //
      // Log the application event.
      //
      this.AddEvent ( applicationEvent );
    }
示例#2
0
    // ==================================================================================
    /// <summary>
    /// This method appends EVENT to the class log
    /// a new line at the end of the text.
    /// </summary>
    /// <param name="Ex">Exception object.</param>
    // ----------------------------------------------------------------------------------
    public void LogException ( Exception Ex )
    {
      String value = "NameSpace: " + this.ClassNameSpace
       + "\r\nUser: "******"\r\nCommonName: " + this.Session.UserProfile.CommonName
       + "\r\n" + EvStatics.getException ( Ex );

      // 
      // Initialise the method variables
      // 
      EvApplicationEvent applicationEvent = new EvApplicationEvent (
        EvApplicationEvent.EventType.Error,
        EvEventCodes.Ok,
        this.ClassNameSpace,
        value,
        this.Session.UserProfile.UserId );

      this.AddEvent ( applicationEvent );

      if ( this._ClassParameters.LoggingLevel >= 0 )
      {
        this._AdapterLog.AppendLine ( DateTime.Now.ToString ( "dd-MM-yy hh:mm:ss" ) + " EXCEPTION EVENT: " );
        this._AdapterLog.AppendLine ( value );
      }
    }//END LogException class
示例#3
0
        }//END LogEvent class

        // ==================================================================================
        /// <summary>
        /// This method appends EVENT to the class log
        /// a new line at the end of the text.
        /// </summary>
        /// <param name="Ex">Exception object.</param>
        // ----------------------------------------------------------------------------------
        protected void LogException(Exception Ex)
        {
            String value = "NameSpace: " + this.ClassNameSpace
                           + "\r\nUser: "******"\r\nUserCommonName: " + this.ClassParameters.UserProfile.CommonName
                           + "\r\n" + EvStatics.getException(Ex);

            //
            // Initialise the method variables
            //
            EvApplicationEvent applicationEvent = new EvApplicationEvent(
                EvApplicationEvent.EventType.Error,
                EvEventCodes.Ok,
                this.ClassNameSpace,
                value,
                this.ClassParameters.UserProfile.UserId);

            this.AddEvent(applicationEvent);

            //
            // Add to the local log.
            //
            this._Log.AppendLine(DateTime.Now.ToString("dd-MM-yy hh:mm:ss") + " EXCEPTION EVENT: ");
            this._Log.AppendLine(value);
        }//END LogException class
示例#4
0
    }//END LogException class

    //  ===========================================================================
    /// <summary>
    /// This class creates the Evado EvEvent Source. This requires administrator privileges
    /// because it needs to write to the registry have.
    /// </summary>
    /// <param name="ClassMethodAccessed">String: a class method accessed string</param>
    /// <param name="User">Evado.Digital.Model.EvUserProfile: A user's profile</param>
    /// <returns>Boolean: true, If the event source was created successfully.</returns>
    /// <remarks>
    /// This method consists of the following steps: 
    /// 
    /// 1. Set Site and EventLogSource2 to default value, if they are not empty.
    /// 
    /// 2. Update the application event value. 
    /// 
    /// 3. Adding items to application event table.
    /// 
    /// 4. Return false, if the adding runs fail
    /// 
    /// 5. Else, return ture. 
    /// </remarks>
    //  ---------------------------------------------------------------------------------
    public void LogPageAccess (
     String ClassMethodAccessed,
      Evado.Digital.Model.EdUserProfile User )
    {
      // 
      // Initialise the method variables
      // 
      string stEvent = "UserId: " + User.UserId
            + " CommonName: " + User.CommonName
            + " opened this " + ClassMethodAccessed 
            + " method at " + DateTime.Now.ToString ( "dd MMM yyyy HH:mm:ss" );

      //
      // Append the value to the text log.
      //
      this._AdapterLog.AppendLine (
        DateTime.Now.ToString ( "dd-MM-yy hh:mm:ss" ) + " ACTION:  " + stEvent );

      //
      // create the application event
      //
      EvApplicationEvent applicationEvent = new EvApplicationEvent (
        EvApplicationEvent.EventType.Action,
        EvEventCodes.Ok,
        this.ClassNameSpace,
        stEvent,
        User.CommonName );

      //
      // Log the event to the application log.
      //
      this.AddEvent ( applicationEvent );

    }//END LogPageAccess class
        }//END getView method.

        #endregion

        #region Get Event section

        // =====================================================================================
        /// <summary>
        /// This class gets ApplicationEvent data object by its unique object identifier.
        /// </summary>
        /// <param name="EventGuid">String: (Mandatory) Unique identifier.</param>
        /// <returns>ApplicationEvent: an item of application event</returns>
        /// <remarks>
        /// This method consists of the following steps:
        ///
        /// 1. Initialize a status string and an application event object
        ///
        /// 2. Validate whether the Unique identifier is not zero
        ///
        /// 3. Define the query parameters and the query string
        ///
        /// 4. Execute the query string
        ///
        /// 5. Convert the value from data reader event object to application event business object,
        /// if value exists
        ///
        /// 6. Return the application event value
        /// </remarks>
        // -------------------------------------------------------------------------------------
        public EvApplicationEvent getItem(
            Guid EventGuid)
        {
            this.LogMethod("getItem method. ");
            this.LogDebugValue("EventGuid: " + EventGuid);
            //
            // Initialize a status string and an application event object
            //
            EvApplicationEvent applicationEvent = new EvApplicationEvent( );

            //
            // Check that there is a valid unique identifier.
            //
            if (EventGuid == Guid.Empty)
            {
                return(applicationEvent);
            }

            //
            // Define the query parameters.
            //
            SqlParameter cmdParms = new SqlParameter(PARM_GUID, SqlDbType.UniqueIdentifier);

            cmdParms.Value = EventGuid;

            //
            // Define the query string.
            //
            _sqlQueryString = _sqlQuery_View
                              + " WHERE (" + DB_GUID + " = " + PARM_GUID + " ); ";

            using (DataTable table = EvSqlMethods.RunQuery(_sqlQueryString, cmdParms))
            {
                //
                // If not rows the return
                //
                if (table.Rows.Count == 0)
                {
                    return(applicationEvent);
                }

                //
                // Extract the table row and store the data row to an activity object
                //
                DataRow row = table.Rows [0];

                applicationEvent = this.getReaderData(row);
            }

            //
            // Pass back the data object.
            //
            return(applicationEvent);
        }//END getItem class
示例#6
0
        }// End getMilestoneList method.

        #endregion

        #region Get object methods

        // =====================================================================================
        /// <summary>
        /// This class gets EvApplicationEvent ResultData object by its unique identifier.
        /// </summary>
        /// <param name="EventGuid">string: a unique identifier</param>
        /// <returns>EvApplicationEvent: An application event ResultData object</returns>
        /// <remarks>
        /// This method consists of the following steps:
        ///
        /// 1. Retrieve the application event object.
        ///
        /// 2. Return the application event object.
        /// </remarks>
        // -------------------------------------------------------------------------------------
        public EvApplicationEvent getItem(Guid EventGuid)
        {
            this.LogMethod("getEventList method. ");
            this.LogDebugValue("EventGuid: " + EventGuid);

            EvApplicationEvent applicationEvent = this._dalApplicationEvents.getItem(EventGuid);

            this.LogClass(this._dalApplicationEvents.Log);

            return(applicationEvent);
        }//END getItem class.
        }//END GetParameters method

        // =====================================================================================
        /// <summary>
        /// This class sets the query parameter values.
        /// </summary>
        /// <param name="cmdParms">SqlParameter: a database parameters array</param>
        /// <param name="ApplicationEvent">EvApplicationEvent: an applicationEvent data object</param>
        /// <remarks>
        /// This method consists of the following step:
        ///
        /// 1. Update value of the database parameters with the value from application event object' items
        /// </remarks>
        // -------------------------------------------------------------------------------------
        private void SetParameters(
            SqlParameter [] cmdParms,
            EvApplicationEvent ApplicationEvent)
        {
            cmdParms [0].Value = (int)ApplicationEvent.EventId;
            cmdParms [1].Value = ApplicationEvent.Type.ToString( );
            cmdParms [2].Value = ApplicationEvent.Category;
            cmdParms [3].Value = ApplicationEvent.UserId;
            cmdParms [4].Value = ApplicationEvent.Description;
            cmdParms [5].Value = ApplicationEvent.PageUrl;
            cmdParms [6].Value = ApplicationEvent.CustomerId;
        }//END SetParameters method.
示例#8
0
    // ==================================================================================
    /// <summary>
    /// This method appendes the debuglog string to the debug log for the class and adds
    /// a new line at the end of the text.
    /// </summary>
    /// <param name="Value">String:  debug text.</param>
    // ----------------------------------------------------------------------------------
    protected void LogEvent ( String Value )
    {
      EvApplicationEvent applicationEvent = new EvApplicationEvent (
        EvApplicationEvent.EventType.Warning,
        EvEventCodes.Ok,
        this.ClassNameSpace,
        Value,
        this.Session.UserProfile.UserId );

      this.AddEvent ( applicationEvent );

      this._AdapterLog.AppendLine (
        DateTime.Now.ToString ( "dd-MM-yy hh:mm:ss" ) + " EVENT:  " + Value );
    }
示例#9
0
 // =====================================================================================
 /// <summary>
 /// This class adds items to the application event table.
 /// </summary>
 /// <param name="ApplicationEvent">EvApplicationEvent: An application event object</param>
 /// <returns>EvEventCodes: an event code for adding items</returns>
 // -------------------------------------------------------------------------------------
 public EvEventCodes AddEvent(
     EvApplicationEvent ApplicationEvent)
 {
     try
     {
         //
         // If the action is set to delete the object.
         //
         return(dalApplicationEvents.addEvent(ApplicationEvent));
     }
     catch
     {
         return(EvEventCodes.Database_Record_Update_Error);
     }
 }//END AddApplicationEvent class
示例#10
0
    // =====================================================================================
    /// <summary>
    /// This class adds a new application event object to the database. 
    /// </summary>
    /// <param name="ApplicationEvent">EvApplicationEvent: An application event object</param>
    /// <returns>EvEventCodes: an event code for adding items</returns>
    // -------------------------------------------------------------------------------------
    private EvEventCodes AddEvent (
      EvApplicationEvent ApplicationEvent )
    {
      Evado.Digital.Bll.EvApplicationEvents bll_ApplicationEvents = new Evado.Digital.Bll.EvApplicationEvents (
        this.ClassParameters );

      try
      {
        return bll_ApplicationEvents.AddEvent ( ApplicationEvent );
      }
      catch(Exception Ex )
      {
        this._AdapterLog.AppendLine( Evado.Model.EvStatics.getException( Ex ) );

        return EvEventCodes.Database_Record_Update_Error;
      }

    }//END AddEvent method
示例#11
0
        }//END method AddEvent

        #endregion

        #region Static methods
        // =====================================================================================
        /// <summary>
        /// This class adds items to the application event table.
        /// </summary>
        /// <param name="ApplicationEvent">EvApplicationEvent: An application event object</param>
        /// <returns>EvEventCodes: an event code for adding items</returns>
        /// <remarks>
        /// This method consists of the following steps:
        ///
        /// 1. Execute the method for adding items to application event ResultData table.
        ///
        /// 2. Return event code for adding items.
        ///
        /// 3. Else, exit.
        /// </remarks>
        // -------------------------------------------------------------------------------------
        public static EvEventCodes NewEvent(
            EvApplicationEvent ApplicationEvent)
        {
            try
            {
                //
                // Initialise the method variables
                //
                Evado.Digital.Dal.EvApplicationEvents dalApplicationEvents = new Evado.Digital.Dal.EvApplicationEvents( );

                //
                // If the action is set to delete the object.
                //
                return(dalApplicationEvents.addEvent(ApplicationEvent));
            }
            catch
            {
                return(EvEventCodes.Database_Communications_Error);
            }
        }//END AddEvent class
        }//END getItem class

        #endregion

        #region Add EvEvent section

        // =====================================================================================
        /// <summary>
        /// This method adds an ApplicationEvent data object to the database.
        /// </summary>
        /// <param name="ApplicationEvent">EvApplicationEvent: an application event data object</param>
        /// <returns>EvEventCodes: a code of an event</returns>
        /// <remarks>
        /// This method consists of the following steps:
        ///
        /// 1. Initialize the status string
        ///
        /// 2. Check that the user identifier is valid
        ///
        /// 3. Remove the domain name from user identifier
        ///
        /// 4. Define the SQL query parameters and load the query values.
        ///
        /// 5. Execute the update command.
        /// </remarks>
        // -------------------------------------------------------------------------------------
        public EvEventCodes addEvent(
            EvApplicationEvent ApplicationEvent)
        {
            this.LogMethod("addEvent method. ");
            this.LogDebugValue("EventId: " + ApplicationEvent.EventId);
            //
            // Check that the user identifier is valid
            //
            if (ApplicationEvent.EventId > 1)
            {
                return(EvEventCodes.Data_InvalidId_Error);
            }

            //
            // Remove the domain name from user identifier
            //
            if (ApplicationEvent.UserId != null)
            {
                //ApplicationEvent.UserName = EvStatics.removeDomainName ( ApplicationEvent.UserName );
            }

            //
            // Define the SQL query parameters and load the query values.
            //
            SqlParameter [] _cmdParms = GetParameters( );
            SetParameters(_cmdParms, ApplicationEvent);

            //
            // Execute the update command.
            //
            if (EvSqlMethods.StoreProcUpdate(_STORED_PROCEDURE_AddItem, _cmdParms) == 0)
            {
                this.LogMethodEnd("addEvent");
                return(EvEventCodes.Database_Record_Update_Error);
            }

            this.LogMethodEnd("addEvent");
            return(EvEventCodes.Ok);
        } // Close method addTestReport
示例#13
0
        }//END LogException class

        // =====================================================================================
        /// <summary>
        /// This class checks whether the event's description,  Category and user name are written to the logError
        /// </summary>
        /// <param name="EventId">Integer: an event identifier</param>
        /// <param name="Description">string: an event's description</param>
        /// <returns>Boolean: true, if the event is logged</returns>
        /// <remarks>
        /// This method consists of the following steps:
        ///
        /// 1. Fill the application event object.
        ///
        /// 2. Write the application event log
        ///
        /// 3. Adding items to application event table.
        ///
        /// 4. Return true, if adding runs successfully.
        ///
        /// </remarks>
        // -------------------------------------------------------------------------------------
        public void LogError(
            EvEventCodes EventId,
            String Description)
        {
            //
            // Initialise the method variables
            //
            EvApplicationEvent applicationEvent = new EvApplicationEvent(
                EvApplicationEvent.EventType.Error,
                EventId,
                this.ClassNameSpace,
                Description,
                this.ClassParameters.UserProfile.UserId);

            this.AddEvent(applicationEvent);

            if (this._ClassParameters.LoggingLevel >= 0)
            {
                this._Log.AppendLine(DateTime.Now.ToString("dd-MM-yy hh:mm:ss") + " EXCEPTION EVENT: ");
                this._Log.AppendLine(Description);
            }
        }//END LogError method
示例#14
0
    // =====================================================================================
    /// <summary>
    /// This class checks whether the event's description,  Category and user name are written to the logError
    /// </summary>
    /// <param name="EventId">Integer: an event identifier</param>
    /// <param name="Description">string: an event's description</param>
    /// <returns>Boolean: true, if the event is logged</returns>
    /// <remarks>
    /// This method consists of the following steps: 
    /// 
    /// 1. Fill the application event object. 
    /// 
    /// 2. Write the application event log
    /// 
    /// 3. Adding items to application event table. 
    /// 
    /// 4. Return true, if adding runs successfully. 
    /// 
    /// </remarks>
    // -------------------------------------------------------------------------------------
    public void LogError (
      EvEventCodes EventId )
    {
      // 
      // Initialise the method variables
      // 
      String stEvent = "EventId: " + EventId;

      EvApplicationEvent applicationEvent = new EvApplicationEvent (
        EvApplicationEvent.EventType.Error,
        EventId,
        this.ClassNameSpace,
        stEvent,
        this.Session.UserProfile.UserId );

      this.AddEvent ( applicationEvent );

      this._AdapterLog.AppendLine ( DateTime.Now.ToString ( "dd-MM-yy hh:mm:ss" )
        + " EXCEPTION EVENT: " );
      this._AdapterLog.AppendLine ( stEvent );

    }//END LogError method
        //
        // Define the class EventId property and variable.
        //
        #endregion

        #region Data Reader section

        // ==================================================================================
        /// <summary>
        /// This class reads the content of the data reader object into ApplicationEvent business object.
        /// </summary>
        /// <param name="Row">DataRow: a data row object</param>
        /// <remarks>
        /// This method consists of the following step:
        ///
        /// 1. Convert the elements from data reader object into the elements
        /// in application event business object.
        /// </remarks>
        // ----------------------------------------------------------------------------------
        public EvApplicationEvent getReaderData(DataRow Row)
        {
            EvApplicationEvent Event = new EvApplicationEvent( );

            //
            // Convert the elements from data reader object into the elements in application event business object.
            //
            Event.Guid     = EvSqlMethods.getGuid(Row, DB_GUID);
            Event.EventId  = EvSqlMethods.getInteger(Row, DB_EVENT_ID);
            Event.DateTime = EvSqlMethods.getDateTime(Row, DB_DATE_TIME);
            string sType = EvSqlMethods.getString(Row, DB_EVENT_TYPE);

            if (sType == "A")
            {
                sType = "Action";
            }
            if (sType == "I")
            {
                sType = "Information";
            }
            if (sType == "W")
            {
                sType = "Warning";
            }
            if (sType == "E")
            {
                sType = "Error";
            }

            Event.Type = Evado.Model.EvStatics.parseEnumValue <EvApplicationEvent.EventType> (sType);

            Event.Category    = EvSqlMethods.getString(Row, DB_EVENT_CATEGORY);
            Event.UserId      = EvSqlMethods.getString(Row, DB_USER_NAME);
            Event.Description = EvSqlMethods.getString(Row, DB_DESCRIPTION);
            Event.PageUrl     = EvSqlMethods.getString(Row, DB_PAGE_URL);
            Event.CustomerId  = EvSqlMethods.getString(Row, DB_SITE);

            return(Event);
        }//END getRowData method.
示例#16
0
        }//END getItem class.

        #endregion

        #region Save object methods

        // =====================================================================================
        /// <summary>
        /// This class adds items to the Application event datatable.
        /// </summary>
        /// <param name="ApplicationEvent">EvApplicationEvent: an application event ResultData object</param>
        /// <returns>EvEventCodes: an event code for adding items</returns>
        /// <remarks>
        /// This class consists of the following steps:
        ///
        /// 1. Add items to the application events table.
        ///
        /// 2. Return the event code for adding items.
        /// </remarks>
        // -------------------------------------------------------------------------------------
        public EvEventCodes AddEvent(EvApplicationEvent ApplicationEvent)
        {
            this.LogMethod("AddEvent method. ");
            this.LogDebugValue("EventId: " + ApplicationEvent.EventId);
            EvEventCodes result = EvEventCodes.Ok;

            if (ApplicationEvent.UserId == String.Empty)
            {
                ApplicationEvent.UserId = "Evado Executive";
            }

            //
            // If the action is set to delete the object.
            //
            result = this._dalApplicationEvents.addEvent(ApplicationEvent);

            this.LogClass(this._dalApplicationEvents.Log);

            this.LogDebugValue("result: " + result);

            return(result);
        }//END method AddEvent
示例#17
0
    }//END LogError method

    // ==================================================================================
    /// <summary>
    /// This method appendes the debuglog string to the debug log for the class and adds
    /// a new line at the end of the text.
    /// </summary>
    /// <param name="Value">String:  debug text.</param>
    // ----------------------------------------------------------------------------------
    public void LogAction ( string Value )
    {
      //
      // create the application event
      //
      EvApplicationEvent applicationEvent = new EvApplicationEvent (
        EvApplicationEvent.EventType.Action,
        EvEventCodes.Ok,
        this.ClassNameSpace,
        Value,
        this.Session.UserProfile.UserId );

      //
      // Log the application event.
      //
      this.AddEvent ( applicationEvent );

      //
      // Append the value to the text log.
      //
      this._AdapterLog.AppendLine (
        DateTime.Now.ToString ( "dd-MM-yy hh:mm:ss" ) + " ACTION:  " + Value );
    }
示例#18
0
        }//END LogMethodEnd class

        // ==================================================================================
        /// <summary>
        /// This method appends EVENT to the class log
        /// a new line at the end of the text.
        /// </summary>
        /// <param name="Value">String:  debug text.</param>
        // ----------------------------------------------------------------------------------
        protected void LogEvent(String Value)
        {
            //
            // Initialise the method variables
            //
            EvEventCodes       iReturn          = EvEventCodes.Ok;
            EvApplicationEvent ApplicationEvent = new EvApplicationEvent(
                EvApplicationEvent.EventType.Warning,
                EvEventCodes.Ok,
                this.ClassNameSpace,
                Value,
                this.ClassParameters.UserProfile.UserId);

            if (this._ClassParameters.LoggingLevel >= 0)
            {
                this._Log.AppendLine(DateTime.Now.ToString("dd-MM-yy hh:mm:ss") + " EVENT: ");
                this._Log.AppendLine(Value);
            }

            //
            // If the action is set to delete the object.
            //
            iReturn = this.AddEvent(ApplicationEvent);
        }//END LogEvent class
示例#19
0
    }//END getListObject method.

    // ==============================================================================
    /// <summary>
    /// This method returns a client application ResultData object
    /// </summary>
    /// <param name="PageCommand">Evado.UniForm.Model.Command object.</param>
    /// <returns>ClientApplicationData object</returns>
    //  ------------------------------------------------------------------------------
    private Evado.UniForm.Model.AppData getObject (
      Evado.UniForm.Model.Command PageCommand )
    {
      this.LogMethod ( "getObject" );
      // 
      // Initialise the methods variables and objects.
      // 
      Evado.UniForm.Model.AppData clientDataObject = new Evado.UniForm.Model.AppData ( );

      //
      // Determine if the user has access to this page and log and error if they do not.
      //
      if ( this.Session.UserProfile.hasManagementAccess == false )
      {
        this.LogIllegalAccess (
          "Evado.UniForm.Clinical.ApplicationEvents.getListObject",
          this.Session.UserProfile );

        this.ErrorMessage = EdLabels.Illegal_Page_Access_Attempt;

        return null;
      }

      // 
      // Log access to page.
      // 
      this.LogPageAccess (
        "Evado.UniForm.Clinical.ApplicationEvents.getObject",
        this.Session.UserProfile );

      // 
      // if the parameter value exists then set the customerId
      // 
      Guid objectGuid = PageCommand.GetGuid ( );
      this.LogValue ( "objectGuid: " + objectGuid );

      try
      {
        // 
        // Retrieve the customer object from the database via the DAL and BLL layers.
        // 
        this._ApplicationEvent = this._Bll_ApplicationEvents.getItem ( objectGuid );

        this.LogClass ( this._Bll_ApplicationEvents.Log );

        this.LogValue ( "EventId: " + this._ApplicationEvent.EventId );
        // 
        // return the client ResultData object for the customer.
        // 
        this.getDataObject ( clientDataObject );

        return clientDataObject;
      }
      catch ( Exception Ex )
      {
        // 
        // Create the error message to be displayed to the user.
        // 
        this.ErrorMessage = EdLabels.ApplicationEvent_Page_Error_Message;

        // 
        // Generate the log the error event.
        // 
        this.LogException ( Ex );
      }

      return this.Session.LastPage;

    }//END getObject method
示例#20
0
        } //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 SetParameters method.

        #endregion

        #region Class Query method section

        // =====================================================================================
        /// <summary>
        /// This class gets a ArrayList containing a selectionList of ApplicationEvent data objects.
        /// </summary>
        /// <param name="EventId">int: The event identifier</param>
        /// <param name="EventType">String: The event type</param>
        /// <param name="Category">String: The event category</param>
        /// <param name="DateStart">DateTime: The period start date</param>
        /// <param name="DateFinish">DateTime: The period finish date</param>
        /// <param name="UserName">String: The user that raised  the event</param>
        /// <returns>List of ApplicationEvent: a list of application event parameters</returns>
        /// <remarks>
        /// This method consists of the following steps:
        ///
        /// 1. Initialize a status string and a return view of the application event.
        ///
        /// 2. Format the started date and finished date and add them to the status string.
        ///
        /// 3. Define the sql query parameters and update them with the retrieving values
        ///
        /// 4. Define the sql query string and execute the query string
        ///
        /// 5. Scroll through the query result
        ///
        /// 6. Convert the result from a data reader event object to an application event business object
        ///
        /// 7. Appent the converted result to a return view.
        /// </remarks>
        // -------------------------------------------------------------------------------------
        public List <EvApplicationEvent> getApplicationEventList(
            int EventId,
            String EventType,
            String Category,
            DateTime DateStart,
            DateTime DateFinish,
            String UserName)
        {
            this.LogMethod("getView method");
            this.LogDebugValue("EventId: " + EventId);
            this.LogDebugValue("Type: " + EventType);
            this.LogDebugValue("Category: " + Category);
            this.LogDebugValue("DateStart: " + DateStart.ToString("dd MMM yy hh:mm"));
            this.LogDebugValue("DateFinish: " + DateFinish.ToString("dd MMM yy hh:mm"));
            this.LogDebugValue("UserName :"******"dd MMM yyyy") + " 00:00 AM";
                DateStart = DateTime.Parse(stStartDate);
            }

            //
            // Set the finish date to default of one day
            //
            if (DateFinish == Evado.Model.EvStatics.CONST_DATE_NULL &&
                DateStart > Evado.Digital.Model.EvcStatics.CONST_DATE_NULL)
            {
                DateFinish = DateStart.AddDays(1);
            }

            //
            // Format the finished date
            //
            String stDateFinish = DateFinish.ToString("dd MMM yyyy") + " 23:59 PM";

            DateFinish = DateTime.Parse(stDateFinish);

            //
            // Add started date and finished date to the status string.
            //
            this.LogDebugValue("DateStart: " + DateStart.ToString("dd MMM yyyy HH:mm"));
            this.LogDebugValue("DateFinish: " + DateFinish.ToString("dd MMM yyyy HH:mm"));

            //
            // Define the SQL query parameters.
            //
            SqlParameter [] cmdParms = new SqlParameter []
            {
                new SqlParameter(PARM_EVENT_ID, SqlDbType.SmallInt),
                new SqlParameter(PARM_EVENT_TYPE, SqlDbType.Char, 1),
                new SqlParameter(PARM_EVENT_CATEGORY, SqlDbType.NVarChar, 20),
                new SqlParameter(PARM_DATE_STATE, SqlDbType.DateTime),
                new SqlParameter(PARM_DATE_FINISH, SqlDbType.DateTime),
                new SqlParameter(PARM_USER_NAME, SqlDbType.NVarChar, 100),
            };

            //
            // Update retrieving values to the sql query parameters.
            //
            cmdParms [0].Value = EventId;
            cmdParms [1].Value = EventType;
            cmdParms [2].Value = Category;
            cmdParms [3].Value = DateStart;
            cmdParms [4].Value = DateFinish;
            cmdParms [5].Value = UserName;

            //
            // Define the query string.
            //
            _sqlQueryString = _sqlQuery_View;

            if (EventId < 0)
            {
                _sqlQueryString += " WHERE (" + PARM_EVENT_ID + " = " + DB_EVENT_ID + " ) ";

                if (EventType != String.Empty)
                {
                    _sqlQueryString += " AND (" + PARM_EVENT_TYPE + " = " + DB_EVENT_TYPE + ") ";
                }

                if (Category != String.Empty)
                {
                    _sqlQueryString += " AND (" + PARM_EVENT_CATEGORY + " = " + DB_EVENT_CATEGORY + ") ";
                }

                if (UserName != String.Empty)
                {
                    _sqlQueryString += " AND (" + PARM_USER_NAME + "  = " + DB_USER_NAME + ") ";
                }

                if (DateStart > Evado.Digital.Model.EvcStatics.CONST_DATE_NULL)
                {
                    _sqlQueryString += " AND (" + DB_DATE_TIME + " >= " + PARM_DATE_STATE + ") "
                                       + " AND (" + DB_DATE_TIME + " <= " + PARM_DATE_FINISH + ") ";
                }
            }
            else if (EventType != String.Empty)
            {
                _sqlQueryString += " WHERE (" + PARM_EVENT_TYPE + " = " + DB_EVENT_TYPE + ") ";

                if (UserName != String.Empty)
                {
                    _sqlQueryString += " AND (" + PARM_USER_NAME + "  = " + DB_USER_NAME + ") ";
                }

                if (DateStart > Evado.Digital.Model.EvcStatics.CONST_DATE_NULL)
                {
                    _sqlQueryString += " AND (" + DB_DATE_TIME + " >= " + PARM_DATE_STATE + ") "
                                       + " AND (" + DB_DATE_TIME + " <= " + PARM_DATE_FINISH + ") ";
                }
            }
            else if (Category != String.Empty)
            {
                _sqlQueryString += " WHERE (" + PARM_EVENT_CATEGORY + " = " + DB_EVENT_CATEGORY + ") ";

                if (UserName != String.Empty)
                {
                    _sqlQueryString += " AND (" + PARM_USER_NAME + "  = " + DB_USER_NAME + ") ";
                }

                if (DateStart > Evado.Digital.Model.EvcStatics.CONST_DATE_NULL)
                {
                    _sqlQueryString += " AND (" + DB_DATE_TIME + " >= " + PARM_DATE_STATE + ") "
                                       + " AND (" + DB_DATE_TIME + " <= " + PARM_DATE_FINISH + ") ";
                }
            }
            else
            {
                if (DateStart > Evado.Digital.Model.EvcStatics.CONST_DATE_NULL)
                {
                    _sqlQueryString += " WHERE (" + DB_DATE_TIME + " >= " + PARM_DATE_STATE + ") "
                                       + " AND (" + DB_DATE_TIME + " <= " + PARM_DATE_FINISH + ") ";

                    if (UserName != String.Empty)
                    {
                        _sqlQueryString += " AND (" + PARM_USER_NAME + "  = " + DB_USER_NAME + ") ";
                    }
                }
                else
                {
                    _sqlQueryString += " WHERE (" + PARM_USER_NAME + "  = " + DB_USER_NAME + ") ";
                }
            }

            _sqlQueryString += " ORDER BY " + DB_DATE_TIME + ";";

            this.LogDebugValue(_sqlQueryString);

            //this.LogDebugValue ( EvSqlMethods.getParameters( cmdParms ) );

            //
            // Execute the query against the database.
            //
            using (DataTable table = EvSqlMethods.RunQuery(_sqlQueryString, cmdParms))
            {
                //
                // Iterate through the results table for extracting the role information.
                //
                for (int Count = 0; Count < table.Rows.Count; Count++)
                {
                    DataRow row = table.Rows [Count];

                    EvApplicationEvent Event = this.getReaderData(row);
                    Event.Uid = Count.ToString("00000");;

                    applicationEventList.Add(Event);
                } //END record iteration loop.
            }     //END using statement
            //
            // Pass back the result arrray.
            //
            return(applicationEventList);
        }//END getView method.