void MaintainLogConfigClientCreateLocalRegionCompleted(object sender, CreateLocalRegionCompletedEventArgs e)
        {
            ButtonSave.IsEnabled = true;
            ButtonNew.IsEnabled  = true;
            if (m_logCategoryConfig.Window.FaultHandle.Handle(e))
            {
                return;
            }
            var globals = (ObservableCollection <QueryLogConfigService.LogLocalRegionBody>)DataGridLocalInfos.ItemsSource ??
                          new ObservableCollection <QueryLogConfigService.LogLocalRegionBody>();

            var insertObj = new QueryLogConfigService.LogLocalRegionBody
            {
                GlobalID   = e.Result.Body.GlobalID,
                GlobalName = e.Result.Body.GlobalName,
                LocalID    = e.Result.Body.LocalID,
                LocalName  = e.Result.Body.LocalName,
                Status     = ContractConvert.ConvertFromMaintainToQuery(e.Result.Body.Status),
                IsChecked  = true
            };

            globals.Insert(0, insertObj);
            DataGridLocalInfos.ItemsSource  = globals;
            DataGridLocalInfos.SelectedItem = insertObj;
            m_logCategoryConfig.Window.MessageBox.Show(LogCategoryConfigResource.LogCategoryConfig_SaveSuccessfully, MessageBoxType.Success);

            m_logCategoryConfig.UpdateLocalRegion();
            m_mainLogCategory.UpdateLocalRegion();
        }
        void MaintainLogConfigClientEditLocalRegionCompleted(object sender, EditLocalRegionCompletedEventArgs e)
        {
            ButtonSave.IsEnabled = true;
            ButtonNew.IsEnabled  = true;
            if (m_logCategoryConfig.Window.FaultHandle.Handle(e))
            {
                return;
            }
            if (m_selectedRadioButton != null)
            {
                var bindingObj = (QueryLogConfigService.LogLocalRegionBody)m_selectedRadioButton.DataContext;
                if (bindingObj != null)
                {
                    bindingObj.GlobalID   = e.Result.Body.GlobalID;
                    bindingObj.GlobalName = e.Result.Body.GlobalName;
                    bindingObj.LocalName  = e.Result.Body.LocalName;
                    bindingObj.Status     = ContractConvert.ConvertFromMaintainToQuery(e.Result.Body.Status);
                }
                DataGridLocalInfos.SelectedItem = bindingObj;
            }

            m_logCategoryConfig.Window.MessageBox.Show(LogCategoryConfigResource.LogCategoryConfig_SaveSuccessfully, MessageBoxType.Success);

            m_logCategoryConfig.UpdateLocalRegion();
            m_mainLogCategory.UpdateLocalRegion();
        }
Example #3
0
        private void RadioButtonDataGridChecked(object sender, RoutedEventArgs e)
        {
            TextBoxGlobalName.IsEnabled = true;
            ComboBoxStatus.IsEnabled    = true;
            ButtonSave.IsEnabled        = true;

            var radioButton = sender as RadioButton;

            if (radioButton != null)
            {
                // ReSharper disable PossibleInvalidOperationException
                if (radioButton.IsChecked.Value || radioButton.DataContext != null)
                // ReSharper restore PossibleInvalidOperationException
                {
                    m_selectRadioButton = radioButton;

                    var globalRegion = (QueryLogConfigService.LogGlobalRegionBody)m_selectRadioButton.DataContext;

                    MaintainArea.DataContext = new MaintainLogConfigService.LogGlobalRegionBody
                    {
                        GlobalID   = globalRegion.GlobalID,
                        GlobalName = globalRegion.GlobalName,
                        Status     =
                            ContractConvert.ConvertFromQueryToMaintain(
                                globalRegion.Status)
                    };
                }
            }
        }
        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);
            }
        }
Example #5
0
        void MaintainLogConfigClientEditLogCategoryCompleted(object sender, EditLogCategoryCompletedEventArgs e)
        {
            if (m_logCategoryConfig.Window.FaultHandle.Handle(e))
            {
                return;
            }
            var queryCategory = new QueryLogConfigService.LogCategoryBody
            {
                CategoryDescription = e.Result.Body.CategoryDescription,
                CategoryName        = e.Result.Body.CategoryName,
                EnableRemoveLog     = e.Result.Body.EnableRemoveLog,
                GlobalID            = e.Result.Body.GlobalID,
                GlobalName          = e.Result.Body.GlobalName,
                InDate         = e.Result.Body.InDate,
                InUser         = e.Result.Body.InUser,
                LocalID        = e.Result.Body.LocalID,
                LocalName      = e.Result.Body.LocalName,
                LogType        = ContractConvert.ConvertFromMaintainToQuery(e.Result.Body.LogType),
                RemoveOverDays = e.Result.Body.RemoveOverDays,
                Status         = ContractConvert.ConvertFromMaintainToQuery(e.Result.Body.Status)
            };

            if (e.Result.Body.EmailNotification != null)
            {
                e.Result.Body.MyInterval        = (e.Result.Body.EmailNotification.Interval / 60).ToString();
                queryCategory.EmailNotification = new QueryLogConfigService.EmailNotificationConfig
                {
                    Address         = e.Result.Body.EmailNotification.Address,
                    FilterDuplicate = e.Result.Body.EmailNotification.FilterDuplicate,
                    Interval        = int.Parse(e.Result.Body.MyInterval) * 60,
                    NeedNotify      = e.Result.Body.EmailNotification.NeedNotify,
                    Subject         = e.Result.Body.EmailNotification.Subject
                };
            }
            m_logCategoryConfig.EditCategoryCallBack(queryCategory);
            m_logCategoryConfig.Window.MessageBox.Show(LogCategoryConfigResource.LogCategoryConfig_SaveSuccessfully, MessageBoxType.Success);
        }
        private void RadioButtonDataGridChecked(object sender, RoutedEventArgs e)
        {
            TextBoxLocalName.IsEnabled    = true;
            ComboBoxLocalStatus.IsEnabled = true;
            ButtonSave.IsEnabled          = true;
            var radioButton = (RadioButton)sender;

            if (radioButton.IsChecked != null)
            {
                if (radioButton.IsChecked.Value || radioButton.DataContext != null)
                {
                    m_selectedRadioButton = radioButton;
                    var localRegion = (QueryLogConfigService.LogLocalRegionBody)m_selectedRadioButton.DataContext;
                    MaintainArea.DataContext = new MaintainLogConfigService.LogLocalRegionBody
                    {
                        GlobalID   = localRegion.GlobalID,
                        GlobalName = localRegion.GlobalName,
                        LocalID    = localRegion.LocalID,
                        LocalName  = localRegion.LocalName,
                        Status     = ContractConvert.ConvertFromQueryToMaintain(localRegion.Status)
                    };
                }
            }
        }