示例#1
0
 private void lnkGopKenh_CapNhat_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     try
     {
         TimeSpan GioDB  = time_GopKenh_GioBatDau.Value.TimeOfDay;
         TimeSpan GioKT  = time_GopKenh_GioKetThuc.Value.TimeOfDay;
         bool     status = chkGopKenh_TrangThai.Checked;
         if (Config_Common.Update(Enum_Config_Common.GopLine, chkGopKenh_TrangThai_Config.Checked ? "1" : ""))
         {
             Config_Common.GopLine = chkGopKenh_TrangThai_Config.Checked;
         }
         else
         {
             new MessageBox.MessageBoxBA().Show(this, "Có lỗi cập nhật cấu hình gộp kênh.");
             return;
         }
         if (ThongTinCauHinh.Update_GopKenh(status, GioKT, GioDB))
         {
             new MessageBox.MessageBoxBA().Show(this, "Cập nhật cấu hình gộp kênh thành công.");
             ThongTinCauHinh.GopKenh_GioBD     = GioDB;
             ThongTinCauHinh.GopKenh_GioKT     = GioKT;
             ThongTinCauHinh.GopKenh_TrangThai = status;
         }
         else
         {
             new MessageBox.MessageBoxBA().Show(this, "Có lỗi cập nhật cấu hình gộp kênh.");
         }
     }
     catch (Exception)
     {
         new MessageBox.MessageBoxBA().Show(this, "Có lỗi cấu hình gộp kênh.");
     }
 }
        /// <summary>
        /// Xử lý những dữ liệu thay đổi
        /// </summary>
        private void DoSave()
        {
            var ListUpdate = LayoutControl.FindAllChildrenByType <Control>().Where(c => c is IShInput && c.Tag != null && c.Tag.ToString() != null && c is ITextChange && ((ITextChange)c).IsChangeText).Cast <IShInput>().ToList();

            if (ListUpdate != null && ListUpdate.Count > 0)
            {
                ListUpdate.ForEach(p =>
                {
                    Config_Common.Update(((Control)p).Tag.To <int>(), ConvertToString(p.GetValue()));
                    ((ITextChange)p).IsChangeText = false;
                });
            }
        }