Esempio n. 1
0
        public static bool validateInsert(string name, string desc, out string errorMsg)
        {
            errorMsg = "";
            ProductType pt = InsertProductTypeHandler.searchByName(name);

            if (name == "" || desc == "")
            {
                errorMsg = "Cannot be empty";
                return(false);
            }
            else if (pt == null && name.Length >= 5)
            {
                InsertProductTypeHandler.insertPT(name, desc);
                errorMsg = "Success";
                return(true);
            }
            else
            {
                if (name.Length < 5)
                {
                    errorMsg = "Product Type must consist of 5 characters or more!";
                    return(false);
                }
                else
                {
                    errorMsg = "Product Type Name already exists!";
                    return(false);
                }
            }
        }
Esempio n. 2
0
        public static Response DoInsertProductType(Int64 ID, String Name, String Description)
        {
            if (Name == "")
            {
                return(new Response(false, "Product Type Name Cannot Be Empty"));
            }
            if (Name.Length < 5)
            {
                return(new Response(false, "Product Type Name Consists of 5 Characters or More"));
            }
            if (Description == "")
            {
                return(new Response(false, "Product Type Description Cannot Be Empty"));
            }
            Response response = InsertProductTypeHandler.DoInsertProductType(ID, Name, Description);

            return(response);
        }
 public static Boolean ProductTypeValidation(string name, string desc, out string errorMessage)
 {
     errorMessage = "";
     if (name == String.Empty || desc == String.Empty)
     {
         errorMessage = "No data can empty";
         return(false);
     }
     else if (name.Length < 5)
     {
         errorMessage = "Name must be more than 5 characters";
         return(false);
     }
     else if (InsertProductTypeHandler.CheckProductTypeHandler(name) > 0)
     {
         errorMessage = "Already have the product name";
         return(false);
     }
     return(true);
 }
Esempio n. 4
0
        public static int CountData()
        {
            int ID = InsertProductTypeHandler.CountData();

            return(ID);
        }
 public static void InsertNewProductTypeController(string name, string desc)
 {
     InsertProductTypeHandler.InsertNewProductTypeHandler(name, desc);
 }