Beispiel #1
0
        protected void aspxCallback_Callback(object sender, DevExpress.Web.ASPxCallback.CallbackEventArgs e)
        {
            SqlJob sqlJob = new SqlJob();

            try
            {
                System.Threading.Thread.Sleep(1000);

                switch (e.Parameter)
                {
                    case "NEW":
                        sqlJob.CreatedBy = User.Identity.Name;
                        sqlJob.CreatedDate = DateTime.Now;
                        FillEntity(sqlJob);
                        jobSchedulerService.AddJob(sqlJob);
                        e.Result = "NEWOK";
                        break;
                    case "UPDATE":
                        sqlJob = (SqlJob)jobSchedulerService.GetJobById(Convert.ToInt32(hdnJobId.Value));
                        FillEntity(sqlJob);
                        jobSchedulerService.UpdateJob(sqlJob);
                        e.Result = "UPDATEDOK";
                        break;
                }
            }
            catch (Exception ex)
            {
                if (log.IsErrorEnabled)
                    log.Error(Utils.UI.Helper.BuildRecursiveErrorMessage(ex));
                e.Result = "Error:\r\n" + Utils.UI.Helper.BuildRecursiveErrorMessage(ex);
            }
        }
 public void SQLMappingTest()
 {
     var sqlJob = new SqlJob
                      {
                          Comments = "blabla",
                          CreatedBy = "sdsd",
                          DatabaseName = "CGControlPanel",
                          CreatedDate = DateTime.Now,
                          Deleted = false,
                          DeletedBy = string.Empty,
                          Description = "Descripcion",
                          IsFavorite = true,
                          Group = "Replicación",
                          Name = "Job Replicación 1",
                          JobType = JobType.Automático,
                          InputSchemaProcedure = "wdwdsadsa",
                          JobTypeEnum = 1,
                          Password = "******",
                          Triggers = new List<JobTrigger>(),
                          ServerName = "SQL",
                          UserName = "******",
                          ExecProcedure = "sarlanga"
                      };
     var unitOfWork = new UnitOfWork();
     unitOfWork.JobsRepository.Insert(sqlJob);
     unitOfWork.Save();
 }
        protected void aspxCallback_Callback(object sender, DevExpress.Web.ASPxCallback.CallbackEventArgs e)
        {
            SqlJob sqlJob = new SqlJob();
            System.Threading.Thread.Sleep(2000);
            try
            {
                // TODO: Validar que se pueda eliminar el proceso.
                switch (e.Parameter)
                {
                    case "DELETE":
                        try
                        {
                            jobSchedulerService.DeleteJob(sqlJob);
                            e.Result = "DELETEOK";
                            throw new Exception();
                        }
                        catch (Exception ex)
                        {
                            e.Result = "DELETENOOK";
                        }

                        break;
                    default:
                        break;
                }
            }
            catch (Exception ex)
            {
                if (e.Parameter == "DELETE")
                {
                    throw new Exception("No se ha podido eliminar el proceso debido al siguiente error: " + ex.Message);
                }
            }
        }
 protected void FillUI(SqlJob sqlJob)
 {
     hdnJobId.Value = sqlJob.JobId.ToString();
     txtGroup.Text = sqlJob.Group;
     txtName.Text = sqlJob.Name;
     txtDescription.Text = sqlJob.Description;
     cmbJobType.SelectedIndex = (int)sqlJob.JobType;
     chkFavorite.Value = sqlJob.IsFavorite;
     txtInputSchemaServerName.Text = sqlJob.ServerName;
     txtInputSchemaDataBaseName.Text = sqlJob.DatabaseName;
     txtInputSchemaUserName.Text = sqlJob.UserName;
     txtInputSchemaProcedure.Text = sqlJob.InputSchemaProcedure;
 }
