}//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, EdReportColumn 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 EdReport.DataTypes.Currency: case EdReport.DataTypes.Float: case EdReport.DataTypes.Integer: { return(EvcStatics.formatDoubleString(value, pattern)); } case EdReport.DataTypes.Date: { return(EvcStatics.formatDateString(value, pattern)); } default: { return(value); } } //END switch } //END formatUsingMask class
}//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(EdReportSection section, EdReportColumn 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(" "); } return(retVal); } // // Switch column datatype and update the html string with value defining by datatypes // switch (column.DataType) { case EdReport.DataTypes.Bool: stHtml += "<input type='checkbox' id='" + column.HeaderText + "-" + section.RowNumber + "' "; stHtml += parseBoolean(currentValue) ? "CHECKED " : ""; stHtml += _report.SelectionOn ? "" : "DISABLED "; stHtml += "/>"; return(stHtml); case EdReport.DataTypes.Text: stHtml = currentValue; stHtml = stHtml.Replace("[[br]]", "[[BR]]"); stHtml = stHtml.Replace("[[BR]]", "<br/>"); stHtml = stHtml.Replace("\b", "<br/>"); return(stHtml); case EdReport.DataTypes.Currency: return(EvcStatics.formatDoubleString(currentValue, "$###,##0")); case EdReport.DataTypes.Date: return(EvcStatics.formatDateString(currentValue, "dd/MM/yyyy")); case EdReport.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
}//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(EdReportSection 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) { EdReportColumn nextColumn = (EdReportColumn)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 == EdReport.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 == EdReport.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 { EdReportColumn currentColumn = (EdReportColumn)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%'> </td></tr>"; } return(stHtml); }//End addTotal method
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #endregion /// <summary> /// This property contains a list of application parameters. /// </summary> //public List<EvObjectParameter> Parameters { get; set; } //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #endregion #region Class Methods // ================================================================================== /// <summary> /// This method sets the field value. /// </summary> /// <param name="FieldName">EvApplicationProfile.ApplicationProfileFieldNames: a field name object</param> /// <param name="Value">string: a Value for updating</param> /// <remarks> /// This method consists of the following steps: /// /// 1. Initialize the internal variables /// /// 2. Switch the FieldName and update the Value on the organization field names. /// </remarks> // --------------------------------------------------------------------------------- public void setValue( EdAdapterSettings.AdapterFieldNames FieldName, String Value) { // // Initialize the internal variables // DateTime date = EvcStatics.CONST_DATE_NULL; //float fltValue = 0; int intValue = 0; Guid guidValue = Guid.Empty; // // Switch the FieldName and update the Value on the organization field names. // switch (FieldName) { case EdAdapterSettings.AdapterFieldNames.Version: { this.Version = Value; return; } case EdAdapterSettings.AdapterFieldNames.MaximumSelectionListLength: { this.MaximumSelectionListLength = EvcStatics.getInteger(Value); return; } case EdAdapterSettings.AdapterFieldNames.DemoAccountExpiryDays: { this.DemoAccountExpiryDays = EvcStatics.getInteger(Value); return; } case EdAdapterSettings.AdapterFieldNames.DemoRegistrationVideoUrl: { this.DemoRegistrationVideoUrl = Value; return; } case EdAdapterSettings.AdapterFieldNames.SmtpServer: { this.SmtpServer = Value; return; } case EdAdapterSettings.AdapterFieldNames.SmtpServerPort: { if (int.TryParse(Value, out intValue) == true) { this.SmtpServerPort = intValue; } return; } case EdAdapterSettings.AdapterFieldNames.SmtpUserId: { this.SmtpUserId = Value; return; } case EdAdapterSettings.AdapterFieldNames.SmtpPassword: { this.SmtpPassword = Value; return; } case EdAdapterSettings.AdapterFieldNames.EmailAlertTestAddress: { this.EmailAlertTestAddress = Value; return; } case EdAdapterSettings.AdapterFieldNames.State: { this.setParameter(AdapterFieldNames.State, Evado.Model.EvDataTypes.Text, Value); return; } case EdAdapterSettings.AdapterFieldNames.Ads_Group: { this.setParameter(AdapterFieldNames.Ads_Group, Evado.Model.EvDataTypes.Text, Value); return; } case EdAdapterSettings.AdapterFieldNames.HelpUrl: { this.HelpUrl = Value; return; } case EdAdapterSettings.AdapterFieldNames.Home_Page_Header: { this._HomePageHeaderText = Value; return; } case EdAdapterSettings.AdapterFieldNames.Title: { this._Title = Value; return; } case EdAdapterSettings.AdapterFieldNames.Http_Reference: { this._HttpReference = Value; return; } case EdAdapterSettings.AdapterFieldNames.Description: { this._HttpReference = Value; return; } case EdAdapterSettings.AdapterFieldNames.EnableAdminGroupOnEntitPages: { this.setParameter(EdAdapterSettings.AdapterFieldNames.EnableAdminGroupOnEntitPages, Evado.Model.EvDataTypes.Boolean, Value.ToString( )); return; } case EdAdapterSettings.AdapterFieldNames.Enable_Binary_Data: { this.setParameter(AdapterFieldNames.Enable_Binary_Data, Evado.Model.EvDataTypes.Boolean, Value); return; } case EdAdapterSettings.AdapterFieldNames.Enable_Entity_Edit_Button_Update: { this.setParameter(EdAdapterSettings.AdapterFieldNames.Enable_Entity_Edit_Button_Update, Evado.Model.EvDataTypes.Boolean, Value.ToString( )); return; } case EdAdapterSettings.AdapterFieldNames.Enable_Entity_Save_Button_Update: { this.setParameter(EdAdapterSettings.AdapterFieldNames.Enable_Entity_Save_Button_Update, Evado.Model.EvDataTypes.Boolean, Value.ToString( )); return; } case EdAdapterSettings.AdapterFieldNames.EnableAdminUpdateOfIssuedObjects: { this.setParameter(AdapterFieldNames.EnableAdminUpdateOfIssuedObjects, Evado.Model.EvDataTypes.Boolean, Value); return; } case EdAdapterSettings.AdapterFieldNames.Enable_User_Organisation_Update: { this.setParameter(AdapterFieldNames.Enable_User_Organisation_Update, Evado.Model.EvDataTypes.Boolean, Value); return; } case EdAdapterSettings.AdapterFieldNames.Enable_User_Address_Update: { this.setParameter(AdapterFieldNames.Enable_User_Address_Update, Evado.Model.EvDataTypes.Boolean, Value); return; } case EdAdapterSettings.AdapterFieldNames.Use_Home_Page_Header_On_All_Pages: { this.setParameter(AdapterFieldNames.Use_Home_Page_Header_On_All_Pages, Evado.Model.EvDataTypes.Boolean, Value); return; } case EdAdapterSettings.AdapterFieldNames.User_Roles: { string roles = Value; roles = roles.Replace("\r\n", ";"); roles = roles.Replace("; ", ";"); roles = roles.Replace(" ;", ";"); this.UserRoles = roles.Replace(";;", ";"); return; } case EdAdapterSettings.AdapterFieldNames.Default_User_Roles: { this.DefaultUserRoles = Value; return; } case EdAdapterSettings.AdapterFieldNames.Org_Types: { string orgType = Value; orgType = orgType.Replace("\r\n", ";"); orgType = orgType.Replace("; ", ";"); orgType = orgType.Replace(" ;", ";"); this.OrgTypes = orgType.Replace(";;", ";"); return; } case EdAdapterSettings.AdapterFieldNames.Default_User_Org_Type: { this.DefaultOrgType = Value; return; } case EdAdapterSettings.AdapterFieldNames.VimeoEmbeddedUrl: { this.setParameter(AdapterFieldNames.VimeoEmbeddedUrl, Evado.Model.EvDataTypes.Text, Value); return; } case EdAdapterSettings.AdapterFieldNames.YouTubeEmbeddedUrl: { this.setParameter(AdapterFieldNames.YouTubeEmbeddedUrl, Evado.Model.EvDataTypes.Text, Value); return; } case EdAdapterSettings.AdapterFieldNames.Static_Query_Filter_Options: { this.setParameter(AdapterFieldNames.Static_Query_Filter_Options, Evado.Model.EvDataTypes.Text, Value); return; } case EdAdapterSettings.AdapterFieldNames.Hidden_User_Fields: { this.HiddenUserFields = Value; return; } case EdAdapterSettings.AdapterFieldNames.Hidden_Organisation_Fields: { this.HiddenOrganisationFields = Value; return; } case EdAdapterSettings.AdapterFieldNames.User_Primary_Entity: { this.UserPrimaryEntity = Value; return; } case EdAdapterSettings.AdapterFieldNames.Create_Organisation_On_User_Registration: { this.CreateOrganisationOnUserRegistration = Evado.Model.EvStatics.getBool(Value); return; } case EdAdapterSettings.AdapterFieldNames.Organisation_Primary_Entity: { this.OrganisationPrimaryEntity = Value; return; } case EdAdapterSettings.AdapterFieldNames.User_Category_List: { this.UserCategoryList = Value; return; } default: return; } //END Switch } //END setValue method
}//END getOptionList method #endregion #region public class methods // ===================================================================================== /// <summary> /// This class sets the value on the object. All of the proper validations should be done here. /// </summary> /// <param name="FieldName">FormFieldClassFieldNames: field of the object to be updated</param> /// <param name="Value">String: a string value to be setted</param> /// <returns> Evado.Model.EvEventCodes: indicating the successful update of the property value</returns> /// <remarks> /// This class consists of the following steps: /// /// 1. Initialize the internal variables. /// /// 2. Switch FieldName and update value for the property defined by form field class field name. /// </remarks> // ------------------------------------------------------------------------------------- public Evado.Model.EvEventCodes setValue(ClassFieldNames FieldName, String Value) { // // Initialise the internal variables // DateTime date = EvcStatics.CONST_DATE_NULL; float fltValue = 0; int intValue = 0; bool boolValue = false; // // The switch determines the item to be updated. // switch (FieldName) { case ClassFieldNames.FieldId: { this.FieldId = Value; break; } case ClassFieldNames.TypeId: { Evado.Model.EvDataTypes type = Evado.Model.EvDataTypes.Null; if (Evado.Model.EvStatics.tryParseEnumValue <Evado.Model.EvDataTypes> (Value, out type) == false) { return(Evado.Model.EvEventCodes.Data_Enumeration_Casting_Error); } this.Design.TypeId = type; break; } case ClassFieldNames.Order: { if (int.TryParse(Value, out intValue) == false) { return(Evado.Model.EvEventCodes.Data_Integer_Casting_Error); } this.Order = intValue; break; } case ClassFieldNames.Subject: { this.Design.Title = Value; break; } case ClassFieldNames.Instructions: { this.Design.Instructions = Value; break; } case ClassFieldNames.Reference: { this.Design.HttpReference = Value; break; } case ClassFieldNames.Html_Link: { this.Design.HttpReference = Value; break; } case ClassFieldNames.Unit: { this.Design.Unit = Value; break; } case ClassFieldNames.ValidationLowerLimit: { if (float.TryParse(Value, out fltValue) == false) { return(Evado.Model.EvEventCodes.Data_Float_Casting_Error); } this._Design.ValidationLowerLimit = fltValue; break; } case ClassFieldNames.DefaultNumericValue: { if (float.TryParse(Value, out fltValue) == false) { return(Evado.Model.EvEventCodes.Data_Float_Casting_Error); } this._Design.DefaultValue = fltValue.ToString( ); break; } case ClassFieldNames.ValidationUpperLimit: { if (float.TryParse(Value, out fltValue) == false) { return(Evado.Model.EvEventCodes.Data_Float_Casting_Error); } this._Design.ValidationUpperLimit = fltValue; break; } case ClassFieldNames.AlertUpperLimit: { if (float.TryParse(Value, out fltValue) == false) { return(Evado.Model.EvEventCodes.Data_Float_Casting_Error); } this._Design.AlertUpperLimit = fltValue; break; } case ClassFieldNames.AlertLowerLimit: { if (float.TryParse(Value, out fltValue) == false) { return(Evado.Model.EvEventCodes.Data_Float_Casting_Error); } this._Design.AlertLowerLimit = fltValue; break; } case ClassFieldNames.NormalRangeUpperLimit: { if (float.TryParse(Value, out fltValue) == false) { return(Evado.Model.EvEventCodes.Data_Float_Casting_Error); } this._Design.NormalRangeUpperLimit = fltValue; break; } case ClassFieldNames.NormalRangeLowerLimit: { if (float.TryParse(Value, out fltValue) == false) { return(Evado.Model.EvEventCodes.Data_Float_Casting_Error); } this._Design.NormalRangeLowerLimit = fltValue; break; } case ClassFieldNames.Selection_Options: { this._Design.Options = Value.Replace("\r\n", String.Empty); break; } case ClassFieldNames.FieldCategory: { this._Design.FieldCategory = Value; break; } case ClassFieldNames.FormSection: { this._Design.SectionNo = Evado.Model.EvStatics.getInteger(Value); break; } case ClassFieldNames.ExSelectionListId: { this._Design.ExSelectionListId = Value; break; } case ClassFieldNames.ExSelectionListCategory: { this._Design.ExSelectionListCategory = Value; break; } case ClassFieldNames.AnalogueLegendStart: { this._Design.AnalogueLegendStart = Value; break; } case ClassFieldNames.AnalogueLegendFinish: { this._Design.AnalogueLegendFinish = Value; break; } case ClassFieldNames.Summary_Field: { this._Design.IsSummaryField = EvcStatics.getBool(Value); break; } case ClassFieldNames.Mandatory: { this._Design.Mandatory = EvcStatics.getBool(Value); break; } case ClassFieldNames.AI_Data_Point: { this._Design.AiDataPoint = EvcStatics.getBool(Value); break; } case ClassFieldNames.Hide_Field: { this._Design.HideField = EvcStatics.getBool(Value); break; } case ClassFieldNames.Java_Script: { this._Design.JavaScript = Value; break; } case ClassFieldNames.Unit_Scaling: { this._Design.UnitScaling = Value; break; } case ClassFieldNames.Field_Layout: { this._Design.FieldLayout = Value; break; } case ClassFieldNames.FieldWidth: { if (int.TryParse(Value, out intValue) == false) { return(Evado.Model.EvEventCodes.Data_Integer_Casting_Error); } this.Design.FieldWidth = intValue; break; } case ClassFieldNames.FieldHeight: { if (int.TryParse(Value, out intValue) == false) { return(Evado.Model.EvEventCodes.Data_Integer_Casting_Error); } this.Design.FieldHeight = intValue; break; } case ClassFieldNames.Media_Url: { this.RecordMedia.Url = Value; break; } case ClassFieldNames.Media_Title: { this.RecordMedia.Title = Value; break; } case ClassFieldNames.Media_Width: { if (int.TryParse(Value, out intValue) == false) { return(Evado.Model.EvEventCodes.Data_Integer_Casting_Error); } this.RecordMedia.Width = intValue; break; } case ClassFieldNames.Media_Height: { if (int.TryParse(Value, out intValue) == false) { return(Evado.Model.EvEventCodes.Data_Integer_Casting_Error); } this.RecordMedia.Height = intValue; break; } }//End switch return(0); }// End setvalue method.
}//END hasRole method. // ================================================================================ /// <summary> /// Sets the value of this activity class field name. Validate the format of the /// value. /// </summary> /// <param name="fieldName">MenuClassFieldNames: Name of the field to be setted.</param> /// <param name="value">String: value to be setted</param> /// <returns> Evado.Model.EvEventCodes: indicating the successful update of the property value.</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Switch the fieldName and update value for the property defined by the activity field names /// /// 2. Return casting error, if field name type is empty /// </remarks> // -------------------------------------------------------------------------------- public Evado.Model.EvEventCodes setValue(MenuFieldNames fieldName, String value) { EdStaticPageIds pageId = EdStaticPageIds.Null; // // Switch the FieldName based on the activity field names // switch (fieldName) { case MenuFieldNames.Page_Id: { this._PageId = value; break; } case MenuFieldNames.Order: { try { this.Order = int.Parse(value); } catch { } break; } case MenuFieldNames.Title: { this.Title = value; break; } case MenuFieldNames.Group: { this.Group = value; break; } case MenuFieldNames.Group_Header: { this.GroupHeader = EvcStatics.getBool(value); break; } case MenuFieldNames.Platform: { this.Platform = value; break; } case MenuFieldNames.Role_List: { this.RoleList = value; break; } case MenuFieldNames.Parameters: { this.Parameters = value; break; } }// End switch field name return(Evado.Model.EvEventCodes.Ok); }//End setValue method.