Beispiel #1
0
 protected void gridChannels_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
 {
     try
     {
         CanonChannel.DeleteChannelById(int.Parse(e.Keys[0].ToString()));
         e.Cancel = true;
         gridChannels.CancelEdit();
         this.BindData();
     }
     catch (Exception ex)
     {
         Logger.Log(string.Format("exception {0}", ex.ToString()), LogLevel.Error);
     }
 }
Beispiel #2
0
 /// <summary>
 /// Handler for general callback event (filtering, bulk deleting)
 /// </summary>
 /// <param name="source"></param>
 /// <param name="e"></param>
 protected void clbPanelChannels_Callback(object source, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e)
 {
     try
     {
         if (string.IsNullOrEmpty(e.Parameter))
         {
             List <object> keyValues = gridChannels.GetSelectedFieldValues("ChannelId");
             foreach (object key in keyValues)
             {
                 CanonChannel.DeleteChannelById(int.Parse(key.ToString()));
             }
         }
         else if (e.Parameter == "Search")
         {
             if (!string.IsNullOrEmpty(txtSearchParam.Text.Trim()))
             {
                 this.FilterText = txtSearchParam.Text;
             }
             this.IsFilterMode = true;
         }
         else if (e.Parameter == "ShowAll")
         {
             this.IsFilterMode = false;
             this.FilterText   = string.Empty;
         }
         else if (e.Parameter.StartsWith("ChannelHistory"))
         {
             string  idValue   = e.Parameter.Replace("ChannelHistory", "");
             int     channelId = int.Parse(idValue);
             Channel channel   = Cdb.Instance.Channels.FirstOrDefault(p => p.ChannelId == channelId);
             if (channel != null)
             {
                 string channelName = channel.ChannelName;
                 popupChannelHistory.HeaderText =
                     string.Format(Utilities.GetResourceString("Headers", "ChannelsHistoryPopupForm"), channelName);
             }
             ChannelHistoryCtrl.Parameters      = new int[] { channelId };
             SessionManager.PopupGridCurrentIds = ChannelHistoryCtrl.Parameters;
             ChannelHistoryCtrl.Bind();
         }
         this.BindData();
     }
     catch (Exception ex)
     {
         Logger.Log(string.Format("exception {0}", ex.ToString()), LogLevel.Error);
     }
 }