Beispiel #5
0
 protected void FillUI(SqlJob sqlJob)
 {
     txtGroup.Text = sqlJob.Group;
     txtName.Text = sqlJob.Name;
     txtDescription.Text = sqlJob.Description;
     cmbJobType.SelectedIndex = (int)sqlJob.JobType;
     chkFavorite.Value = sqlJob.IsFavorite;
     chkDaily.Value = sqlJob.IsDaily;
     txtInputSchemaServerName.Text = sqlJob.ServerName;
     txtInputSchemaDataBaseName.Text = sqlJob.DatabaseName;
     txtInputSchemaUserName.Text = sqlJob.UserName;
     txtInputSchemaProcedure.Text = sqlJob.InputSchemaProcedure;
     txtExecProcedure.Text = sqlJob.ExecProcedure;
     txtFixedParametersProcedure.Text = sqlJob.FixedParametersProcedure;
 }
        protected void FillUI(SqlJob sqlJob)
        {
            hdnJobId.Value = sqlJob.JobId.ToString();
            txtGroup.Value = sqlJob.Group;

            if (sqlJob.JobType == JobType.Manual)
            {
                lblInputSchemaProcedure.Visible = true;
                lblAutomaticProcessTime.Visible = false;
            }
            else
            {
                if (sqlJob.AutomaticProcessTime.HasValue)
                    dtAutomaticProcessTime.Value = sqlJob.AutomaticProcessTime.Value.TimeOfDay.Hours.ToString().PadLeft(2, '0') + ":" + sqlJob.AutomaticProcessTime.Value.TimeOfDay.Minutes.ToString().PadLeft(2, '0');
                lblInputSchemaProcedure.Visible = false;
            }

            txtName.Value = sqlJob.Name;
            txtDescription.Value = sqlJob.Description;
            txtComments.Value = sqlJob.Comments;
            chkGeneral.Checked =sqlJob.IsGeneral;
            cmbJobType.Value = sqlJob.JobTypeEnum.ToString();
            if (sqlJob.ParentJobId.HasValue && sqlJob.ParentJobId.Value == 0)
            {
                cmbRelatedProcess.Value = "Ninguno";
            }
            else
            {
                if (sqlJob.ParentJobId.HasValue)
                {
                    cmbRelatedProcess.Value = jobSchedulerService.GetJobById(sqlJob.ParentJobId.Value).Name;
                }
                else
                {
                    cmbRelatedProcess.Value = "Ninguno";
                }
            }
            chkFavorite.Checked = sqlJob.IsFavorite;
            txtProcedureServerName.Value = sqlJob.ServerName;
            txtProcedureDataBaseName.Value = sqlJob.DatabaseName;
            txtProcedureUserName.Value = sqlJob.UserName;
            txtInputSchemaProcedure.Value = sqlJob.InputSchemaProcedure;

            Weekdays weekdays = new Weekdays();
            weekdays.AllDays = Convert.ToByte(sqlJob.Weekdays);

            PopulateCheckBoxes(weekdays);
        }
Beispiel #7
0
        protected void FillEntity(SqlJob sqlJob)
        {
            if (!String.IsNullOrEmpty(hdnJobId.Value))
                sqlJob.JobId = Convert.ToInt32(hdnJobId.Value);

            sqlJob.Group = txtGroup.Text;
            sqlJob.Name = txtName.Text;
            sqlJob.Description = txtDescription.Text;
            sqlJob.JobType =(JobType)cmbJobType.SelectedIndex;
            sqlJob.IsFavorite = Convert.ToBoolean(chkFavorite.Value);
            sqlJob.IsDaily = Convert.ToBoolean(chkDaily.Value);
            sqlJob.ServerName = txtInputSchemaServerName.Text;
            sqlJob.DatabaseName =  txtInputSchemaDataBaseName.Text;
            sqlJob.UserName = txtInputSchemaUserName.Text;
            sqlJob.InputSchemaProcedure = txtInputSchemaProcedure.Text;
            sqlJob.ExecProcedure = txtExecProcedure.Text;
            sqlJob.FixedParametersProcedure = txtFixedParametersProcedure.Text;
        }
