Ejemplo n.º 1
0
        public void CheckCompleteLoad()
        {
            SystemLog.LogAuditMessage(EntityIspf.constScrName, DiagnosticLevel.level2, MethodBase.GetCurrentMethod().Name + EntityGlobal.METHOD_START, EntityGlobal.transactionId);


            TCSRPA.XMLLibrary.ScreenIdentifier menuText = XMLLibrary.GetScreenIdentifier(EntityIspf.constScrName, EntityIspf.constMenuText);

            string menuTextCheck = null;

            objWatch.Restart();
            while (menuTextCheck == null)
            {
                if (objWatch.ElapsedMilliseconds < EntityGlobal.pageLoadWaitTime)
                {
                    menuTextCheck = MainFrameAdapter.GetScreenText(menuText.Row, menuText.Column, menuText.Length);
                    if (!(menuTextCheck.Equals(menuText.Text)))
                    {
                        throw new UINotSupported(EntityIspf.constScrName);
                    }
                }
                else
                {
                    throw new UINotSupported(EntityIspf.constScrName);
                }
            }

            SystemLog.LogAuditMessage(EntityIspf.constScrName, DiagnosticLevel.level2, MethodBase.GetCurrentMethod().Name + EntityGlobal.METHOD_END, EntityGlobal.transactionId);
        }
Ejemplo n.º 2
0
        public void DoOperations()
        {
            string ispfText = XMLLibrary.GetName(EntityPwd.constScrName, EntityPwd.constIspf);

            TCSRPA.XMLLibrary.TextSetter pwdValue = XMLLibrary.GetTextSetter(EntityPwd.constScrName, EntityPwd.constPwdValue);

            MainFrameAdapter.SetTextOnScreen(pwdValue.Row, pwdValue.Column, CryptSecurity.ConvertToUnsecureString(EntityGlobal.pswd));
            Thread.Sleep(1000);
            MainFrameAdapter.SendKey(PcomKeys.Enter);

            #region Navigate till Ispf screen

            //ICH70001I RPASAR   LAST ACCESS
            MainFrameAdapter.SendKey(PcomKeys.Enter);

            //Notice screen
            MainFrameAdapter.SendKey(PcomKeys.Enter);

            //Notice screen - continue
            MainFrameAdapter.SendKey(PcomKeys.Enter);

            //ZIOEC screen
            MainFrameAdapter.SendKey(PcomKeys.Enter);

            MainFrameAdapter.SendKey(ispfText);
            Thread.Sleep(1000);
            MainFrameAdapter.SendKey(PcomKeys.Enter);

            #endregion

            SystemLog.LogAuditMessage(EntityPwd.constScrName, DiagnosticLevel.level2, MethodBase.GetCurrentMethod().Name + EntityGlobal.METHOD_END, EntityGlobal.transactionId);
        }
Ejemplo n.º 3
0
        public void DoOperations()
        {
            TCSRPA.XMLLibrary.TextSetter AppName = XMLLibrary.GetTextSetter(EntityTSO.constScrName, EntityTSO.constAppName);

            MainFrameAdapter.SetTextOnScreen(AppName.Row, AppName.Column, AppName.Text);
            Thread.Sleep(1000);
            MainFrameAdapter.SendKey(PcomKeys.Enter);

            SystemLog.LogAuditMessage(EntityTSO.constScrName, DiagnosticLevel.level2, MethodBase.GetCurrentMethod().Name + EntityGlobal.METHOD_END, EntityGlobal.transactionId);
        }
Ejemplo n.º 4
0
        public void DoOperations()
        {
            SystemLog.LogAuditMessage("ScreenCtaUsuarioEliminar", DiagnosticLevel.level2, MethodBase.GetCurrentMethod().Name + EntityGlobal.METHOD_START, EntityGlobal.transactionId);

            MainFrameAdapter.SetTextOnScreen(18, 51, "S");

            Thread.Sleep(1000);
            MainFrameAdapter.SendKey(PcomKeys.Enter);

            SystemLog.LogAuditMessage("ScreenCtaUsuarioEliminar", DiagnosticLevel.level2, MethodBase.GetCurrentMethod().Name + EntityGlobal.METHOD_END, EntityGlobal.transactionId);
        }
