Exemplo n.º 1
0
        public bool Login(string UserName, string Password, string Client, string Language)
        {
            BeforeLogin?.Invoke(Session, new EventArgs());
            Session.FindById <GuiTextField>("wnd[0]/usr/txtRSYST-BNAME").Text = UserName;
            Session.FindById <GuiTextField>("wnd[0]/usr/pwdRSYST-BCODE").Text = Password;
            Session.FindById <GuiTextField>("wnd[0]/usr/txtRSYST-MANDT").Text = Client;
            Session.FindById <GuiTextField>("wnd[0]/usr/txtRSYST-LANGU").Text = Language;
            var window = Session.FindById <GuiFrameWindow>("wnd[0]");

            window.SendVKey(0);
            GuiStatusbar status = Session.FindById <GuiStatusbar>("wnd[0]/sbar");

            if (status != null && status.MessageType.ToLower() == "e")
            {
                Connection.CloseSession(Session.Id);
                FailLogin?.Invoke(Session, new EventArgs());
                return(false);
            }
            AfterLogin?.Invoke(Session, new EventArgs());
            GuiRadioButton rb_Button = Session.FindById <GuiRadioButton>("wnd[1]/usr/radMULTI_LOGON_OPT2");

            if (rb_Button != null)
            {
                rb_Button.Select();
                window.SendVKey(0);
            }
            return(true);
        }
Exemplo n.º 2
0
        public static void KeepOneSessionSAP()
        {
            GuiConnection connection = SAPGui.GetConnection();

            for (int count = connection.Sessions.Count - 1; count > 0; count--)
            {
                connection.CloseSession(connection.Sessions.ElementAt(count).Id);
            }
        }
Exemplo n.º 3
0
        public void Login(string UserName, string Password, string Client, string Language)
        {
            if (BeforeLogin != null)
            {
                BeforeLogin(_sapGuiSession, new EventArgs());
            }

            _sapGuiSession.FindById <GuiTextField>("wnd[0]/usr/txtRSYST-BNAME").Text = UserName;
            _sapGuiSession.FindById <GuiTextField>("wnd[0]/usr/pwdRSYST-BCODE").Text = Password;
            _sapGuiSession.FindById <GuiTextField>("wnd[0]/usr/txtRSYST-MANDT").Text = Client;
            _sapGuiSession.FindById <GuiTextField>("wnd[0]/usr/txtRSYST-LANGU").Text = Language;


            var window = _sapGuiSession.FindById <GuiFrameWindow>("wnd[0]");

            window.SendVKey(0);

            GuiStatusbar status = _sapGuiSession.FindById <GuiStatusbar>("wnd[0]/sbar");

            if (status != null && status.MessageType.ToLower() == "e")
            {
                _sapGuiConnection.CloseSession(_sapGuiSession.Id);
                if (FailLogin != null)
                {
                    FailLogin(_sapGuiSession, new EventArgs());
                }
                return;
            }

            if (AfterLogin != null)
            {
                AfterLogin(_sapGuiSession, new EventArgs());
            }

            GuiRadioButton rb_Button = _sapGuiSession.FindById <GuiRadioButton>("wnd[1]/usr/radMULTI_LOGON_OPT2");

            if (rb_Button != null)
            {
                rb_Button.Select();
                window.SendVKey(0);
            }
        }
Exemplo n.º 4
0
        public static void DestroySession(object currentSession)
        {
            GuiConnection connection = SAPGui.GetConnection();

            connection.CloseSession((currentSession as GuiSession).Id);
        }
Exemplo n.º 5
0
 public void CloseSession()
 {
     _sapGuiConnection.CloseSession(SAPGuiSession.Id);
 }