Esempio n. 1
0
        private void OnSave(object sender, RoutedEventArgs e)
        {
            int instanceExpandMask = 0;

            try
            {
                foreach (var item in cbe_DefaultInstanceExpandMask.SelectedItems)
                {
                    instanceExpandMask += ((KeyValuePair <string, int>)item).Value;
                }

                SQLInformation.Data.ApplicationDataSet.ServersRow newServer = Common.ApplicationDataSet.Servers.NewServersRow();

                newServer.ID          = Guid.Parse(textEdit_ID.Text);
                newServer.NetName     = textEdit_NetName.Text;
                newServer.ADDomain    = cbe_ADDomain.Text;
                newServer.Environment = cbe_Environment.Text;
                newServer.DefaultInstanceExpandMask = instanceExpandMask;

                Common.ApplicationDataSet.Servers.AddServersRow(newServer);
                Common.ApplicationDataSet.ServersTA.Update(Common.ApplicationDataSet.Servers);
            }
            catch (Exception ex)
            {
                VNC.AppLog.Error(ex, LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2);
            }

            ClearEntries();
        }
Esempio n. 2
0
        private void OnCreateNewServer(object sender, RoutedEventArgs e)
        {
            try
            {
                SQLInformation.Data.ApplicationDataSet.ServersRow newServer = Common.ApplicationDataSet.Servers.NewServersRow();
                newServer.ID      = Guid.NewGuid();
                newServer.NetName = te_ServerName.Text.ToUpper();

                Window parentWindow = Window.GetWindow(this);


                if (CanPingServer(newServer.NetName))
                {
                    Common.ApplicationDataSet.Servers.AddServersRow(newServer);
                    Common.ApplicationDataSet.Servers_Update();
                    //Common.ApplicationDataSet.ServersTA.Update(Common.ApplicationDataSet.Servers);
                    parentWindow.DialogResult = true;
                }
                else
                {
                    MessageBox.Show("Cannot Ping Server.  Check Name");
                    parentWindow.DialogResult = false;
                }
            }
            catch (Exception ex)
            {
                VNC.AppLog.Error(ex, LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2);
            }
        }
        private void SyncServerInfoAndInstanceInfo(SQLInformation.Data.ApplicationDataSet.InstancesRow instance)
        {
            var servers = from s in Common.ApplicationDataSet.Servers
                          where s.NetName == instance.NetName
                          select s;

            try
            {
                SQLInformation.Data.ApplicationDataSet.ServersRow server = servers.First();

                instance.Server_ID = server.ID;

                server.OSVersion      = instance.OSVersion;
                server.PhysicalMemory = instance.PhysicalMemory;
                server.Platform       = instance.Platform;
                server.Processors     = instance.Processors;

                server.EndEdit();
            }
            catch (Exception ex)
            {
                // No matching server.
                MessageBox.Show("No matching server.  Add new entry then continue");
            }
        }
Esempio n. 4
0
        private void OnPingServer_Click(object sender, DevExpress.Xpf.Bars.ItemClickEventArgs e)
        {
            SQLInformation.Data.ApplicationDataSet.ServersRow server =
                (SQLInformation.Data.ApplicationDataSet.ServersRow)
                    ((System.Data.DataRowView)dataGrid.View.FocusedRowData.Row).Row;

            Helpers.Server.PingServer(server.NetName);
        }
