private void btnDelete_Click(object sender, EventArgs e) { try { Model.Job db = new Model.Job(); db.JobID = Convert.ToInt32(jobIDTextBox.Text); db.ComID = Convert.ToInt32(comNameComboBox.Text); db.JobName = jobNameTextBox.Text; db.JobDetail = jobDetailTextBox.Text; if (Convert.ToBoolean(jobStatusCheckBox.Checked) == true) { db.JobStatus = true; } else { db.JobStatus = false; } db.ViewCount = Convert.ToInt32(viewCountTextBox.Text); db.JobCatID = Convert.ToInt32(cataNameComboBox.Text); db.PositionID = Convert.ToInt32(positionNameComboBox.Text); db.CityID = Convert.ToInt32(cityNameComboBox.Text); db.SalaryMin = Convert.ToInt32(salaryMinTextBox.Text); db.SalaryMax = Convert.ToInt32(salaryMaxTextBox.Text); db.PostDay = postDayDateTimePicker.Value; db.StartDay = startDayDateTimePicker.Value; db.EndDay = endDayDateTimePicker.Value; JobBUL.Delete(db); this.jobDataGridView.DataSource = JobBUL.getlist(); } catch { MessageBox.Show("Không thể xoá dữ liệu!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public static string Message(this Model.Job job) { DateTime dtnow = DateTime.Now; if (job.JobType == 1) { DateTime dt = Convert.ToDateTime(job.JobDate + " " + job.Time); if (!string.IsNullOrWhiteSpace(job.ExecTime)) { return("已执行"); } else if ((dtnow - dt).TotalSeconds > 0) { return("已过期"); } else { return("将在:" + dt.ToString() + "执行"); } } else { if (!string.IsNullOrWhiteSpace(job.Time)) { DateTime dt = Convert.ToDateTime(job.JobDate + " " + job.Time); dt = Convert.ToDateTime(job.Time); if (!string.IsNullOrWhiteSpace(job.ExecTime) && Convert.ToDateTime(job.ExecTime).Date == dtnow.Date) { return("已执行"); } else if ((dtnow - dt).TotalSeconds > 0) { return("已过期"); } else { return("每天执行一次,时间是:" + job.Time); } } else { var index = job.Space.Value / 1000 / 60 / 60 >= 1 ? 1 : 0; var space = index == 1 ? job.Space.Value / 1000 / 60 / 60 : job.Space.Value / 1000 / 60; var dt = Convert.ToDateTime(job.EndTime); if ((dtnow - dt).TotalSeconds > 0) { return("已过期"); } else { return(string.Format("在每天的{0}到{1},每隔{2}{3}执行一次", job.StartTime, job.EndTime, space, index == 1 ? "小时" : "分钟")); } } } }
public void AddJob(Job job) { UnitOfWork.JobsRepository.Insert(job); UnitOfWork.Save(); //IJobDetail jobDetail = JobBuilder.Create<SqlScheduledJob>() // .WithIdentity(job.JOB_NAME, job.JOB_GROUP) // .Build(); //jobDetail.JobDataMap.Put("JobId", job.JobId); //Scheduler.AddJob(jobDetail, false); }
public void AddJob(Job job, JobTrigger jobTrigger) { IJobDetail jobDetail = JobBuilder.Create<SqlScheduledJob>() .WithIdentity(job.JOB_NAME, job.JOB_GROUP) .Build(); jobDetail.JobDataMap.Put("TriggerId",job.JobId); DateTimeOffset runDate = DateBuilder.TodayAt(((DateTime)jobTrigger.StartExecutionDate).Hour, ((DateTime)jobTrigger.StartExecutionDate).Minute, ((DateTime)jobTrigger.StartExecutionDate).Second); ITrigger trigger = TriggerBuilder.Create() .StartAt(runDate) .Build(); Scheduler.ScheduleJob(jobDetail, trigger); }
protected void FillUI(Job job) { var sqlJob = (SqlJob)job; ltrlProcessType.Text = sqlJob.JobType.ToString(); lblProcessName.Text = "ID: " + job.JobId + " - Proceso: " + job.Name + " - Grupo: " + job.Group; lblDescription.Text = "Descripción: " + job.Description; lblComments.Text = "Comentarios: " + sqlJob.Comments; lblProcessOwner.Text = "Creado Por: " + job.CreatedBy; if (sqlJob.JobType == JobType.Automático) { divInputSchemaProcedure.Visible = false; if (sqlJob.AutomaticProcessTime.HasValue && sqlJob.Weekdays != 0) { lblAutomaticProcessTime.Text = "Hora Ejecución: " + sqlJob.AutomaticProcessTime.Value.ToString("HH:mm:ss"); } else lblAutomaticProcessTime.Text = "Hora Ejecución: --:-- --"; } else { divInputSchemaProcedure.Visible = true; divAutomaticProcessTime.Visible = false; } lblProcessType.Text = "Tipo de Proceso: " + sqlJob.JobType; lblServerName.Text = "Nombre Servidor: " + sqlJob.ServerName; lblDataBaseName.Text = "Nombre BD: " + sqlJob.DatabaseName; lblStoredProcedure.Text = "Stored de Ejecución: " + sqlJob.ExecProcedure; lblDataBaseUser.Text = "Usuario DB: " + sqlJob.UserName; lblInputXmlFixedParameters.Text = "Valores Fijos: " + sqlJob.InputXmlFixedParameters; if (sqlJob.JobType == JobType.Automático) divInputSchemaProcedure.Visible = false; else lblInputSchemaProcedure.Text = "Stored de Config: " + sqlJob.InputSchemaProcedure; Weekdays weekdays = new Weekdays(); weekdays.AllDays = Convert.ToByte(sqlJob.Weekdays); if (weekdays.AllDays == 0) lblWeekDays.Text = "Frecuencia: No Diaria"; else lblWeekDays.Text = "Frecuencia: " + Utils.UI.Helper.BuildPopulateDaysLegend(weekdays); }
public void BinData() { Model.Job job = new Model.Job(); JobSystem jobSystem = new JobSystem(); job = jobSystem.Get_SingJob(nID); if (job.ID == nID) { Title_2.Text = job.Title; Updatatime.Text = job.Updatatime.ToString(); Content.Text = job.Content; } else { Response.Write("<script>alert('数据不存在');history.back(1);</script>"); Response.End(); } }
public void AddQuartzJob(Job job, JobTrigger jobTrigger) { var jobDetail = JobBuilder.Create<SqlScheduledJob>() .WithIdentity(job.JobId.ToString(), jobTrigger.JobTriggerId.ToString()) .Build(); jobDetail.JobDataMap.Put("TriggerId", jobTrigger.JobTriggerId.ToString()); DateTimeOffset runDate = DateBuilder.TodayAt((jobTrigger.ScheduledStartExecutionDate).Hour, (jobTrigger.ScheduledStartExecutionDate).Minute, (jobTrigger.ScheduledStartExecutionDate).Second); ITrigger trigger = TriggerBuilder.Create() .WithIdentity(jobTrigger.JobTriggerId.ToString()) .ForJob(jobDetail) .StartAt(runDate) .Build(); if (Status() == SchedulerStatus.Apagado) throw new QuartzException("El servicio scheduler se encuentra apagado"); Scheduler.ScheduleJob(jobDetail, trigger); }
/// <summary> /// Si el job es de tipo Automático crea un trigger en CGControlPanel y en Quartz. Se ejecuta automáticamente. /// Si el job es de tipo manual se crea un trigger DESHABILITADO en CGControlPanel. Se ejecutará luego manualmente desde el menú contextual correspondiente -que disparará ExecuteManualJob-. /// </summary> /// <param name="job"></param> /// <param name="trigger"></param> public void AddTrigger(Job job, JobTrigger trigger) { // OJO: Si el trigger viene deshabilitado NO se lo debe agregar al Quartz, es el caso de agendamiento de un job manual job.Triggers.Add(trigger); trigger.Job = job; trigger.JobId = job.JobId; if (trigger.Validate()) { UnitOfWork.JobTriggerRepository.Insert(trigger); UnitOfWork.JobsRepository.Update(job); UnitOfWork.Save(); if (trigger.Enabled) { AddQuartzJob(job, trigger); } } else { Utils.Validation.Helper.BuildValidationErrors(trigger.ValidationErrors); } }
public void ExecuteManualJob(Job job, JobTrigger trigger) { }
public void UpdateJob(Job job) { UnitOfWork.JobsRepository.Update(job); UnitOfWork.Save(); }
static void Main(string[] args) { using (var context = new HrContext.HrContext()) { #region lazy eager explicit /* Lazy, Eager, Explicit cu lazy, proxy - true false //Lazy = true: var firstEmployee = context.Employees.First(); //Lazy = false: (incercati si cu proxy true si cu proxy false) var firstEmployee2 = context.Employees.Include(x => x.Department).Include(x => x.Job).First(); var dep = firstEmployee2.Department; // Explicit loading: (lazy = false) context.Entry(firstEmployee).Reference(s => s.Department).Load(); // Inverse property: - lazy true: var departament = context.Departments.First(x => x.DepartmentName == "Marketing"); var employees = departament.Employees.ToList(); foreach (var employee in employees) { Console.WriteLine(employee.FullName); } */ #endregion #region inverse property var departament2 = context.Departments.Include(x => x.Employees).FirstOrDefault(x => x.DepartmentName == "IT"); if (departament2 != null) { var employees2 = departament2.Employees.ToList(); foreach (var employee2 in employees2) { Console.WriteLine(employee2.FullName); } } #endregion #region Iquerable vs Ienumerable var jobs = context.Jobs; var jobsList = jobs.ToList(); #endregion #region insert, update, delete #region insert var newJob = new Job { JobTitle = "Mecanic", MaxSalary = 7, MinSalary = 1 }; context.Jobs.Add(newJob); context.SaveChanges(); var newJobList = new List<Job>(); newJobList.Add(newJob); newJobList.Add(new Job { JobTitle = "Paznic", MinSalary = 1, MaxSalary = 3 }); //var newJobList = new List<Job> //{ // newJob, // new Job // { // JobTitle = "Paznic", // MinSalary = 1, // MaxSalary = 3 // } //}; context.Jobs.AddRange(newJobList); context.SaveChanges(); #endregion #region update newJob.MaxSalary = (decimal)6.5; context.Jobs.AddOrUpdate(newJob); var mecanics = context.Jobs.Where(x => x.JobTitle == "Mecanic").ToList(); foreach (var m in mecanics) { m.MaxSalary = 6; context.Jobs.AddOrUpdate(m); } context.SaveChanges(); #endregion #region delete var anotherJob = context.Jobs.FirstOrDefault(x => x.Id == 20); context.Jobs.Remove(newJob); if (anotherJob != null) { context.Jobs.Remove(anotherJob); } var jobsToDeleteList = context.Jobs.Where(x => x.Id > 5).ToList(); context.Jobs.RemoveRange(jobsToDeleteList); context.SaveChanges(); #endregion #endregion Console.ReadKey(); var newManager = context.Employees.FirstOrDefault(x => x.FirstName == "Raluca" && x.LastName == "Ionescu"); if (newManager != null) { var newManagerId = new SqlParameter("@NewManagerId", newManager.Id); var employees = context.Database.SqlQuery<Employee>("exec [Hr].[ChangeManager] @NewManagerId", newManagerId) .ToList(); foreach (var employee in employees) { Console.WriteLine("Employee: {0} {1}", employee.FirstName, employee.LastName); } //foreach (var employee in context.Employees.ToList()) //{ // Console.WriteLine("Employee: {0} {1} {2}", employee.FirstName, employee.LastName, // employee.Manager != null ? employee.Manager.FullName : String.Empty); //} } Console.ReadKey(); } }
public void AddJob(Job job) { UnitOfWork.JobsRepository.Insert(job); UnitOfWork.Save(); }
public string GetInputFormSchema(Job job) { var inputSchema = Helper.GetInputFormSchema(job.InputSchemaProcedure); if (String.IsNullOrEmpty(inputSchema)) throw new Exception("No se pudo ejecutar el Stored Procedure:" + job.InputSchemaProcedure); return inputSchema; }
public string GetInputFormSchema(Job job) { return @"<?xml version=""1.0"" encoding=""iso-8859-1"" ?> <CDIALOGO> <CAMPO> <CCLAVE>CTITULO1</CCLAVE> <CTIPO>TITULO</CTIPO> <CNOMBRE>0111- PROCESOS DE CUENTAS BANCARIAS</CNOMBRE> <LTITULO>1</LTITULO> </CAMPO> <CAMPO> <CCLAVE>CSEPARADOR1</CCLAVE> <CTIPO>SEPARADOR</CTIPO> <CNOMBRE>Parametros del proceso</CNOMBRE> <LTITULO>1</LTITULO> </CAMPO> <CAMPO> <CCLAVE>CCOMENTARIO</CCLAVE> <CTIPO>TPTEXTO</CTIPO> <CNOMBRE>Comentarios</CNOMBRE> <NLARGOMIN>1</NLARGOMIN> <NLARGOMAX>255</NLARGOMAX> <LVACIO>1</LVACIO> <LMODIFICABLE>1</LMODIFICABLE> </CAMPO> <CAMPO> <CCLAVE>CPRODUCTO</CCLAVE> <CTIPO>TPRADIO</CTIPO> <CDEFAULT>CCORR</CDEFAULT> <CCONTROLASOC>CCONCEPTO</CCONTROLASOC> <CNOMBRE>Producto a procesar</CNOMBRE> <VALORES> <VALOR> <CCLAVE>TARJETA</CCLAVE> <CTEXTO>Tarjetas de credito</CTEXTO> </VALOR> <VALOR> <CCLAVE>CCORR</CCLAVE> <CTEXTO>Cuenta Corriente</CTEXTO> </VALOR> <VALOR> <CCLAVE>CAHORRO</CCLAVE> <CTEXTO>Caja de Ahorro</CTEXTO> </VALOR> </VALORES> </CAMPO> <CAMPO> <CCLAVE>CPRODUCTOCHECK</CCLAVE> <CTIPO>TPCHECK</CTIPO> <CNOMBRE>Productos a procesar</CNOMBRE> <VALORES> <VALOR> <CCLAVE>TARJETACHECK</CCLAVE> <CTEXTO>Tarjetas de credito</CTEXTO> </VALOR> <VALOR> <CCLAVE>CCORRCHECK</CCLAVE> <CTEXTO>Cuenta Corriente</CTEXTO> </VALOR> </VALORES> </CAMPO> <CAMPO> <CCLAVE>CCONCEPTO</CCLAVE> <CTIPO>TPCOMBO</CTIPO> <CNOMBRE>Concepto a procesar</CNOMBRE> <VALORES> <VALOR> <CCLAVEASOC>CAHORRO</CCLAVEASOC> <CCLAVE>INT CH</CCLAVE> <CTEXTO>Generar Intereses</CTEXTO> </VALOR> <VALOR> <CCLAVEASOC>CAHORRO</CCLAVEASOC> <CCLAVE>MULTA CH</CCLAVE> <CTEXTO>Generar Multas</CTEXTO> </VALOR> <VALOR> <CCLAVEASOC>CCORR</CCLAVEASOC> <CCLAVE>INT CC</CCLAVE> <CTEXTO>Generar Intereses</CTEXTO> </VALOR> <VALOR> <CCLAVEASOC>CCORR</CCLAVEASOC> <CCLAVE>MULTA CC</CCLAVE> <CTEXTO>Generar Multas</CTEXTO> </VALOR> <VALOR> <CCLAVEASOC>CCORR</CCLAVEASOC> <CCLAVE>SALDOS CC</CCLAVE> <CTEXTO>Recalcular Saldos</CTEXTO> </VALOR> <VALOR> <CCLAVEASOC>TARJETA</CCLAVEASOC> <CCLAVE>REDOND TJ</CCLAVE> <CTEXTO>Corregir redondeos</CTEXTO> </VALOR> <VALOR> <CCLAVEASOC>TARJETA</CCLAVEASOC> <CCLAVE>PAG TJ</CCLAVE> <CTEXTO>Pago Minimo</CTEXTO> </VALOR> </VALORES> </CAMPO> <CAMPO> <CCLAVE>NMONTOMINIMO</CCLAVE> <CTIPO>TPREAL</CTIPO> <CNOMBRE>Monto minimo de interes</CNOMBRE> <LVACIO>1</LVACIO> <LMODIFICABLE>1</LMODIFICABLE> <NMINIMO>10.59</NMINIMO> <NMAXIMO>4000.53</NMAXIMO> </CAMPO> <CAMPO> <CCLAVE>NPERIODOS</CCLAVE> <CTIPO>TPENTERO</CTIPO> <CNOMBRE>Periodos a Procesar</CNOMBRE> <NMINIMO>1</NMINIMO> <NMAXIMO>1000</NMAXIMO> <LVACIO>1</LVACIO> </CAMPO> <CAMPO> <CCLAVE>CSEPARADOR2</CCLAVE> <CTIPO>SEPARADOR</CTIPO> <CNOMBRE>Rango de Fechas</CNOMBRE> </CAMPO> <CAMPO> <CCLAVE>DFECHADESDE</CCLAVE> <CTIPO>TPFECHA</CTIPO> <CCONTROLASOC>DFECHAHASTA</CCONTROLASOC> <CNOMBRE>Fecha Desde</CNOMBRE> <LVACIO>0</LVACIO> <DMINDATE>2012/01/01</DMINDATE> <DMAXDATE>2013/12/24</DMAXDATE> </CAMPO> <CAMPO> <CCLAVE>DFECHAHASTA</CCLAVE> <CTIPO>TPFECHA</CTIPO> <CNOMBRE>Fecha Hasta</CNOMBRE> <LVACIO>0</LVACIO> <DMINDATE>2012/01/01</DMINDATE> <DMAXDATE>2012/06/30</DMAXDATE> </CAMPO> <CAMPO> <CCLAVE>HORA</CCLAVE> <CTIPO>TPHORA</CTIPO> <CNOMBRE>Hora</CNOMBRE> <LVACIO>0</LVACIO> <HMINIMO>09:00:00</HMINIMO> <HMAXIMO>18:00:00</HMAXIMO> </CAMPO> </CDIALOGO>"; }
public void AddJob(Job job) { }
public void AddTrigger(Job job, JobTrigger trigger) { }
public void AddQuartzJob(Job job, JobTrigger trigger) { }
// Borrar los triggers de Quartz y del sistema (baja lógica) public void DeleteJob(Job job) { foreach (var trigger in job.Triggers) { trigger.DeletedBy = job.DeletedBy; DeleteTrigger(trigger); } job.Deleted = true; job.DeletedDate = DateTime.Now; //job.DeletedBy = "PENDIENTE"; if (job.Validate()) { UnitOfWork.JobsRepository.Update(job); UnitOfWork.Save(); } }
public void AddJob(Job job, JobTrigger trigger) { throw new NotImplementedException(); }
public void UpdateJob(Job job) { }
public void DeleteJob(Job job) { }
// TODO: Testear public string GetInputFormSchema(Job job) { var dbReader = Helper.ExecuteReader(ConfigurationManager.AppSettings["CGControlPanelContext"], job.InputSchemaProcedure); if (dbReader.HasRows) { return dbReader[0].ToString(); } throw new Exception("No se pudo ejecutar el Stored Procedure:" + job.InputSchemaProcedure); }
public void UpdateJob(Job job) { throw new NotImplementedException(); }
/// <summary> /// Utilizado para proceso manual que no ha sido agendado previamente, se crea el trigger en CGControlPanel y en Quartz. /// </summary> /// <param name="job">Job Manual</param> /// <param name="trigger"></param> public void ExecuteManualJob(Job job, JobTrigger trigger) { trigger.ScheduledStartExecutionDate = DateTime.Now; job.Triggers.Add(trigger); UnitOfWork.JobsRepository.Update(job); UnitOfWork.Save(); AddQuartzJob(job, trigger); }