protected override void BeforeChange(DataColumn dc, DataRow row) { atriumDB.AppointmentRow dr = (atriumDB.AppointmentRow)row; switch (dc.ColumnName) { case "Subject": if (dr.IsSubjectNull()) { throw new RequiredException(dc.ColumnName); } break; case "StartDate": // myA.IsValidDate(Resources.ActivityActivityDate, dr.StartDate, false, DateTime.Today.AddYears(-1), DateTime.Today.AddYears(1), String.Format(Resources.ValidationXYearsAgo, 1), String.Format(Resources.ValidationXYearsFromToday, 1)); // myA.IsWarningDate(Resources.ActivityDateWarning, dr.StartDate, false, DateTime.Today, DateTime.Today.AddYears(1)); break; case "EndDate": break; } }
public fApptRecurrence(FileManager fm, atriumDB.AppointmentRow ar) { InitializeComponent(); fmCurrent = fm; originalApptRow = ar; Init(); }
protected override void BeforeUpdate(DataRow dr) { BeforeChange("Subject", dr); atriumDB.AppointmentRow apptRow = (atriumDB.AppointmentRow)dr; if (!apptRow.IsIntervalNull()) { officeDB.OfficerRow workingas = myA.AtMng.WorkingAsOfficer; foreach (atriumDB.AttendeeRow att in apptRow.GetAttendeeRows()) { if (att.ContactId == workingas.OfficerId || att.RowState == DataRowState.Added) { att.Interval = apptRow.Interval; att.NotificationDismiss = false; } } } //if (!apptRow.IsApptRecurrenceIdNull() && apptRow.OriginalRecurrence == true) //{ // apptRow.ApptRecurrenceRow.updateDate = DateTime.Now; //} if (!apptRow.IsApptRecurrenceIdNull()) { if (apptRow.ApptRecurrenceRow.RecurrenceRemoved) { apptRow.ApptRecurrenceRow.Delete(); apptRow.SetApptRecurrenceIdNull(); myA.DB.ApptRecurrence.AcceptChanges(); } } }
protected override void BeforeUpdate(DataRow dr) { atriumDB.ApptRecurrenceRow drApptRecurrence = (atriumDB.ApptRecurrenceRow)dr; DataRow[] apptRows = myA.DB.Appointment.Select("ApptRecurrenceId=" + drApptRecurrence.ApptRecurrenceId.ToString() + " AND OriginalRecurrence='True'"); if (apptRows.Length > 0) { originalApptRow = (atriumDB.AppointmentRow)apptRows[0]; atriumDB.AppointmentRow[] appdt = originalApptRow.ApptRecurrenceRow.GetAppointmentRows(); foreach (atriumDB.AppointmentRow apptRow in appdt) { if (originalApptRow.ApptId != apptRow.ApptId) { atriumDB.AttendeeRow[] attRows = apptRow.GetAttendeeRows(); foreach (atriumDB.AttendeeRow attRow in attRows) { attRow.Delete(); } apptRow.Delete(); } } if (drApptRecurrence.RecurrenceRemoved) { // originalApptRow.SetApptRecurrenceIdNull(); originalApptRow.OriginalRecurrence = false; //drApptRecurrence.Delete(); } else { CreateRecurrenceAppointments(originalApptRow); } } }
protected override void AfterAdd(DataRow row) { atriumDB.AppointmentRow dr = (atriumDB.AppointmentRow)row; string ObjectName = this.myAppointmentDT.TableName; //System.Diagnostics.Debug.WriteLine(dr["ContactId"] + dr.RowState.ToString() ); dr.ApptId = this.myA.AtMng.PKIDGet(ObjectName, 10); if (dr.IsNull("FileId")) { dr.FileId = myA.CurrentFileId; } dr.Type = 0; dr.ShowAsBusy = true; dr.AllDayEvent = false; dr.Subject = "..."; dr.Tentative = false; dr.Vacation = false; DateTime d = DateTime.Now.AddHours(1); dr.StartDateLocal = new DateTime(d.Year, d.Month, d.Day, d.Hour, 0, 0); dr.StartDate = dr.StartDateLocal.ToUniversalTime(); d = d.AddHours(1); dr.EndDateLocal = new DateTime(d.Year, d.Month, d.Day, d.Hour, 0, 0); dr.EndDate = dr.EndDateLocal.ToUniversalTime(); dr.OriginalRecurrence = false; //atriumDB.AttendeeRow ar = (atriumDB.AttendeeRow)myA.GetAttendee().Add(dr); //ar.ContactId = myA.AtMng.WorkingAsOfficer.OfficerId; //ar.Accepted = true; EFileBE.XmlAddToc(myA.CurrentFile, "appointment", "Calendar", "Calendrier", 119); }
private void CreateRecurrenceAppointments(atriumDB.AppointmentRow apptRow) { originalApptRow = apptRow; originalAttRows = originalApptRow.GetAttendeeRows(); trackDate = originalApptRow.StartDateLocal; DateTime tmpDateTime = apptRow.ApptRecurrenceRow.EndRangeDate.DateTime; tmpDateTime = tmpDateTime.AddHours(trackDate.TimeOfDay.Hours); recurrenceEndDate = tmpDateTime; occursEvery = apptRow.ApptRecurrenceRow.OccursEvery; tsAppointmentLength = originalApptRow.EndDateLocal - originalApptRow.StartDateLocal; switch (originalApptRow.ApptRecurrenceRow.ApptRecurrenceTypeId) { case 0: AddRecurrenceAppointmentDaily(); break; case 1: AddRecurrenceAppointmentWeekly(); break; case 2: AddRecurrenceAppointmentMonthly(); break; default: // do nothing break; } }
public void EnableReminders() { try { DateTime currentDate = DateTime.Now; int dueInMinutes; notificationDT = new DataTable("AppointmentNotification"); notificationDT.Columns.Add("AttendeeId", typeof(int)); notificationDT.Columns.Add("Subject", typeof(string)); notificationDT.Columns.Add("DueIn", typeof(string)); notificationDT.Columns.Add("StartDateLocal", typeof(DateTime)); notificationDT.Columns.Add("Interval", typeof(int)); //foreach (atriumDB.AttendeeRow attrow in myFMCal.DB.Attendee.Rows) atriumDB.AttendeeRow[] attrs = (atriumDB.AttendeeRow[])myFMCal.DB.Attendee.Select("ContactId=" + myOfficerId.ToString()); foreach (atriumDB.AttendeeRow attrow in attrs) { if (!attrow.IsIntervalNull() && !attrow.IsNotificationDismissNull()) { atriumDB.AppointmentRow appr = attrow.AppointmentRow; if (appr != null && appr.RowState != DataRowState.Deleted) { dueInMinutes = appr.StartDateLocal.Subtract(DateTime.Now).Minutes; if (attrow.Interval > 0 && dueInMinutes <= attrow.Interval) { if (!attrow.NotificationDismiss) { string sDueIn = GetStringDueIn(dueInMinutes, appr.StartDateLocal.Subtract(DateTime.Now)); notificationDT.Rows.Add(attrow.AttendeeId, appr.Subject, sDueIn, appr.StartDateLocal, attrow.Interval); notificationDT.AcceptChanges(); } } } } } if (notificationDT.Rows.Count > 0) { // if (fApp == null ) if (!VerifyOpenForm("fApptNotification")) { fApp = new fApptNotification(myFMCal, notificationDT); fApp.Show(); fApp.WindowState = FormWindowState.Normal; } else { fApp.Datasource = notificationDT; fApp.Refresh(); } } } catch (Exception x) { UIHelper.HandleUIException(x); } }
private void schedule1_AppointmentRead(object sender, Janus.Windows.Schedule.AppointmentEventArgs e) { DataRowView drv = (DataRowView)e.Appointment.DataRow; atriumDB.AppointmentRow apptRow = (atriumDB.AppointmentRow)drv.Row; if (!apptRow.IsApptRecurrenceIdNull()) { e.Appointment.ImageIndex1 = 3; } }
public override void ApplySecurity(DataRow dr) { atriumDB.AppointmentRow cbr = (atriumDB.AppointmentRow)dr; UIHelper.EnableControls(AppointmentBindingSource, FM.GetAppointment().CanEdit(cbr)); UIHelper.EnableCommandBarCommand(tsDelete, FM.GetAppointment().CanDelete(cbr)); if (ApptIsHearing()) { tsDelete.Enabled = Janus.Windows.UI.InheritableBoolean.False; } tentativeUICheckBox.Enabled = false; vacationUICheckBox.Enabled = false; }
protected override void BeforeUpdate(DataRow row) { SST.HearingRow dr = (SST.HearingRow)row; myA.FM.CurrentFile.SetMisc1DateNull(); foreach (SST.HearingRow ahr in myHearingDT) { if (ahr.HearingStatus == 1 && !ahr.IsApptIdNull()) { atriumDB.AppointmentRow aDr = myA.FM.DB.Appointment.FindByApptId(ahr.ApptId); myA.FM.CurrentFile.Misc1Date = aDr.StartDateLocal.Date; } } }
private void GetOriginalRecurrenceAppointment(FileManager fm) { atriumDB.AppointmentRow apptr = (atriumDB.AppointmentRow)((DataRowView)AppointmentBindingSource.Current).Row; if (!apptr.IsApptRecurrenceIdNull()) { DataRow[] drs = fm.DB.Appointment.Select("ApptRecurrenceId=" + apptr.ApptRecurrenceId.ToString() + " AND OriginalRecurrence='True'"); if (drs.Length > 0) { atriumDB.AppointmentRow origRecurrApptRow = (atriumDB.AppointmentRow)drs[0]; AppointmentBindingSource.Position = AppointmentBindingSource.Find("ApptId", origRecurrApptRow.ApptId); } } }
private void AddRecurrenceSymbol() { foreach (Janus.Windows.Schedule.ScheduleAppointment apptScheduled in schedule1.Appointments) { DataRowView drv = (DataRowView)apptScheduled.DataRow; atriumDB.AppointmentRow apptRow = (atriumDB.AppointmentRow)drv.Row; if (!apptRow.IsApptRecurrenceIdNull()) { apptScheduled.ImageIndex1 = 3; } } }
protected override void AfterChange(DataColumn dc, DataRow row) { atriumDB.AppointmentRow dr = (atriumDB.AppointmentRow)row; if (!dr.IsApptRecurrenceIdNull() && dr.OriginalRecurrence == true && dr.ApptRecurrenceRow != null) { dr.ApptRecurrenceRow.updateDate = DateTime.Now; } switch (dc.ColumnName) { case "StartDateLocal": if (!dr.IsEndDateLocalNull() && !dr.IsStartDateLocalNull() && !dr.IsNull("EndDate") && !dr.IsNull("StartDate")) { //keep duration TimeSpan ts = dr.StartDate.DateTime.Subtract(dr.EndDate.DateTime); dr.EndDateLocal = dr.StartDateLocal.Add(ts.Duration()); dr.EndDate = dr.EndDateLocal.ToUniversalTime(); } dr.StartDate = dr.StartDateLocal.ToUniversalTime(); dr.EndEdit(); break; case "EndDateLocal": if (!dr.IsEndDateLocalNull() && !dr.IsStartDateLocalNull() && !dr.IsNull("EndDate") && !dr.IsNull("StartDate")) { if (dr.EndDateLocal <= dr.StartDateLocal) { dr.StartDateLocal = dr.EndDateLocal.AddHours(-1); } } dr.EndDate = dr.EndDateLocal.ToUniversalTime(); dr.EndEdit(); break; } }
private void btnSnooze_Click(object sender, EventArgs e) { try { int attendeeId; List <DataRow> rowList = new List <DataRow>(); foreach (Janus.Windows.GridEX.GridEXSelectedItem gsi in gridEXNotification.SelectedItems) { if (gsi.RowType == Janus.Windows.GridEX.RowType.Record) { rowList.Add(((DataRowView)gsi.GetRow().DataRow).Row); } } if (rowList.Count > 0) { foreach (DataRow dr in rowList) { attendeeId = (int)dr.ItemArray[0]; atriumDB.AttendeeRow attrow = currentFM.DB.Attendee.FindByAttendeeId(attendeeId); atriumDB.AppointmentRow approw = attrow.AppointmentRow; if (!attrow.IsNotificationDismissNull()) { attrow.BeginEdit(); attrow.NotificationDismiss = false; int SelectedValue; bool result = Int32.TryParse(ucDDReminder.SelectedValue.ToString(), out SelectedValue); if (result) { attrow.Interval = SelectedValue; } // // Activate this option in 1.10 // //TimeSpan TS = approw.StartDateLocal.Subtract(DateTime.Now); //int SelectedValue; //bool result = Int32.TryParse(ucDDReminder.SelectedValue.ToString(), out SelectedValue); //if (result) //{ // double interval = TS.TotalMinutes - SelectedValue; // attrow.Interval = Convert.ToInt32(interval); //} attrow.EndEdit(); } dr.Delete(); dr.AcceptChanges(); } atLogic.BusinessProcess bp = currentFM.GetBP(); bp.AddForUpdate(currentFM.DB.Attendee); bp.Update(); DataTable dt = (DataTable)bSourceAppointmentDataview.DataSource; if (dt.Rows.Count == 0) { this.Close(); } SetFormHeader(dt.Rows.Count); Refresh(); } else { this.Close(); } } catch (Exception x) { UIHelper.HandleUIException(x); } }
protected override void AfterChange(DataColumn dc, DataRow row) { SST.HearingRow dr = (SST.HearingRow)row; switch (dc.ColumnName) { case "ApptId": //add all the filecontacts as attendees //atriumDB.AppointmentRow appr = myA.FM.DB.Appointment.FindByApptId(dr.ApptId); //foreach (SST.FilePartyRow fcr in myA.DB.FileParty) //{ // atriumDB.AttendeeRow ar = (atriumDB.AttendeeRow)myA.FM.GetAttendee().Add(appr); // ar.ContactId = fcr.PartyId; // ar.Accepted = true; //} break; case "HearingToCloneId": SST.HearingRow drHearing2Clone = (SST.HearingRow)myA.DB.Hearing.Select("ApptId=" + dr.HearingToCloneId)[0]; //are attendees loaded already? //myA.FM.GetAttendee().LoadByApptId(drHearing2Clone.ApptId); //find new appointment atriumDB.AppointmentRow apptRow = myA.FM.DB.Appointment.FindByApptId(dr.ApptId); atriumDB.AppointmentRow oldApptRow = myA.FM.DB.Appointment.FindByApptId(drHearing2Clone.ApptId); oldApptRow.ShowAsBusy = false; //add attendees for each attendee in cloned hearing foreach (atriumDB.AttendeeRow attendeerow in myA.FM.DB.Attendee.Select("ApptId=" + drHearing2Clone.ApptId)) { atriumDB.AttendeeRow newAttendee = (atriumDB.AttendeeRow)myA.FM.GetAttendee().Add(apptRow); newAttendee.ContactId = attendeerow.ContactId; } dr.HearingMethodId = drHearing2Clone.HearingMethodId; apptRow.Subject = oldApptRow.Subject; break; case "HearingMethodId": if (!dr.IsHearingMethodIdNull()) { if (dr.HearingMethodId != 3) // teleconference { dr.SetSecurityPINNull(); } } break; case "PINMode": if (!dr.IsHearingMethodIdNull()) { if (dr.HearingMethodId == 3) // teleconference { atriumDB.FileContactRow fcrTM = myA.FM.GetFileContact().GetByRole("FTM"); //SST.HearingDataTable hdt = myDAL.LoadByMemberId(fcrTM.ContactId); DataTable dt = myA.AtMng.GetGeneralRec("select * from vddeSecurityPIN where OfficerID=" + fcrTM.ContactId.ToString()); Random random = new Random(); int PIN = 0; if (!dr.IsPINModeNull()) { if (!dr.IsSecurityPINNull()) { dr.PreviousSecurityPIN = dr.SecurityPIN; } else { //see if there this member already has a PIN for the file. DataRow[] drs = dt.Select("Fileid=" + dr.FileID.ToString()); if (drs.Length > 0) { dr.SecurityPIN = (int)drs[0]["SecurityPIN"]; dr.PreviousSecurityPIN = dr.SecurityPIN; } else { dr.PreviousSecurityPIN = 0; } } if (dr.PINMode == 1 || dr.PINMode == 3 || dr.IsSecurityPINNull()) // generate new PIN { PIN = GeneratePIN(dt); } else // check for duplicates not on the same file { DataRow[] drs = dt.Select("SecurityPIN=" + dr.SecurityPIN.ToString() + " and Fileid<>" + dr.FileID.ToString()); if (drs.Length > 0) { PIN = GeneratePIN(dt); } else { dr.PreviousSecurityPIN = 0; //this is to force the current PIN into the member's PIN history PIN = dr.SecurityPIN; } } } dr.SecurityPIN = PIN; } } break; } }
public void MyXml(SST.SSTCaseRow sstr, System.Xml.XmlDocument xd) { //special doc folders System.Xml.XmlElement xdoc = (System.Xml.XmlElement)xd.SelectSingleNode("//toc[@type='document' and @filter='true']"); System.Xml.XmlElement xDocFilt; if (xdoc != null) { xdoc.InnerXml = ""; if (sstr.AppealLevelID == 1) { xDocFilt = xd.CreateElement("toc"); xDocFilt.SetAttribute("type", "document"); xDocFilt.SetAttribute("filter", "DocTypeMajorCode='P1'"); xDocFilt.SetAttribute("titlee", "Part 1"); xDocFilt.SetAttribute("titlef", "Partie 1"); xDocFilt.SetAttribute("sort", "10"); xdoc.AppendChild(xDocFilt); xDocFilt = xd.CreateElement("toc"); xDocFilt.SetAttribute("type", "document"); xDocFilt.SetAttribute("filter", "DocTypeMajorCode='P2'"); xDocFilt.SetAttribute("titlee", "Part 2"); xDocFilt.SetAttribute("titlef", "Partie 2"); xDocFilt.SetAttribute("sort", "20"); xdoc.AppendChild(xDocFilt); xDocFilt = xd.CreateElement("toc"); xDocFilt.SetAttribute("type", "document"); xDocFilt.SetAttribute("filter", "DocTypeMajorCode is null"); xDocFilt.SetAttribute("titlee", "Internal"); xDocFilt.SetAttribute("titlef", "Interne"); xDocFilt.SetAttribute("sort", "30"); xdoc.AppendChild(xDocFilt); } else { xDocFilt = xd.CreateElement("toc"); xDocFilt.SetAttribute("type", "document"); xDocFilt.SetAttribute("filter", "DocTypeMajorCode='P1' and SourceDivision=1"); xDocFilt.SetAttribute("titlee", "GD - Part 1"); xDocFilt.SetAttribute("titlef", "GD - Partie 1"); xDocFilt.SetAttribute("sort", "10"); xdoc.AppendChild(xDocFilt); xDocFilt = xd.CreateElement("toc"); xDocFilt.SetAttribute("type", "document"); xDocFilt.SetAttribute("filter", "DocTypeMajorCode='P2' and SourceDivision=1"); xDocFilt.SetAttribute("titlee", "GD - Part 2"); xDocFilt.SetAttribute("titlef", "GD - Partie 2"); xDocFilt.SetAttribute("sort", "20"); xdoc.AppendChild(xDocFilt); xDocFilt = xd.CreateElement("toc"); xDocFilt.SetAttribute("type", "document"); xDocFilt.SetAttribute("filter", "DocTypeMajorCode='P1' and SourceDivision<>1"); xDocFilt.SetAttribute("titlee", "AD - Part 1"); xDocFilt.SetAttribute("titlef", "AD - Partie 1"); xDocFilt.SetAttribute("sort", "30"); xdoc.AppendChild(xDocFilt); xDocFilt = xd.CreateElement("toc"); xDocFilt.SetAttribute("type", "document"); xDocFilt.SetAttribute("filter", "DocTypeMajorCode='P2' and SourceDivision<>1"); xDocFilt.SetAttribute("titlee", "AD - Part 2"); xDocFilt.SetAttribute("titlef", "AD - Partie 2"); xDocFilt.SetAttribute("sort", "40"); xdoc.AppendChild(xDocFilt); xDocFilt = xd.CreateElement("toc"); xDocFilt.SetAttribute("type", "document"); xDocFilt.SetAttribute("filter", "DocTypeMajorCode is null"); xDocFilt.SetAttribute("titlee", "AD - Internal"); xDocFilt.SetAttribute("titlef", "AD - Interne"); xDocFilt.SetAttribute("sort", "50"); xdoc.AppendChild(xDocFilt); } } System.Xml.XmlElement xe = (System.Xml.XmlElement)xd.SelectSingleNode("//toc[@supertype='sstcase' and @type='sstcase']"); if (xe == null) { string sort = "109"; xe = xd.CreateElement("toc"); xe.SetAttribute("supertype", "sstcase"); xe.SetAttribute("type", "sstcase"); xe.SetAttribute("sort", sort); xe.SetAttribute("id", sstr.SSTCaseId.ToString()); System.Xml.XmlElement xeAfter = (System.Xml.XmlElement)xd.SelectSingleNode("//toc[@sort>" + sort + "]"); if (xeAfter == null) { xeAfter = (System.Xml.XmlElement)xd.SelectSingleNode("//fld[@sort>" + sort + "]"); } if (xeAfter == null) { xd.DocumentElement.AppendChild(xe); } else { xd.DocumentElement.InsertBefore(xe, xeAfter); } } xe.SetAttribute("titlee", "SST Appeal"); xe.SetAttribute("titlef", "Appel au TSS"); //if (!sstr.IsCaseStatusDescEngNull() && !sstr.IsCaseStatusDescFreNull()) //{ // xe.SetAttribute("titlee", "SST Appeal (" + sstr.CaseStatusDescEng + ")"); // xe.SetAttribute("titlef", "Appel au TSS (" + sstr.CaseStatusDescFre + ")"); // if (sstr.CaseStatus == 2)//Hearing Scheduled // { int Fileid = sstr.FileId; if (xe.HasChildNodes) { xe.RemoveChild(xe.FirstChild); } SST.HearingRow[] aHrs = (SST.HearingRow[])myA.DB.Hearing.Select("Fileid=" + Fileid.ToString() + " and HearingStatus=1"); //myA.FM.CurrentFile.SetMisc1DateNull(); //it's all inhearing before update now 2015-3-10 CJW if (aHrs.Length > 0) { foreach (SST.HearingRow aHr in aHrs) { // JLL: If Hearing/ApptId is null, don't create xmldate node if (!aHr.IsApptIdNull()) { int ApptId = aHr.ApptId; atriumDB.AppointmentRow aDr = (atriumDB.AppointmentRow)myA.FM.DB.Appointment.Select("ApptId=" + ApptId.ToString())[0]; DateTime dateTimeLocal = aDr.StartDateLocal; string dtDateEng = dateTimeLocal.ToString("MMMM dd, yyyy @ hh:mm tt", System.Globalization.CultureInfo.CreateSpecificCulture("en-CA")); string dtDateFre = dateTimeLocal.ToString("dd MMMM yyyy à HH:mm", System.Globalization.CultureInfo.CreateSpecificCulture("fr-CA")); string[] tzv = GetAcronymTimeZoneLabel(); System.Xml.XmlElement xmlDate = xd.CreateElement("toc"); xmlDate.SetAttribute("supertype", "sstcase"); xmlDate.SetAttribute("type", "sstcase"); xmlDate.SetAttribute("bold", "true"); xmlDate.SetAttribute("titlef", dtDateFre + " " + tzv[0]); xmlDate.SetAttribute("titlee", dtDateEng + " " + tzv[1]); if (xe.HasChildNodes) { xe.RemoveChild(xe.FirstChild); } xe.AppendChild(xmlDate); if (!aHr.IsSCOfficeIdNull()) { myA.FM.EFile.XmlAddTocACS(xd, 105352, "sstcase", 109); } } } } //} //Hearing Postponed || Hearing Adjourned ||Hearing Held || Decision Issued //if ((sstr.CaseStatus == 6) || (sstr.CaseStatus == 7) || (sstr.CaseStatus == 5) || (sstr.CaseStatus == 4) || (sstr.CaseStatus == 9)) //{ // if (xe.HasChildNodes) // { // xe.RemoveChild(xe.FirstChild); // } //} //} //else //{ // xe.SetAttribute("titlee", "SST Appeal"); // xe.SetAttribute("titlef", "Appel au TSS"); //} System.Xml.XmlElement xe2 = (System.Xml.XmlElement)xd.SelectSingleNode("//toc[@supertype='sstcase' and @type='sstdetail']"); if (xe2 == null) { string sort = "110"; xe2 = xd.CreateElement("toc"); xe2.SetAttribute("supertype", "sstcase"); xe2.SetAttribute("type", "sstdetail"); xe2.SetAttribute("sort", sort); xe2.SetAttribute("id", sstr.SSTCaseId.ToString()); xe2.SetAttribute("titlee", "Program Information"); xe2.SetAttribute("titlef", "Information sur le Programme"); System.Xml.XmlElement xeAfter = (System.Xml.XmlElement)xd.SelectSingleNode("//toc[@sort>" + sort + "]"); if (xeAfter == null) { xeAfter = (System.Xml.XmlElement)xd.SelectSingleNode("//fld[@sort>" + sort + "]"); } if (xeAfter == null) { xd.DocumentElement.AppendChild(xe2); } else { xd.DocumentElement.InsertBefore(xe2, xeAfter); } } }
/// <summary> /// This method is used to sync bf records between datasets /// It only works after the bf has been saved and committed /// </summary> /// <param name="abfr"></param> public void SyncAppointment(atriumDB.AppointmentRow apptRow, bool forDelete) { //see if bf is loaded atriumDB.AppointmentRow apptRowToSync = DB.Appointment.FindByApptId(apptRow.ApptId); if (apptRowToSync != null) { if (apptRowToSync.RowState == DataRowState.Unchanged) { if (forDelete) { try { apptRowToSync.Delete(); } catch (Exception x) { apptRowToSync.RowError = ""; } apptRowToSync.AcceptChanges(); } else { //if it is sync it GetAppointment().Load(apptRow.ApptId); if (IsVirtualFM && apptRowToSync.GetAttendeeRows().Length > apptRow.GetAttendeeRows().Length) { //an attendee must have been deleted foreach (atriumDB.AttendeeRow atrd in apptRowToSync.GetAttendeeRows()) { atrd.Delete(); } DB.Attendee.AcceptChanges(); } GetAttendee().LoadByApptId(apptRow.ApptId); if (apptRow.OriginalRecurrence) { GetApptRecurrence().Load(apptRow.ApptRecurrenceId); } } } } else { //load it atriumDB.AppointmentRow appr = (atriumDB.AppointmentRow)GetAppointment().Load(apptRow.ApptId); GetAttendee().LoadByApptId(appr.ApptId); if (appr.OriginalRecurrence) { GetApptRecurrence().Load(appr.ApptRecurrenceId); } //check to see if bflistofficer is an attendee atriumDB.AttendeeRow[] attrs = (atriumDB.AttendeeRow[])DB.Attendee.Select("ApptId=" + appr.ApptId.ToString() + " and ContactId=" + BfListOfficerId.ToString()); if (attrs.Length > 0) { //ok 2 keep } else { try { appr.Delete(); } catch (Exception x) { //do nothing appr.RowError = ""; } appr.AcceptChanges(); } } }
protected override void AfterUpdate(DataRow dr) { atriumDB.AppointmentRow apptRow = (atriumDB.AppointmentRow)dr; myA.AtMng.SyncAppointment(apptRow, myA.IsVirtualFM, false); }