public Boolean addNewItemCat(itemCategory itemCat) { CatagoryDataAccess cda1 = new CatagoryDataAccess(); int insertResult = cda1.insertCatagory(itemCat); if (insertResult.Equals(1)) return true; else return false; }
public products(int productID, String productCode, String productName, String productMake, String productModel, String productDescription, decimal productPrice, itemCategory productCateogery) { this.productID = productID; this.productCode = productCode; this.productName = productName; this.productMake = productMake; this.productModel = productModel; this.productDescription = productDescription; this.productPrice = productPrice; this.productCateogery = productCateogery; }
public products(int productID, String productCode, String productName, String productMake, String productModel, String productDescription, decimal productPrice, itemCategory productCateogery, int quantity) { this.productID = productID; this.productCode = productCode; this.productName = productName; this.productMake = productMake; this.productModel = productModel; this.productDescription = productDescription; this.productPrice = productPrice; this.productCateogery = productCateogery; this.quantity = quantity; }
public int insertCatagory(itemCategory tempCat) { int result = 1; try { using (SqlConnection con = new SqlConnection(conString)) { con.Open(); SqlCommand cmd = new SqlCommand("InsertCatagory", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@prod_Cat_Id", tempCat.ItemCatID); cmd.Parameters.AddWithValue("@prod_Cat_Name", tempCat.ItemCategoryName); cmd.Parameters.AddWithValue("@prod_Cat_Description", tempCat.ItemCategoryDesc); result = (Int32)cmd.ExecuteScalar(); con.Close(); } } catch (Exception e) { result = 0; } return result; }
private void categoryDataBindings() { stockDataManipulations stockDataManipulation = new stockDataManipulations(); List<itemCategory> categories = stockDataManipulation.getAllCategories(); Dictionary<itemCategory, string> productCategory = new Dictionary<itemCategory, string>(); itemCategory defCategory = new itemCategory(-1, "Default", null); productCategory.Add(defCategory, defCategory.ItemCategoryName); foreach (itemCategory category in categories) { productCategory.Add(category, category.ItemCategoryName); } combProCat.DataSource = new BindingSource(productCategory, null); combProCat.DisplayMember = "Value"; combProCat.ValueMember = "Key"; }