Ejemplo n.º 5
0
        public void DoOperations()
        {
            GlobalHelper.GetUserPwd(EntityGlobal.appName);

            TCSRPA.XMLLibrary.TextSetter userIdValue = XMLLibrary.GetTextSetter(EntityUserId.constScrName, EntityUserId.constUserIdValue);
            MainFrameAdapter.SetTextOnScreen(userIdValue.Row, userIdValue.Column, CryptSecurity.ConvertToUnsecureString(EntityGlobal.userId));
            Thread.Sleep(1000);
            MainFrameAdapter.SendKey(PcomKeys.Enter);

            SystemLog.LogAuditMessage(EntityUserId.constScrName, DiagnosticLevel.level2, MethodBase.GetCurrentMethod().Name + EntityGlobal.METHOD_END, EntityGlobal.transactionId);
        }
Ejemplo n.º 6
0
        public void DoOperations()
        {
            SystemLog.LogAuditMessage("ScreenMenuSeguridadII", DiagnosticLevel.level2, MethodBase.GetCurrentMethod().Name + EntityGlobal.METHOD_START, EntityGlobal.transactionId);

            MainFrameAdapter.SetTextOnScreen(22, 7, "1");


            Thread.Sleep(1000);
            MainFrameAdapter.SendKey(PcomKeys.Enter);

            SystemLog.LogAuditMessage("ScreenMenuSeguridadII", DiagnosticLevel.level2, MethodBase.GetCurrentMethod().Name + EntityGlobal.METHOD_END, EntityGlobal.transactionId);
        }
Ejemplo n.º 7
0
        public void DoOperations()
        {
            MainFrameAdapter.WaitForCursor(6, 53);
            //GlobalHelper.GetUserPwd(EntityGlobal.appName);
            SystemLog.LogAuditMessage(EntityUserId.constScrName, DiagnosticLevel.level2, MethodBase.GetCurrentMethod().Name + EntityGlobal.METHOD_START, EntityGlobal.transactionId);

            EntityGlobal.userId = ConvertToSecureString("BFPGENJUL");
            EntityGlobal.pswd   = ConvertToSecureString("JUP1T3R6");

            //TCSRPA.XMLLibrary.TextSetter userIdValue = XMLLibrary.GetTextSetter(EntityUserId.constScrName, EntityUserId.constUserIdValue);
            MainFrameAdapter.SetTextOnScreen(6, 53, CryptSecurity.ConvertToUnsecureString(EntityGlobal.userId));
            MainFrameAdapter.SetTextOnScreen(7, 53, CryptSecurity.ConvertToUnsecureString(EntityGlobal.pswd));

            Thread.Sleep(1000);
            MainFrameAdapter.SendKey(PcomKeys.Enter);

            SystemLog.LogAuditMessage(EntityUserId.constScrName, DiagnosticLevel.level2, MethodBase.GetCurrentMethod().Name + EntityGlobal.METHOD_END, EntityGlobal.transactionId);
        }
