Exemplo n.º 1
0
 /// <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;
 }
Exemplo n.º 2
0
 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;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the vwJobsToExecutes EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTovwJobsToExecutes(vwJobsToExecute vwJobsToExecute)
 {
     base.AddObject("vwJobsToExecutes", vwJobsToExecute);
 }
Exemplo n.º 4
0
        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;
                }
            }
        }