Esempio n. 5
0
        private void OnGetIPAddress(object sender, RoutedEventArgs e)
        {
            SQLInformation.Data.ApplicationDataSet.ServersRow server =
                (SQLInformation.Data.ApplicationDataSet.ServersRow)
                    ((System.Data.DataRowView)dataGrid.View.FocusedRowData.Row).Row;

            server.IPAddress = Helpers.Server.GetIPV4Address(server.NetName);

            Common.ApplicationDataSet.ServersTA.Update(Common.ApplicationDataSet.Servers);
        }
        private void UpdateInfo()
        {
            SQLInformation.Data.ApplicationDataSet.ServersRow server =
                (SQLInformation.Data.ApplicationDataSet.ServersRow)
                    ((System.Data.DataRowView)serversDataGrid.SelectedItem).Row;

            Console.WriteLine(server.NetName);
            Console.WriteLine(server.ID.ToString());
            System.Diagnostics.Debug.WriteLine(server.NetName);

            //var row1 = serversDataGrid.SelectedItem;

            //var gridRow = serversDataGrid.ItemContainerGenerator.ContainerFromItem(serversDataGrid.SelectedItem);

            //System.Data.DataRowView row2 = (System.Data.DataRowView)serversDataGrid.SelectedItem;

            //var realRow = row2.Row;

            //var realRow2 = (Data.ApplicationDataSet.ServersRow)row2.Row;

            //Data.ApplicationDataSet.ServersRow typedRow = (Data.ApplicationDataSet.ServersRow)row2.Row;

            //ManagedComputer mc = new ManagedComputer(typedRow.name);

            //Common.WriteToDebugWindow(typedRow.name);
            //Common.WriteToDebugWindow(String.Format("Name:{0}  State:{1}", mc.Name, mc.State));

            //foreach (ClientProtocol cp in mc.ClientProtocols)
            //{
            //    Common.WriteToDebugWindow(String.Format("  CP Name:{0}  Order:{1}  IsEnabled:{2}", cp.Name, cp.Order, cp.IsEnabled));
            //}

            //foreach (ServerInstance si in mc.ServerInstances)
            //{
            //    Common.WriteToDebugWindow(String.Format("  SI Name:{0}", si.Name));

            //    foreach (ServerProtocol sp in si.ServerProtocols)
            //    {
            //        Common.WriteToDebugWindow(String.Format("    SP Name:{0}  IsEnabled:{1}", sp.Name, sp.IsEnabled));

            //        foreach (ServerIPAddress sipa in sp.IPAddresses)
            //        {
            //            Common.WriteToDebugWindow(String.Format("        SIPA Name:{0}  IPAddress:{1}  State:{2}", sipa.Name, sipa.IPAddress, sipa.State ));

            //            foreach (IPAddressProperty ipap in sipa.IPAddressProperties)
            //            {
            //                Common.WriteToDebugWindow(String.Format("        IPAP Name:{0}  Value:{1}", ipap.Name, ipap.Value));
            //            }
            //        }
            //    }
            //}
        }
Esempio n. 7
0
        private void OnGetMultipleIPAddress(object sender, RoutedEventArgs e)
        {
            var rows = tableView1.SelectedRows;

            foreach (DataRowView s in tableView1.SelectedRows)
            {
                SQLInformation.Data.ApplicationDataSet.ServersRow server =
                    (SQLInformation.Data.ApplicationDataSet.ServersRow)s.Row;

                server.IPAddress = Helpers.Server.GetIPV4Address(server.NetName);

                Common.ApplicationDataSet.ServersTA.Update(Common.ApplicationDataSet.Servers);
            }
        }
        private void btnLoadFromXML_Click(object sender, RoutedEventArgs e)
        {
            Test_Data.InstanceData.LoadNewInstancesInfoFromFile();

            // Use just the server part of the instance list.

            foreach (var instance in Test_Data.InstanceData.DBInstances)
            {
                SQLInformation.Data.ApplicationDataSet.ServersRow newServer = Common.ApplicationDataSet.Servers.NewServersRow();
                newServer.ID      = Guid.NewGuid();
                newServer.NetName = instance.server;
                Common.ApplicationDataSet.Servers.AddServersRow(newServer);
            }
        }
Esempio n. 9
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            SQLInformation.Data.ApplicationDataSet.ServersRow newServer = Common.ApplicationDataSet.Servers.NewServersRow();

            newServer.ID             = Guid.Parse(iDTextBox.Text);
            newServer.NetName        = netNameTextBox.Text;
            newServer.Environment    = environmentTextBox.Text;
            newServer.OSVersion      = oSVersionTextBox.Text;
            newServer.PhysicalMemory = int.Parse(physicalMemoryTextBox.Text);
            newServer.Platform       = platformTextBox.Text;
            newServer.Processors     = int.Parse(processorsTextBox.Text);

            Common.ApplicationDataSet.Servers.AddServersRow(newServer);
            Common.ApplicationDataSet.ServersTA.Update(Common.ApplicationDataSet.Servers);
        }
        private void SyncServerInfoAndInstanceInfo(SQLInformation.Data.ApplicationDataSet.InstancesRow instance)
        {
            var servers = from s in Common.ApplicationDataSet.Servers
                          where s.NetName == instance.NetName
                          select s;

            SQLInformation.Data.ApplicationDataSet.ServersRow server = servers.First();

            instance.Server_ID = server.ID;

            server.OSVersion      = instance.OSVersion;
            server.PhysicalMemory = instance.PhysicalMemory;
            server.Platform       = instance.Platform;
            server.Processors     = instance.Processors;

            server.EndEdit();
        }
