public DataTable postAllData(PurchaseReportInventory purchaseReportInventory) { SqlCommand command = new SqlCommand(); SqlConnection conn = new SqlConnection(strConn); // string sql = BuildQuery(purchaseReportInventory.sellerId, purchaseReportInventory.subcategoryId, purchaseReportInventory.brandId, purchaseReportInventory.productId, purchaseReportInventory.startDate, purchaseReportInventory.endDate); conn.Open(); command.Connection = conn; command.CommandType = CommandType.StoredProcedure; command.CommandText = "Mst_PurchaseReport_Product_Wise_DATA"; command.Parameters.AddWithValue("@SellerId", purchaseReportInventory.sellerId); command.Parameters.AddWithValue("@SubCategoryId", purchaseReportInventory.subcategoryId); command.Parameters.AddWithValue("@BrandId", purchaseReportInventory.brandId); command.Parameters.AddWithValue("@ProductId", purchaseReportInventory.productId); command.Parameters.AddWithValue("@OrderDate", purchaseReportInventory.startDate); command.Parameters.AddWithValue("@DeliveryDate", purchaseReportInventory.endDate); command.Parameters.AddWithValue("@CategoryId", purchaseReportInventory.categoryId); SqlDataAdapter adapter = new SqlDataAdapter(command); DataSet fileData = new DataSet(); adapter.Fill(fileData, "fileData"); conn.Close(); DataTable firstTable = fileData.Tables[0]; return(firstTable); }
public DataTable postAllData(PurchaseReportInventory purchaseReportInventory) { SqlCommand command = new SqlCommand(); SqlConnection conn = new SqlConnection(strConn); string sql = BuildQuery(purchaseReportInventory.sellerId, purchaseReportInventory.subcategoryId, purchaseReportInventory.brandId, purchaseReportInventory.productId, purchaseReportInventory.startDate, purchaseReportInventory.endDate); command.Connection = conn; command.CommandType = CommandType.Text; command.CommandText = sql; SqlDataAdapter adapter = new SqlDataAdapter(command); conn.Open(); DataSet fileData = new DataSet(); adapter.Fill(fileData, "fileData"); conn.Close(); DataTable firstTable = fileData.Tables[0]; return(firstTable); }