Exemplo n.º 1
0
        //=====================================================================

        /// <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()
        {
            bool result = true;

            tabInfo.SelectedTab = pgGeneral;

            this.ErrorProvider.Clear();

            VAlarmCollection alarms = (VAlarmCollection)this.BindingSource.DataSource;

            foreach (VAlarm a in alarms)
            {
                if (a.Trigger.DurationValue == Duration.Zero && a.Trigger.TimeZoneDateTime == DateTime.MinValue)
                {
                    this.BindingSource.Position = alarms.IndexOf(a);
                    this.ErrorProvider.SetError(dtpTrigger, "A trigger duration or date/time must be specified");
                    result = false;
                }

                if ((a.Action.Action == AlarmAction.EMail || a.Action.Action == AlarmAction.Display) &&
                    String.IsNullOrWhiteSpace(a.Description.Value))
                {
                    this.ErrorProvider.SetError(txtDescription, "A description is required");
                    result = false;
                }

                if (a.Action.Action == AlarmAction.EMail)
                {
                    if (String.IsNullOrEmpty(a.Summary.Value))
                    {
                        this.ErrorProvider.SetError(txtSummary, "A summary is required for an e-mail alarm");
                        result = false;
                    }
                    else
                    if (result && a.Attendees.Count == 0)
                    {
                        tabInfo.SelectedTab = pgAttendees;
                        this.ErrorProvider.SetError(ucAttendees, "At least one attendee is required for " +
                                                    "an e-mail alarm");
                        result = false;
                    }
                }

                if (!result)
                {
                    break;
                }
            }

            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// The method can be called to clear all current property values from the event.  The version is left
        /// unchanged.
        /// </summary>
        public override void ClearProperties()
        {
            classification = null;
            categories = null;
            resources = null;
            url = null;
            uid = null;
            geo = null;
            lastMod = null;
            dateCreated = null;
            startDate = null;
            endDate = null;
            dateStamp = null;
            summary = null;
            desc = null;
            location = null;
            priority = null;
            sequence = null;
            transp = null;
            rNum = null;
            comment = null;
            organizer = null;
            recurId = null;
            status = null;
            duration = null;

            contacts = null;
            attendees = null;
            relatedTo = null;
            attachments = null;
            reqStats = null;
            alarms = null;

            customProps = null;

            base.ClearProperties();
        }