protected void TicketTypesOrderList_InsertCommand(object sender, ReorderListCommandEventArgs e) { TextBox tb = (TextBox)e.Item.FindControl("AddTypeNameTextBox"); if(!string.IsNullOrEmpty(tb.Text.Trim())) { OrderedTypes.Add(tb.Text); SettingsManager.TicketTypesList = OrderedTypes.ToArray(); } }
protected override bool OnBubbleEvent(object source, EventArgs args) { var ceargs = args as CommandEventArgs; if(null != ceargs) { var e = new ReorderListCommandEventArgs(ceargs, source, this); RaiseBubbleEvent(this, e); return true; } return true; }
protected void TicketTypesOrderList_UpdateCommand(object sender, ReorderListCommandEventArgs e) { TextBox tb = (TextBox)e.Item.FindControl("TypeNameTextBox"); if(!string.IsNullOrEmpty(tb.Text.Trim())) { SettingChangeResult result = SettingsManager.RenameTicketType(OrderedTypes[e.Item.ItemIndex], tb.Text); OrderedTypes = new List<string>(SettingsManager.TicketTypesList); TicketTypesOrderList.EditItemIndex = -1; switch(result) { case SettingChangeResult.Merge: Message.Text = "Ticket type has been merged with an existing type."; break; case SettingChangeResult.Failure: Message.Text = "No changes saved."; break; default: //do nothing, change will be apparent from updated order list break; } } }
protected void TicketPrioritiesOrderList_UpdateCommand(object sender, ReorderListCommandEventArgs e) { TextBox tb = (TextBox)e.Item.FindControl("PriorityNameTextBox"); if(!string.IsNullOrEmpty(tb.Text.Trim())) { SettingChangeResult result = SettingsManager.RenamePriority(OrderedPriorities[e.Item.ItemIndex], tb.Text); OrderedPriorities = new List<string>(SettingsManager.PrioritiesList); TicketPrioritiesOrderList.EditItemIndex = -1; switch(result) { case SettingChangeResult.Merge: Message.Text = "Приоритет завяки был объединен с существующим."; break; case SettingChangeResult.Failure: Message.Text = "Изменения не сохранены"; break; default: //do nothing, change will be apparent from updated order list break; } } }
/// <summary> /// When we get a bubble event, we create our ReorderListCommandArgs object /// and pass the event up to our parent to handle. /// </summary> protected override bool OnBubbleEvent(object source, EventArgs args) { CommandEventArgs ceargs = args as CommandEventArgs; if (null != ceargs) { ReorderListCommandEventArgs e = new ReorderListCommandEventArgs(ceargs, source, this); RaiseBubbleEvent(this, e); return true; } return true; }