Advertisement
Advertisement
| 04.20.2008 at 08:11AM PDT, ID: 23337760 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
|
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: |
using System;
using System.Data;
using System.Data.Common;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
/// <summary>
/// Product Catalog Business Tier Component
/// </summary>
public struct ProductDetails
{
public string Name;
public string Description;
public decimal Price;
public string Image1URL;
public string Image2URL;
public bool OnDepatmentPromotion;
public bool OnCatalogPromotion;
}
public static class CatalogAccess
{
// Get category details
public static CategoryDetails GetCategoryDetails(string categoryID)
{
// get a configured DbCommand object
DbCommand comm = GenericDataAccess.CreateCommand();
// set the stored procedure name
comm.CommandText = "GetCategoryDetails";
// create a new parameter
DbParameter param = comm.CreateParameter();
param.ParameterName = "@CategoryID";
param.Value = categoryID;
param.DbType = DbType.Int32;
comm.Parameters.Add(param);
// execute the stored procedure
DataTable table = GenericDataAccess.ExecuteSelectCommand(comm);
// wrap retrieved data into a CategoryDetails object
CategoryDetails details = new CategoryDetails();
if (table.Rows.Count > 0)
{
details.DepartmentID = Int32.Parse(table.Rows[0]["DepartmentID"].ToString());
details.Name = table.Rows[0]["Name"].ToString(); //STRING TO INT ERROR HERE
details.Description = table.Rows[0]["Description"].ToString(); //STRING TO INT ERROR HERE
}
// return department details
return details;
//retrieve the list of categories in a departmemt
public static ProductDetails GetCategoriesInDepartment(string departmentID)
{
// get a configured DbCommand object
DbCommand comm = GenericDataAccess.CreateCommand();
// set the stored pocedure name
comm.CommandText = "GetCategoriesInDepartment";
// create a new parameter
DbParameter param = comm.CreateParameter();
param.ParameterName = "@DepartmentID";
param.Value = departmentID;
param.DbType = DbType.Int32;
comm.Parameters.Add(param);
//execute the stored procedure
return GenericDataAccess.ExecuteSelectCommand(comm);//SYSTEM.DATA.DATATABLE ERROR IS HERE.
}
}
}
|