public SampleThelibraryResponses GetSampleThelibrary(SampleThelibraryCondition request) { SampleThelibraryResponses response = new SampleThelibraryResponses(); try { response = new DaoSampleStorage().GetThelibrary(request); } catch (Exception ex) { LogError(ex); } return(response); }
public SampleThelibraryResponses GetThelibrary(SampleThelibraryCondition WhereThelibrary) { SampleThelibraryResponses Sample = new SampleThelibraryResponses(); using (SqlConnection conn = new SqlConnection(connStr)) { try { SqlCommand cmd = new SqlCommand("pro_wms_SampleThelibrarySelect", conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Category", WhereThelibrary.Category); cmd.Parameters[0].SqlDbType = SqlDbType.VarChar; cmd.Parameters[0].Size = 100; cmd.Parameters.AddWithValue("@SKU", WhereThelibrary.SKU); cmd.Parameters[1].SqlDbType = SqlDbType.VarChar; cmd.Parameters[1].Size = 4000; cmd.Parameters.AddWithValue("@PE", WhereThelibrary.PE); cmd.Parameters[2].SqlDbType = SqlDbType.VarChar; cmd.Parameters[2].Size = 100; cmd.Parameters.AddWithValue("@Requester", WhereThelibrary.Requester); cmd.Parameters[3].SqlDbType = SqlDbType.VarChar; cmd.Parameters[3].Size = 4000; cmd.Parameters.AddWithValue("@OrderBeginTime", WhereThelibrary.OrderBeginTime); cmd.Parameters[4].SqlDbType = SqlDbType.VarChar; cmd.Parameters[4].Size = 100; cmd.Parameters.AddWithValue("@OrderEndTime", WhereThelibrary.OrderEndTime); cmd.Parameters[5].SqlDbType = SqlDbType.VarChar; cmd.Parameters[5].Size = 100; cmd.Parameters.AddWithValue("@DeliverBeginTime", WhereThelibrary.DeliverBeginTime); cmd.Parameters[6].SqlDbType = SqlDbType.VarChar; cmd.Parameters[6].Size = 100; cmd.Parameters.AddWithValue("@DeliverEndTime", WhereThelibrary.DeliverEndTime); cmd.Parameters[7].SqlDbType = SqlDbType.VarChar; cmd.Parameters[7].Size = 100; cmd.Parameters.AddWithValue("@Type", WhereThelibrary.Type); cmd.Parameters[8].SqlDbType = SqlDbType.VarChar; cmd.Parameters[8].Size = 10; cmd.Parameters.AddWithValue("@PageIndex", WhereThelibrary.PageIndex); cmd.Parameters[9].SqlDbType = SqlDbType.Int; cmd.Parameters.AddWithValue("@PageSize", WhereThelibrary.PageSize); cmd.Parameters[10].SqlDbType = SqlDbType.Int; cmd.Parameters.AddWithValue("@RowCount", 0); cmd.Parameters[11].Direction = ParameterDirection.Output; cmd.Parameters[11].SqlDbType = SqlDbType.Int; conn.Open(); SqlDataAdapter sda = new SqlDataAdapter(); sda.SelectCommand = cmd; sda.Fill(ds); //Type=0才分页 if (WhereThelibrary.Type == "0") { Sample.RowCount = (int)cmd.Parameters[11].Value; } Sample.SampleTb = ds.ConvertToEntityCollection <SampleThelibrarySelect>(); conn.Close(); } catch (Exception) { throw; } } return(Sample); }