Beispiel #1
0
 private void GmsButton_Executed(object sender, ExecutedRoutedEventArgs e)
 {
     try
     {
         NewMainWindow.ExecuteProgram($"http://gms.dengisrazy.ru/search.php?id={SelectedTT.NumberCVZ}");
     }
     catch (Exception)
     {
         Bindings.StatusBarText = "Необходимо выбрать ЦВЗ";
     }
 }
Beispiel #2
0
 /// <summary>
 /// Метод открытия Zabbix в браузере
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ZabbixButton_Executed(object sender, ExecutedRoutedEventArgs e)
 {
     try
     {
         //MessageBox.Show(Environment.Version.ToString());
         if (Environment.UserDomainName.ToLower().Contains("dengisrazy"))
         {
             NewMainWindow.ExecuteProgram($"http://zabbix.dengisrazy.ru/search.php?sid=402de2905824eba9&form_refresh=3&search={SelectedTT.Lan_Ip}");
         }
         else
         {
             NewMainWindow.ExecuteProgram($"http://zabbix.vpn.dengisrazy.ru/search.php?sid=402de2905824eba9&form_refresh=3&search={SelectedTT.Lan_Ip}");
         }
     }
     catch (Exception)
     {
         Bindings.StatusBarText = "Необходимо выбрать ЦВЗ";
     }
 }
Beispiel #3
0
        private void ListViewHostsInCustomer_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (NewMainWindow.settings.Fields.DoubleClickPing)
            {
                var dep = (DependencyObject)e.OriginalSource;
                while (dep != null)
                {
                    dep = VisualTreeHelper.GetParent(dep);
                    if (dep is ListViewItem)
                    {
                        IP selIP = ((ListViewItem)dep).Content as IP;

                        Log($"cmd.exe  /c title {SelectedIP.Owner.ToStringDisplay} {SelectedIP.IPAddress} & ping {SelectedIP.IPAddress} /t & pause ", false, false, "", false);
                        NewMainWindow.ExecuteProgram("cmd.exe", $"/c title {SelectedIP.Owner.ToStringDisplay} {SelectedIP.IPAddress} & ping {SelectedIP.IPAddress} /t & pause", false, true, "", false, "", "");

                        return;
                    }
                }
            }
        }
Beispiel #4
0
 private int CalculateHostCount(string SubnetMask, int defaultCount = 1)
 {
     if ((SubnetMask == "255.255.255.255") || (SubnetMask == "255.255.255.254"))
     {
         return(1);
     }
     try
     {
         byte[] addressBytes = IPAddress.Parse(SubnetMask).GetAddressBytes();
         int    num2         = (((0x100 - addressBytes[0]) * (0x100 - addressBytes[1])) * (0x100 - addressBytes[2])) * (0xfe - addressBytes[3]);
         if (num2 > 0x100)
         {
             num2 = 0x100;
             NewMainWindow.ShowBalloonWarning("Количество хостов уменьшено до 256.", "Количество хостов превышено");
         }
         return(num2);
     }
     catch
     {
         return(defaultCount);
     }
 }
Beispiel #5
0
        public Customer(NewMainWindow owner)
        {
            Owner          = owner;
            this.Hosts     = new List <Host>();
            this.Info      = new ObservableCollection <BindingListItem>();
            this.Employees = new List <Employee>();
            //ContextMenuCreate();
            //CustomerContextMenuCreate();
            Provider      = new ProvInfo();
            Provider.Info = new ObservableCollection <BindingListItem>();
            //LoadPopup();
            ListViewHostsInCustomer             = new ListView();
            ListViewHostsInCustomer.DataContext = this;

            //Binding myBind = new Binding("SelectedIPTest");
            //Binding selIPCust = new Binding("SelectedIPInCustomer");
            //selIPCust.Source = Owner;

            //Binding selIPCust = new Binding("SelectedIPInCustomer");
            //selIPCust.Source = Owner;

            //SetBinding(SelectedIPProperty, selIPCust);

            //Binding commentCust = new Binding("Text");
            //commentCust.Source = Owner.TTPinComment;
            //this.SetBinding(CommentProperty, commentCust);


            //ListViewHostsInCustomer.SetBinding(System.Windows.Controls.ListView.SelectedItemProperty, selIPCust);

            //Binding ipArrayBind = new Binding("IPArray");
            //ipArrayBind.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
            //ipArrayBind.Source = this;
            //ipArrayBind.Source = IPArray;
            //ipArrayBind.Mode = BindingMode.OneWay;
            //ListViewHostsInCustomer.SetBinding(ListView.ItemsSourceProperty, ipArrayBind);

            //FillCustomer();
        }
