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); }
public static Boolean RemoveApplicationsFromPreviousExperience(ApplicationTDS AMainDS) { TDBTransaction Transaction = null; bool SubmissionOK = false; DBAccess.GDBAccessObj.BeginAutoTransaction(IsolationLevel.Serializable, ref Transaction, ref SubmissionOK, delegate { foreach (ApplicationTDSPmShortTermApplicationRow Row in AMainDS.PmShortTermApplication.Rows) { PmPastExperienceTable PastExperienceTable = PmPastExperienceAccess.LoadByUniqueKey( Row.PartnerKey, Row.EventEndDate, Row.EventStartDate, Row.ConfirmedOptionCode, Transaction); if ((PastExperienceTable != null) && (PastExperienceTable.Rows.Count > 0)) { PastExperienceTable.Rows[0].Delete(); PmPastExperienceAccess.SubmitChanges(PastExperienceTable, Transaction); } } SubmissionOK = true; }); return(SubmissionOK); }