}//End WithdrawIssuedList method. // ===================================================================================== /// <summary> /// This class deletes items from formfield selection list table. /// </summary> /// <param name="Item">EvFormFieldSelectionList: a formfield selection list object</param> /// <returns>EvEventCodes: an event code for deleting items</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Define the sql query parameters and execute the storeprocedure for deleting the items. /// /// 2. Return an event code for deleting the items. /// </remarks> // ------------------------------------------------------------------------------------- public EvEventCodes deleteItem(EdPageLayout Item) { this.LogMethod("deleteItem method. "); // // Define the query parameters // SqlParameter [] commandParameters = new SqlParameter [] { new SqlParameter(EdPageLayouts.PARM_GUID, SqlDbType.UniqueIdentifier), new SqlParameter(EdPageLayouts.PARM_UPDATED_BY_USER_ID, SqlDbType.NVarChar, 100), new SqlParameter(EdPageLayouts.PARM_UPDATED_BY, SqlDbType.NVarChar, 100), new SqlParameter(EdPageLayouts.PARM_UPDATED_DATE, SqlDbType.DateTime) }; commandParameters [0].Value = Item.Guid; commandParameters [1].Value = this.ClassParameters.UserProfile.UserId; commandParameters [2].Value = this.ClassParameters.UserProfile.CommonName; commandParameters [3].Value = DateTime.Now; // // Execute the update command. // if (EvSqlMethods.StoreProcUpdate(_STORED_PROCEDURE_DeleteItem, commandParameters) == 0) { return(EvEventCodes.Database_Record_Update_Error); } return(EvEventCodes.Ok); }// End deleteYear method.
}// END getView method. // ===================================================================================== /// <summary> /// This class returns a list of options based on the state and Guid values /// </summary> /// <param name="State">EvFormFieldSelectionList.SelectionListStates: The selection list state.</param> /// <param name="SelectByGuid">Boolean: True, if the selection is based on Guid.</param> /// <returns>List of EvOption: a list of option data objects</returns> /// <remarks> /// This method consists of the followings steps: /// /// 1. Define the sql query parameters and sql query string. /// /// 2. Execute the sql query string and store the results on data table. /// /// 3. Loop through the table and extract the data row to the option object. /// /// 4. Add the Option object values to the Options list. /// /// 5. Return the Options list. /// </remarks> // --------------------------------------------------------------------------------- public List <EvOption> getList( EdPageLayout.States State, bool SelectByGuid) { this.LogMethod("getList method."); this._Log.AppendLine("State: " + State); this._Log.AppendLine("SelectByUid: " + SelectByGuid.ToString( )); // // Initialise the local variables // List <EvOption> list = new List <EvOption> ( ); EvOption option = new EvOption( ); list.Add(option); // // get the list of selectionLists // var selectionList = this.getView(State); // // Iterate through the results extracting the role information. // for (int count = 0; count < selectionList.Count; count++) { EdPageLayout item = selectionList [count]; // // If SelectByGuid = True then optionId is to be the objects TestReport UID // if (SelectByGuid == true) { option = new EvOption(item.Guid.ToString( ), String.Format("{0} - {1} ", item.PageId, item.Title)); } // // If SelectByGuid = False then optionId is to be the objects ListId. // else { option = new EvOption(item.PageId, String.Format("{0} - {1} ", item.PageId, item.Title)); } list.Add(option); if (count > this.ClassParameters.MaxResultLength) { break; } } //END interation loop. // // Return the ArrayList. // return(list); }//END getList class
}//END getList method #endregion #region RetrievePageLayoutt object methods // ===================================================================================== /// <summary> /// This class retrieves the formfield selectionList object based on ListGuid. /// </summary> /// <param name="ListGuid">Guid: a list's global unique identifier</param> /// <returns>EvFormFieldSelectionList: a formfield selectionList object</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Execute the method for retrieving a formfield selectionList object based on ListGuid /// /// 2. Return a formfield selectionList object /// </remarks> // ------------------------------------------------------------------------------------- public EdPageLayout getItem(Guid ListGuid) { this.LogMethod("getItem"); this.LogDebug("ListGuid: " + ListGuid); // // Initialise the method variables and objects. // EdPageLayout item = this._dal_SelectionLists.getItem(ListGuid); this.LogClass(this._dal_SelectionLists.Log); return(item); }//END getItem method
// ============================================================================== /// <summary> /// This method tests to see if the a page group header exists for the page. /// </summary> /// <param name="Page">EdPageLayout object</param> /// <returns>True: menu group header exist.</returns> // ------------------------------------------------------------------------------ private bool hasMenuHeader ( EdPageLayout Page ) { this.LogMethod ( "hasMenuHeader" ); foreach ( EvMenuItem item in this.AdapterObjects.MenuList ) { if ( item.GroupHeader == true && item.Group.ToUpper ( ) == Page.PageId.ToUpper ( ) ) { this.LogDebug ( "Page Group found" ); return true; } } this.LogDebug ( "Page Group NOT found" ); return false; }
}//END SetParameters class. #endregion #region PageLayout Reader // ===================================================================================== /// <summary> /// This class extracts the content of the reader to the formfield selectionlist object. /// </summary> /// <param name="Row">DataRow: a data Reader containing the query results</param> /// <returns>EvFormFieldSelectionList: a formfield selectionlist object</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Extract the compatible data row values to the formfield selectionlist object. /// /// 2. Return the Formfield selectionlist object. /// </remarks> // --------------------------------------------------------------------------------- private EdPageLayout readDataRow(DataRow Row) { // // Initialise the formfield selectionlist object. // EdPageLayout Item = new EdPageLayout( ); // // Extract the compatible data row values to the formfield selectionlist object items. // Item.Guid = EvSqlMethods.getGuid(Row, EdPageLayouts.DB_GUID); Item.PageId = EvSqlMethods.getString(Row, EdPageLayouts.DB_PAGE_ID); Item.State = EvSqlMethods.getString <EdPageLayout.States> (Row, EdPageLayouts.DB_STATE); Item.UserTypes = EvSqlMethods.getString(Row, EdPageLayouts.DB_USER_TYPES); Item.Title = EvSqlMethods.getString(Row, EdPageLayouts.DB_TITLE); Item.HomePage = EvSqlMethods.getBool(Row, EdPageLayouts.DB_HOME_PAGE); Item.MenuLocation = EvSqlMethods.getString <EdPageLayout.MenuLocations> (Row, EdPageLayouts.DB_MENU_LOCATION); Item.PageCommands = EvSqlMethods.getString(Row, EdPageLayouts.DB_PAGE_COMMANDS); Item.HeaderContent = EvSqlMethods.getString(Row, EdPageLayouts.DB_HEADER_CONTENT); Item.HeaderComponentList = EvSqlMethods.getString(Row, EdPageLayouts.DB_HEADER_COMPONENT_LIST); Item.LeftColumnContent = EvSqlMethods.getString(Row, EdPageLayouts.DB_LEFT_CONTENT); Item.LeftColumnComponentList = EvSqlMethods.getString(Row, EdPageLayouts.DB_LEFT_COMPONENT_LIST); Item.LeftColumnWidth = (short)EvSqlMethods.getInteger(Row, EdPageLayouts.DB_LEFT_COLUMN_WIDTH); Item.CenterColumnContent = EvSqlMethods.getString(Row, EdPageLayouts.DB_CENTER_CONTENT); Item.CenterColumnComponentList = EvSqlMethods.getString(Row, EdPageLayouts.DB_CENTER_COMPONENT_LIST); Item.RightColumnContent = EvSqlMethods.getString(Row, EdPageLayouts.DB_RIGHT_CONTENT); Item.RightColumnComponentList = EvSqlMethods.getString(Row, EdPageLayouts.DB_RIGHT_COMPONENT_LIST); Item.RightColumnWidth = (short)EvSqlMethods.getInteger(Row, EdPageLayouts.DB_RIGHT_COLUMN_WIDTH); Item.Version = EvSqlMethods.getInteger(Row, EdPageLayouts.DB_VERSION); Item.UpdatedByUserId = EvSqlMethods.getString(Row, EdPageLayouts.DB_UPDATED_BY_USER_ID); Item.UpdatedBy = EvSqlMethods.getString(Row, EdPageLayouts.DB_UPDATED_BY); Item.UpdatedDate += EvSqlMethods.getDateTime(Row, EdPageLayouts.DB_UPDATED_DATE); // // Return item // return(Item); }//END readDataRow method.
}//END GetParameters class // ================================================================================== /// <summary> /// This class sets the values to the parameters array. /// </summary> /// <param name="parms">SqlParameter: an array of sql parameters</param> /// <param name="Item">EvFormFieldSelectionList: a formfield selectionlist object</param> /// <remarks> /// This method consists of the following steps: /// /// 1. Add new DB row Guid, if item's Guid is empty /// /// 2. Update the items values from formfield selectionlist object to the array of sql parameters. /// </remarks> // --------------------------------------------------------------------------------- private void SetParameters(SqlParameter [] parms, EdPageLayout Item) { // // Add new DB row Guid, if item's Guid is empty // if (Item.Guid == Guid.Empty) { Item.Guid = Guid.NewGuid( ); } // // Update the items values from formfield selectionlist object to the array of sql parameters. // parms [0].Value = Item.Guid; parms [1].Value = Item.PageId; parms [2].Value = Item.UserTypes; parms [3].Value = Item.State; parms [4].Value = Item.Title; parms [5].Value = Item.HomePage; parms [6].Value = Item.MenuLocation; parms [7].Value = Item.PageCommands; parms [8].Value = Item.HeaderContent; parms [9].Value = Item.HeaderComponentList; parms [10].Value = Item.LeftColumnContent; parms [11].Value = Item.LeftColumnComponentList; parms [12].Value = Item.LeftColumnWidth; parms [13].Value = Item.CenterColumnContent; parms [14].Value = Item.CenterColumnComponentList; parms [15].Value = Item.RightColumnContent; parms [16].Value = Item.RightColumnComponentList; parms [17].Value = Item.RightColumnWidth; parms [18].Value = Item.Version; parms [19].Value = this.ClassParameters.UserProfile.UserId; parms [20].Value = this.ClassParameters.UserProfile.CommonName; parms [21].Value = DateTime.Now; }//END SetParameters class.
}//END saveItem class // ===================================================================================== /// <summary> /// This class updates the state of formfield selectionlist object /// </summary> /// <param name="Item">EvFormFieldSelectionList: a formfield selectionlist object</param> /// <remarks> /// This method consists of the following step: /// /// 1. Update the formfield selectionlist object's items and its state based on its action codes. /// </remarks> // ------------------------------------------------------------------------------------- private void updateState(EdPageLayout Item) { this.LogMethod("updateState."); this.LogDebug("Action: " + Item.Action); // // If action is save then minor version increment version and add UpdatedBy entry // switch (Item.Action) { case EdPageLayout.SaveActions.Draft: { this.LogDebug("Draft list"); Item.State = EdPageLayout.States.Draft; return; } case EdPageLayout.SaveActions.Issue: { Item.State = EdPageLayout.States.Draft; Item.Version++; return; } case EdPageLayout.SaveActions.Withdraw: { Item.State = EdPageLayout.States.Withdrawn; Item.Version++; return; } } //End switch statement } //END updateState method.
}//END updateItem class // ===================================================================================== /// <summary> /// This class adds new items to the formfield selection list table. /// </summary> /// <param name="Item">EvFormFieldSelectionList: a formfield selection list object</param> /// <returns>EvEventCodes: an event code for adding items</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Exit if the List's identifier is empty or duplicated /// /// 2. Create new DB row Guid /// /// 3. Define the sql query parameters and execute the sql storeprocedure for adding items. /// /// 4. Return the event code fore adding new items. /// </remarks> // ------------------------------------------------------------------------------------- public EvEventCodes addItem(EdPageLayout Item) { this.LogMethod("addItem method. "); this.LogDebug("ListId: '" + Item.PageId); this.LogDebug("Version: '" + Item.Version + "'"); String sqlQueryString = String.Empty; //---------------------- Check for duplicate TestReport identifiers. ------------------ // // Define the query parameters // SqlParameter [] cmdParms = new SqlParameter [] { new SqlParameter(EdPageLayouts.PARM_PAGE_ID, SqlDbType.NVarChar, 10), }; cmdParms [0].Value = Item.PageId; // // Generate the SQL query string // sqlQueryString = SQL_VIEW_QUERY + " WHERE (" + EdPageLayouts.DB_PAGE_ID + " = " + EdPageLayouts.PARM_PAGE_ID + ") " + " AND (" + EdPageLayouts.DB_DELETED + " = 0);"; this.LogDebug("Duplication SQL Query:" + sqlQueryString); // // Execute the query against the database // using (DataTable table = EvSqlMethods.RunQuery(sqlQueryString, cmdParms)) { // // If not rows the return // if (table.Rows.Count > 0) { this.LogDebug("Duplication list found."); return(EvEventCodes.Data_Duplicate_Id_Error); } } // // Create the Guid // Item.Guid = Guid.NewGuid( ); // // Define the query parameters // SqlParameter [] commandParameters = GetParameters( ); SetParameters(commandParameters, Item); //this.LogDebug( EvSqlMethods.getParameterSqlText( commandParameters ) ) ; // // Execute the update command. // if (EvSqlMethods.StoreProcUpdate(_STORED_PROCEDURE_AddItem, commandParameters) == 0) { return(EvEventCodes.Database_Record_Update_Error); } // // Return the event code for adding new items. // return(EvEventCodes.Ok); }//END addItem class
}//END EvFormFieldSelectionList method #endregion #region SelectionList Update queries // ===================================================================================== /// <summary> /// This class updates items on formfield selection list table. /// </summary> /// <param name="Item">EvFormFieldSelectionList: a formfield selection list object</param> /// <returns>EvEventCodes: an event code for updating items</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Exit, if the Old list's Guid is empty. /// /// 2. Add items to datachange object if they exist after comparing with the old list. /// /// 3. Define the sql parameters and execute the storeprocedure for updating items. /// /// 4. Add the datachange values to the backup datachanges object. /// /// 5. Return the event code for updating the items. /// </remarks> // ------------------------------------------------------------------------------------- public EvEventCodes updateItem(EdPageLayout Item) { this.LogMethod("updateItem"); // // Get the previous value // EdPageLayout oldItem = getItem(Item.Guid); if (oldItem.Guid == Guid.Empty) { return(EvEventCodes.Identifier_Global_Unique_Identifier_Error); } // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // Compare the objects. // EvDataChanges dataChanges = new EvDataChanges( ); EvDataChange dataChange = new EvDataChange( ); dataChange.TableName = EvDataChange.DataChangeTableNames.EdPageLayouts; dataChange.TrialId = String.Empty; dataChange.RecordUid = -1; dataChange.RecordGuid = Item.Guid; dataChange.UserId = Item.UpdatedByUserId; dataChange.DateStamp = DateTime.Now; // // Add items to datachange object if they exist. // if (Item.PageId != oldItem.PageId) { dataChange.AddItem("ListId", oldItem.PageId, Item.PageId); } if (Item.Title != oldItem.Title) { dataChange.AddItem("Title", oldItem.Title, Item.Title); } if (Item.UserTypes != oldItem.UserTypes) { dataChange.AddItem("UserType", oldItem.UserTypes, Item.UserTypes); } if (Item.State != oldItem.State) { dataChange.AddItem("State", oldItem.State, Item.State); } if (Item.HeaderContent != oldItem.HeaderContent) { dataChange.AddItem("HeaderContent", Item.HeaderContent, Item.HeaderContent); } if (Item.HeaderComponentList != oldItem.HeaderComponentList) { dataChange.AddItem("HeaderGroupList", oldItem.HeaderComponentList, Item.HeaderComponentList); } if (Item.LeftColumnContent != oldItem.LeftColumnContent) { dataChange.AddItem("LeftColumnContent", oldItem.LeftColumnContent, Item.LeftColumnContent); } if (Item.LeftColumnComponentList != oldItem.LeftColumnComponentList) { dataChange.AddItem("LeftColumnGroupList", oldItem.LeftColumnComponentList, Item.LeftColumnComponentList); } if (Item.LeftColumnWidth != oldItem.LeftColumnWidth) { dataChange.AddItem("LeftColumnCommandList", oldItem.LeftColumnWidth, Item.LeftColumnWidth); } if (Item.CenterColumnContent != oldItem.CenterColumnContent) { dataChange.AddItem("CenterColumnContent", oldItem.CenterColumnContent, Item.CenterColumnContent); } if (Item.LeftColumnComponentList != oldItem.LeftColumnComponentList) { dataChange.AddItem("LeftColumnGroupList", oldItem.LeftColumnComponentList, Item.LeftColumnComponentList); } if (Item.RightColumnContent != oldItem.RightColumnContent) { dataChange.AddItem("RightColumnContent", oldItem.RightColumnContent, Item.RightColumnContent); } if (Item.RightColumnComponentList != oldItem.RightColumnComponentList) { dataChange.AddItem("RightColumnGroupList", oldItem.RightColumnComponentList, Item.RightColumnComponentList); } if (Item.RightColumnWidth != oldItem.RightColumnWidth) { dataChange.AddItem("RightColumnCommandList", oldItem.RightColumnWidth, Item.RightColumnWidth); } if (Item.Version != oldItem.Version) { dataChange.AddItem("Version", oldItem.Version, Item.Version); } if (Item.State != oldItem.State) { dataChange.AddItem("State", oldItem.State.ToString( ), Item.State.ToString( )); } // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // // Define the query parameters // SqlParameter [] commandParameters = GetParameters( ); SetParameters(commandParameters, Item); // // Execute the update command. // if (EvSqlMethods.StoreProcUpdate(_STORED_PROCEDURE_UpdateItem, commandParameters) == 0) { return(EvEventCodes.Database_Record_Update_Error); } // // update the parameter object values. // this.UpdateObjectParameters(Item.Parameters, Item.Guid); // // Add the change record // dataChanges.AddItem(dataChange); return(EvEventCodes.Ok); }//END updateItem class
}//END getList class #endregion #region Retrieval Queries // ===================================================================================== /// <summary> /// This class retrieves the formfield selection list based on Guid value /// </summary> /// <param name="PageGuid">Guid: The Global unique identifier</param> /// <returns>EvFormFieldSelectionList: The formfield selection list object</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Return an empty selection list if the list's Guid is empty. /// /// 2. Define the sql query string and sql query parameters. /// /// 3. Execute the sql query string and store the results on data table. /// /// 4. Extract the first row to the formfield selection list object. /// /// 5. Return the formfield selection list data object. /// </remarks> // --------------------------------------------------------------------------------- public EdPageLayout getItem(Guid PageGuid) { this.LogMethod("getItem"); this._Log.AppendLine("PageGuid: " + PageGuid); // // Initialise the local variables // EdPageLayout item = new EdPageLayout( ); String sqlQueryString = String.Empty; // // If TestReport UID is null return empty checlist object. // if (PageGuid == Guid.Empty) { return(item); } // // Initialise the query parameters. // SqlParameter [] cmdParms = new SqlParameter [] { new SqlParameter(EdPageLayouts.PARM_GUID, SqlDbType.UniqueIdentifier), }; cmdParms [0].Value = PageGuid; // // Generate the Selection query string. // sqlQueryString = SQL_VIEW_QUERY + " WHERE " + EdPageLayouts.DB_GUID + " = " + EdPageLayouts.PARM_GUID + ";"; this.LogDebug(sqlQueryString); // // Execute the query against the database // using (DataTable table = EvSqlMethods.RunQuery(sqlQueryString, cmdParms)) { // // If not rows the return // if (table.Rows.Count == 0) { return(item); } // // Extract the table row // DataRow row = table.Rows [0]; item = this.readDataRow(row); // // retrieve the parameter object values. // item.Parameters = this.LoadObjectParameters(item.Guid); }//END Using // // Return Checklsit data object. // return(item); }//END EvFormFieldSelectionList method
}//END readDataRow method. #endregion #region SelectionList Queries // ===================================================================================== /// <summary> /// This class returns the list of formfield selectionlist object using state and orderBy values /// </summary> /// <param name="State">EvFormFieldSelectionList.SelectionListStates: an enumeration state</param> /// <returns>List of EvFormFieldSelectionList: a list of formfield selectionlist object</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Define the sql query parameter and sql query string /// /// 2. Execute the sql query string with parameters and store the results on datatable. /// /// 3. Iterate through the table and extract datarow to the formfield selectionlist object /// /// 4. Add the object values to the Formfield selection list. /// /// 5. Return the Formfield selection list. /// </remarks> // --------------------------------------------------------------------------------- public List <EdPageLayout> getView( EdPageLayout.States State) { // // Initialize the method status and a return list of formfield selectionlist object // this.LogMethod("getView method."); this._Log.AppendLine("State: " + State); List <EdPageLayout> view = new List <EdPageLayout> ( ); String sqlQueryString = String.Empty; // // Define the sql query parameter and load the query values. // SqlParameter [] cmdParms = new SqlParameter [] { new SqlParameter(EdPageLayouts.PARM_STATE, SqlDbType.VarChar, 20) }; cmdParms [0].Value = State.ToString( ); // // Define the sql query string. // sqlQueryString = SQL_VIEW_QUERY; if (State != EdPageLayout.States.Null) { sqlQueryString += " WHERE ( " + EdPageLayouts.DB_STATE + " = " + EdPageLayouts.PARM_STATE + " ) " + " AND (" + EdPageLayouts.DB_DELETED + " = 0) " + " ORDER BY " + EdPageLayouts.DB_PAGE_ID + ";"; } else { sqlQueryString += " WHERE ( " + EdPageLayouts.DB_STATE + " <> '" + EdPageLayout.States.Withdrawn + "' ) " + " AND (" + EdPageLayouts.DB_DELETED + " = 0) " + " ORDER BY " + EdPageLayouts.DB_PAGE_ID + ";"; } this.LogDebug("SQL Query: " + sqlQueryString); // // Execute the query against the database // using (DataTable table = EvSqlMethods.RunQuery(sqlQueryString, cmdParms)) { // // Iterate through the results extracting the role information. // for (int Count = 0; Count < table.Rows.Count; Count++) { // // Extract the table row // DataRow row = table.Rows [Count]; EdPageLayout pageLayout = this.readDataRow(row); // // retrieve the parameter object values. // pageLayout.Parameters = this.LoadObjectParameters(pageLayout.Guid); // // Append the value to the visit // view.Add(pageLayout); } //END interation loop. } //END using statement this.LogDebug(" view count: " + view.Count.ToString( )); // // return the Array object. // return(view); }// END getView method.
// ============================================================================== /// <summary> /// This method adds a menu header item for the page.. /// </summary> /// <param name="Page">EdPageLayout object</param> /// <returns>True: menu group header created.</returns> // ------------------------------------------------------------------------------ private bool addMenuHeader ( EdPageLayout Page ) { this.LogMethod ( "addMenuHeader" ); // // initialise the methods variables and objects. // EvMenuItem newHeader = new EvMenuItem ( ); int headerOrder = 0; // // iterate through the list of menu items // foreach ( EvMenuItem item in this.AdapterObjects.MenuList ) { if ( item.GroupHeader == false ) { continue; } headerOrder = item.Order; } headerOrder++; // // define the new menu group header object. // newHeader.PageId = Evado.Digital.Model.EdStaticPageIds.Home_Page.ToString ( ); newHeader.Group = Page.PageId.ToUpper ( ); newHeader.Title = Page.Title; newHeader.GroupHeader = true; newHeader.UserTypes = Page.UserTypes; newHeader.Order = headerOrder; newHeader.RoleList = "Administrator"; newHeader.Platform = "ADMIN"; var result = this._Bll_Menus.saveItem ( newHeader ); if ( result != EvEventCodes.Ok ) { return false; } // // define the new menu group header object. // newHeader = new EvMenuItem ( ); newHeader.PageId = Evado.Digital.Model.EdStaticPageIds.Home_Page.ToString ( ); newHeader.Group = Page.PageId; newHeader.Title = Page.Title; newHeader.GroupHeader = true; newHeader.UserTypes = Page.UserTypes; newHeader.Order = headerOrder; newHeader.RoleList = "Administrator"; newHeader.Platform = "PROD"; result = this._Bll_Menus.saveItem ( newHeader ); if ( result != EvEventCodes.Ok ) { return false; } // // force a load of a fresh menu list. // this.AdapterObjects.MenuList = new List<EvMenuItem> ( ); return true; }
}//END getItem method #endregion #region UpdatePageLayout object methods // =================================================================================== /// <summary> /// This class saves items to the Formfield selectionlist ResultData table /// </summary> /// <param name="PageLayout">EvFormFieldSelectionList: a formfield selection list object</param> /// <returns>EvEventCodes: an event code for saving items</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Exit, if the PageId or UserCommonName is empty /// /// 2. Loop through the selectionlist object and remove the empty items. /// /// 3. Execute the method for deleting items, if the action code is delete. /// /// 4. Execute the method for adding items, if the Uid is not defined. /// /// 5. Else, execute the method for updating items. /// /// 6. Return an event code of method execution. /// </remarks> // ------------------------------------------------------------------------------------- public EvEventCodes SaveItem(EdPageLayout PageLayout) { this.LogMethod("saveItem"); // // Initialise the local variables // EvEventCodes iReturn = EvEventCodes.Ok; // // Exit, if the PageId or UserCommonName is empty // if (PageLayout.PageId == String.Empty) { return(EvEventCodes.Data_InvalidId_Error); } if (PageLayout.State == EdPageLayout.States.Null) { PageLayout.State = EdPageLayout.States.Draft; } // // If the Action is DELTE and the state is draft. // if (PageLayout.Title == String.Empty && PageLayout.Guid != Guid.Empty && PageLayout.State == EdPageLayout.States.Draft) { iReturn = this._dal_SelectionLists.deleteItem(PageLayout); this.LogClass(this._dal_SelectionLists.Log); return(iReturn); } // // Update thePageLayoutt state based on thePageLayoutt object Action property. // this.updateState(PageLayout); this.LogDebug(" Record State: " + PageLayout.State); // // If the unique identifier is null then add this object as a new //PageLayoutt object. // this.LogDebug("Save Object to Database."); if (PageLayout.Guid == Guid.Empty) // Add new record { this.LogDebug("AddPageLayoutt to database"); iReturn = this._dal_SelectionLists.addItem(PageLayout); this.LogClass(this._dal_SelectionLists.Log); return(iReturn); } // // If the checklist being approved then withdraw the pervious issues checklist // if (PageLayout.Action == EdPageLayout.SaveActions.Issue) { this.LogDebug("Withdraw the existing checklist"); iReturn = this._dal_SelectionLists.WithdrawIssuedList(PageLayout); this.LogClass(this._dal_SelectionLists.Log); PageLayout.State = EdPageLayout.States.Issued; } // // Update the checklist object. // this.LogDebug("UpdatePageLayoutt "); iReturn = this._dal_SelectionLists.updateItem(PageLayout); // UpdatePageLayoutt properties. this.LogClass(this._dal_SelectionLists.Log); return(iReturn); }//END saveItem class