aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Notes/Tango.Notes/DB/SQL Dependency.txt
blob: d46f10bd73909e3f250f2982639ee4d3de0e7709 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
-- Set user as db owner --
USE Tango
GO
SP_DROPUSER Developer
GO
SP_CHANGEDBOWNER Developer


-- Maybe this one also ? --
ALTER AUTHORIZATION ON DATABASE::Tango TO Developer;


-- Get state of broker service on each database --
SELECT NAME, IS_BROKER_ENABLED FROM SYS.DATABASES


-- Enable broker service --
ALTER DATABASE Tango SET ENABLE_BROKER;
t .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Threading;
using Tango.Integration.ExternalBridge;
using Tango.PMR.Integration;
using Tango.SharedUI;

namespace Tango.PPC.UI.Dialogs
{
    public class SafetyLevelOperationsConfirmationViewVM : DialogViewVM
    {
        private DispatcherTimer _timer;

        private int _maxSeconds;
        public int MaxSeconds
        {
            get { return _maxSeconds; }
            set { _maxSeconds = value; RaisePropertyChangedAuto(); }
        }

        private int _secondsRemaining;
        public int SecondsRemaining
        {
            get { return _secondsRemaining; }
            set { _secondsRemaining = value; RaisePropertyChangedAuto(); }
        }

        private ExternalBridgeClientConnectedEventArgs _connection;
        /// <summary>
        /// Gets or sets the last client connection event arguments.
        /// </summary>
        public ExternalBridgeClientConnectedEventArgs Connection
        {
            get { return _connection; }
            set { _connection = value; RaisePropertyChangedAuto(); }
        }

        public SafetyLevelOperationsConfirmationViewVM(ExternalBridgeClientConnectedEventArgs connection)
        {
            Connection = connection;

            MaxSeconds = 30;
            SecondsRemaining = 30;

            _timer = new DispatcherTimer(DispatcherPriority.Background, Application.Current.Dispatcher);
            _timer.Interval = TimeSpan.FromMilliseconds(800);
            _timer.Tick += _timer_Tick;
        }

        public override void OnShow()
        {
            base.OnShow();
            _timer.Start();
        }

        protected override void Accept()
        {
            _timer.Stop();
            base.Accept();
        }

        protected override void Cancel()
        {
            _timer.Stop();
            base.Cancel();
        }

        private void _timer_Tick(object sender, EventArgs e)
        {
            SecondsRemaining--;

            if (SecondsRemaining == 0)
            {
                Cancel();
            }
        }
    }
}