Exemple #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);
        }
        public bool RadioBoxSelectByID(string strControlID)
        {
            GuiSession     SapSession = getCurrentSession();
            GuiRadioButton rdoControl = (GuiRadioButton)SapSession.ActiveWindow.FindById(strControlID, "GuiTextField");

            rdoControl.SetFocus();
            rdoControl.Select();
            return(true);
        }
        public static void RadioButtonSelect(string id, GuiRadioButton radiobutton, GuiSession session)
        {
            if (radiobutton == null && string.IsNullOrEmpty(id))
            {
                throw new Exception("Parameters for the Target object not provided: id or GuiRadioButton object");
            }

            if (session == null)
            {
                throw new Exception("SAP session parameter is required and was not provided.");
            }

            if (radiobutton == null)
            {
                radiobutton = (GuiRadioButton)(session).FindById(id);
            }
            radiobutton.SetFocus();
            radiobutton.Selected = true;
        }
        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);
            }
        }