public List <ProductSpecification> GetAllProductSpecification(ProductSpecificationAdvanceSearch productSpecificationAdvanceSearch) { List <ProductSpecification> productSpecificationList = null; try { using (SqlConnection con = _databaseFactory.GetDBConnection()) { using (SqlCommand cmd = new SqlCommand()) { if (con.State == ConnectionState.Closed) { con.Open(); } cmd.Connection = con; cmd.CommandText = "[PSA].[GetAllProductSpecification]"; cmd.Parameters.Add("@SearchValue", SqlDbType.NVarChar, -1).Value = string.IsNullOrEmpty(productSpecificationAdvanceSearch.SearchTerm) ? "" : productSpecificationAdvanceSearch.SearchTerm; cmd.Parameters.Add("@RowStart", SqlDbType.Int).Value = productSpecificationAdvanceSearch.DataTablePaging.Start; if (productSpecificationAdvanceSearch.DataTablePaging.Length == -1) { cmd.Parameters.AddWithValue("@Length", DBNull.Value); } else { cmd.Parameters.Add("@Length", SqlDbType.Int).Value = productSpecificationAdvanceSearch.DataTablePaging.Length; } cmd.CommandType = CommandType.StoredProcedure; using (SqlDataReader sdr = cmd.ExecuteReader()) { if ((sdr != null) && (sdr.HasRows)) { productSpecificationList = new List <ProductSpecification>(); while (sdr.Read()) { ProductSpecification productSpecification = new ProductSpecification(); { productSpecification.Code = (sdr["Code"].ToString() != "" ? int.Parse(sdr["Code"].ToString()) : productSpecification.Code); productSpecification.Description = (sdr["Description"].ToString() != "" ? sdr["Description"].ToString() : productSpecification.Description); productSpecification.PSASysCommon = new PSASysCommon(); productSpecification.PSASysCommon.CreatedDateString = (sdr["CreatedDate"].ToString() != "" ? DateTime.Parse(sdr["CreatedDate"].ToString()).ToString(settings.DateFormat) : productSpecification.PSASysCommon.CreatedDateString); productSpecification.TotalCount = (sdr["TotalCount"].ToString() != "" ? int.Parse(sdr["TotalCount"].ToString()) : productSpecification.TotalCount); productSpecification.FilteredCount = (sdr["FilteredCount"].ToString() != "" ? int.Parse(sdr["FilteredCount"].ToString()) : productSpecification.FilteredCount); } productSpecificationList.Add(productSpecification); } } } } } } catch (Exception ex) { throw ex; } return(productSpecificationList); }
public List <ProductSpecification> GetAllProductSpecification(ProductSpecificationAdvanceSearch productSpecificationAdvanceSearch) { return(_productSpecificationRepository.GetAllProductSpecification(productSpecificationAdvanceSearch)); }