Ejemplo n.º 8
0
        public void DoActivities()
        {
            EntityGlobal.transactionId = "0001";

            //int businessTrails = 3;

            //for (int i = 0; i < businessTrails; i++)
            //{
            EntityGlobal.isTransactionComplete = false;

            SystemLog.LogAuditMessage(MethodBase.GetCurrentMethod().Name, DiagnosticLevel.level1, EntityGlobal.TRANSACTION_START, EntityGlobal.transactionId);
            //Thread.Sleep(EntityGlobal.pageLoadWaitTime);
            //MainFrameAdapter.WaitForCursor(3, 15);
            try
            {
                /*new ScreenTSO().DoActivities();
                 * new ScreenUserId().DoActivities();
                 * new ScreenPwd().DoActivities();
                 * new ScreenIspf().DoActivities();*/

                new ScreenServicesMMC().DoActivities();


                EntityGlobal.isTransactionComplete = true;
                //break;
            }
            catch (AppException e)
            {
                count_AppException++;
                SystemLog.LogExceptionMessage(e.Message, EntityGlobal.transactionId, EntityGlobal.lastScreenName);
                if (count_AppException > 5)
                {
                    throw new TcsRpaException("Maximum limit reached for Application Exception");
                }
            }
            catch (TcsRpaException e)
            {
                count_TcsRpaException++;
                SystemLog.LogErrorMessage(e, EntityGlobal.transactionId, EntityGlobal.lastScreenName);
                if (count_TcsRpaException > 5)
                {
                    throw new TcsRpaException("Maximum limit reached for TCSRPA Exception");
                }
            }
            catch (COMException e)
            {
                count_ComExceptiom++;
                SystemLog.LogErrorMessage(e, EntityGlobal.transactionId, EntityGlobal.lastScreenName);
                if (count_ComExceptiom > 5)
                {
                    throw new TcsRpaException("Maximum limit reached for COM Exception");
                }
            }
            catch (Exception e)
            {
                count_UnknownErrors++;
                SystemLog.LogErrorMessage(e, EntityGlobal.transactionId, EntityGlobal.lastScreenName);
                if (count_UnknownErrors > 5)
                {
                    throw new TcsRpaException("Maximum limit reached for Unknown errors Exception");
                }
            }
            //}
            if (!EntityGlobal.isTransactionComplete)
            {
                SystemLog.LogExceptionMessage("Transaction Not Completed", EntityGlobal.transactionId, EntityGlobal.lastScreenName);
            }

            SystemLog.LogAuditMessage(MethodBase.GetCurrentMethod().Name, DiagnosticLevel.level1, EntityGlobal.TRANSACTION_END, EntityGlobal.transactionId);
        }
Ejemplo n.º 9
0
        static void Main()
        {
            bool isOpened = false;

            try
            {
                //Initializing mandatory parameters for application
                ConfigLibrary.Initialize();

                SystemLog.LogAuditMessage(MethodBase.GetCurrentMethod().Name, DiagnosticLevel.level1, EntityGlobal.ROBO_START, typeof(MainframeAutomation).Name);

                Initialize();

                /*V1*/

                /*isOpened = MainFrameAdapter.OpenPcomSessionAndConnect();
                 *
                 * Process[] p = Process.GetProcessesByName("pcsws");*/

                /*
                 * System.Windows.Automation.AutomationElement t = WinFormAdapter.GetAEFromHandle(p[0].MainWindowHandle);
                 *
                 * System.Windows.Automation.AutomationElement t1 = WinFormAdapter.GetAEOnChildByName(t, "Inicio de sesión de IBM i");
                 *
                 *
                 * System.Windows.Automation.AutomationElement t2 = WinFormAdapter.GetAEOnChildByName(t, ControlType.Edit, "ID de usuario:");
                 * System.Windows.Automation.AutomationElement t2_1 = WinFormAdapter.GetAEOnChildById(t, ControlType.Edit,"1321");
                 * System.Windows.Automation.AutomationElement t2_2 = WinFormAdapter.GetAEOnDescByName(t, ControlType.Edit, "ID de usuario:");
                 * System.Windows.Automation.AutomationElement t2_3 = WinFormAdapter.GetAEOnDescByName(t, ControlType.Edit, "1321");
                 *
                 * System.Windows.Automation.AutomationElement t3 = WinFormAdapter.GetAEOnChildByName(t, ControlType.Edit, "Contraseña:");
                 *
                 * WinFormAdapter.SetText(t2, "BFPJUARUI");
                 * WinFormAdapter.SetText(t3, "BFPJUARUI2");
                 */

                /*
                 * if (isOpened)
                 * {
                 * new BusinessLogic.BLIspfValidator().DoActivities();
                 * }*/

                new BusinessLogic.BLIsWebValidator().DoActivities();
                //new BusinessLogic.BLIsDesktopValidator().DoActivities();
            }
            catch (TcsRpaException e)
            {
                SystemLog.LogErrorMessage(e, typeof(CeseAutomation).Name, MethodBase.GetCurrentMethod().Name);
            }
            catch (Exception e)
            {
                SystemLog.LogErrorMessage(e, typeof(CeseAutomation).Name, MethodBase.GetCurrentMethod().Name);
            }
            finally
            {
                if (isOpened)
                {
                    MainFrameAdapter.ClosePCOM();
                }
            }

            SystemLog.LogAuditMessage(MethodBase.GetCurrentMethod().Name, DiagnosticLevel.level1, EntityGlobal.ROBO_END, typeof(CeseAutomation).Name);
            Thread.Sleep(2000);
        }
