public List <Resource> GetResourceList() { List <Resource> resourcelist = null; using (DataTable table = SqlDBHelper.ExecuteSelectCommand("[Resource_Control].[sp_ResourceSelectAll]", CommandType.StoredProcedure)) { if (table.Rows.Count > 0) { resourcelist = new List <Resource>(); foreach (DataRow row in table.Rows) { Resource resource = new Resource(); resource.ID = Convert.ToInt32(row["ID"]); resource.Name = row["name"] as string; resource.Location = row["location_name"] as string; resource.Description = row["description"] as string; resource.CategoryName = row["category"] as string; resource.CategoryID = Convert.ToInt32(row["categoryID"]); resource.Capacity = Convert.ToInt32(row["capacity"]); resourcelist.Add(resource); } } } return(resourcelist); }
public List <Location> GetAllLocation() { List <Location> loclist = null; using (DataTable table = SqlDBHelper.ExecuteSelectCommand("[Resource_Control].[sp_LocationsSelectAll]", CommandType.StoredProcedure)) { if (table.Rows.Count > 0) { loclist = new List <Location>(); foreach (DataRow row in table.Rows) { Location loc = new Location(); loc.Id = Convert.ToInt32(row["Id"]); loc.Name = row["name"] as string; loc.Address = row["address"] as string; loclist.Add(loc); } } } return(loclist); }
//public Option GetOptionDetails(int optID) //{ // Option option = null; // SqlParameter[] parameters = new SqlParameter[] // { // new SqlParameter("@ID", optID) // }; // using (DataTable table = SqlDBHelper.ExecuteParamerizedSelectCommand("sp_OptionSelect", CommandType.StoredProcedure, parameters)) // { // if (table.Rows.Count == 1) // { // DataRow row = table.Rows[0]; // option = new Option(); // option.ID = Convert.ToInt32(row["ID"]); // option.Name = row["name"] as string; // } // } // return option; //} public List <Option> GetOptionList() { List <Option> optionlist = null; using (DataTable table = SqlDBHelper.ExecuteSelectCommand("[Resource_Control].[sp_OptionsSelectAll]", CommandType.StoredProcedure)) { if (table.Rows.Count > 0) { optionlist = new List <Option>(); foreach (DataRow row in table.Rows) { Option option = new Option(); option.ID = Convert.ToInt32(row["ID"]); option.Name = row["name"] as string; optionlist.Add(option); } } } return(optionlist); }
public List <Category> GetCategoryList() { List <Category> categorylist = null; using (DataTable table = SqlDBHelper.ExecuteSelectCommand("[Resource_Control].[sp_CategorySelectAll]", CommandType.StoredProcedure)) { if (table.Rows.Count > 0) { categorylist = new List <Category>(); foreach (DataRow row in table.Rows) { Category category = new Category(); category.ID = Convert.ToInt32(row["ID"]); category.Name = row["name"] as string; category.Description = row["description"] as string; categorylist.Add(category); } } } return(categorylist); }