Exemple #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);
     }
 }
Exemple #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);
     }
 }
Exemple #3
0
        protected void gridChannels_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            try
            {
                SessionManager.IsEditFormCreated = false;
                int keyToUpdate    = int.Parse(e.Keys[0].ToString());
                int newChannelType = int.Parse(Utilities.GetEditFormComboValue(gridChannels, "cmbEfType").ToString());
                int newInfoType    = int.Parse(Utilities.GetEditFormComboValue(gridChannels, "cmbEfInfoType").ToString());
                if ((newChannelType != 0) && (newInfoType != 0))
                {
                    //update channel
                    CanonChannel cc = new CanonChannel();
                    cc.ChannelName = e.NewValues["ChannelName"].ToString();
                    cc.ChannelType = newChannelType;
                    cc.InfoType    = newInfoType;
                    if (e.NewValues["IsActive"] != null)
                    {
                        cc.IsActive = (bool)e.NewValues["IsActive"];
                    }
                    else
                    {
                        cc.IsActive = false;
                    }
                    cc.Url         = e.NewValues["Url"].ToString();
                    cc.ReportingTo = e.NewValues["ReportingTo"].ToString();
                    CanonChannel.UpdateChannelById(keyToUpdate, cc);
                }

                e.Cancel = true;
                gridChannels.CancelEdit();
                this.BindData();
            }
            catch (Exception ex)
            {
                Logger.Log(string.Format("exception {0}", ex.ToString()), LogLevel.Error);
            }
        }