Esempio n. 1
0
        public static MachineInfo GetConnectionDetails(String DomainName, String ServerName)
        {
            MachineInfo objMachineInfo = new MachineInfo();

            try
            {
                ProfileConnectionInfo resultItem = ProfileConnectionInfo.Where(t => t.DomainName == DomainName && t.ServerName == ServerName).FirstOrDefault();
                if (resultItem != null)
                {
                    objMachineInfo = new MachineInfo()
                    {
                        DomainName        = resultItem.DomainName,
                        ServerName        = resultItem.ServerName,
                        UserName          = resultItem.UserName,
                        Password          = resultItem.Password,
                        IsLocalConnection = resultItem.IsLocalConnection
                    };
                }
            }
            catch (Exception ex)
            {
                AMTLogger.WriteToLog(ex.Message, MethodBase.GetCurrentMethod().Name, 0, AMTLogger.LogInfo.Error);
            }

            return(objMachineInfo);
        }
Esempio n. 2
0
        public static Boolean DeleteProfile(ProfileConnectionInfo profileConnection)
        {
            Boolean result = false;

            try
            {
                var item = ProfileConnectionInfo.Where(t => t.DomainName == profileConnection.DomainName && t.ServerName == profileConnection.ServerName).FirstOrDefault();



                if (ProfileConnectionInfo.Contains(item))
                {
                    ProfileConnectionInfo.Remove(profileConnection);
                }

                result = true;

                ReloadProfileTableWithValues();
            }
            catch (Exception ex)
            {
                AMTLogger.WriteToLog(ex.Message, MethodBase.GetCurrentMethod().Name, 0, AMTLogger.LogInfo.Error);
            }

            return(result);
        }
Esempio n. 3
0
        public static Boolean ChangeProfileConnectionStatus(ProfileConnectionInfo connectionInfo)
        {
            Boolean result = false;

            try
            {
                ProfileConnectionInfo resultItem = ProfileConnectionInfo.Where(t => t.DomainName == connectionInfo.DomainName && t.ServerName == connectionInfo.ServerName).FirstOrDefault();
                if (resultItem != null)
                {
                    resultItem.IsLocalConnection = connectionInfo.IsLocalConnection;

                    resultItem.ConnectionStatus = connectionInfo.ConnectionStatus;
                    resultItem.DomainName       = connectionInfo.DomainName;
                    resultItem.IsConnected      = connectionInfo.IsConnected;
                    resultItem.LastConnectTime  = connectionInfo.LastConnectTime;
                    resultItem.Password         = connectionInfo.Password;
                    resultItem.ServerName       = connectionInfo.ServerName;
                    resultItem.UserName         = connectionInfo.UserName;
                }



                result = true;
            }
            catch (Exception ex)
            {
                AMTLogger.WriteToLog(ex.Message, MethodBase.GetCurrentMethod().Name, 0, AMTLogger.LogInfo.Error);
            }

            return(result);
        }
Esempio n. 4
0
        public static Boolean AddProfile(ProfileConnectionInfo profileConnection)
        {
            Boolean result = false;

            try
            {
                var item = ProfileConnectionInfo.Where(t => t.DomainName == profileConnection.DomainName && t.ServerName == profileConnection.ServerName).Count();


                if (item == 0)
                {
                    if (!ProfileConnectionInfo.Contains(profileConnection))
                    {
                        profileConnection.Hash = Utility.HashPassword(profileConnection.Password);

                        profileConnection.Password = profileConnection.Password;


                        ProfileConnectionInfo.Add(profileConnection);
                    }
                }
                result = true;


                ReloadProfileTableWithValues();
            }
            catch (Exception ex)
            {
                AMTLogger.WriteToLog(ex.Message, MethodBase.GetCurrentMethod().Name, 0, AMTLogger.LogInfo.Error);
            }

            return(result);
        }
Esempio n. 5
0
        private void AddTSButton_Click(object sender, EventArgs e)
        {
            try
            {
                if (usercredentials.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    ProfileConnectionInfo pinfo = new ProfileConnectionInfo();

                    pinfo.ConnectionStatus = ApplicationConstants.Connected;

                    pinfo.DomainName = usercredentials.objMachineInfo.DomainName;
                    pinfo.ServerName = usercredentials.objMachineInfo.ServerName;
                    pinfo.UserName   = usercredentials.objMachineInfo.UserName;


                    pinfo.Password = usercredentials.objMachineInfo.Password;

                    pinfo.LastConnectTime = DateTime.Now;

                    pinfo.IsLocalConnection = usercredentials.objMachineInfo.IsLocalConnection;


                    ConnectionManagerUtil.AddProfile(pinfo);

                    //  this.DialogResult = System.Windows.Forms.DialogResult.OK;
                }
                else
                {
                    this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
                }

                SetGridSource();
            }
            catch (Exception ex)
            {
                AMTLogger.WriteToLog(ex.Message, MethodBase.GetCurrentMethod().Name, 0, AMTLogger.LogInfo.Error);
            }
        }