Example #1
0
        /// <summary>
        /// Handles events when clicking image button in the grid (Edit/Up/Down)
        /// </summary>
        /// <history>
        ///     [tamttt] 20/10/2004	Created
        /// </history>
        protected void grdEntries_ItemCommand(object source, DataGridCommandEventArgs e)
        {
            try
            {
                ListController ctlLists = new ListController();
                int            entryID  = Convert.ToInt32(((DataGrid)source).DataKeys[e.Item.ItemIndex]);

                switch (e.CommandName.ToLower())
                {
                case "delete":
                    DeleteItem(entryID);
                    InitList();
                    BindGrid();
                    break;

                case "edit":
                    EnableView(false);
                    EnableEdit(false);

                    ListEntryInfo entry = ctlLists.GetListEntryInfo(entryID);
                    this.txtEntryID.Text          = entryID.ToString();
                    this.txtParentKey.Text        = entry.ParentKey;
                    this.txtEntryName.Text        = entry.ListName;
                    this.txtEntryValue.Text       = entry.Value;
                    this.txtEntryText.Text        = entry.Text;
                    this.txtEntryName.ReadOnly    = true;
                    this.cmdSaveEntry.CommandName = "Update";

                    if (!(entry.DefinitionID == -1))
                    {
                        this.cmdDelete.Visible = true;
                        ClientAPI.AddButtonConfirm(cmdDelete, Localization.GetString("DeleteItem"));
                    }
                    else
                    {
                        this.cmdDelete.Visible = false;
                    }

                    break;

                case "up":
                    ctlLists.UpdateListSortOrder(entryID, true);
                    InitList();
                    BindGrid();
                    break;

                case "down":
                    ctlLists.UpdateListSortOrder(entryID, false);
                    InitList();
                    BindGrid();
                    break;
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Example #2
0
        /// <summary>
        ///     Handles events when clicking image button in the grid (Edit/Up/Down)
        /// </summary>
        /// <param name="source"></param>
        /// <param name="e"></param>
        protected void EntriesGridItemCommand(object source, GridCommandEventArgs e)
        {
            try
            {
                var ctlLists = new ListController();
                int entryID  = Convert.ToInt32(((GridDataItem)e.Item).GetDataKeyValue("EntryID"));

                switch (e.CommandName.ToLower())
                {
                case "delete":
                    Mode = "ListEntries";
                    DeleteItem(entryID);
                    break;

                case "edit":
                    Mode = "EditEntry";

                    ListEntryInfo entry = ctlLists.GetListEntryInfo(entryID);
                    txtEntryID.Text          = entryID.ToString(CultureInfo.InvariantCulture);
                    txtParentKey.Text        = entry.ParentKey;
                    txtEntryValue.Text       = entry.Value;
                    txtEntryText.Text        = entry.Text;
                    rowListName.Visible      = false;
                    cmdSaveEntry.CommandName = "Update";

                    if (!SystemList)
                    {
                        cmdDelete.Visible = true;
                        ClientAPI.AddButtonConfirm(cmdDelete, Localization.GetString("DeleteItem"));
                    }
                    else
                    {
                        cmdDelete.Visible = false;
                    }
                    e.Canceled = true;                      //stop the grid from providing inline editing
                    DataBind();
                    break;

                case "up":
                    ctlLists.UpdateListSortOrder(entryID, true);
                    DataBind();
                    break;

                case "down":
                    ctlLists.UpdateListSortOrder(entryID, false);
                    DataBind();
                    break;
                }
            }
            catch (Exception exc)             //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
        /// <summary>
        ///     Handles events when clicking image button in the grid (Edit/Up/Down)
        /// </summary>
        /// <param name="source"></param>
        /// <param name="e"></param>
        protected void EntriesGridItemCommand(object source, GridCommandEventArgs e)
        {
            try
            {
                var ctlLists = new ListController();
                int entryID = Convert.ToInt32(((GridDataItem) e.Item).GetDataKeyValue("EntryID"));

                switch (e.CommandName.ToLower())
                {
                    case "delete":
                        Mode = "ListEntries";
                        DeleteItem(entryID);
                        break;
                    case "edit":
                        Mode = "EditEntry";

                        ListEntryInfo entry = ctlLists.GetListEntryInfo(entryID);
                        txtEntryID.Text = entryID.ToString(CultureInfo.InvariantCulture);
                        txtParentKey.Text = entry.ParentKey;
                        txtEntryValue.Text = entry.Value;
                        txtEntryText.Text = entry.Text;
                        rowListName.Visible = false;
                        cmdSaveEntry.CommandName = "Update";

                        if (!SystemList)
                        {
                            cmdDelete.Visible = true;
                            ClientAPI.AddButtonConfirm(cmdDelete, Localization.GetString("DeleteItem"));
                        }
                        else
                        {
                            cmdDelete.Visible = false;
                        }
                        e.Canceled = true;  //stop the grid from providing inline editing
                        DataBind();
                        break;
                    case "up":
                        ctlLists.UpdateListSortOrder(entryID, true);
                        DataBind();
                        break;
                    case "down":
                        ctlLists.UpdateListSortOrder(entryID, false);
                        DataBind();
                        break;
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
        /// <summary>
        /// Handles events when clicking image button in the grid (Edit/Up/Down)
        /// </summary>
        /// <history>
        ///     [tamttt] 20/10/2004	Created
        /// </history>
        protected void grdEntries_ItemCommand( object source, DataGridCommandEventArgs e )
        {
            try
            {
                ListController ctlLists = new ListController();
                int entryID = Convert.ToInt32(((DataGrid)source).DataKeys[e.Item.ItemIndex]);

                switch (e.CommandName.ToLower())
                {
                    case "delete":
                        DeleteItem(entryID);
                        InitList();
                        BindGrid();
                        break;
                    case "edit":
                        EnableView(false);
                        EnableEdit(false);

                        ListEntryInfo entry = ctlLists.GetListEntryInfo(entryID);
                        this.txtEntryID.Text = entryID.ToString();
                        this.txtParentKey.Text = entry.ParentKey;
                        this.txtEntryName.Text = entry.ListName;
                        this.txtEntryValue.Text = entry.Value;
                        this.txtEntryText.Text = entry.Text;
                        this.txtEntryName.ReadOnly = true;
                        this.cmdSaveEntry.CommandName = "Update";

                        if (!(entry.DefinitionID == -1))
                        {
                            this.cmdDelete.Visible = true;
                            ClientAPI.AddButtonConfirm(cmdDelete, Localization.GetString("DeleteItem"));
                        }
                        else
                        {
                            this.cmdDelete.Visible = false;
                        }

                        break;
                    case "up":
                        ctlLists.UpdateListSortOrder(entryID, true);
                        InitList();
                        BindGrid();
                        break;
                    case "down":
                        ctlLists.UpdateListSortOrder(entryID, false);
                        InitList();
                        BindGrid();
                        break;
                }

            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }