Ejemplo n.º 1
0
        }//End getMaxColSpan class

        //  =================================================================================
        /// <summary>
        /// This class formats the string value using the pattern
        /// </summary>
        /// <param name="value">String: value to be formatted in its string representation</param>
        /// <param name="column">EvReportColumn: a column object</param>
        /// <returns>string: a string format using mask</returns>
        /// <remarks>
        /// This method consists of the following steps:
        ///
        /// 1. Initialize a pattern string
        ///
        /// 2. Validate whether the pattern is not null and empty
        ///
        /// 3. Switch the datatype of column and update the numberic value defining by the datatypes.
        /// </remarks>
        // ----------------------------------------------------------------------------------
        private string formatUsingMask(String value, EvReportColumn column)
        {
            //
            // Initialize a pattern string
            //
            String pattern = column.ValueFormatingString;

            //
            // Validate whether the pattern is not null and empty
            //
            if (pattern == null || pattern.Equals(String.Empty))
            {
                return(value);
            }

            //
            // Switch the datatype of column and update the numberic value defining by the datatypes.
            //
            switch (column.DataType)
            {
            case EvReport.DataTypes.Currency:
            case EvReport.DataTypes.Float:
            case EvReport.DataTypes.Integer:
            {
                return(EvcStatics.formatDoubleString(value, pattern));
            }

            case EvReport.DataTypes.Date:
            {
                return(EvcStatics.formatDateString(value, pattern));
            }

            default:
            {
                return(value);
            }
            } //END switch
        }     //END formatUsingMask class
Ejemplo n.º 2
0
    }//END getObject method

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

      ClientDataObject.Id = this._ApplicationEvent.Guid;
      ClientDataObject.Title = EdLabels.ApplicationEvent_Page_Title;

      ClientDataObject.Page.Id = ClientDataObject.Id;
      ClientDataObject.Page.Title = ClientDataObject.Title;
      ClientDataObject.Page.EditAccess = Evado.UniForm.Model.EditAccess.Enabled;

      //
      // Add the help button if the help url is defined.
      //
      if ( this.AdapterObjects.HelpUrl != String.Empty )
      {
        Evado.UniForm.Model.Command helpCommand = ClientDataObject.Page.addCommand (
         EdLabels.Label_Help_Command_Title,
         EuAdapter.ADAPTER_ID,
         EuAdapterClasses.Events.ToString ( ),
         Evado.UniForm.Model.ApplicationMethods.Get_Object );

        helpCommand.Type = Evado.UniForm.Model.CommandTypes.Http_Link;

        helpCommand.AddParameter ( Evado.UniForm.Model.CommandParameters.Link_Url,
           EvcStatics.createHelpUrl (
            this.AdapterObjects.HelpUrl,
             Evado.Digital.Model.EdStaticPageIds.Application_Event ) );
      }

      // 
      // create the page pageMenuGroup
      // 
      Evado.UniForm.Model.Group pageGroup = ClientDataObject.Page.AddGroup (
        String.Empty,
        String.Empty,
        Evado.UniForm.Model.EditAccess.Inherited );
      pageGroup.Layout = Evado.UniForm.Model.GroupLayouts.Full_Width;
      pageGroup.EditAccess = Evado.UniForm.Model.EditAccess.Enabled;

      // 
      // Create the customer id object
      // 
      pageField = pageGroup.createReadOnlyTextField (
        String.Empty,
        EdLabels.ApplicationEvent_Date_Time_Field_Label,
        this._ApplicationEvent.DateTime.ToString ( "dd MMM yyyy HH:mm:ss" ) );
      pageField.Layout = EuAdapter.DefaultFieldLayout;

      // 
      // Create the event id object
      // {
      if ( this._ApplicationEvent.EventId == 0
        || this._ApplicationEvent.EventId == 1 )
      {
        this._ApplicationEvent.EventId = (int) EvEventCodes.Ok;
      }

      EvEventCodes code = (EvEventCodes) this._ApplicationEvent.EventId;

      String content = this._ApplicationEvent.EventId.ToString ( "000000" )
        + " > " +
         Evado.Model.EvStatics.enumValueToString ( code );

      pageField = pageGroup.createReadOnlyTextField (
        String.Empty,
        EdLabels.ApplicationEvent_Event_Id_Field_Label,
        content );
      pageField.Layout = EuAdapter.DefaultFieldLayout;

      // 
      // Create the type id object
      // 
      pageField = pageGroup.createReadOnlyTextField (
        String.Empty,
        EdLabels.ApplicationEvent_Type_Field_Label,
         Evado.Model.EvStatics.enumValueToString ( this._ApplicationEvent.Type ) );
      pageField.Layout = EuAdapter.DefaultFieldLayout;

      // 
      // Create the Category id object
      // 
      pageField = pageGroup.createReadOnlyTextField (
        String.Empty,
        EdLabels.ApplicationEvent_Category_Field_Label,
        this._ApplicationEvent.Category );
      pageField.Layout = EuAdapter.DefaultFieldLayout;

      // 
      // Create the description object
      // 
      pageField = pageGroup.createFreeTextField (
        String.Empty,
        EdLabels.ApplicationEvent_Description_Field_Label,
        this._ApplicationEvent.Description,
        80,
        40 );
      pageField.Layout = EuAdapter.DefaultFieldLayout;

      // 
      // Create the user object
      // 
      pageField = pageGroup.createReadOnlyTextField (
        String.Empty,
        EdLabels.ApplicationEvent_UserName_Field_Label,
        this._ApplicationEvent.UserId );
      pageField.Layout = EuAdapter.DefaultFieldLayout;

    }//END Method
