Esempio n. 1
0
 public static void UpdateChannelById(int id, CanonChannel newValues)
 {
     CanonDataContext db = Cdb.Instance;
     Channel channel = db.Channels.First(u => u.ChannelId == id);
     channel.ChannelName = newValues.ChannelName;
     channel.ChannelType = newValues.ChannelType;
     channel.InfoType = newValues.InfoType;
     channel.IsActive = newValues.IsActive;
     channel.Url = newValues.Url;
     channel.ReportingTo = newValues.ReportingTo;
     db.SubmitChanges();
 }
Esempio n. 2
0
        public static void UpdateChannelById(int id, CanonChannel newValues)
        {
            CanonDataContext db      = Cdb.Instance;
            Channel          channel = db.Channels.First(u => u.ChannelId == id);

            channel.ChannelName = newValues.ChannelName;
            channel.ChannelType = newValues.ChannelType;
            channel.InfoType    = newValues.InfoType;
            channel.IsActive    = newValues.IsActive;
            channel.Url         = newValues.Url;
            channel.ReportingTo = newValues.ReportingTo;
            db.SubmitChanges();
        }
Esempio n. 3
0
 public static void InsertChannel(CanonChannel newValues)
 {
     CanonDataContext db = Cdb.Instance;
     Channel channel = new Channel();
     channel.ChannelName = newValues.ChannelName;
     channel.ChannelType = newValues.ChannelType;
     channel.InfoType = newValues.InfoType;
     channel.IsActive = newValues.IsActive;
     channel.Url = newValues.Url;
     channel.ReportingTo = newValues.ReportingTo;
     db.Channels.InsertOnSubmit(channel);
     db.SubmitChanges();
 }
Esempio n. 4
0
        public static void InsertChannel(CanonChannel newValues)
        {
            CanonDataContext db      = Cdb.Instance;
            Channel          channel = new Channel();

            channel.ChannelName = newValues.ChannelName;
            channel.ChannelType = newValues.ChannelType;
            channel.InfoType    = newValues.InfoType;
            channel.IsActive    = newValues.IsActive;
            channel.Url         = newValues.Url;
            channel.ReportingTo = newValues.ReportingTo;
            db.Channels.InsertOnSubmit(channel);
            db.SubmitChanges();
        }
Esempio n. 5
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);
            }
        }