Beispiel #8
0
        protected void FillEntity(SqlJob sqlJob)
        {
            if (!String.IsNullOrEmpty(hdnJobId.Value))
                sqlJob.JobId = Convert.ToInt32(hdnJobId.Value);

            sqlJob.Group = txtGroup.Value;
            sqlJob.Name = txtName.Value;
            sqlJob.Description = txtDescription.Value;
            sqlJob.Comments = txtComments.Value;
            sqlJob.JobTypeEnum = Convert.ToInt32(cmbJobType.Value);
            sqlJob.IsFavorite = Convert.ToBoolean(chkFavorite.Checked);
            sqlJob.ServerName = txtProcedureServerName.Value;
            sqlJob.IsGeneral = chkGeneral.Checked;
            int parentJobId;
            if (cmbRelatedProcess.Value != null && int.TryParse(cmbRelatedProcess.Value.ToString(), out parentJobId))
                sqlJob.ParentJobId = parentJobId;
            else
                sqlJob.ParentJobId = 0;
            sqlJob.DatabaseName = txtProcedureDataBaseName.Value;
            sqlJob.UserName = txtProcedureUserName.Value;

            if (sqlJob.JobType == JobType.Automático)
            {
                var time = DateTime.Parse(dtAutomaticProcessTime.Value,
                                          new CultureInfo("es-AR"),
                                          DateTimeStyles.NoCurrentDateDefault);
                sqlJob.AutomaticProcessTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day,
                                                           time.Hour, time.Minute, time.Second);
            }

            sqlJob.InputSchemaProcedure = txtInputSchemaProcedure.Value;
            sqlJob.ExecProcedure = txtExecProcedure.Value;
            if (!string.IsNullOrEmpty(txtProcedurePassword.Value))
                sqlJob.Password = encryptionService.Encrypt(txtProcedurePassword.Value, encryptionService.EncryptionKey);

            sqlJob.InputXmlFixedParameters = "<INPUTXMLFIXEDPARAMETERS>" + Server.HtmlDecode(txtInputXmlFixedParameters.Value) + "</INPUTXMLFIXEDPARAMETERS>";

            sqlJob.Weekdays = GetCheckBoxesSelections().AllDays;
        }
Beispiel #9
0
        protected void aspxCallback_Callback(object sender, DevExpress.Web.ASPxCallback.CallbackEventArgs e)
        {
            SqlJob sqlJob = new SqlJob();
            System.Threading.Thread.Sleep(2000);
            try
            {
                e.Result = "UPDATEDOK";

            }
            catch (Exception ex)
            {
                if (e.Parameter == "UPDATE")
                {
                    throw new Exception("No se ha podido actualizar el proceso debido al siguiente error: " + ex.Message);
                }

                if (e.Parameter == "NEW")
                {
                    throw new Exception("No se ha podido crear el proceso debido al siguiente error: " + ex.Message);
                }
            }
        }
 public void SQLMappingTest()
 {
     var sqlJob = new SqlJob
                      {
                          Comments = "blabla",
                          CreatedBy = "sdsd",
                          DatabaseName = "CGControlPanel",
                          CreatedDate = DateTime.Now,
                          Deleted = false,
                          DeletedBy = string.Empty,
                          Description = "Descripcion",
                          IsFavorite = true,
                          ExecutionDays = 1,
                          Group = "Replicación",
                          Name = "Job Replicación 1",
                          JobType = JobType.Automatico,
                          InputSchemaProcedure = "wdwdsadsa",
                          JOB_GROUP = "wwww",
                          JOB_NAME = "adasas",
                          JobStatus = JobStatus.Scheduled,
                          JobStatusEnum = 1,
                          JobTypeEnum = 1,
                          Password = "******",
                          Logs = new List<JobLog>(),
                          Triggers = new List<JobTrigger>(),
                          SCHED_NAME = "asdsdsa",
                          LastExecutionStatus = LastExecutionStatus.Success,
                          LastExecutionStatusEnum = 1,
                          ServerName = "SQL",
                          UserName = "******",
                          ExecProcedure = "sarlanga"
                      };
     var unitOfWork = new UnitOfWork();
     unitOfWork.JobsRepository.Insert(sqlJob);
     unitOfWork.Save();
 }
