Пример #1
0
        protected override void ExecuteMain()
        {
            try
            {
                this.Status = StepStatusEnum.Executing;
                string log    = "";
                string cmd    = Properties.Settings.Default.DownloadRiMEConfigCommand;
                int    result = ThirdPartyProgramBLL.EnhancedRunCommand(out log, cmd, Properties.Settings.Default.DownloadRiMEConfigReferencedList.ToArray());

                switch (result)
                {
                case 0:
                    if (!log.Contains("Error occured. The remote name could not be resolved: ", StringComparison.InvariantCultureIgnoreCase))
                    {
                        this.Status       = StepStatusEnum.Pass;
                        this.ResultDetail = new StepResultDetail("Successfully ran the command: {0}.".FormatWith(cmd));
                    }
                    else
                    {
                        this.Status       = StepStatusEnum.Failed;
                        this.ResultDetail = new StepResultDetail("The command '{0}' failed.".FormatWith(cmd));
                    }
                    break;

                case -1073741510:
                    this.Status       = StepStatusEnum.Cancelled;
                    this.ResultDetail = new StepResultDetail("User cancelled the command: {0}.".FormatWith(cmd));
                    break;

                case -532462766:
                    this.Status       = StepStatusEnum.Warning;
                    this.ResultDetail = new StepResultDetail("This step has run successfully, but some exceptions had been thrown by that step during running. Please check log file for more detailed information.");
                    break;

                default:
                    this.Status       = StepStatusEnum.Failed;
                    this.ResultDetail = new StepResultDetail("Command didn't run successfully, please check log for more detailed information.");
                    break;
                }
            }
            catch (Exception ex)
            {
                this.Status       = StepStatusEnum.Failed;
                this.ResultDetail = new StepResultDetail("Error has occurred, please check log.", ExceptionHelper.CentralProcessSingle2(ex));
            }
            finally
            {
                if (this.ResultDetail != null)
                {
                    Log.Info(this.ResultDetail.Message);
                }
            }
        }
        /// <summary>
        /// Execute this step.
        /// </summary>
        protected override void ExecuteMain()
        {
            string log = string.Empty;

            try
            {
                this.Status = StepStatusEnum.Executing;
                string path   = Path.Combine(Settings.Default.ReplayToolPath, "RiskApiCaller.exe");
                string cmd    = "{0} call /isZipped:{1} /TPS:{2} /path:{3} /count:{4} /newGuid:{5} /needLog:{6} /rptType:\"{7}\" /description:\"{8}\" /isBaseLine:{9} /isDisplay:{10} /jumpMinute:{11}".FormatWith(path, true, Properties.Settings.Default.ReplayToolTPS, Properties.Settings.Default.RiskAPICaller_DataFilePath, Properties.Settings.Default.ReplayToolCount, true, false, string.Empty, "For generating agg data", false, false, 0);
                int    result = ThirdPartyProgramBLL.RunCommand(out log, cmd);

                switch (result)
                {
                case 0:
                    this.Status       = StepStatusEnum.Pass;
                    this.ResultDetail = new StepResultDetail("Successfully ran replay tool.");
                    break;

                case -1073741510:
                    this.Status       = StepStatusEnum.Cancelled;
                    this.ResultDetail = new StepResultDetail("User cancelled the replay tool run.");
                    break;

                default:
                    this.Status       = StepStatusEnum.Failed;
                    this.ResultDetail = new StepResultDetail("Replay tool didn't run successfully, please check log for more detailed information.");
                    break;
                }
            }
            catch (Exception ex)
            {
                this.Status       = StepStatusEnum.Failed;
                this.ResultDetail = new StepResultDetail("Error has occurred, please check log.", ExceptionHelper.CentralProcessSingle2(ex));
            }
            finally
            {
                if (this.ResultDetail != null)
                {
                    if (!string.IsNullOrEmpty(log))
                    {
                        this.ResultDetail.Message += "Execution log: \r\n{0}".FormatWith(log);
                    }

                    Log.Info(this.ResultDetail.Message);
                }
            }
        }
