// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #endregion #region Class public methods // ================================================================================== /// <summary> /// This method gets the trial site object. /// /// </summary> /// <param name="PageCommand">ClientPateEvado.UniForm.Model.Command object</param> /// <returns>Evado.UniForm.Model.AppData</returns> // ---------------------------------------------------------------------------------- override public Evado.UniForm.Model.AppData getDataObject ( Evado.UniForm.Model.Command PageCommand ) { this.LogMethod ( "getClientDataObject" ); this.LogValue ( "PageCommand Content: " + PageCommand.getAsString ( false, false ) ); try { // // Initialise the methods variables and objects. // bool bResult = true; Evado.UniForm.Model.AppData clientDataObjectObject = 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.hasAdministrationAccess == false ) { this.LogIllegalAccess ( this.ClassNameSpace + "getListObject", this.Session.UserProfile ); this.ErrorMessage = EdLabels.Illegal_Page_Access_Attempt; return null; } // // Log access to page. // this.LogPageAccess ( this.ClassNameSpace + "getObject", this.Session.UserProfile ); if ( this.AdapterObjects.ContentTemplates == null ) { this.AdapterObjects.ContentTemplates = new EvStaticContentTemplates ( ); this.AdapterObjects.ContentTemplates = EvStatics.Files.readXmlFile<EvStaticContentTemplates> ( this.AdapterObjects.ApplicationPath, EuStaticContentTemplates.CONST_EMAIL_TEMPLATE_FILENAME ); } if ( this.AdapterObjects.ContentTemplates == null ) { this.AdapterObjects.ContentTemplates = new EvStaticContentTemplates ( ); } if ( this.AdapterObjects.ContentTemplates.IntroductoryEmail_Title == null ) { this.AdapterObjects.ContentTemplates.IntroductoryEmail_Title = String.Empty; this.AdapterObjects.ContentTemplates.IntroductoryEmail_Body = String.Empty; this.AdapterObjects.ContentTemplates.UpdatePasswordEmail_Title = String.Empty; this.AdapterObjects.ContentTemplates.UpdatePasswordEmail_Body = String.Empty; this.AdapterObjects.ContentTemplates.ResetPasswordEmail_Body = String.Empty; this.AdapterObjects.ContentTemplates.ResetPasswordEmail_Body = String.Empty; this.AdapterObjects.ContentTemplates.PasswordConfirmationEmail_Title = String.Empty; this.AdapterObjects.ContentTemplates.PasswordConfirmationEmail_Body = String.Empty; } _displayPage = false; string value = PageCommand.GetParameter ( EuStaticContentTemplates.CONST_DISPLAY_PAGE ); if ( true == EvStatics.getBool ( value ) ) { _displayPage = true; } // // Set the page type to control the DB query type. // string pageType = PageCommand.GetPageId ( ); this.Session.setPageId ( pageType ); this.LogValue ( "PageId: " + this.Session.PageId ); // // Determine the method to be called // switch ( PageCommand.Method ) { case Evado.UniForm.Model.ApplicationMethods.Get_Object: { clientDataObjectObject = this.getObject ( PageCommand ); break; } case Evado.UniForm.Model.ApplicationMethods.Save_Object: { this.LogValue ( " Save Object method" ); // // Update the object values // bResult = this.updateObject ( PageCommand ); // // Process an update error result. // if ( bResult == false ) { this.LogValue ( " Save method failed" ); // // Return the generated ResultData object. // clientDataObjectObject = null; } break; } }//END Swith // // Handle returned exceptions. // if ( clientDataObjectObject == null ) { this.LogValue ( " null application data returned." ); } // // Return the last client ResultData object. // return clientDataObjectObject; } catch ( Exception Ex ) { this.LogException ( Ex ); } return new Evado.UniForm.Model.AppData ( ); }//END getClientDataObject method
}//END updateField method // ===================================================================================== /// <summary> /// This class update fields on formfield table using formfield object. /// </summary> /// <param name="SqlUpdateStatement">StringBuilder: containing the SQL update statemenet</param> /// <param name="ParmList">list of SqlParameter objects</param> /// <param name="RecordField">EvFormField: a formfield data object</param> /// <param name="ColumnId">String: column identifier</param> /// <param name="Row">Row: row index</param> // ------------------------------------------------------------------------------------- private void updateSingleValueField( StringBuilder SqlUpdateStatement, List <SqlParameter> ParmList, EdRecordField RecordField, String ColumnId, int Row) { this.LogMethod("updateField method. "); this.LogDebug("ValueCount: " + _ValueCount); // // Define the record field Guid // SqlParameter prm = new SqlParameter(EdRecordValues.PARM_FIELD_GUID + "_" + this._ValueCount, SqlDbType.UniqueIdentifier); prm.Value = RecordField.FieldGuid; ParmList.Add(prm); // // Define the record field Guid // prm = new SqlParameter(EdRecordValues.PARM_VALUE_GUID + "_" + this._ValueCount, SqlDbType.UniqueIdentifier); prm.Value = RecordField.Guid; ParmList.Add(prm); // // Define the record column identifier // prm = new SqlParameter(EdRecordValues.PARM_VALUE_COLUMN_ID + "_" + this._ValueCount, SqlDbType.NVarChar, 10); prm.Value = ColumnId; ParmList.Add(prm); // // Define the record field Guid // prm = new SqlParameter(EdRecordValues.PARM_VALUE_ROW + "_" + this._ValueCount, SqlDbType.SmallInt); prm.Value = Row; ParmList.Add(prm); switch (RecordField.TypeId) { case EvDataTypes.Yes_No: case EvDataTypes.Boolean: { string value = "0"; bool bValue = EvStatics.getBool(RecordField.ItemValue); if (bValue == true) { value = "1"; } prm = new SqlParameter(EdRecordValues.PARM_VALUE_NUMERIC + "_" + this._ValueCount, SqlDbType.Float); prm.Value = value; ParmList.Add(prm); // // Create the add query . // SqlUpdateStatement.AppendLine(" INSERT INTO ED_RECORD_VALUES " + "(" + EdRecordValues.DB_RECORD_GUID + ", " + EdRecordValues.DB_FIELD_GUID + ", " + EdRecordValues.DB_VALUES_GUID + ", " + EdRecordValues.DB_VALUES_COLUMN_ID + ", " + EdRecordValues.DB_VALUES_ROW + ", " + EdRecordValues.DB_VALUES_NUMERIC + " ) "); SqlUpdateStatement.AppendLine("VALUES ("); SqlUpdateStatement.AppendLine( " " + EdRecordValues.PARM_RECORD_GUID + ", " + EdRecordValues.PARM_FIELD_GUID + "_" + this._ValueCount + ", " + EdRecordValues.PARM_VALUE_GUID + "_" + this._ValueCount + ", " + EdRecordValues.PARM_VALUE_COLUMN_ID + "_" + this._ValueCount + ", " + EdRecordValues.PARM_VALUE_ROW + "_" + this._ValueCount + ", " + EdRecordValues.PARM_VALUE_NUMERIC + "_" + +this._ValueCount + " );\r\n"); break; } case EvDataTypes.Numeric: { prm = new SqlParameter(EdRecordValues.PARM_VALUE_NUMERIC + "_" + this._ValueCount, SqlDbType.Float); prm.Value = RecordField.ItemValue; ParmList.Add(prm); // // Create the add query . // SqlUpdateStatement.AppendLine(" INSERT INTO ED_RECORD_VALUES " + "(" + EdRecordValues.DB_RECORD_GUID + ", " + EdRecordValues.DB_FIELD_GUID + ", " + EdRecordValues.DB_VALUES_GUID + ", " + EdRecordValues.DB_VALUES_COLUMN_ID + ", " + EdRecordValues.DB_VALUES_ROW + ", " + EdRecordValues.DB_VALUES_NUMERIC + " ) "); SqlUpdateStatement.AppendLine("VALUES ("); SqlUpdateStatement.AppendLine( " " + EdRecordValues.PARM_RECORD_GUID + ", " + EdRecordValues.PARM_FIELD_GUID + "_" + this._ValueCount + ", " + EdRecordValues.PARM_VALUE_GUID + "_" + this._ValueCount + ", " + EdRecordValues.PARM_VALUE_COLUMN_ID + "_" + this._ValueCount + ", " + EdRecordValues.PARM_VALUE_ROW + "_" + this._ValueCount + ", " + EdRecordValues.PARM_VALUE_NUMERIC + "_" + +this._ValueCount + " );\r\n"); break; } case EvDataTypes.Date: { if (RecordField.ItemValue == String.Empty) { RecordField.ItemValue = EvStatics.CONST_DATE_NULL.ToString("dd-MMM-yyyy"); } prm = new SqlParameter(EdRecordValues.PARM_VALUE_DATE + "_" + this._ValueCount, SqlDbType.DateTime); prm.Value = RecordField.ItemValue; ParmList.Add(prm); // // Create the add query . // SqlUpdateStatement.AppendLine(" INSERT INTO ED_RECORD_VALUES " + "(" + EdRecordValues.DB_RECORD_GUID + ", " + EdRecordValues.DB_FIELD_GUID + ", " + EdRecordValues.DB_VALUES_GUID + ", " + EdRecordValues.DB_VALUES_COLUMN_ID + ", " + EdRecordValues.DB_VALUES_ROW + ", " + EdRecordValues.DB_VALUES_DATE + " ) "); SqlUpdateStatement.AppendLine("VALUES ("); SqlUpdateStatement.AppendLine( " " + EdRecordValues.PARM_RECORD_GUID + ", " + EdRecordValues.PARM_FIELD_GUID + "_" + this._ValueCount + ", " + EdRecordValues.PARM_VALUE_GUID + "_" + this._ValueCount + ", " + EdRecordValues.PARM_VALUE_COLUMN_ID + "_" + this._ValueCount + ", " + EdRecordValues.PARM_VALUE_ROW + "_" + this._ValueCount + ", " + EdRecordValues.PARM_VALUE_DATE + "_" + this._ValueCount + " );\r\n"); break; } case EvDataTypes.Free_Text: { prm = new SqlParameter(EdRecordValues.PARM_VALUE_TEXT + "_" + this._ValueCount, SqlDbType.NText); prm.Value = RecordField.ItemText; ParmList.Add(prm); // // Create the add query . // SqlUpdateStatement.AppendLine(" INSERT INTO ED_RECORD_VALUES " + "(" + EdRecordValues.DB_RECORD_GUID + ", " + EdRecordValues.DB_FIELD_GUID + ", " + EdRecordValues.DB_VALUES_GUID + ", " + EdRecordValues.DB_VALUES_COLUMN_ID + ", " + EdRecordValues.DB_VALUES_ROW + ", " + EdRecordValues.DB_VALUES_TEXT + " ) "); SqlUpdateStatement.AppendLine("VALUES ("); SqlUpdateStatement.AppendLine( " " + EdRecordValues.PARM_RECORD_GUID + ", " + EdRecordValues.PARM_FIELD_GUID + "_" + this._ValueCount + ", " + EdRecordValues.PARM_VALUE_GUID + "_" + this._ValueCount + ", " + EdRecordValues.PARM_VALUE_COLUMN_ID + "_" + this._ValueCount + ", " + EdRecordValues.PARM_VALUE_ROW + "_" + this._ValueCount + ", " + EdRecordValues.PARM_VALUE_TEXT + "_" + this._ValueCount + " );\r\n"); break; } default: { prm = new SqlParameter(EdRecordValues.PARM_VALUE_STRING + "_" + this._ValueCount, SqlDbType.NVarChar, 100); prm.Value = RecordField.ItemValue; ParmList.Add(prm); // // Create the add query . // SqlUpdateStatement.AppendLine(" INSERT INTO ED_RECORD_VALUES " + "(" + EdRecordValues.DB_RECORD_GUID + ", " + EdRecordValues.DB_FIELD_GUID + ", " + EdRecordValues.DB_VALUES_GUID + ", " + EdRecordValues.DB_VALUES_COLUMN_ID + ", " + EdRecordValues.DB_VALUES_ROW + ", " + EdRecordValues.DB_VALUES_STRING + " ) "); SqlUpdateStatement.AppendLine("VALUES ("); SqlUpdateStatement.AppendLine( " " + EdRecordValues.PARM_RECORD_GUID + ", " + EdRecordValues.PARM_FIELD_GUID + "_" + this._ValueCount + ", " + EdRecordValues.PARM_VALUE_GUID + "_" + this._ValueCount + ", " + EdRecordValues.PARM_VALUE_COLUMN_ID + "_" + this._ValueCount + ", " + EdRecordValues.PARM_VALUE_ROW + "_" + this._ValueCount + ", " + EdRecordValues.PARM_VALUE_STRING + "_" + this._ValueCount + " );\r\n"); break; } } //End switch statement } //END method.
// ============================================================================== /// <summary> /// This method creates an entity filter selection field object. /// </summary> /// <param name="PageGroup">Evado.Model.Uniform.Group object to add the pageGroup .</param> /// <param name="FilterIndex">Integer: filter index</param> /// <param name="SelectionFilter">String: filter value </param> /// <param name="Field">EdRecordField object.</param> // ------------------------------------------------------------------------------ private void getFilteredList_SelectionField ( Evado.UniForm.Model.Group PageGroup, int FilterIndex, String SelectionFilter, EdRecordField Field ) { this.LogMethod ( "getFilteredList_SelectionField" ); this.LogDebug ( "FilterIndex: {0}, SelectionFilter: {1}. ", FilterIndex, SelectionFilter ); //this.LogDebug ( "F: {0}, T: {1}, Type {2}. ", Field.FieldId, Field.Title, Field.TypeId ); List<EvOption> optionList = Evado.UniForm.Model.EuStatics.getStringAsOptionList ( Field.Design.Options ); optionList.Sort ( ( n1, n2 ) => n1.Description.CompareTo ( n2.Description ) ); List<EvOption> selectionOptionList = new List<EvOption> ( ); selectionOptionList.Add ( new EvOption ( ) ); foreach ( EvOption opt in optionList ) { selectionOptionList.Add ( opt ); } // // user the switch to select the selection data types. // switch ( Field.TypeId ) { case EvDataTypes.Check_Box_List: { var field = PageGroup.createCheckBoxListField ( EuEntities.CONST_SELECTION_FIELD + FilterIndex, Field.Title, SelectionFilter, optionList ); field.Layout = EuAdapter.DefaultFieldLayout; field.AddParameter ( Evado.UniForm.Model.FieldParameterList.Snd_Cmd_On_Change, 1 ); break; } case EvDataTypes.Yes_No: case EvDataTypes.Boolean: { var field = PageGroup.createBooleanField ( EuEntities.CONST_SELECTION_FIELD + FilterIndex, Field.Title, EvStatics.getBool ( SelectionFilter ) ); field.Layout = EuAdapter.DefaultFieldLayout; field.AddParameter ( Evado.UniForm.Model.FieldParameterList.Snd_Cmd_On_Change, 1 ); break; } case EvDataTypes.Selection_List: case EvDataTypes.Radio_Button_List: { var field = PageGroup.createSelectionListField ( EuEntities.CONST_SELECTION_FIELD + FilterIndex, Field.Title, SelectionFilter, selectionOptionList ); field.Layout = EuAdapter.DefaultFieldLayout; field.AddParameter ( Evado.UniForm.Model.FieldParameterList.Snd_Cmd_On_Change, 1 ); break; } case EvDataTypes.External_Selection_List: case EvDataTypes.External_RadioButton_List: { this.LogDebug ( "External_Selection_List filter" ); selectionOptionList = this.getFilteredList_SelectionOptions ( Field, true ); if ( selectionOptionList.Count <= 1 ) { this.LogDebug ( "No Selection list options" ); break; } var field = PageGroup.createSelectionListField ( EuEntities.CONST_SELECTION_FIELD + FilterIndex, Field.Title, SelectionFilter, selectionOptionList ); field.Layout = EuAdapter.DefaultFieldLayout; field.AddParameter ( Evado.UniForm.Model.FieldParameterList.Snd_Cmd_On_Change, 1 ); break; } case EvDataTypes.External_CheckBox_List: { this.LogDebug ( "External_CheckBox_List filter" ); selectionOptionList = this.getFilteredList_SelectionOptions ( Field, false ); if ( selectionOptionList.Count == 0 ) { this.LogDebug ( "No CheckBox list options" ); break; } var field = PageGroup.createCheckBoxListField ( EuEntities.CONST_SELECTION_FIELD + FilterIndex, Field.Title, SelectionFilter, selectionOptionList ); field.Layout = EuAdapter.DefaultFieldLayout; field.AddParameter ( Evado.UniForm.Model.FieldParameterList.Snd_Cmd_On_Change, 1 ); break; } }//END switch statment this.LogMethodEnd ( "getFilteredList_SelectionField" ); }//END getFilteredList_SelectionField Query