public static Boolean ConvertApplicationsToPreviousExperience(ApplicationTDS AMainDS) { TDBTransaction Transaction = null; bool SubmissionOK = false; DBAccess.GDBAccessObj.BeginAutoTransaction(IsolationLevel.Serializable, ref Transaction, ref SubmissionOK, delegate { PmPastExperienceTable PastExperienceTable = new PmPastExperienceTable(); foreach (PmShortTermApplicationRow Row in AMainDS.PmShortTermApplication.Rows) { // create the new past experience record PmPastExperienceRow PastExperienceRow = PastExperienceTable.NewRowTyped(true); PastExperienceRow.Key = Convert.ToInt64(TSequenceWebConnector.GetNextSequence(TSequenceNames.seq_past_experience)); PastExperienceRow.PartnerKey = Row.PartnerKey; PastExperienceRow.PrevLocation = Row.ConfirmedOptionCode; PastExperienceRow.StartDate = Row.Arrival; PastExperienceRow.EndDate = Row.Departure; PastExperienceRow.PrevWorkHere = true; PastExperienceRow.PrevWork = true; PastExperienceRow.PastExpComments = "Created from Event Application"; PastExperienceRow.OtherOrganisation = ""; PastExperienceRow.PrevRole = ""; PastExperienceTable.Rows.Add(PastExperienceRow); } PmPastExperienceAccess.SubmitChanges(PastExperienceTable, Transaction); SubmissionOK = true; }); return(SubmissionOK); }
public static Boolean RemoveApplicationsFromPreviousExperience(ApplicationTDS AMainDS) { TDBTransaction Transaction = null; bool SubmissionOK = false; DBAccess.GDBAccessObj.BeginAutoTransaction(IsolationLevel.Serializable, ref Transaction, ref SubmissionOK, delegate { foreach (PmShortTermApplicationRow Row in AMainDS.PmShortTermApplication.Rows) { PmPastExperienceTable PastExperienceTable = new PmPastExperienceTable(); PmPastExperienceRow TempRow = PastExperienceTable.NewRowTyped(false); TempRow.PartnerKey = Row.PartnerKey; TempRow.PrevLocation = Row.ConfirmedOptionCode; PastExperienceTable = PmPastExperienceAccess.LoadUsingTemplate(TempRow, Transaction); if ((PastExperienceTable != null) && (PastExperienceTable.Rows.Count > 0)) { PastExperienceTable.Rows[0].Delete(); PmPastExperienceAccess.SubmitChanges(PastExperienceTable, Transaction); } } SubmissionOK = true; }); return(SubmissionOK); }
private void ShowDetailsManual(PmPastExperienceRow ARow) { // In theory, the next Method call could be done in Methods NewRowManual; however, NewRowManual runs before // the Row is actually added and this would result in the Count to be one too less, so we do the Method call here, short // of a non-existing 'AfterNewRowManual' Method.... DoRecalculateScreenParts(); }
private void ValidateDataDetailsManual(PmPastExperienceRow ARow) { TVerificationResultCollection VerificationResultCollection = FPetraUtilsObject.VerificationResultCollection; TSharedPersonnelValidation_Personnel.ValidatePreviousExperienceManual(this, ARow, ref VerificationResultCollection, FValidationControlsDict); }
/// <summary> /// Code to be run after the deletion process /// </summary> /// <param name="ARowToDelete">the row that was/was to be deleted</param> /// <param name="AAllowDeletion">whether or not the user was permitted to delete</param> /// <param name="ADeletionPerformed">whether or not the deletion was performed successfully</param> /// <param name="ACompletionMessage">if specified, is the deletion completion message</param> private void PostDeleteManual(PmPastExperienceRow ARowToDelete, bool AAllowDeletion, bool ADeletionPerformed, string ACompletionMessage) { if (ADeletionPerformed) { DoRecalculateScreenParts(); } }
/// <summary> /// Performs checks to determine whether a deletion of the current /// row is permissable /// </summary> /// <param name="ARowToDelete">the currently selected row to be deleted</param> /// <param name="ADeletionQuestion">can be changed to a context-sensitive deletion confirmation question</param> /// <returns>true if user is permitted and able to delete the current row</returns> private bool PreDeleteManual(PmPastExperienceRow ARowToDelete, ref string ADeletionQuestion) { /*Code to execute before the delete can take place*/ ADeletionQuestion = Catalog.GetString("Are you sure you want to delete the current row?"); ADeletionQuestion += String.Format("{0}{0}({1} {2}, {3} {4})", Environment.NewLine, lblLocation.Text, txtLocation.Text, lblRole.Text, txtRole.Text); return(true); }
/// <summary> /// Validates the previous experience data of a Person. /// </summary> /// <param name="AContext">Context that describes where the data validation failed.</param> /// <param name="ARow">The <see cref="DataRow" /> which holds the the data against which the validation is run.</param> /// <param name="AVerificationResultCollection">Will be filled with any <see cref="TVerificationResult" /> items if /// data validation errors occur.</param> /// <param name="AValidationControlsDict">A <see cref="TValidationControlsDict" /> containing the Controls that /// display data that is about to be validated.</param> /// <returns>void</returns> public static void ValidatePreviousExperienceManual(object AContext, PmPastExperienceRow ARow, ref TVerificationResultCollection AVerificationResultCollection, TValidationControlsDict AValidationControlsDict) { DataColumn ValidationColumn; TValidationControlsData ValidationControlsData; TVerificationResult VerificationResult; // Don't validate deleted DataRows if (ARow.RowState == DataRowState.Deleted) { return; } // 'Start Date' must not be a future date ValidationColumn = ARow.Table.Columns[PmPastExperienceTable.ColumnStartDateId]; if (AValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData)) { VerificationResult = null; VerificationResult = TDateChecks.IsCurrentOrPastDate(ARow.StartDate, ValidationControlsData.ValidationControlLabel, AContext, ValidationColumn, ValidationControlsData.ValidationControl); // Handle addition to/removal from TVerificationResultCollection AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn); } // 'End Date' must not be a future date ValidationColumn = ARow.Table.Columns[PmPastExperienceTable.ColumnEndDateId]; if (AValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData)) { VerificationResult = null; VerificationResult = TDateChecks.IsCurrentOrPastDate(ARow.EndDate, ValidationControlsData.ValidationControlLabel, AContext, ValidationColumn, ValidationControlsData.ValidationControl); // Handle addition to/removal from TVerificationResultCollection AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn); } // 'End Date' must be later or equal 'Start Date' ValidationColumn = ARow.Table.Columns[PmPastExperienceTable.ColumnEndDateId]; if (AValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData)) { VerificationResult = null; VerificationResult = TDateChecks.FirstGreaterOrEqualThanSecondDate(ARow.EndDate, ARow.StartDate, ValidationControlsData.ValidationControlLabel, ValidationControlsData.SecondValidationControlLabel, AContext, ValidationColumn, ValidationControlsData.ValidationControl); // Handle addition to/removal from TVerificationResultCollection AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn); } }
// Sets the key for a new row private void NewRowManual(ref PmPastExperienceRow ARow) { ARow.PartnerKey = FMainDS.PPerson[0].PartnerKey; ARow.Key = Convert.ToInt32(TRemote.MCommon.WebConnectors.GetNextSequence(TSequenceNames.seq_past_experience)); }
/// <summary> /// Performs checks to determine whether a deletion of the current /// row is permissable /// </summary> /// <param name="ARowToDelete">the currently selected row to be deleted</param> /// <param name="ADeletionQuestion">can be changed to a context-sensitive deletion confirmation question</param> /// <returns>true if user is permitted and able to delete the current row</returns> private bool PreDeleteManual(PmPastExperienceRow ARowToDelete, ref string ADeletionQuestion) { /*Code to execute before the delete can take place*/ ADeletionQuestion = Catalog.GetString("Are you sure you want to delete the current row?"); ADeletionQuestion += String.Format("{0}{0}({1} {2}, {3} {4})", Environment.NewLine, lblLocation.Text, txtLocation.Text, lblRole.Text, txtRole.Text); return true; }