Beispiel #11
0
        protected void FillUI(SqlJob sqlJob)
        {
            txtGroup.Value = sqlJob.Group;
            txtName.Value = sqlJob.Name;
            txtDescription.Value = sqlJob.Description;

            if (sqlJob.ParentJobId.HasValue && sqlJob.ParentJobId.Value != 0)
            {
                cmbRelatedProcess.Value = jobSchedulerService.GetJobById(sqlJob.ParentJobId.Value).JobId.ToString();
            }

            if (sqlJob.ParentJobId.HasValue && sqlJob.ParentJobId.Value == 0)
            {
                cmbRelatedProcess.Value = "Ninguno";
            }

            cmbJobType.Value = sqlJob.JobTypeEnum.ToString();
            chkFavorite.Checked = sqlJob.IsFavorite;
            chkGeneral.Checked = sqlJob.IsGeneral;
            txtComments.Value = sqlJob.Comments;
            txtProcedureServerName.Value = sqlJob.ServerName;
            txtProcedureDataBaseName.Value = sqlJob.DatabaseName;

            if (sqlJob.JobType == JobType.Manual)
            {
                lblProcessTime.Visible = false;
            }
            else
            {
                if (sqlJob.AutomaticProcessTime.HasValue)
                    dtAutomaticProcessTime.Value = sqlJob.AutomaticProcessTime.Value.TimeOfDay.Hours.ToString().PadLeft(2, '0') + ":" + sqlJob.AutomaticProcessTime.Value.TimeOfDay.Minutes.ToString().PadLeft(2, '0');
                lblInputSchemaProcedure.Visible = false;
            }

            if (sqlJob.InputSchemaProcedure == null || sqlJob.InputSchemaProcedure.Trim() == "")
            {
                btnCheckInputDialog.Visible = false;
            }

            txtProcedureUserName.Value = sqlJob.UserName;
            txtInputSchemaProcedure.Value = sqlJob.InputSchemaProcedure;
            txtExecProcedure.Value = sqlJob.ExecProcedure;

            txtInputXmlFixedParameters.Value = sqlJob.InputXmlFixedParameters.Replace("<INPUTXMLFIXEDPARAMETERS>", "").Replace("</INPUTXMLFIXEDPARAMETERS>", "");

            Weekdays weekdays = new Weekdays();
            weekdays.AllDays = Convert.ToByte(sqlJob.Weekdays);

            PopulateCheckBoxes(weekdays);
        }
        public List<JobTrigger> GetJobTriggersByExecutionDay(DateTime dateTime)
        {
            var jobsTriggerList = new List<JobTrigger>();

            var sqlJob = new SqlJob
                {
                    JobId = 12,
                    IsFavorite = true,
                    Group = "Replicación",
                    Name = "Job Replicación 2",
                    JobType = JobType.Manual,
                    Weekdays = 6
                };

            var sqlJob2 = new SqlJob
            {
                JobId = 13,
                IsFavorite = true,
                Group = "Replicación Automática",
                Name = "Job Replicación 3",
                JobType = JobType.Automático,
                Weekdays = 0
            };

            var sqlJob3 = new SqlJob
            {
                JobId = 14,
                IsFavorite = true,
                Group = "Replicación Automática",
                Name = "Job Replicación 4",
                JobType = JobType.Manual,
                InputSchemaProcedure = "PROCEDURE",
                Weekdays = 21
            };

            jobsTriggerList.Add(new SqlJobTrigger { JobTriggerId = 1, Job = sqlJob, JobTriggerStatus = JobTriggerStatus.Agendado });
            jobsTriggerList.Add(new SqlJobTrigger { JobTriggerId = 2, Job = sqlJob2, StartExecutionDate = DateTime.Now, JobTriggerStatus = JobTriggerStatus.Ejecutando });
            jobsTriggerList.Add(new SqlJobTrigger { JobTriggerId = 3, Job = sqlJob, RecordsAffected = 33, StartExecutionDate = DateTime.Now, EndExecutionDate = DateTime.Now.AddHours(1), RecordsProcessed = 250, JobTriggerStatus = JobTriggerStatus.Ejecutado });
            jobsTriggerList.Add(new SqlJobTrigger { JobTriggerId = 4, Job = sqlJob3, JobTriggerStatus = JobTriggerStatus.Agendado });

            return jobsTriggerList;
        }
        public List<JobTrigger> GetJobTriggersByExecutionDay(DateTime? dateTime, JobTriggerStatus jobTriggerStatus)
        {
            var jobsTriggerList = new List<JobTrigger>();

            var sqlJob = new SqlJob
            {
                JobId = 12,
                IsFavorite = true,
                ExecutionDays = 1,
                Group = "Replicación",
                Name = "Job Replicación 1",
                JobType = JobType.Manual
            };

            jobsTriggerList.Add(new SqlJobTrigger { JobTriggerId = 1, Job = sqlJob, RecordsAffected = 1, RecordsProcessed = 100, JobTriggerStatus = jobTriggerStatus});
            jobsTriggerList.Add(new SqlJobTrigger { JobTriggerId = 2, Job = sqlJob, RecordsAffected = 2, RecordsProcessed = 200, JobTriggerStatus = jobTriggerStatus });

            return jobsTriggerList;
        }
        public List<JobTrigger> GetJobTriggersByExecutionDay(DateTime? dateTime)
        {
            var jobsTriggerList = new List<JobTrigger>();

            var sqlJob = new SqlJob
                {
                    JobId = 12,
                    IsFavorite = true,
                    ExecutionDays = 1,
                    Group = "Replicación",
                    Name = "Job Replicación 1",
                    JobType = JobType.Manual
                };

            var sqlJob2 = new SqlJob
            {
                JobId = 13,
                IsFavorite = true,
                ExecutionDays = 1,
                Group = "Replicación Automática",
                Name = "Job Replicación 1",
                JobType = JobType.Automatico
            };

            jobsTriggerList.Add(new SqlJobTrigger { JobTriggerId = 1, Job = sqlJob, RecordsAffected = 1, RecordsProcessed = 100, JobTriggerStatus = JobTriggerStatus.Agendado });
            jobsTriggerList.Add(new SqlJobTrigger { JobTriggerId = 2, Job = sqlJob2, RecordsAffected = 2, RecordsProcessed = 200, JobTriggerStatus = JobTriggerStatus.Agendado });
            jobsTriggerList.Add(new SqlJobTrigger { JobTriggerId = 3, Job = sqlJob, RecordsAffected = 33, RecordsProcessed = 250, JobTriggerStatus = JobTriggerStatus.Ejecutado });

            return jobsTriggerList;
        }
        public JobTrigger GetJobTriggerById(int JobId)
        {
            var sqlJob = new SqlJob
            {
                JobId = 1,
                IsFavorite = true,
                ExecutionDays = 1,
                Group = "Replicación",
                Name = "Job Replicación 1",
                Comments = "Comentarios",
                JobType = JobType.Automatico,
                ServerName = "SQL1",
                DatabaseName = "CGPlanos",
                Description = "Esto es una descripción de las tareas que realiza el proceso",
                UserName = "******",
                CreatedBy = "Carlos.Daniel.Vazquez",

            };

            return new SqlJobTrigger
            {
                JobTriggerId = 1,
                CreatedBy = "Carlos",
                XmlFormInputValues = "Input Values",
                XmlTableInput = "XML Input Values",
                XmlTableOutput = "XML Output",
                RecordsProcessed = 100,
                RecordsAffected = 10,
                Job =sqlJob,
                JobTriggerStatus = JobTriggerStatus.Agendado,
                XmlTableExecutionLog = "Execution Log",
                XmlResult = @"<?xml version=""1.0"" encoding=""iso-8859-1"" ?>
            <CTABLARESULTADO>
              <CCABECERA>
            <CVALOR>CABECERA 1</CVALOR>
            <CVALOR>CABECERA 2</CVALOR>
            <CVALOR>CABECERA 3</CVALOR>
            <CVALOR>CABECERA 4</CVALOR>
              </CCABECERA>
              <CFILA>
            <CVALOR>CTITULO1</CVALOR>
            <CVALOR>TITULO</CVALOR>
            <CVALOR>0111- PROCESOS DE CUENTAS BANCARIAS</CVALOR>
            <CVALOR>1</CVALOR>
              </CFILA>
              <CFILA>
            <CVALOR>CTITULO2</CVALOR>
            <CVALOR>TITULO2</CVALOR>
            <CVALOR>0112- PROCESOS DE CUENTAS BANCARIAS</CVALOR>
            <CVALOR>2</CVALOR>
              </CFILA>
              <CFILA>
            <CVALOR>CTITULO3</CVALOR>
            <CVALOR>TITULO3</CVALOR>
            <CVALOR>0113- PROCESOS DE CUENTAS BANCARIAS</CVALOR>
            <CVALOR>3</CVALOR>
              </CFILA>
              <CFILA>
            <CVALOR>CTITULO4</CVALOR>
            <CVALOR>TITULO4</CVALOR>
            <CVALOR>0114- PROCESOS DE CUENTAS BANCARIAS</CVALOR>
            <CVALOR>4</CVALOR>
              </CFILA>
            </CTABLARESULTADO>"
            };
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                var job = new SqlJob
                               {
                                   DatabaseName = "TestDB",
                                   ExecProcedure = "Procedure",
                                   UserName = "******",
                                   Password = "******",
                                   ServerName = "server",
                                   JobStatus = JobStatus.Success,
                                   CreatedBy = "",
                                   CreatedDate = DateTime.Now,
                                   Deleted = false,
                                   Description = "",
                                   ExecutionDays = 1,
                                   JobStatusEnum = 1,
                                   JobType = JobType.Manual,
                                   Name = "Nombre",
                                   Group = "Grupo",
                                   JobTypeEnum = 1,
                                   JOB_GROUP = "Grupo",
                                   JOB_NAME = "Nombre",
                                   SCHED_NAME = "Sched",
                                   LastExecutionStatus = LastExecutionStatus.Success
                               };

                //jobSchedulerService.AddJob(job);
                var sqlJobTrigger = jobSchedulerService.GetJobTriggerById(Convert.ToInt32(Request.Form["jobid"]));

                FillUI(sqlJobTrigger);
            }
        }
        public JobTrigger GetJobTriggerById(int JobTriggerId)
        {
            var sqlJob = new SqlJob
            {
                JobId = 1,
                IsFavorite = true,
                Group = "Replicación",
                Name = "Job Replicación 1",
                Comments = "Comentarios",
                JobType = JobType.Manual,
                AutomaticProcessTime = DateTime.Now,
                ServerName = "SQL1",
                DatabaseName = "CGPlanos",
                Description = "Esto es una descripción de las tareas que realiza el proceso",
                UserName = "******",
                CreatedBy = "Carlos.Daniel.Vazquez",
                Weekdays = 21
            };

            var sqlJobTrigger = new SqlJobTrigger
            {
                JobTriggerId = JobTriggerId,
                CreatedBy = "Carlos",
                InputFormXmlValues = "Input Values",
                InputXmlTable = "XML Input Values",
                OutputXmlTable = "XML Output",
                RecordsProcessed = 100,
                RecordsAffected = 10,
                Job =sqlJob,
                JobTriggerStatus = JobTriggerStatus.Ejecutado,
                ScheduledStartExecutionDate = DateTime.Now.AddDays(-1),
                StartExecutionDate = DateTime.Now.AddDays(-1),
                EndExecutionDate = DateTime.Now,
                OutputExecutionStatus = "Ejecutado SIN Errores",
                OutputExecutionLog = "<table width='100%'><tr><td>test</td></tr></table>",
                OutputExecutionResult= @"<p>resultado 1</p><p>resultado 2</p><p>resultado 3</p>"
            };
            // Si NO se ejecutó
            if (JobTriggerId != 3)
            {
                sqlJobTrigger.StartExecutionDate = null;
                sqlJobTrigger.JobTriggerStatus = JobTriggerStatus.Agendado;
                sqlJobTrigger.OutputExecutionLog = "-";
                sqlJobTrigger.OutputExecutionResult = "-";
                sqlJobTrigger.OutputExecutionStatus = "-";
                sqlJobTrigger.InputFormXmlValues = "-";
                sqlJobTrigger.InputXmlTable = "-";
                sqlJobTrigger.OutputXmlTable = "-";
                sqlJobTrigger.RecordsProcessed = 0;
                sqlJobTrigger.RecordsAffected = 0;
                sqlJobTrigger.EndExecutionDate = null;
                sqlJobTrigger.Job.Weekdays = 0;
            }

            // En Ejecución
            if (JobTriggerId == 2)
            {
                sqlJobTrigger.StartExecutionDate = DateTime.Now;
                sqlJobTrigger.Job.Weekdays = 6;
                sqlJobTrigger.JobTriggerStatus = JobTriggerStatus.Ejecutando;
                sqlJobTrigger.Job.JobType = JobType.Automático;
            }

            return sqlJobTrigger;
        }
        public void Setup()
        {
            stream = new FileStream(@"C:\test.xlsx", FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
            IExcelDataReader excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream);
            excelReader.IsFirstRowAsColumnNames = true;
            DataSet result = excelReader.AsDataSet();

            ISchedulerFactory sf = new StdSchedulerFactory();
            if (_schedulerService == null)
            {
                _schedulerService = new DefaultJobSchedulerService();
                ((DefaultJobSchedulerService)_schedulerService).Scheduler = sf.GetScheduler();
            }
            _unitOfWork = new UnitOfWork();
            _schedulerService.UnitOfWork = _unitOfWork;
            //_schedulerService.Resume();

            _sqlJobTrigger = new SqlJobTrigger
            {
                CreatedBy = "Pepe",
                CreatedDate = DateTime.Now,
                Enabled = true,
                JobTriggerStatus = JobTriggerStatus.NoAgendado,
                InputFormXmlValues = "<prueba>Prueba</prueba>",
                ScheduledStartExecutionDate = DateTime.Now
            };

            _sqlJob = new SqlJob
            {
                Comments = "blabla",
                CreatedBy = "sdsd",
                DatabaseName = "cgQuartz",
                CreatedDate = DateTime.Now,
                Deleted = false,
                DeletedBy = string.Empty,
                Description = "Descripcion",
                IsFavorite = true,
                Group = "Replicación",
                Name = "Job Replicación 1",
                JobType = JobType.Automático,
                InputSchemaProcedure = "wdwdsadsa",
                JobTypeEnum = 1,
                Password = "******",
                ServerName = @".\SQLEXPRESS",
                UserName = "******",
                ExecProcedure = "OP_PROCESO_QUARTZ_EXEC",
            };

            _sqlJobTrigger2 = new SqlJobTrigger
            {
                CreatedBy = "Pepe",
                CreatedDate = DateTime.Now,
                Enabled = true,
                JobTriggerStatus = JobTriggerStatus.NoAgendado,
                InputFormXmlValues = "<prueba>Prueba2</prueba>",
                ScheduledStartExecutionDate = DateTime.Now
            };

            _sqlJobTrigger3 = new SqlJobTrigger
            {
                CreatedBy = "Pepe",
                CreatedDate = DateTime.Now,
                Enabled = true,
                JobTriggerStatus = JobTriggerStatus.NoAgendado,
                InputFormXmlValues = "<prueba>Prueba2</prueba>",
                ScheduledStartExecutionDate = DateTime.Now
            };

            _sqlJobTrigger4 = new SqlJobTrigger
            {
                CreatedBy = "Pepe",
                CreatedDate = DateTime.Now,
                Enabled = true,
                JobTriggerStatus = JobTriggerStatus.NoAgendado,
                InputFormXmlValues = "<prueba>Prueba2</prueba>",
                ScheduledStartExecutionDate = DateTime.Now
            };

            _sqlJobTrigger5 = new SqlJobTrigger
            {
                CreatedBy = "Pepe",
                CreatedDate = DateTime.Now,
                Enabled = true,
                JobTriggerStatus = JobTriggerStatus.NoAgendado,
                InputFormXmlValues = "<prueba>Prueba2</prueba>",
                ScheduledStartExecutionDate = DateTime.Now
            };

            _sqlJobTrigger6 = new SqlJobTrigger
            {
                CreatedBy = "Pepe",
               CreatedDate = DateTime.Now,
                Enabled = true,
                JobTriggerStatus = JobTriggerStatus.NoAgendado,
                InputFormXmlValues = "<prueba>Prueba2</prueba>",
                ScheduledStartExecutionDate = DateTime.Now
            };

            _sqlJob2 = new SqlJob
            {
                Comments = "blabla2",
                CreatedBy = "sdsd2",
                DatabaseName = "cgQuartz",
                CreatedDate = DateTime.Now,
                Deleted = false,
                DeletedBy = string.Empty,
                Description = "Descripcion",
                IsFavorite = true,
                Group = "Replicación",
                Name = "Job Replicación 2",
                JobType = JobType.Automático,
                InputSchemaProcedure = "wdwdsadsa2",
                JobTypeEnum = 1,
                Password = "******",
                ServerName = @".\SQLEXPRESS",
                UserName = "******",
                ExecProcedure = "OP_PROCESO_QUARTZ_EXEC2",
            };

            _sqlJob3 = new SqlJob
            {
                Comments = "blabla3",
                CreatedBy = "sdsd3",
                DatabaseName = "cgQuartz",
                CreatedDate = DateTime.Now,
                Deleted = false,
                DeletedBy = string.Empty,
                Description = "Descripcion",
                IsFavorite = true,
                Group = "Replicación",
                Name = "Job Replicación 3",
                JobType = JobType.Automático,
                InputSchemaProcedure = "wdwdsadsa3",
                JobTypeEnum = 1,
                Password = "******",
                ServerName = @".\SQLEXPRESS",
                UserName = "******",
                ExecProcedure = "OP_PROCESO_QUARTZ_EXEC3",
            };

            _sqlJob4 = new SqlJob
            {
                Comments = "blabla4",
                CreatedBy = "sdsd4",
                DatabaseName = "cgQuartz",
                CreatedDate = DateTime.Now,
                Deleted = false,
                DeletedBy = string.Empty,
                Description = "Descripcion",
                IsFavorite = true,
                Group = "Replicación",
                Name = "Job Replicación 4",
                JobType = JobType.Automático,
                InputSchemaProcedure = "wdwdsadsa4",
                JobTypeEnum = 1,
                Password = "******",
                ServerName = @".\SQLEXPRESS",
                UserName = "******",
                ExecProcedure = "OP_PROCESO_QUARTZ_EXEC4",
            };

            _sqlJob4 = new SqlJob
            {
                Comments = "blabla5",
                CreatedBy = "sdsd5",
                DatabaseName = "cgQuartz",
                CreatedDate = DateTime.Now,
                Deleted = false,
                DeletedBy = string.Empty,
                Description = "Descripcion",
                IsFavorite = true,
                Group = "Replicación",
                Name = "Job Replicación 5",
                JobType = JobType.Automático,
                InputSchemaProcedure = "wdwdsadsa5",
                JobTypeEnum = 1,
                Password = "******",
                ServerName = @".\SQLEXPRESS",
                UserName = "******",
                ExecProcedure = "OP_PROCESO_QUARTZ_EXEC5",
            };

            _sqlJob5 = new SqlJob
            {
                Comments = "blabla6",
                CreatedBy = "sdsd6",
                DatabaseName = "cgQuartz",
                CreatedDate = DateTime.Now,
                Deleted = false,
                DeletedBy = string.Empty,
                Description = "Descripcion",
                IsFavorite = true,
                Group = "Replicación",
                Name = "Job Replicación 6",
                JobType = JobType.Automático,
                InputSchemaProcedure = "wdwdsadsa6",
                JobTypeEnum = 1,
                Password = "******",
                ServerName = @".\SQLEXPRESS",
                UserName = "******",
                ExecProcedure = "OP_PROCESO_QUARTZ_EXEC6",
            };
        }
        public void Setup()
        {
            _schedulerService = new DefaultJobSchedulerService();
            _schedulerService.UnitOfWork = new UnitOfWork();

            ISchedulerFactory sf = new StdSchedulerFactory();
            ((DefaultJobSchedulerService)_schedulerService).Scheduler = sf.GetScheduler();
            _schedulerService.Start();

            _sqlJobTrigger = new SqlJobTrigger
            {
                CreatedBy = "Pepe",
                CreatedDate = DateTime.Now,
                Enabled = true,
                JobLogs = new List<JobLog>(),
                JobTriggerStatus = JobTriggerStatus.NoAgendado,
                XmlFormInputValues = "<prueba>Prueba</prueba>",
            };

            _sqlJob = new SqlJob
            {
                Comments = "blabla",
                CreatedBy = "sdsd",
                DatabaseName = "CGControlPanel3",
                CreatedDate = DateTime.Now,
                Deleted = false,
                DeletedBy = string.Empty,
                Description = "Descripcion",
                IsFavorite = true,
                ExecutionDays = 1,
                Group = "Replicación",
                Name = "Job Replicación 1",
                JobType = JobType.Automatico,
                InputSchemaProcedure = "wdwdsadsa",
                JOB_GROUP = "wwww",
                JOB_NAME = "adasas",
                JobStatus = JobStatus.Scheduled,
                JobStatusEnum = 1,
                JobTypeEnum = 1,
                Password = "******",
                Logs = new List<JobLog>(),
                Triggers = new List<JobTrigger>
                               {
                                   _sqlJobTrigger
                               },
                SCHED_NAME = "asdsdsa",
                LastExecutionStatus = LastExecutionStatus.Success,
                LastExecutionStatusEnum = 1,
                ServerName = @".\SQLEXPRESS",
                UserName = "******",
                ExecProcedure = "OP_PROCESO_EJEMPLO_EXEC",
            };

            _sqlJobTrigger.Job = _sqlJob;
        }