/// <summary> /// Create a new vwJobsToExecute object. /// </summary> /// <param name="jobId">Initial value of the JobId property.</param> /// <param name="sqlToExecute">Initial value of the SqlToExecute property.</param> public static vwJobsToExecute CreatevwJobsToExecute(global::System.Int32 jobId, global::System.String sqlToExecute) { vwJobsToExecute vwJobsToExecute = new vwJobsToExecute(); vwJobsToExecute.JobId = jobId; vwJobsToExecute.SqlToExecute = sqlToExecute; return vwJobsToExecute; }
private Guid? StartJob(vwJobsToExecute job) { Guid? retValue = null; using (Entities ctx = new Entities()) { var activityIdParam = new ObjectParameter("ActivityId", typeof(Guid?)); ctx.StartJob(job.JobId, activityIdParam); if (activityIdParam.Value != null && activityIdParam.Value.GetType() != typeof(System.DBNull)) { retValue = (Guid)activityIdParam.Value; } } return retValue; }
/// <summary> /// Deprecated Method for adding a new object to the vwJobsToExecutes EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddTovwJobsToExecutes(vwJobsToExecute vwJobsToExecute) { base.AddObject("vwJobsToExecutes", vwJobsToExecute); }
private void ExecuteJob(vwJobsToExecute job) { string connString = (string.IsNullOrEmpty(job.ConnectionStringToUse)) ? DefaultConnectionString() : job.ConnectionStringToUse; using (var con = new SqlConnection(connString)) { try { con.Open(); using (var cmd = con.CreateCommand()) { cmd.CommandText = job.SqlToExecute; cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.ExecuteNonQuery(); } } catch (SqlException) { Trace.TraceError("SqlException"); throw; } } }