Example #1
0
 protected void lbDeleteSelected_Click(object sender, EventArgs e)
 {
     if ((_selectionFilter != null) && (_selectionFilter.Values != null))
     {
         if (!_inverseSelection)
         {
             foreach (var id in _selectionFilter.Values)
             {
                 VoiceService.DeleteTheme(Convert.ToInt32(id));
             }
         }
         else
         {
             var itemsIds = _paging.ItemsIds <int>("VoiceThemeID as ID");
             foreach (int id in itemsIds.Where(id => !_selectionFilter.Values.Contains(id.ToString())))
             {
                 VoiceService.DeleteTheme(id);
             }
         }
     }
 }
Example #2
0
    protected void grid_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "DeleteTheme")
        {
            VoiceService.DeleteTheme(Convert.ToInt32(e.CommandArgument));
        }

        if (e.CommandName == "AddTheme")
        {
            //TODO validate input
            try
            {
                VoiceService.AddTheme(new VoiceTheme
                {
                    Name      = ((TextBox)grid.FooterRow.FindControl("txtNewName")).Text,
                    IsDefault =
                        ((CheckBox)grid.FooterRow.FindControl("chkNewIsDefault")).Checked,
                    IsHaveNullVoice =
                        ((CheckBox)grid.FooterRow.FindControl("chkNewIsHaveNullVoice")).
                        Checked,
                    IsClose =
                        ((CheckBox)grid.FooterRow.FindControl("chkNewIsClose")).Checked
                });
                grid.ShowFooter = false;
            }
            catch (Exception ex)
            {
                MsgErr(ex.Message);
            }
        }


        if (e.CommandName == "CancelAdd")
        {
            grid.ShowFooter = false;
        }
    }