public static string insertProductType(string name, string description)
        {
            if (name.Length < 5)
            {
                return("Name must at least 5 characters!");
            }
            else if (description.Length <= 0)
            {
                return("Description must not be empty!");
            }
            else if (!ProductTypeHandler.validateProductTypeName(name))
            {
                return("These product type name has already taken!");
            }

            try
            {
                ProductTypeHandler.addProductType(name, description);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                return("Database update on server failure, please try again!");
            }
            return("");
        }
예제 #2
0
 public static void addProductType(String name, String desc)
 {
     ProductTypeHandler.addProductType(name, desc);
 }