Ejemplo n.º 3
0
        }//End getTabulatedSection class

        //  =================================================================================
        /// <summary>
        /// This class obtains the formatted value of the column. It can be a currency, or a check box etc.
        /// </summary>
        /// <param name="section">EvReportSection: a report section</param>
        /// <param name="column">EvReportColumn: a section column</param>
        /// <returns>string: a formatted value string</returns>
        /// <remarks>
        /// This method consists of the following steps:
        ///
        /// 1. Initialize a html string, column value string and column pattern string.
        ///
        /// 2. If a pattern string is not empty, return a formatted value column
        ///
        /// 3. Switch column datatype and update the html string with value defining by datatypes
        /// </remarks>
        // ----------------------------------------------------------------------------------
        private string getFormattedValue(EvReportSection section, EvReportColumn column)
        {
            this.writeDebugLogMethod("getFormattedValue method.");
            //
            // Initialize a html string, column value string and column pattern string.
            //
            String stHtml       = String.Empty;
            string currentValue = (string)section.ColumnValuesByHeaderText [column.HeaderText];
            String pattern      = column.ValueFormatingString == null ? String.Empty : column.ValueFormatingString.Trim( );

            //
            // If a pattern string is not empty, return a formatted value column
            //
            if (pattern != String.Empty)
            {
                String retVal = formatUsingMask(currentValue, column);

                if (retVal.Trim( ) == String.Empty)
                {
                    return("&nbsp;");
                }

                return(retVal);
            }

            //
            // Switch column datatype and update the html string with value defining by datatypes
            //
            switch (column.DataType)
            {
            case EvReport.DataTypes.Bool:
                stHtml += "<input type='checkbox' id='" + column.HeaderText + "-" + section.RowNumber + "' ";
                stHtml += parseBoolean(currentValue) ? "CHECKED " : "";
                stHtml += _report.SelectionOn ? "" : "DISABLED ";
                stHtml += "/>";
                return(stHtml);

            case EvReport.DataTypes.Text:
                stHtml = currentValue;
                stHtml = stHtml.Replace("[[br]]", "[[BR]]");
                stHtml = stHtml.Replace("[[BR]]", "<br/>");
                stHtml = stHtml.Replace("\b", "<br/>");
                return(stHtml);

            case EvReport.DataTypes.Currency:
                return(EvcStatics.formatDoubleString(currentValue, "$###,##0"));

            case EvReport.DataTypes.Date:
                return(EvcStatics.formatDateString(currentValue, "dd/MM/yyyy"));

            case EvReport.DataTypes.Percent:
                try
                {
                    double dVal = double.Parse(currentValue);
                    dVal = dVal / 100;
                    return(dVal.ToString("p1"));
                }
                catch (Exception)
                {
                    return(currentValue);
                }

            default:
                return(currentValue);
            } //END switch
        }     //End getFormattedValue class