Beispiel #6
0
        public Access()
        {
            this.InitializeComponent();
            //MainWindow.DBPath = @"\\maxus.lan\msk\A\IT\All\Централизация\!Единая ТП ТТ\ttlist";
            //MainWindow.helpfile = Path.Combine(MainWindow.DBPath, "help.zip");
            //MainWindow.pilot_sbr_file = Path.Combine(MainWindow.DBPath, "pilot_sbr.txt");
            //MainWindow.pilot_flora_file = Path.Combine(MainWindow.DBPath, "pilot_flora.txt");
            //MainWindow.pilot_bio_file = Path.Combine(MainWindow.DBPath, "pilot_bio.txt");
            //MainWindow.pilot_zlock_file = Path.Combine(MainWindow.DBPath, "pilot_zlock.txt");
            //MainWindow.versions_file = Path.Combine(MainWindow.DBPath, "versions.txt");

            App.splashScreen.AddMessage("Инициализация...");
            NewMainWindow window = new NewMainWindow();

            Application.Current.MainWindow = window;
            try
            {
                //PrincipalContext pc = new PrincipalContext(ContextType.Domain, Environment.UserDomainName);
                App.splashScreen.AddMessage("Авторизация.");
                //if (CheckUserInGroup(pc, "SG.IT.ttlist.AccessMinimal"))
                //{
                //    MainWindow.Bindings.GrantedAccess |= AccessRoles.Minimal;
                //}
                App.splashScreen.AddMessage("Авторизация..");
                //if (CheckUserInGroup(pc, "SG.IT.ttlist.AccessGrade2"))
                //{
                //    MainWindow.Bindings.GrantedAccess |= AccessRoles.Grade2;
                //}
                App.splashScreen.AddMessage("Авторизация...");
                //if (CheckUserInGroup(pc, "SG.IT.ttlist.AccessFull"))
                //{
                //    MainWindow.Bindings.GrantedAccess |= AccessRoles.Full;
                //}
                App.splashScreen.AddMessage("Авторизация....");
                //if (CheckUserInGroup(pc, "SG.IT.ttlist.AccessOfficeSupport"))
                //{
                //    MainWindow.Bindings.GrantedAccess |= AccessRoles.Office;
                //}
                App.splashScreen.AddMessage("Авторизация.....");
                //if (CheckUserInGroup(pc, "SG.IT.OPP.Master-Line"))
                //{
                //    MainWindow.Bindings.GrantedAccess |= AccessRoles.Ext;
                //}
            }
            catch (Exception exception)
            {
                App.splashScreen.ShowError(exception.Message, "", false);
            }
            //if (!MainWindow.Bindings.GrantedAccess.HasFlag(AccessRoles.Minimal))
            //{
            //    App.splashScreen.ShowError("Доступ запрещен для пользователя " + Environment.UserName, "", true);
            //    Environment.Exit(1);
            //}


            App.splashScreen.AddMessage("Загрузка списка ЦВЗ из БД...");
            //window.LoadDBFromSQLServer("Data Source=localhost;Port=3306;Initial Catalog=mikrotik;User Id=root;password=fawGV89094047282");
            //window.LoadDBFromSQLServer(NewMainWindow.settings.Fields.ConnectionString);
            window.LoadDBFromSQLServer("Data Source=gms.dengisrazy.ru;Port=3306;Initial Catalog=mikrotik;User Id=otp;password=Wct3XH39hxbC;Encrypt=false;");
            window.FillSearchListBoxAllTT();
            App.splashScreen.AddMessage("Запуск...");
            //window.SelectedLoginCreate();
            window.Show();
            base.Close();
        }
