/// <summary> /// This handles the Add command for the exception data grid /// </summary> /// <param name="source">The source of the event</param> /// <param name="e">The event arguments</param> protected void dgExceptions_ItemCommand(object source, DataGridCommandEventArgs e) { if (e.CommandName == "Add") { // Save changes to the edited item if there is one if (dgExceptions.EditItemIndex != -1) { dgExceptions_UpdateCommand(source, new DataGridCommandEventArgs( dgExceptions.Items[dgExceptions.EditItemIndex], e.CommandSource, e)); } // Ignore the request if the page is not valid if (!Page.IsValid) { return; } // Add a new exception and go into edit mode on it RecurringObject ro = GetCurrentObject(); ExRuleProperty exrule = new ExRuleProperty(); exrule.Recurrence.RecurDaily(1); ro.ExceptionRules.Add(exrule); dgExceptions.EditItemIndex = ro.ExceptionRules.Count - 1; dgExceptions.DataSource = ro.ExceptionRules; dgExceptions.DataBind(); } }
//===================================================================== /// <summary> /// This is overridden to allow cloning of a PDI object /// </summary> /// <returns>A clone of the object</returns> public override object Clone() { ExRuleProperty o = new ExRuleProperty(); o.Clone(this); return(o); }
//===================================================================== /// <summary> /// Add a recurrence rule /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event parameters</param> private void btnAddRRule_Click(object sender, EventArgs e) { using (RecurrencePropertiesDlg dlg = new RecurrencePropertiesDlg()) { if (dlg.ShowDialog() == DialogResult.OK) { // Add the recurrence rule to the collection and the list box using the appropriate type if (!editsExceptions) { RRuleProperty rr = new RRuleProperty(); dlg.GetRecurrence(rr.Recurrence); rRules.Add(rr); lbRRules.Items.Add(rr.Recurrence.ToString()); } else { ExRuleProperty er = new ExRuleProperty(); dlg.GetRecurrence(er.Recurrence); rRules.Add(er); lbRRules.Items.Add(er.Recurrence.ToString()); } } } this.SetButtonStates(); }
//===================================================================== /// <summary> /// This is overridden to allow cloning of a PDI object /// </summary> /// <returns>A clone of the object</returns> public override object Clone() { ExRuleProperty o = new ExRuleProperty(); o.Clone(this); return o; }