Ejemplo n.º 4
0
        }//END getSection method.

        //===================================================================================
        /// <summary>
        /// This class adds the total row after a section.
        /// </summary>
        /// <param name="section">EvReportSection: a report section</param>
        /// <returns>String: a total string</returns>
        /// <remarks>
        /// This method consists of the following steps:
        ///
        /// 1. Validate the secion is not null and empty
        ///
        /// 2. Paint a new table row for total value
        ///
        /// 3. Loop through the detail columns of the row.
        ///
        /// 4. If title does not exists, paint title and add total value
        ///
        /// 5. If title exists, add total value.
        /// </remarks>
        // ----------------------------------------------------------------------------------
        private String addTotal(EvReportSection section)
        {
            this.writeDebugLogMethod("addTotal method.");
            int    span   = getMaxColSpan(section);
            string stHtml = String.Empty;

            //
            // If this section is not null.
            //
            if (section.DetailColumnsList == null &&
                section.Acumulator == null)
            {
                return(String.Empty);
            }

            //
            // If this section is not empty.
            //
            if (section.DetailColumnsList.Count > 0 &&
                section.Acumulator.Count > 0)
            {
                //
                // Paint total new table row
                //
                stHtml += "<tr class='Rpt_Alt'>\n\r";
                //stHtml += "<tr class='" + getClassNameForDetail ( recordNumber + 1 ) + "'>\n\r";

                //
                // The title should be set one column before the first total,
                // and should span from the first column to this.
                //
                bool isTitleSet = false;

                //
                // Iterate over all of the details columns.
                //
                for (int j = 0; j < section.DetailColumnsList.Count; j++)
                {
                    String cell = null;

                    //
                    // If there is no title yet and we are not at the end of the array
                    //
                    if (!isTitleSet && (j + 1) < section.DetailColumnsList.Count)
                    {
                        EvReportColumn nextColumn = (EvReportColumn)section.DetailColumnsList [j + 1];

                        //
                        // Obtains the acumulated value for the next column.
                        //
                        String nextValue = (String)section.Acumulator [nextColumn.HeaderText];

                        //
                        // If the accumulated value for the next column is not empty, then place the total label in this column.
                        //
                        if (nextValue != null && nextValue != String.Empty)
                        {
                            int spanValue = j + 1;

                            if (nextColumn.GroupingType == EvReport.GroupingTypes.Total)
                            {
                                cell = "<td colspan='" + spanValue + "' class='Rpt_Total' style='background-color: white' ><strong>Total "
                                       + section.GroupingColumnValue + ":</strong></td>\r\n";
                            }
                            else if (nextColumn.GroupingType == EvReport.GroupingTypes.Count)
                            {
                                cell = "<td colspan='" + spanValue + "' class='Rpt_Total' style='background-color: white' ><strong>" +
                                       section.GroupingColumnValue + " total quantity:</strong></td>\r\n";
                            }

                            isTitleSet = true;
                        }
                    }

                    //
                    // If the title is already set, then paint the totals.
                    //
                    else
                    {
                        EvReportColumn currentColumn = (EvReportColumn)section.DetailColumnsList [j];
                        String         value         = (String)section.Acumulator [currentColumn.HeaderText];

                        if (value != null)
                        {
                            cell = "<td class='Rpt_Total'><strong>"
                                   + EvcStatics.formatDoubleString(value, currentColumn.ValueFormatingString)
                                   + "</strong></td>\r\n";
                        }
                    }


                    if (cell != null && cell != String.Empty)
                    {
                        stHtml += cell;
                    }
                    else if (isTitleSet)
                    {
                        stHtml += "<td class='Rpt_Item'></td>\r\n";
                    }
                }

                stHtml += "</tr>\n\r<tr><td class='Rpt_Item' colspan='" + span + "' style='width:100%'>&nbsp</td></tr>";
            }

            return(stHtml);
        }//End addTotal method