예제 #1
0
        private void FinishSteps(string solution)
        {
            this.Logger.Info("Response from recaptcha ready... Finishing fourth step...");
            if (!this.FinishFourthStep(solution))
            {
                this.Logger.Info("Fourth step can't be solved, please, see messages higher to see more information");
                this.webDriver.Dispose();
                return;
            }
            this.Logger.Info("Fourth step finished... Completing fifth step...");
            if (!this.DoFifthStep())
            {
                this.Logger.Info("Fifth step can't be solved, please, see messages higher to see more information");
                this.CreateHTMLPage("fifth_error");
                this.webDriver.Dispose();
                return;
            }
            this.Logger.Info("fifth step finished... Completing sixth step...");
            if (!this.DoSixthStep())
            {
                this.Logger.Error("Sixth step can't be solved, please, see messages higher to see more information");
                this.CreateHTMLPage("sixth_error");
                this.webDriver.Dispose();
                return;
            }
            this.Logger.Info("Sixth step finished... Completing Seventh step...");
            if (!this.DoSeventhStep())
            {
                this.Logger.Error("Seventh step can't be solved, please, see messages higher to see more information");
                this.CreateHTMLPage("seventh_error");
                this.webDriver.Dispose();
                return;
            }
            this.Logger.Info("Seventh step finished... Completing Eight step...");
            if (!this.DoEightStep())
            {
                this.Logger.Error("Eight step can't be solved, please, see messages higher to see more information");
                this.CreateHTMLPage("eight_error");
                //this.webDriver.Dispose();
                return;
            }
            this.Logger.Info("Eight step finished... Completing Nineth step...");
            if (!this.DoNinethStep())
            {
                this.Logger.Error("Nineth step can't be solved, please, see messages higher to see more information");
                this.CreateHTMLPage("nineth_error");
                this.webDriver.Dispose();
                return;
            }

            this.CreateHTMLPage("finish");

            string PS    = this.webDriver.GetPageSource();
            string Ufile = $"pdf/{UserData.CustomerNameAndSurname}/Cita.Previa.{UserData.CustomerNameAndSurname.Replace(" ", ".")}.{DateTime.Now.ToShortDateString()}.html";

            if (!_f.CreateDirectory($"pdf/{UserData.CustomerNameAndSurname}"))
            {
                Logger.Error($"Cannot create directory for {UserData.CustomerNameAndSurname}");
                return;
            }

            if (!_f.Create(Ufile, PS))
            {
                Logger.Error($"Cannot create file {UserData.CustomerNameAndSurname}");
                return;
            }


            this.InvokeOnStepsControllerCitaStatusCallback(UserData, this.webDriver.GetDataFromPage("#justificanteFinal"));

            this.InvokeOnStepsControllerMailCallback(this.UserData.CustomerNameAndSurname, Ufile);

            this.webDriver.Dispose();
        }
        private void FinishSteps(string solution)
        {
            this._logger.Info("Response from recaptcha ready... Finishing fourth step...");
            if (!this.FinishFourthStep(solution))
            {
                this._logger.Info("Fourth step can't be solved, please, see messages higher to see more information");
                this.WebDriver.Dispose();
                return;
            }
            this._logger.Info("Fourth step finished... Completing fifth step...");
            if (!this.DoFifthStep())
            {
                this._logger.Info("Fifth step can't be solved, please, see messages higher to see more information");
                if (!this.CaptchaResolver.Report(this._currentTask.RequestId, _settings.RucaptchaBadAction))
                {
                    this._logger.Error($"Error, cannot report about capthca with id {this._currentTask.RequestId}");
                }
                this.CreateHtmlPage("fifth_error");
                this.WebDriver.Dispose();
                return;
            }
            this._logger.Info("fifth step finished... Completing sixth step...");
            if (!this.CaptchaResolver.Report(this._currentTask.RequestId, _settings.RucaptchaSuccessAction))
            {
                this._logger.Error($"Error, cannot report about capthca with id {this._currentTask.RequestId}");
            }
            if (!this.DoSixthStep())
            {
                this._logger.Error("Sixth step can't be solved, please, see messages higher to see more information");
                this.CreateHtmlPage("sixth_error");
                this.WebDriver.Dispose();
                return;
            }
            this._logger.Info("Sixth step finished... Completing Seventh step...");
            if (!this.DoSeventhStep())
            {
                this._logger.Error("Seventh step can't be solved, please, see messages higher to see more information");
                this.CreateHtmlPage("seventh_error");
                this.WebDriver.Dispose();
                return;
            }
            this._logger.Info("Seventh step finished... Completing Eight step...");
            if (!this.DoEightStep())
            {
                this._logger.Error("Eight step can't be solved, please, see messages higher to see more information");
                this.CreateHtmlPage("eight_error");
                this.WebDriver.Dispose();
                return;
            }
            this._logger.Info("Eight step finished... Completing Nineth step...");
            if (!this.DoNinethStep())
            {
                this._logger.Error("Nineth step can't be solved, please, see messages higher to see more information");
                this.CreateHtmlPage("nineth_error");
                this.WebDriver.Dispose();
                return;
            }

            this.CreateHtmlPage("finish");

            string PS    = this.WebDriver.GetPageSource();
            string Ufile = $"pdf/{UserData.CustomerNameAndSurname}/Cita.Previa.{UserData.CustomerNameAndSurname.Replace(" ", ".")}.{DateTime.Now.ToShortDateString()}.html";

            if (!_f.CreateDirectory($"pdf/{UserData.CustomerNameAndSurname}"))
            {
                _logger.Error($"Cannot create directory for {UserData.CustomerNameAndSurname}");
                return;
            }

            if (!_f.Create(Ufile, PS))
            {
                _logger.Error($"Cannot create file {UserData.CustomerNameAndSurname}");
                return;
            }


            this.InvokeOnStepsControllerCitaStatusCallback(UserData, this.WebDriver.GetDataFromPage("#justificanteFinal"));

            this.InvokeOnStepsControllerMailCallback(this.UserData.CustomerNameAndSurname, $"{_settings.DefaultAppDataDir}{Ufile}");

            this.WebDriver.Dispose();
        }