/// <summary> /// The method can be called to clear all current property values from the free/busy object. The version /// is left unchanged. /// </summary> public override void ClearProperties() { url = null; uid = null; startDate = null; endDate = null; timeStamp = null; comment = null; organizer = null; duration = null; contact = null; attendees = null; reqstats = null; freebusy = null; customProps = null; }
//===================================================================== /// <summary> /// Validate the items in the collection /// </summary> /// <returns>Returns true if all are valid or false if any item is not valid. The position is set to the /// first invalid item.</returns> /// <remarks>The navigator doesn't allow for validation of all fields so we have to do some checking /// before saving the results.</remarks> public bool ValidateItems() { this.ErrorProvider.Clear(); FreeBusyPropertyCollection freebusys = (FreeBusyPropertyCollection)this.BindingSource.DataSource; foreach (FreeBusyProperty fb in freebusys) { if (fb.FreeBusyType == FreeBusyType.Other && fb.OtherType.Trim().Length == 0) { this.BindingSource.Position = freebusys.IndexOf(fb); txtOtherType.Focus(); this.ErrorProvider.SetError(txtOtherType, "When type is set to 'OTHER', a description " + "is required"); return(false); } if (fb.PeriodValue.StartDateTime == DateTime.MinValue) { this.BindingSource.Position = freebusys.IndexOf(fb); dtpStartDate.Focus(); this.ErrorProvider.SetError(dtpStartDate, "A start date is required"); return(false); } if (fb.PeriodValue.EndDateTime == DateTime.MinValue) { this.BindingSource.Position = freebusys.IndexOf(fb); dtpEndDate.Focus(); this.ErrorProvider.SetError(dtpEndDate, "An end date is required"); return(false); } if (fb.PeriodValue.StartDateTime > fb.PeriodValue.EndDateTime) { this.BindingSource.Position = freebusys.IndexOf(fb); dtpStartDate.Focus(); this.ErrorProvider.SetError(dtpStartDate, "Start date must be less than or equal to end date"); return(false); } } return(true); }