Example #1
0
        protected void reorderListLocation_ItemCommand(object sender, ReorderListCommandEventArgs e)
        {
            Location location;

            switch (e.CommandName)
            {
            case "View":
                location = Module.LocationGetById(Convert.ToInt32(e.CommandArgument));
                imgLocationView.ImageUrl = location.Image;
                lblLocationName.Text     = location.Name;
                ModalPopupExtender.Show();
                break;

            case "Delete":
                try
                {
                    location = Module.LocationGetById(Convert.ToInt32(e.CommandArgument));
                    Module.Delete(location);
                    GetDataSource();
                    reorderListLocation.DataBind();
                }
                catch (Exception ex)
                {
                    ShowError(ex.Message);
                    logger.Error("Delete location error", ex);
                }
                break;

            default:
                break;
            }
        }
Example #2
0
        protected void TicketCategoriesOrderList_UpdateCommand(object sender, ReorderListCommandEventArgs e)
        {
            TextBox tb = (TextBox)e.Item.FindControl("CategoryNameTextBox");

            if (!string.IsNullOrEmpty(tb.Text.Trim()))
            {
                SettingChangeResult result = SettingsManager.RenameCategory(OrderedCategories[e.Item.ItemIndex], tb.Text);
                OrderedCategories = new List <string>(SettingsManager.CategoriesList);
                TicketCategoriesOrderList.EditItemIndex = -1;
                switch (result)
                {
                case SettingChangeResult.Merge:
                    Message.Text = "Ticket category has been merged with an existing category.";
                    break;

                case SettingChangeResult.Failure:
                    Message.Text = "No changes saved.";
                    break;

                default:
                    //do nothing, change will be apparent from updated order list
                    break;
                }
            }
        }
        protected void DeleteItem(object sender, ReorderListCommandEventArgs e)
        {
            // remove from the sorted list, add to the removeFromSorted list
            this._sortItems     = this.Session[SortList] as List <ItemRelationshipSort>;
            this._unsortedItems = this.Session[UnSortedList] as List <ItemRelationshipSort>;
            if (this._sortItems != null)
            {
                foreach (ItemRelationshipSort irs in this._sortItems)
                {
                    if (irs.ItemRelationshipId == Convert.ToInt32(e.CommandArgument, CultureInfo.InvariantCulture))
                    {
                        this._sortItems.Remove(irs);
                        if (this._unsortedItems != null)
                        {
                            this._unsortedItems.Add(irs);
                        }

                        var li = new ListItem(irs.Name, irs.ItemRelationshipId.ToString(CultureInfo.InvariantCulture));
                        this.lbCategoryItems.Items.Add(li);
                        break;
                    }
                }

                this.rlCategorySort.DataSource = this._sortItems;
            }

            this.rlCategorySort.DataBind();

            this.Session[SortList]     = this._sortItems;
            this.Session[UnSortedList] = this._unsortedItems;

            // e.CommandArgument
            // add item to UnSortedList
        }
Example #4
0
        protected void TicketCategoriesOrderList_InsertCommand(object sender, ReorderListCommandEventArgs e)
        {
            TextBox tb = (TextBox)e.Item.FindControl("AddCategoryNameTextBox");

            if (!string.IsNullOrEmpty(tb.Text.Trim()))
            {
                OrderedCategories.Add(tb.Text);
                SettingsManager.CategoriesList = OrderedCategories.ToArray();
            }
        }