public bool WindowsLogin(string projectName, string projectFullName, string serverUrl, string databaseName)
        {
            LoadIOMWrapper(projectFullName);

            try
            {
                serverConnection = IOMWrapperInstance.IomFactory_CreateWinAuthHttpServerConnection(serverUrl, databaseName);
                var loginItem = serverConnection.Login();
                if (!loginItem.isError())
                {
                    innovator = IOMWrapperInstance.Innovator_Ctor(serverConnection);

                    InnovatorUser = new InnovatorUser()
                    {
                        currentProjectName = projectName,
                        serverUrl          = serverUrl,
                        databaseName       = databaseName,
                        userName           = Environment.UserName
                    };

                    return(true);
                }
            }
            catch (Exception ex)
            {
            }

            return(false);
        }
示例#2
0
		public bool TryWindowsLogin(string projectName, string projectFullName, string serverUrl, string databaseName)
		{
			LoadIOMWrapper(projectFullName);

			try
			{
				var сonnection = IOMWrapperInstance.IomFactory_CreateWinAuthHttpServerConnection(serverUrl, databaseName);
				var loginItem = сonnection.Login();

				if (!loginItem.isError())
				{
					сonnection.Logout();

					InnovatorUser = new InnovatorUser()
					{
						userName = Environment.UserName
					};

					return true;
				}
			}
			catch (Exception ex)
			{

			}

			return false;
		}
        public bool Login(string projectName, string projectFullName, string serverUrl, string databaseName, string login, string password, Window window)
        {
            LoadIOMWrapper(projectFullName);

            bool isWindowsLogin = WindowsLogin(projectName, projectFullName, serverUrl, databaseName);

            if (isWindowsLogin)
            {
                return(true);
            }

            string passwordHash = IOMWrapperInstance.Innovator_ScalcMD5(password);

            serverConnection = IOMWrapperInstance.IomFactory_CreateHttpServerConnection(serverUrl, databaseName, login, passwordHash);

            var loginItem = serverConnection.Login();

            if (loginItem.isError())
            {
                var    messageWindow = new MessageBoxWindow();
                string message       = loginItem.getErrorString();
                if (message.Contains("Authentication failed for"))
                {
                    message = string.Format(this.messageManager.GetMessage("AuthenticationFailedFor"), login);
                }

                messageWindow.ShowDialog(window, message, string.Empty, Dialogs.MessageButtons.OK, Dialogs.MessageIcon.None);

                return(false);
            }

            innovator     = IOMWrapperInstance.Innovator_Ctor(serverConnection);
            InnovatorUser = new InnovatorUser()
            {
                currentProjectName = projectName,
                serverUrl          = serverUrl,
                databaseName       = databaseName,
                userName           = login,
                passwordHash       = passwordHash
            };

            //Login succesed
            return(true);
        }