Пример #3
0
        /// <summary>
        /// Execute this step.
        /// </summary>
        protected override void ExecuteMain()
        {
            string log = string.Empty;

            try
            {
                this.Status = StepStatusEnum.Executing;
                string path = Path.Combine(Settings.Default.ReplayToolPath, "RiskApiCaller.exe");

                string cmd = "{0} call /iszipped:{1} /newGuid:{2} /TPS:{3} /path:{4} /count:{5} /needRpt:{6} /description:{7} /isBaseLine:{8} /jumpMinute:{9} /takoSvr:{10} /ImpersonateUserName:{11} /ImpersonateDomain:{12} /ImpersonatePassword:{13}".FormatWith(
                    path,
                    Properties.Settings.Default.RiskAPICaller_IsZipped,
                    Properties.Settings.Default.RiskAPICaller_NewGuid,
                    Properties.Settings.Default.RiskAPICaller_TPS_ChangedRun,
                    Path.Combine(Properties.Settings.Default.RiskAPICaller_DataFilePath, "{0}.dat.gz".FormatWith(string.Join("_", Properties.Settings.Default.RuleIds.ToArray()))),
                    Properties.Settings.Default.RiskAPICaller_Count_Run,
                    true,
                    Properties.Settings.Default.RiskAPICaller_Description,
                    false,
                    Properties.Settings.Default.RiskAPICaller_JumpMinute,
                    Properties.Settings.Default.RiskAPICaller_TakoServer,
                    Properties.Settings.Default.RiskAPICaller_ImpersonateUserName,
                    Properties.Settings.Default.RiskAPICaller_ImpersonateDomain,
                    Properties.Settings.Default.RiskAPICaller_ImpersonatePassword);

                int result = ThirdPartyProgramBLL.RunCommand(out log, cmd);

                switch (result)
                {
                case 0:
                    this.Status       = StepStatusEnum.Pass;
                    this.ResultDetail = new StepResultDetail("Successfully ran replay tool.");
                    break;

                case -1073741510:
                    this.Status       = StepStatusEnum.Cancelled;
                    this.ResultDetail = new StepResultDetail("User cancelled the replay tool run.");
                    break;

                case -532462766:
                    this.Status       = StepStatusEnum.Warning;
                    this.ResultDetail = new StepResultDetail("This step has run successfully, but some exceptions had been thrown by that step during running. Please check log file for more detailed information.");
                    break;

                default:
                    this.Status       = StepStatusEnum.Failed;
                    this.ResultDetail = new StepResultDetail("Replay tool didn't run successfully, please check log for more detailed information.");
                    break;
                }
            }
            catch (Exception ex)
            {
                this.Status       = StepStatusEnum.Failed;
                this.ResultDetail = new StepResultDetail("Error has occurred, please check log.", ExceptionHelper.CentralProcessSingle2(ex));
            }
            finally
            {
                if (this.ResultDetail != null)
                {
                    if (!string.IsNullOrEmpty(log))
                    {
                        this.ResultDetail.Message += "Execution log: \r\n{0}".FormatWith(log);
                    }

                    Log.Info(this.ResultDetail.Message);
                }
            }
        }
