public IMSClasses.Jobs.Task CreateTask(IMSClasses.Jobs.Task oNewTask) { IMSClasses.Jobs.Task oResponse = oNewTask; if (this.ConnectionStart()) { SqlCommand oCmd = new SqlCommand("Task_Create", this.oConnection); oCmd.CommandType = CommandType.StoredProcedure; String FinalStatus = "", Comments = ""; if (oNewTask.StatusFinal != null) FinalStatus = oNewTask.StatusFinal; if (oNewTask.TaskComments != null) Comments = oNewTask.TaskComments; oCmd.Parameters.AddWithValue("@Json", oNewTask.Serialize()); oCmd.Parameters.AddWithValue("@JobID", oNewTask.oJob.JOBID); oCmd.Parameters.AddWithValue("@CreateDate", oNewTask.CreateDate); oCmd.Parameters.AddWithValue("@CurrentStatus", oNewTask.StatusCurrent); oCmd.Parameters.AddWithValue("@Message", Comments); SqlParameter pTaskID = oCmd.Parameters.Add("@TaskID", SqlDbType.BigInt); pTaskID.Direction = ParameterDirection.Output; try { oCmd.ExecuteNonQuery(); oResponse.TaskID = Int64.Parse(oCmd.Parameters["@TaskID"].Value.ToString()); } catch { //error creando tarea oResponse.TaskID = -1; } this.ConectionClose(); } return oResponse; }
public bool updateTask(IMSClasses.Jobs.Task oTask) { if (this.ConnectionStart()) { SqlCommand oCmd = new SqlCommand("Task_Update", this.oConnection); oCmd.CommandType = CommandType.StoredProcedure; String FinalStatus = "", Comments = ""; if (oTask.StatusFinal != null) FinalStatus = oTask.StatusFinal; if (oTask.TaskComments != null) Comments = oTask.TaskComments; oCmd.Parameters.AddWithValue("@Json", oTask.Serialize()); oCmd.Parameters.AddWithValue("@TaskID", oTask.TaskID); oCmd.Parameters.AddWithValue("@EndStatus", FinalStatus); oCmd.Parameters.AddWithValue("@CurrentStatus", oTask.StatusCurrent); oCmd.Parameters.AddWithValue("@Message", Comments); oCmd.ExecuteNonQuery(); this.ConectionClose(); } return true; }
public bool updateJob(IMSClasses.Jobs.Job oJob) { if (this.ConnectionStart()) { SqlCommand oCmd = new SqlCommand("Job_Update", this.oConnection); oCmd.CommandType = CommandType.StoredProcedure; oCmd.Parameters.AddWithValue("@Json", oJob.Serialize()); oCmd.Parameters.AddWithValue("@JobID", oJob.JOBID); oCmd.ExecuteNonQuery(); this.ConectionClose(); } return true; }