Esempio n. 11
0
        /// <summary>
        /// Store current values in ServerInfo history table.
        /// </summary>
        /// <param name="instance"></param>
        /// <param name="database"></param>
        private void TakeSnapShot(string instanceName, SQLInformation.Data.ApplicationDataSet.ServersRow serverRow)
        {
            //SMO.Server server = SMOH.SMOD.GetServer(instanceName);

            SQLInformation.Data.ApplicationDataSetTableAdapters.ServerInfoTableAdapter tableAdapter = new SQLInformation.Data.ApplicationDataSetTableAdapters.ServerInfoTableAdapter();

            tableAdapter.Connection.ConnectionString = SQLInformation.Data.Config.SQLMonitorDBConnection;

            //int dbID = int.Parse(serverRow.ID_DB);

            //SMO.Database db = server.Databases.ItemById(dbID);

            SQLInformation.Data.ApplicationDataSet.ServerInfoRow newSnapShot = Common.ApplicationDataSet.ServerInfo.NewServerInfoRow();

            newSnapShot.Server_ID    = serverRow.ID;
            newSnapShot.SnapShotDate = DateTime.Now;

            Common.ApplicationDataSet.ServerInfo.AddServerInfoRow(newSnapShot);
            tableAdapter.Update(Common.ApplicationDataSet.ServerInfo);
        }
Esempio n. 12
0
        private void SyncServerInfoAndInstanceInfo(SQLInformation.Data.ApplicationDataSet.InstancesRow instance)
        {
            var servers = from s in Common.ApplicationDataSet.Servers
                          where s.NetName.ToUpper() == instance.NetName.ToUpper()
                          select s;

            try
            {
                SQLInformation.Data.ApplicationDataSet.ServersRow server = servers.First();

                instance.Server_ID = server.ID;

                // TODO: Verify these are set before trying to SYNC.

                try
                {
                    server.ADDomain     = instance.ADDomain;
                    server.Environment  = instance.Environment;
                    server.SecurityZone = instance.SecurityZone;

                    server.OSVersion      = instance.OSVersion;
                    server.PhysicalMemory = instance.PhysicalMemory;
                    server.Platform       = instance.Platform;
                    server.Processors     = instance.Processors;
                }
                catch (Exception)
                {
                }

                server.EndEdit();
            }
            catch (Exception)
            {
                // No matching server.
                MessageBox.Show("No matching server found.  Adding new server.");

                int instanceExpandMask = 127;

                try
                {
                    SQLInformation.Data.ApplicationDataSet.ServersRow newServer = Common.ApplicationDataSet.Servers.NewServersRow();

                    newServer.ID      = Guid.NewGuid();
                    newServer.NetName = instance.NetName.ToUpper();
                    newServer.DefaultInstanceExpandMask = instanceExpandMask;

                    // Wrap in exception in case not populated

                    try
                    {
                        newServer.OSVersion      = instance.OSVersion;
                        newServer.PhysicalMemory = instance.PhysicalMemory;
                        newServer.Platform       = instance.Platform;
                        newServer.Processors     = instance.Processors;
                    }
                    catch (Exception)
                    {
                    }

                    Common.ApplicationDataSet.Servers.AddServersRow(newServer);
                    Common.ApplicationDataSet.Servers_Update();
                    //Common.ApplicationDataSet.ServersTA.Update(Common.ApplicationDataSet.Servers);

                    instance.Server_ID = newServer.ID;
                    Common.ApplicationDataSet.Instances_Update();
                    //Common.ApplicationDataSet.InstancesTA.Update(Common.ApplicationDataSet.Instances);
                }
                catch (Exception ex)
                {
                    VNC.AppLog.Error(ex, LOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2);
                }
            }
        }