Пример #4
0
        protected override void ExecuteMain()
        {
            string       log          = string.Empty;
            Impersonator impersonator = null;

            try
            {
                this.Status = StepStatusEnum.Executing;

                //foreach (string changeGroupXmlFile in Properties.Settings.Default.ChangeGroupXmlFiles)
                //{
                //    Properties.Settings.Default.DownloadRiMEConfigReferencedList.Add(changeGroupXmlFile);
                //}

                bool pass = true;
                this.ResultDetail = new StepResultDetail("Started.");

                string cmd = Properties.Settings.Default.ApplyChangeGroupCommand;
                impersonator = new Impersonator(
                    Properties.Settings.Default.DomainUserName,
                    Properties.Settings.Default.Domain,
                    Properties.Settings.Default.DomainPassword);

                foreach (string sourceFile in Properties.Settings.Default.ChangeGroupXmlFiles)
                {
                    string fileName = Path.GetFileName(sourceFile);
                    File.Copy(sourceFile, Path.Combine(Directory.GetCurrentDirectory(), fileName), true);
                    cmd = cmd.FormatWith(fileName);

                    int result = ThirdPartyProgramBLL.EnhancedRunCommand(out log, cmd);

                    switch (result)
                    {
                    case 0:
                        if (!log.Contains("Error occured. The remote name could not be resolved: ", StringComparison.InvariantCultureIgnoreCase))
                        {
                            this.ResultDetail.Message += "\r\nSuccessfully ran the command: {0}.".FormatWith(cmd);
                            pass = true;
                        }
                        else
                        {
                            this.Status = StepStatusEnum.Failed;
                            this.ResultDetail.Message += "\r\nThe command '{0}' failed.".FormatWith(cmd);
                            pass = false;
                        }
                        break;

                    case -1073741510:
                        this.Status = StepStatusEnum.Cancelled;
                        this.ResultDetail.Message += "\r\nUser cancelled the command: {0}.".FormatWith(cmd);
                        pass = false;
                        break;

                    case -532462766:
                        this.Status = StepStatusEnum.Warning;
                        this.ResultDetail.Message += "\r\nThis step has run successfully, but some exceptions had been thrown by that step during running. Please check log file for more detailed information.";
                        pass = false;
                        break;

                    default:
                        this.Status = StepStatusEnum.Failed;
                        this.ResultDetail.Message += "\r\nCommand didn't run successfully, please check log for more detailed information.";
                        pass = false;
                        break;
                    }

                    if (!pass)
                    {
                        break;
                    }
                }

                if (pass)
                {
                    this.Status = StepStatusEnum.Pass;
                }
            }
            catch (Exception ex)
            {
                this.Status       = StepStatusEnum.Failed;
                this.ResultDetail = new StepResultDetail("Error has occurred, please check log.", ExceptionHelper.CentralProcessSingle2(ex));
            }
            finally
            {
                if (this.ResultDetail != null)
                {
                    Log.Info(this.ResultDetail.Message);
                }

                if (impersonator != null)
                {
                    impersonator.Undo();
                }
            }
        }
Пример #5
0
        protected override void ExecuteMain()
        {
            try
            {
                string log = "";
                this.Status = StepStatusEnum.Executing;
                Impersonator impersonator = new Impersonator(
                    Properties.Settings.Default.DomainUserName,
                    Properties.Settings.Default.Domain,
                    Properties.Settings.Default.DomainPassword);

                Properties.Settings.Default.RiskAPICaller_Count_Run = (Properties.Settings.Default.TransactionCountPerRule * Properties.Settings.Default.RuleIds.Count).ToString();

                Properties.Settings.Default.Save();

                string path = Path.Combine(Properties.Settings.Default.ReplayToolPath, "MixedMerge.exe");

                string cmd = "{0} Mix /SrcFileFolder:\"{1}\" /RuleID:\"{2}\" /DefaultDstCnt:{3} /DstFileFolder:\"{4}\" /ImpersonateUserName:{5} /ImpersonateDomain:{6} /ImpersonatePassword:{7}".FormatWith(
                    path,
                    Properties.Settings.Default.RuleDestFolder,
                    string.Join(",", Properties.Settings.Default.RuleIds.ToArray()),
                    Properties.Settings.Default.RiskAPICaller_Count_Run,
                    Properties.Settings.Default.RiskAPICaller_DataFilePath,
                    Properties.Settings.Default.DomainUserName,
                    Properties.Settings.Default.Domain,
                    Properties.Settings.Default.DomainPassword
                    );

                Log.Info("Starting {0}".FormatWith(cmd));

                int result = ThirdPartyProgramBLL.RunCommand(out log, cmd);

                switch (result)
                {
                case 0:
                    this.Status       = StepStatusEnum.Pass;
                    this.ResultDetail = new StepResultDetail(log + "\r\nSuccessfully ran mixed merge tool.");
                    break;

                case -1073741510:
                    this.Status       = StepStatusEnum.Cancelled;
                    this.ResultDetail = new StepResultDetail(log + "\r\nUser cancelled the replay tool run.");
                    break;

                case -532462766:
                    this.Status       = StepStatusEnum.Warning;
                    this.ResultDetail = new StepResultDetail(log + "\r\nThis step has run successfully, but some exceptions had been thrown by that step during running. Please check log file for more detailed information.");
                    break;

                default:
                    this.Status       = StepStatusEnum.Failed;
                    this.ResultDetail = new StepResultDetail(log + "\r\nFailed, please check log for more detailed information.");
                    break;
                }

                impersonator.Undo();
            }
            catch (Exception ex)
            {
                this.Status       = StepStatusEnum.Failed;
                this.ResultDetail = new StepResultDetail("Error has occurred, please check log.", ExceptionHelper.CentralProcessSingle2(ex));
            }
            finally
            {
                if (this.ResultDetail != null)
                {
                    Log.Info(this.ResultDetail.Message);
                }
            }
        }