Ejemplo n.º 10
0
        static void Main_2()
        {
            bool isOpened = false;

            try
            {
                //Initializing mandatory parameters for application
                ConfigLibrary.Initialize();

                SystemLog.LogAuditMessage(MethodBase.GetCurrentMethod().Name, DiagnosticLevel.level1, EntityGlobal.ROBO_START, typeof(MainframeAutomation).Name);

                Initialize();

                //isOpened = MainFrameAdapter.OpenPcomSessionAndConnect();
                //Process p = Process.GetProcesses().SingleOrDefault(item => item.ProcessName == "pcsws");
//                Process.GetProcessById("")
                Process p = Process.GetProcesses().SingleOrDefault(item => item.ProcessName == "filezilla");
                System.Windows.Automation.AutomationElement t = WinFormAdapter.GetAEFromHandle(p.MainWindowHandle);

                //System.Windows.Automation.ControlType
                System.Windows.Automation.AutomationElement fdsfasdf = WinFormAdapter.GetAEOnChildByName(t, "ID_QUICKCONNECTBAR");
                //System.Windows.Automation.AutomationElement fdsfasdf = WinFormAdapter.GetAEOnChildByName(t, "Servidor:");

                WinFormAdapter.SetTextInTextArea(t, "fdsafsafasfdasfdsafdasfasfasdfasdfdsafsdafdasfdasfasd " + "\r\n" + "gfsdfdafs" + "\t" + "gadsfdad");
                WinFormAdapter.SetTextInTextArea(t, "servidor" + "\t" + "usuario" + "\t" + "contraseña");

                /*System.Windows.Automation.AutomationElement Servidor = WinFormAdapter.GetAEOnChildById(fdsfasdf, "-31800");
                *  System.Windows.Automation.AutomationElement Servidor1 = WinFormAdapter.GetAEOnChildById(fdsfasdf, "31801");*/
                System.Windows.Automation.AutomationElement Servidor       = WinFormAdapter.GetAEOnChildByName(fdsfasdf, ControlType.Edit, "Servidor:");
                System.Windows.Automation.AutomationElement conexionRapida = WinFormAdapter.GetAEOnChildById(fdsfasdf, "-31925");
                //System.Windows.Automation.AutomationElement conexionRapida = WinFormAdapter.GetAEOnChildByName(fdsfasdf, "Conexión rápida");
                WinFormAdapter.SetText(Servidor, "hola");

                //Point conexionRapida.GetClickablePoint();

                WinFormAdapter.ClickElement(conexionRapida);

                //WinFormAdapter.SetText(WinFormAdapter.GetAEOnChildByName(fdsfasdf, "Conexión rápida"), "rrorro");

                //System.Windows.Automation.AutomationElement t2 = WinFormAdapter.GetDialogBox("");

                t.SetFocus();
                //WinFormAdapter.SetText(t, "eeee");
                WinFormAdapter.SetTextInTextArea(t, "fdsafsafasfdasfdsafdasfasfasdfasdfdsafsdafdasfdasfasd " + "\r\n" + "gfsdfdafs" + "\t" + "gadsfdad");
                string texto = WinFormAdapter.GetText(t); //>> devuelve:  //Microsoft Excel - Libro1

                t.GetRuntimeId();
                t.SetFocus();
                System.Windows.Point punto = new System.Windows.Point(40, 40);


                System.Windows.Automation.AutomationElement xx = WinFormAdapter.GetAEFromBoundingRectangle(punto);


                string www = WinFormAdapter.GetText(xx);
                //WinFormAdapter.SetTextInTextArea(xx, "EFDSFSDAFSFDSAFASFA");
                IntPtr e = WinFormAdapter.GetHandleForAE(t);

                const uint WM_KEYDOWN      = 0x100;
                const uint KEYEVENTF_KEYUP = 0x0002;
                /*IntPtr result3 = SendMessage(WindowToFind, WM_KEYDOWN, ((IntPtr)k), (IntPtr)0);*/
                SendMessage(e, WM_KEYDOWN, (IntPtr)Keys.Enter, (IntPtr)0);

                WinFormAdapter.SetWindowForeground(e);
                bool eeee = SetForegroundWindow(e);
                keybd_event((byte)((char)Keys.Enter), 0, KEYEVENTF_KEYUP, IntPtr.Zero);
                keybd_event((byte)((char)Keys.Enter), 0, KEYEVENTF_KEYUP, IntPtr.Zero);
                keybd_event((byte)((char)Keys.Enter), 0, KEYEVENTF_KEYUP, IntPtr.Zero);
                keybd_event((byte)((char)Keys.A), 0, KEYEVENTF_KEYUP, IntPtr.Zero);
                keybd_event((byte)((char)Keys.A), 0, KEYEVENTF_KEYUP, IntPtr.Zero);
                keybd_event((byte)((char)Keys.A), 0, KEYEVENTF_KEYUP, IntPtr.Zero);
                keybd_event((byte)((char)Keys.A), 0, KEYEVENTF_KEYUP, IntPtr.Zero);
                keybd_event((byte)((char)Keys.A), 0, KEYEVENTF_KEYUP, IntPtr.Zero);
                keybd_event((byte)((char)Keys.Enter), 0, KEYEVENTF_KEYUP, IntPtr.Zero);
                keybd_event((byte)((char)Keys.Enter), 0, KEYEVENTF_KEYUP, IntPtr.Zero);

                //SendKeys.SendWait("EE");
                //SendKeys.SendWait(Keys.Enter.ToString());

                /*SendKeys.Send("K");
                 * SendKeys.Send(Keys.Enter.ToString());
                 * SendKeys.Send(Keys.Enter.ToString());
                 * SendKeys.Send(Keys.Enter.ToString());
                 * SendKeys.Send(Keys.Enter.ToString());
                 * SendKeys.Send(Keys.Enter.ToString());
                 * SendKeys.Send(Keys.Enter.ToString());*/



                Console.Write(www);
                MessageBox.Show(www);

                //System.Windows.Automation.AutomationElement t3 = WinFormAdapter.GetAEOnChildByName(t, "");


                //WinFormAdapter.ClickElement(t2);

                /*System.Windows.Automation.AutomationElement t3 = WinFormAdapter.GetAE()
                 *
                 * WinFormAdapter.SetText(t2, "BFPJUARUI");*/
                //Thread.Sleep(1000000);

                /*if (isOpened)
                 * {
                 *  new BusinessLogic.BLIspfValidator().DoActivities();
                 * }**/
                Thread.Sleep(10000900);
            }
            catch (TcsRpaException e)
            {
                SystemLog.LogErrorMessage(e, typeof(MainframeAutomation).Name, MethodBase.GetCurrentMethod().Name);
            }
            catch (Exception e)
            {
                SystemLog.LogErrorMessage(e, typeof(MainframeAutomation).Name, MethodBase.GetCurrentMethod().Name);
            }
            finally
            {
                if (isOpened)
                {
                    MainFrameAdapter.ClosePCOM();
                }
            }

            SystemLog.LogAuditMessage(MethodBase.GetCurrentMethod().Name, DiagnosticLevel.level1, EntityGlobal.ROBO_END, typeof(MainframeAutomation).Name);
            Thread.Sleep(2000);
        }