コード例 #1
0
 public static void isType(string abc)
 {
     try
     {
         Backend.Type tmp = (Backend.Type)Enum.Parse(typeof(Backend.Type), abc);
     }
     catch (ArgumentException)
     {
         throw new Exception("The Type of Produce doesnt exist.");
     }
 }
コード例 #2
0
ファイル: InputCheck.cs プロジェクト: Landy-man/Intro
 public static void isType(string abc)
 {
     if (abc != "Electronics" && abc != "Food" && abc != "Fashion" && abc != "HomeAndGarden")
     {
         try
         {
             Backend.Type tmp = (Backend.Type)Enum.Parse(typeof(Backend.Type), abc);
         }
         catch (ArgumentException)
         {
             throw new Exception("The Type of Produce doesnt exist.at all");
         }
     }
 }
コード例 #3
0
        //returns a list of products where type = type1
        internal List <Product> productTypeQuery(Backend.Type type1, List <Product> listP = null)
        {
            if (listP == null)
            {
                listP = products;
            }

            var type =
                from p in listP
                where p.Type == type1
                orderby p.SoldLastMonth descending
                select p;

            return(type.ToList <Product>());
        }