public string AddNewProduct(string data) { string result = ""; try { Products product = new Products(); product.ProductName = data.Split(';')[0].ToString(); product.SupplierID = Convert.ToInt32(data.Split(';')[1].ToString()); product.CategoryID = Convert.ToInt32(data.Split(';')[2].ToString()); product.QuantityPerUnit = data.Split(';')[3].ToString(); product.UnitPrice = Convert.ToDecimal(data.Split(';')[4].ToString()); product.UnitsInStock = Convert.ToInt16(data.Split(';')[5].ToString()); product.UnitsOnOrder = Convert.ToInt16(data.Split(';')[6].ToString()); product.ReorderLevel = Convert.ToInt16(data.Split(';')[7].ToString()); if (data.Split(';')[8].ToString() == "1") { product.Discontinued = true; } else if (data.Split(';')[8].ToString() == "0") { product.Discontinued = false; } ProductOperation productOperation = new ProductOperation(); result = productOperation.InsertProduct(product); } catch (Exception) { result = "An error occurred during this operation."; } return(result); }