示例#1
0
    }//END setUpdateRecordState method. 

    // =====================================================================================
    /// <summary>
    /// This method creates the submitted sign off object.
    /// </summary>
    /// <param name="Record">EvForm: a form object.</param>
    /// <param name="AuthenticatedUserId">String: the users authenticated identifier.</param>
    /// <remarks>
    /// This method consists of the following steps: 
    /// 
    /// 1. Reset the form object to default values and a state to be submitted
    /// 
    /// 2. Update the form object's values to the sign off object. 
    /// </remarks>
    //  ----------------------------------------------------------------------------------
    private void submitRecordSignoff ( EdRecord Record )
    {
      this.LogMethod ( "submitRecordSignoff method." );
      // 
      // Initialise the local variables
      // 
      EdUserSignoff userSignoff = new EdUserSignoff ( );

      Record.State = EdRecordObjectStates.Submitted_Record;

      // 
      // Append the signoff object.
      // 
      userSignoff.Type = EdUserSignoff.TypeCode.Record_Submitted_Signoff;
      userSignoff.SignedOffUserId = this.ClassParameters.UserProfile.UserId;
      userSignoff.SignedOffBy = this.ClassParameters.UserProfile.CommonName;
      userSignoff.SignOffDate = DateTime.Now;

      Record.Signoffs.Add ( userSignoff );

    }//END createSignoff method 
        }//END unlockItem method

        // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        #endregion

        #region Ancillary Record state update

        // =====================================================================================
        /// <summary>
        /// This class updates the Record state and approve records for the Record.
        /// </summary>
        /// <param name="AncillaryRecord">EvSubjectRecord: a milestone record object</param>
        /// <remarks>
        /// This method consists of the following steps:
        ///
        /// 1. Update the Authenticated userId, if it exists.
        ///
        /// 2. Update the SubjectRecord object and userSignoff object
        /// based on the milestone record's state and action
        /// </remarks>
        //  ----------------------------------------------------------------------------------
        private void updateState(EvAncillaryRecord AncillaryRecord)
        {
            this._DebugLog.AppendLine("Evado.Digital.Bll.AncillaryRecords.updateState method. ");
            this._DebugLog.AppendLine("Action: " + AncillaryRecord.Action);

            //
            // Define the local variables.
            //
            string        dt          = DateTime.Now.ToString("MMM dd yyyy");
            EdUserSignoff userSignoff = new EdUserSignoff( );

            //
            // IF the signoff object is null then initialise it.
            //
            if (AncillaryRecord.Signoffs == null)
            {
                AncillaryRecord.Signoffs = new List <EdUserSignoff> ( );
            }

            //
            // If the instrument has an authenticated signoff pass the user id to the
            // to the DAL layer and DB.
            //
            string AuthenticatedUserId = String.Empty;

            if (AncillaryRecord.IsAuthenticatedSignature == true)
            {
                AuthenticatedUserId = AncillaryRecord.UpdatedByUserId;
            }

            //
            // Save the trial record to the database.
            //
            // If state is null set it to created.
            //
            if (AncillaryRecord.State == EdRecordObjectStates.Null)
            {
                AncillaryRecord.State = EdRecordObjectStates.Draft_Record;
            }

            //
            // If the record state is created then reset the approveal properties.
            //
            if (AncillaryRecord.State == EdRecordObjectStates.Draft_Record)
            {
                AncillaryRecord.Reviewer     = String.Empty;
                AncillaryRecord.ReviewDate   = Evado.Digital.Model.EvcStatics.CONST_DATE_NULL;
                AncillaryRecord.Approver     = String.Empty;
                AncillaryRecord.ApprovalDate = Evado.Digital.Model.EvcStatics.CONST_DATE_NULL;
            }

            //
            // Perform author signoff of the record and save it to the database.
            //
            if (AncillaryRecord.Action == EvAncillaryRecords.ACTION_SIGNED)
            {
                this._DebugLog.AppendLine("Researcher Signoff record.");
                AncillaryRecord.State            = EdRecordObjectStates.Submitted_Record;
                AncillaryRecord.Researcher       = AncillaryRecord.UserCommonName;
                AncillaryRecord.ResearcherUserId = AuthenticatedUserId;
                AncillaryRecord.ResearcherDate   = DateTime.Now;

                userSignoff.Type            = EdUserSignoff.TypeCode.Record_Author_Signoff;
                userSignoff.SignedOffUserId = AuthenticatedUserId;
                userSignoff.SignedOffBy     = AncillaryRecord.UserCommonName;
                userSignoff.SignOffDate     = AncillaryRecord.ResearcherDate;
                AncillaryRecord.Signoffs.Add(userSignoff);



                return;
            }

            //
            // Perform withdrawn of the trial record and save it to the database.
            //
            if (AncillaryRecord.Action == EvAncillaryRecords.ACTION_WITHDRAW &&
                AncillaryRecord.Reviewer == String.Empty &&
                AncillaryRecord.Approver == String.Empty)
            {
                this._DebugLog.AppendLine("Withdrawn Record.");
                AncillaryRecord.State = EdRecordObjectStates.Withdrawn;

                return;
            }
        }//END updateState method.