}//END GetSubjectRecordsList class #endregion #region Unique identifers section /* * // ================================================================================== * /// <summary> * /// GetFormFieldList module * /// * /// Description: * /// this method gets a list of form fields by thier Uid. * /// * /// </summary> * // ---------------------------------------------------------------------------------- * private optionList<EvOption> GetFormFieldList ( int RecordUid ) * { * EvFormFields formFields = new EvFormFields( ); * * return formFields.GetList(RecordUid ); * } * * // ================================================================================== * /// <summary> * /// GetCommonFormFieldList module * /// * /// Description: * /// this method gets a list of form fields by thier Uid. * /// * /// </summary> * // ---------------------------------------------------------------------------------- * private optionList<EvOption> GetCommonFormFieldList ( int RecordUid ) * { * EvCommonFormFields commonFormFields = new EvCommonFormFields( ); * * return commonFormFields.GetList( RecordUid ); * } * * // ================================================================================== * /// <summary> * /// GetTestItemList module * /// * /// Description: * /// this method gets a list of form fields by thier Uid. * /// * /// </summary> * // ---------------------------------------------------------------------------------- * private optionList<EvOption> GetTestItemList ( int RecordUid ) * { * this._Status += "\r\nGetTestItemList method RecordUid: " + RecordUid; * * EvTestItems testItems = new EvTestItems( ); * * optionList<EvOption> list = testItems.getList( RecordUid ); * this._Status += "\r\n " + testItems.DebugLog; * * return list; * } * * // ================================================================================== * /// <summary> * /// GetTestItemList module * /// * /// Description: * /// this method gets a list of form fields by thier Uid. * /// * /// </summary> * // ---------------------------------------------------------------------------------- * private optionList<EvOption> GetTestReportItemList ( int RecordUid ) * { * EvTestReportItems testReportItems = new EvTestReportItems( ); * * return testReportItems.getList( RecordUid ); * } */ //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #endregion #region Guid identifers section // ================================================================================== /// <summary> /// This class returns a list of formfield option objects /// </summary> /// <param name="RecordGuid">Guid: a record global unqiue identifier</param> /// <returns>List of EvOption: a list of formfield options</returns> /// <remarks> /// This method consists of the following steps /// /// 1. Execute the method for retrieving a list of formfield objects /// /// 2. Return a list of formfield objects. /// /// </remarks> // ---------------------------------------------------------------------------------- private List <EvOption> GetFormFieldList(Guid RecordGuid) { EdRecordFields formFields = new EdRecordFields( ); return(formFields.GetList(RecordGuid)); }//END GetFormFieldList class
}// Close GetIssuedItem method #endregion #region Update form object methods // =================================================================================== /// <summary> /// This class saves items to form ResultData table /// </summary> /// <param name="Layout">EvForm: a form object</param> /// <returns>EvEventCodes: an event code for saving items</returns> /// <remarks> /// This method consists of the following steps: /// /// 1. Exit, if the UserCommonName or VisitId or FormId is empty. /// /// 2. Execute the method for deleting items, if the action code is delete /// /// 3. Execute the method for adding items, if the form Uid is empty. /// /// 4. Else, execute the method for updating items /// /// 5. Return an event code of the method execution. /// </remarks> // ------------------------------------------------------------------------------------- public EvEventCodes SaveItem(EdRecord Layout) { this.LogMethod("saveForm method."); this.LogValue("Action: " + Layout.SaveAction); // // Initialise the local variables // EdRecords records = new EdRecords(this.ClassParameters); EdRecordFields formFields = new EdRecordFields(this.ClassParameters); EvEventCodes iReturn = EvEventCodes.Ok; if (Layout.LayoutId == String.Empty) { this.LogValue("Empty FormId"); return(EvEventCodes.Identifier_Form_Id_Error); } // // If the Action is DELETE and the state is draft. // if (Layout.SaveAction == EdRecord.SaveActionCodes.Layout_Deleted && Layout.State == EdRecordObjectStates.Form_Draft) { iReturn = this._Dal_RecordLayouts.DeleteItem(Layout); if (iReturn != EvEventCodes.Ok) { return(iReturn); } // // Withdraw the TestReport items associated with this TestReport. // iReturn = formFields.DeleteFields(Layout); return(iReturn); } // // Update the form state based on the form object Action property. // this.updateState(Layout); this.LogValue("Form State: " + Layout.State); // // If the trial is in use and not being re-issued then it cannot be withdrawn. // // Check if trial has been used. If so return an error. // if (Layout.State == EdRecordObjectStates.Withdrawn) { }//END trial state is withdrawn. // // If the unique identifier is null then add this object as a new // form object. // this.LogValue("Save Form to Database."); if (Layout.Guid == Guid.Empty) // Add new form { this.LogValue("Add Form to database"); // // Add the trial to the database. // iReturn = this._Dal_RecordLayouts.AddItem(Layout); this.LogClass(this._Dal_RecordLayouts.Log); // // Return the DAL DebugLog. // return(iReturn); }//END Add new trial. // // If the trial being approved then withdraw the pervious issues trial // if (Layout.SaveAction == EdRecord.SaveActionCodes.Layout_Approved) { this.LogValue("Withdraw the form"); // // Update the trial to withdraw is from use. // iReturn = this._Dal_RecordLayouts.WithdrawIssuedForm(Layout); this.LogClass(this._Dal_RecordLayouts.Log); } // // Update the trial object. // this.LogValue("Update Form "); // // Update the trial int the database. // iReturn = this._Dal_RecordLayouts.UpdateItem(Layout); this.LogClass(this._Dal_RecordLayouts.Log); // // Return the DAL DebugLog. // return(iReturn); }//END SaveItem method