Пример #6
0
        protected override void ExecuteMain()
        {
            this.Status = StepStatusEnum.Executing;
            string log = string.Empty;

            try
            {
                Impersonator impersonator = new Impersonator(
                    Properties.Settings.Default.DomainUserName,
                    Properties.Settings.Default.Domain,
                    Properties.Settings.Default.DomainPassword);

                Properties.Settings.Default.ChangeGroupXmlFiles.Clear();
                for (int i = 0; i < Properties.Settings.Default.ChangeGroupLinks.Count; i++)
                {
                    string cmd = @"\\bedtransfer\transfer\RulePerf\MergeChangeGroupTool.exe Merge /retrieveFromRCM:false /isEnforceRefresh:true /Links:{0}".FormatWith(
                        Properties.Settings.Default.ChangeGroupLinks[i]
                        );

                    int result = ThirdPartyProgramBLL.EnhancedRunCommand(
                        out log,
                        cmd,
                        Properties.Settings.Default.ChangeGroupDownloadingReferencedList.ToArray()
                        );

                    switch (result)
                    {
                    case 0:
                        string fileName = log.Replace('\r', ' ').Replace('\n', ' ');
                        fileName = Regex.Replace(fileName, @".*Merge File: (\\\\bedtransfer\\transfer\\RulePerf\\MergeResult\\.+\.xml)\s*.*$", "$1");

                        Log.Info("Downloaded change group from {0} to {1}".FormatWith(
                                     Properties.Settings.Default.ChangeGroupLinks[i],
                                     fileName
                                     ));

                        string downloadedXmlFile = Path.Combine(Properties.Settings.Default.ChangeGroupDownloadTo, Path.GetFileName(fileName));
                        File.Copy(fileName, downloadedXmlFile, true);

                        Log.Info("Copied change group from {0} to {1}".FormatWith(
                                     fileName, downloadedXmlFile
                                     ));

                        Properties.Settings.Default.ChangeGroupXmlFiles.Add(downloadedXmlFile);
                        break;

                    default:
                        throw new Exception("Command didn't run successfully.{0}".FormatWith(log));
                    }
                }

                Properties.Settings.Default.RuleIds.Clear();

                List <string> ruleIds = new List <string>();

                for (int i = 0; i < Properties.Settings.Default.ChangeGroupXmlFiles.Count; i++)
                {
                    ruleIds.AddRange(GetRulesFromXmlFile(Properties.Settings.Default.ChangeGroupXmlFiles[i]));
                }

                foreach (string ruleId in ruleIds)
                {
                    Properties.Settings.Default.RuleIds.Add(ruleId);
                }

                Properties.Settings.Default.RiskAPICaller_Description = Path.GetFileNameWithoutExtension(Properties.Settings.Default.ChangeGroupXmlFiles[0]);

                SettingEntityModel.SaveAll();

                this.Status       = StepStatusEnum.Pass;
                this.ResultDetail = new StepResultDetail("");
                for (int i = 0; i < Properties.Settings.Default.ChangeGroupLinks.Count; i++)
                {
                    this.ResultDetail.Message += "\r\n" + "Successfully downloaded {0} to {1}".FormatWith(
                        Properties.Settings.Default.ChangeGroupLinks[i],
                        Properties.Settings.Default.ChangeGroupXmlFiles[i]
                        );
                }

                impersonator.Undo();
            }
            catch (Exception ex)
            {
                this.Status       = StepStatusEnum.Failed;
                this.ResultDetail = new StepResultDetail("Error has occurred, please check log.", ExceptionHelper.CentralProcessSingle2(ex));
            }
            finally
            {
                if (this.ResultDetail != null)
                {
                    Log.Info(this.ResultDetail.Message);
                }
            }
        }