Esempio n. 1
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
Esempio n. 2
0
    }//END LogPageAccess 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 LogIllegalAccess (
     String ClassMethodAccessed,
      String RoleId,
      Evado.Digital.Model.EdUserProfile User )
    {
      // 
      // Initialise the method variables
      // 
      System.Text.StringBuilder stEvent = new StringBuilder ( );

      stEvent.AppendFormat (
         "Illegal access attempt UserId: {0} name {1} opened {2} method at {3} ",
         User.UserId, 
         User.CommonName, 
         ClassMethodAccessed, 
         DateTime.Now.ToString ( "dd MMM yyyy HH:mm:ss" ) );
      
      stEvent.AppendFormat ( 
        "Page Role: {0} user Access: {1} ",
        User.Roles, 
        RoleId ); 

      //
      // Log the event to the application log.
      //
      this.LogError ( EvEventCodes.User_Access_Error, stEvent.ToString() );

    }//END LogPageAccess class
        }//END ImportCsvData method.

        //===================================================================================
        /// <summary>
        /// This method executes a CSV import or export query.
        /// </summary>
        /// <param name="UserProfile">Evado.Digital.Model.EdUserProfile object.</param>
        /// <param name="QueryType">EiQueryTypes: Csv encoded data object.</param>
        /// <param name="CsvDataList">List of String: Csv encoded data object.</param>
        /// <returns> Evado.Integration.Model.EiData object</returns>
        //-----------------------------------------------------------------------------------
        public Evado.Integration.Model.EiData ImportData(
            Evado.Digital.Model.EdUserProfile UserProfile,
            EiQueryTypes QueryType,
            List <String> CsvDataList)
        {
            this.LogMethod("ImportData method.");
            this.LogDebug("UserProfile: " + UserProfile.CommonName);
            this.LogDebug("QueryType: " + QueryType);
            this.writeProcessLog("CSV Import Service - Commence processing query data.");
            //
            // Initialise the methods variables and objects.
            //
            Evado.Integration.Model.EiData        resultData      = new  Evado.Integration.Model.EiData( );
            Evado.Digital.Model.EdQueryParameters queryParameters =
                new Evado.Digital.Model.EdQueryParameters( );

            //
            // Get extract the data from the CSV file.
            //
            EiData ImportData = this.getDataObjectFromCsv(
                CsvDataList,
                QueryType);

            /*
             * if ( this.Settings.LoggingLevel > 4 )
             * {
             * foreach ( EiColumnParameters parm in ImportData.Columns )
             * {
             *  string content = String.Format ( "Parm: Field: {0}, Type: {1}, Index: {2}", parm.EvadoFieldId, parm.DataType, parm.Index );
             *  this.LogValue ( content );
             * }
             * }
             */

            //
            // Execute the query.
            //
            resultData = EI_Services.ProcessQuery(ImportData);

            this.LogClass(EI_Services.Log);

            this._ProcessLog.AppendLine(resultData.ProcessLog);

            this.LogMethodEnd("ImportData");
            return(resultData);
        }//END ImportCsvData method.