public SampleJobResponses GetSampleJob(SampleJobCondition request) { SampleJobResponses response = new SampleJobResponses(); try { response = new DaoSampleStorage().GetSampleJob(request); } catch (Exception ex) { LogError(ex); } return(response); }
public SampleJobResponses GetSampleJob(SampleJobCondition WhereJob) { SampleJobResponses Sample = new SampleJobResponses(); using (SqlConnection conn = new SqlConnection(connStr)) { try { SqlCommand cmd = new SqlCommand("pro_wms_SampleJobSelect", conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@BeginTime", WhereJob.BeginTime); cmd.Parameters[0].SqlDbType = SqlDbType.VarChar; cmd.Parameters[0].Size = 100; cmd.Parameters.AddWithValue("@EndTime", WhereJob.EndTime); cmd.Parameters[1].SqlDbType = SqlDbType.VarChar; cmd.Parameters[1].Size = 100; cmd.Parameters.AddWithValue("@PageIndex", WhereJob.PageIndex); cmd.Parameters[2].SqlDbType = SqlDbType.Int; cmd.Parameters.AddWithValue("@PageSize", WhereJob.PageSize); cmd.Parameters[3].SqlDbType = SqlDbType.Int; cmd.Parameters.AddWithValue("@RowCount", 0); cmd.Parameters[4].Direction = ParameterDirection.Output; cmd.Parameters[4].SqlDbType = SqlDbType.Int; conn.Open(); SqlDataAdapter sda = new SqlDataAdapter(); sda.SelectCommand = cmd; sda.Fill(ds); Sample.RowCount = (int)cmd.Parameters[4].Value; Sample.SampleJob = ds.ConvertToEntityCollection <SampleJobSelect>(); conn.Close(); } catch (Exception) { throw; } } return(Sample); }