Beispiel #7
0
 public CustomerAuxiliaryPaneItem(NewMainWindow owner)
 {
     Owner = owner;
 }
Beispiel #8
0
        private void NewMainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            //Log("NewMainWindow_Loaded");
            try
            {
                try
                {
                    App.splashScreen.LoadComplete();
                    //base.Focus();
                }
                catch (Exception ex)
                {
                    Bindings.StatusBarText = ex.Message;
                }
                NewMainWindow.PinnedTTs = new ObservableCollection <PinnedTT>();
                LoadPinnedTTs();
                ListViewPinned.ItemsSource = NewMainWindow.PinnedTTs;
                NewMainWindow.UpdateCollectionView(ListViewPinned.ItemsSource, "Color");
                CreateSearchListBoxItemTemplate();
                //TabCtrl.DataContext = this;
                //TabCtrl.SetBinding(System.Windows.Controls.TabControl.SelectedItemProperty, new System.Windows.Data.Binding("SelectedTT"));

                Tabs.DataContext = this;
                //Tabs.SetBinding(System.Windows.Controls.TabControl.SelectedItemProperty, new System.Windows.Data.Binding("SelectedTT"));

                System.Windows.Data.Binding isipselBind = new System.Windows.Data.Binding("isipselected");
                isipselBind.Source = Bindings;
                isipselBind.Mode   = BindingMode.TwoWay;
                SetBinding(isipselectedProperty, isipselBind);


                System.Windows.Data.Binding isttselBind = new System.Windows.Data.Binding("isttselected");
                isttselBind.Source = Bindings;
                isttselBind.Mode   = BindingMode.TwoWay;
                SetBinding(isttselectedProperty, isttselBind);

                string fileHelpHTML = System.IO.Path.Combine(System.Windows.Forms.Application.StartupPath, @"html\help.htm");
                frameHelp.Source = new Uri(fileHelpHTML);

                string fileVersionsHTML = System.IO.Path.Combine(System.Windows.Forms.Application.StartupPath, @"html\versions.htm");
                frameVersions.Source = new Uri(fileVersionsHTML);

                //Binding listBoxTaskISBinding = new Binding("listBoxTaskItemsSource");
                //listBoxTaskISBinding.Source = Bindings;
                //listBoxTaskISBinding.Mode = BindingMode.TwoWay;
                //ListBoxTask.SetBinding(ListBox.ItemsSourceProperty, listBoxTaskISBinding);

                //System.Windows.Data.Binding commentBind = new System.Windows.Data.Binding("Comment");
                //isipselBind.Source = SelectedTT;
                //isipselBind.Mode = BindingMode.TwoWay;
                //SetBinding(isipselectedProperty, isipselBind);
                //SelectedTT.SetBinding(Customer.CommentProperty, "Comment");

                //Bindings.isipselected = new System.Windows.Data.Binding(isipselectedProperty, isipselBind);


                //SelectedTT.SetBinding(System.Windows.Controls.TabControl.SelectedItemProperty, "SelectedTT");
                ////SelectedTT.DataContext = this;
                ////SelectedTT.SetBinding(Customer.SelectedIPProperty, "SelectedIP");
                //TabCtrl.SetBinding(System.Windows.Controls.TabControl.SelectedItemProperty, )
            }
            catch (Exception ex)
            {
                Log(ex.Message, true, false, ex.StackTrace, false);
            }
            //Log("NewMainWindow_Loaded_End");
        }