Ejemplo n.º 1
0
        private void RadioButtonChecked(object sender, RoutedEventArgs e)
        {
            // ReSharper disable PossibleInvalidOperationException
            if (((RadioButton)sender).IsChecked.Value && ((RadioButton)sender).DataContext != null)
            // ReSharper restore PossibleInvalidOperationException
            {
                m_selectedIdx = DataGridLogCategory.SelectedIndex;
                if (!ButtonSave.IsEnabled)
                {
                    ButtonSave.IsEnabled = true;
                }

                m_selectedRadioButton = sender as RadioButton;

                ((UserControl)MaintainArea.Children[0]).IsEnabled = true;

                var category         = (QueryLogConfigService.LogCategoryBody)m_selectedRadioButton.DataContext;
                var maintainCategory = new MaintainLogConfigService.LogCategoryBody
                {
                    CategoryDescription = category.CategoryDescription,
                    CategoryName        = category.CategoryName,
                    EnableRemoveLog     = category.EnableRemoveLog,
                    GlobalID            = category.GlobalID,
                    GlobalName          = category.GlobalName,
                    InDate           = category.InDate,
                    InUser           = category.InUser,
                    LocalID          = category.LocalID,
                    LocalName        = category.LocalName,
                    LogType          = ContractConvert.ConvertFromQueryToMaintain(category.LogType),
                    RemoveOverDays   = category.RemoveOverDays,
                    MyRemoveOverDays = category.RemoveOverDays.ToString(),
                    Status           = ContractConvert.ConvertFromQueryToMaintain(category.Status)
                };
                if (category.EmailNotification != null)
                {
                    maintainCategory.EmailNotification = new MaintainLogConfigService.EmailNotificationConfig
                    {
                        Address         = category.EmailNotification.Address,
                        FilterDuplicate =
                            category.EmailNotification.FilterDuplicate,
                        Interval   = category.EmailNotification.Interval,
                        NeedNotify = category.EmailNotification.NeedNotify,
                        Subject    = category.EmailNotification.Subject
                    };
                }

                ((MaintainLogCategory)MaintainArea.Children[0]).BindDataContext(maintainCategory);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 绑定LogCategory的详细信息并设置相应状态
        /// </summary>
        /// <param name="entity"></param>
        public void BindDataContext(MaintainLogConfigService.LogCategoryBody entity)
        {
            ComboBoxLocal.IsEnabled   = false;
            ComboBoxGlobal.IsEnabled  = false;
            TextBoxCategory.IsEnabled = false;

            if (ComboBoxGlobal.Items.Count > 0 && ComboBoxLocal.Items.Count > 0)
            {
                ComboBoxGlobal.SelectedIndex = 0;
                ComboBoxLocal.SelectedIndex  = 0;
            }

            if (entity.EmailNotification != null)
            {
                //当延时大于0的时候,设置立即发送为false.
                if (entity.EmailNotification.Interval > 0)
                {
                    entity.IsInstant  = false;
                    entity.MyInterval = (entity.EmailNotification.Interval / 60).ToString();
                    ShowImmediatelyConfig(Visibility.Visible);
                }
                else
                {
                    entity.IsInstant = true;
                    ShowImmediatelyConfig(Visibility.Collapsed);
                }

                //当需要邮件通知的时候,设置相应的控件状态和初始值
                if (entity.EmailNotification.NeedNotify)
                {
                    SetStatusOfMailNotification(true);
                }
                else
                {
                    SetStatusOfMailNotification(false);
                    //entity.IsInstant = false;
                }
            }

            TextBoxRemoveOverDays.IsEnabled = entity.EnableRemoveLog;


            MaintainArea.DataContext = entity;
            m_selectedLocalId        = entity.LocalID;
            m_selectedGlobalId       = entity.GlobalID;
            m_isEdit = true;
        }