public List <JobAssignment> GetJobAssignmentDetailsAsync(int ID, int jobId) { try { SqlDataReader reader = null; if (myconn.State != ConnectionState.Open) { myconn.Open(); } SqlCommand sqlCmd = new SqlCommand(); sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.CommandText = "SP_JobAssignmentGet"; sqlCmd.Parameters.Add(new SqlParameter("@ID", ID)); sqlCmd.Parameters.Add(new SqlParameter("@jobId", jobId)); sqlCmd.Connection = myconn; reader = sqlCmd.ExecuteReader(); List <JobAssignment> lst = new List <JobAssignment>(); while (reader.Read()) { lst.Add(new JobAssignment() { Id = Convert.ToInt32(reader.GetValue(0)), jobID = Convert.ToInt32(reader.GetValue(1)), teamID = Convert.ToInt32(reader.GetValue(2)), teamName = reader.GetValue(3).ToString(), subcontractorID = Convert.ToInt32(reader.GetValue(4)), subConName = reader.GetValue(5).ToString(), jobAssignDate = Convert.ToDateTime(reader.GetValue(6)), startTime = Convert.ToDateTime(reader.GetValue(7)), endTime = Convert.ToDateTime(reader.GetValue(8)), notes = reader.GetValue(9).ToString(), createdDate = Convert.ToDateTime(reader.GetValue(10)), modifiedDate = reader.GetValue(11) == DBNull.Value ? (DateTime?)null : Convert.ToDateTime(reader.GetValue(11)), userId = Convert.ToInt32(reader.GetValue(12)) }); } if (myconn.State != ConnectionState.Closed) { myconn.Close(); } return(lst); } catch (Exception ex) { gs.LogData(ex); throw ex; } }
public List <JobBOQVariation> GetJobBOQVariationDetailsAsync(int ID, int jobId) { try { SqlDataReader reader = null; if (myconn.State != ConnectionState.Open) { myconn.Open(); } SqlCommand sqlCmd = new SqlCommand(); sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.CommandText = "SP_JobBOQVariationGet"; sqlCmd.Parameters.Add(new SqlParameter("@ID", ID)); sqlCmd.Parameters.Add(new SqlParameter("@jobId", jobId)); sqlCmd.Connection = myconn; reader = sqlCmd.ExecuteReader(); List <JobBOQVariation> lst = new List <JobBOQVariation>(); while (reader.Read()) { lst.Add(new JobBOQVariation() { Id = Convert.ToInt32(reader.GetValue(0)), jobID = Convert.ToInt32(reader.GetValue(1)), jobRatesId = Convert.ToInt32(reader.GetValue(2)), SORCode = reader.GetValue(3).ToString(), BOQQuantity = Convert.ToDecimal(reader.GetValue(4)), createdDate = Convert.ToDateTime(reader.GetValue(5)), modifiedDate = reader.GetValue(6) == DBNull.Value ? (DateTime?)null : Convert.ToDateTime(reader.GetValue(6)), userId = Convert.ToInt32(reader.GetValue(7)) }); } if (myconn.State != ConnectionState.Closed) { myconn.Close(); } return(lst); } catch (Exception ex) { gs.LogData(ex); throw ex; } }
public List <JobStatus> GetJobStatusDetailsAsync(int Id) { try { SqlDataReader reader = null; if (myconn.State != ConnectionState.Open) { myconn.Open(); } SqlCommand sqlCmd = new SqlCommand(); sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.CommandText = "SP_JobStatusGet"; sqlCmd.Parameters.Add(new SqlParameter("@Id", Id)); sqlCmd.Connection = myconn; reader = sqlCmd.ExecuteReader(); List <JobStatus> lst = new List <JobStatus>(); while (reader.Read()) { lst.Add(new JobStatus() { ID = Convert.ToInt32(reader.GetValue(0)), name = reader.GetValue(1).ToString(), createdDate = Convert.ToDateTime(reader.GetValue(2)), modifiedDate = reader.GetValue(3) == DBNull.Value ? (DateTime?)null : Convert.ToDateTime(reader.GetValue(3)), userId = Convert.ToInt32(reader.GetValue(4)) }); } if (myconn.State != ConnectionState.Closed) { myconn.Close(); } return(lst); } catch (Exception ex) { gs.LogData(ex); throw ex; } }