private bool SetOpeningState() { try { // if we are doing 3270 if (_use3270) { // connect to the host if not already done so if (m_Handler == null) { m_Handler = new SessionDisplay(); m_Handler.Connect("TRANSPORT=SNA;LOGICALUNITNAME=" + this.InputLUNameBox.Text.Trim().ToUpperInvariant()); m_Handler.Connection.HostCodePage = 37; // set the large form, so that we can see 3270 stuff this.Width = _largeWindowSize; // wait for the Message 10 Screen m_Handler.WaitForContent("TERM NAME", 20000); // try to connect to CICS m_Handler.SendKey("LOGON APPLID(" + this.InputCICSNameBox.Text.Trim().ToUpperInvariant() + ")@E"); // must be in PLU session m_Handler.WaitForSession(SessionDisplayWaitType.PLUSLU, 20000); // wait for the blurb to come m_Handler.WaitForContent(@"DEMONSTRATION", 20000); // go to the clear screen ClearScreenAndWait(); _hostOK = true; } } else { // squash the form down! this.Width = 1049; this.Height = 588; _hostOK = true; } } catch (Exception ex) { MessageBox.Show(ex.Message); if (m_Handler != null) { m_Handler.Disconnect(); } m_Handler = null; return(false); } DisableEverything(); EnableWorkTab(); return(true); }
override public void ValidateCustomer(string customerName) { if (string.IsNullOrEmpty(customerName)) { throw new ArgumentNullException("customerName"); } // save the name come what may _name = customerName; // call up the WBGA transaction _Handler.SendKey("WBGA@E"); TraceScreen(); // wait for the F9=Add Acct _Handler.WaitForContent("F9=Add Acct", 5000); TraceScreen(); // The cursor is at the right place _Handler.SendKey(customerName + "@E"); TraceScreen(); // wait for the "paging commands" or name is invalid ScreenPartialFieldCollection fields = new ScreenPartialFieldCollection(2); fields.Add(new ScreenPartialField("Customer name not found", 21, 2)); fields.Add(new ScreenPartialField("Press <Enter> and follow with paging commands", 1, 2)); int indexOfField = _Handler.WaitForContent(fields, 5000); TraceScreen(); // if we can't find the customer if (indexOfField == 0) { _isExistingCustomer = false; // go to the blank screen ClearScreenAndWait(); } else { _isExistingCustomer = true; // hit enter _Handler.SendKey("@E"); TraceScreen(); // wait for "End of Report" _Handler.WaitForContent("End of Report", 5000); TraceScreen(); // get all the accounts available ScreenFieldCollection sfcAccountNumbers = _Handler.GetFieldsByColumn(2, 4); _accountNumbers = new string[sfcAccountNumbers.Length]; for (int index = 0; index < sfcAccountNumbers.Length; index++) { _accountNumbers[index] = (string)sfcAccountNumbers[index].Data; } // go to the blank screen ClearScreenAndWait(); // get the customers address data RetrieveCustomerInfo(); } }