Пример #1
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        ///     Loads top level entry list
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [tamttt]  20/10/2004	Created
        ///     [cnurse]  01/30/2007	Extracted to separate user control
        /// </history>
        /// -----------------------------------------------------------------------------
        private void BindGrid()
        {
            foreach (DataGridColumn column in grdEntries.Columns)
            {
                if (ReferenceEquals(column.GetType(), typeof(ImageCommandColumn)))
                {
                    //Manage Delete Confirm JS
                    var imageColumn = (ImageCommandColumn)column;
                    if (imageColumn.CommandName == "Delete")
                    {
                        imageColumn.OnClickJS = Localization.GetString("DeleteItem");
                        if (SystemList)
                        {
                            column.Visible = false;
                        }
                        else
                        {
                            column.Visible = true;
                        }
                    }

                    //Localize Image Column Text
                    if (!String.IsNullOrEmpty(imageColumn.CommandName))
                    {
                        imageColumn.Text = Localization.GetString(imageColumn.CommandName, LocalResourceFile);
                    }
                }
            }
            grdEntries.DataSource = SelectedListItems;             //selList
            grdEntries.DataBind();
            if (SelectedListItems == null)
            {
                lblEntryCount.Text = "0 " + Localization.GetString("Entries", LocalResourceFile);
            }
            else
            {
                lblEntryCount.Text = SelectedListItems.Count() + " " + Localization.GetString("Entries", LocalResourceFile);
                foreach (var item in SelectedListItems)
                {
                    //list cannot be deleted if any of the item belongs to host
                    if (item.SystemList)
                    {
                        cmdDeleteList.Visible = false;
                        break;
                    }
                }
            }
        }
Пример #2
0
 private void DeleteItem(int entryId)
 {
     if (SelectedListItems.Any())
     {
         try
         {
             var ctlLists = new ListController();
             ctlLists.DeleteListEntryByID(entryId, true);
             DataBind();
         }
         catch (Exception exc)                 //Module failed to load
         {
             Exceptions.ProcessModuleLoadException(this, exc);
         }
     }
     else
     {
         DeleteList();
     }
 }