コード例 #1
0
        public static Items creatItems()
        {
            Items item = new Items();

            Console.WriteLine("Input the itemCode");//nhập mã mặt hàng
            int temp1 = Convert.ToInt32(Console.ReadLine());

            item.itemCode = temp1;
            Console.WriteLine("Input the nameItems");// nhập tên mặt hàng
            string temp2 = Console.ReadLine();

            item.nameItem = temp2;
            Console.WriteLine("Input the dataexpiryDate mm/dd/yyyy"); //nhập hạn sử dụng mặt hàng
            DateTime temp3 = Convert.ToDateTime(Console.ReadLine());

            item.dataexpiryDate = temp3;
            Console.WriteLine("Input the companyProduct"); //Công ty sản xuất
            string temp4 = Console.ReadLine();

            item.companyProduct = temp4;
            Console.WriteLine("Input the Year Of Product"); //Năm sản xuất
            temp1 = Convert.ToInt32(Console.ReadLine());
            item.yearOfProduction = temp1;
            Console.WriteLine("Input the typeOfProduct");// loại hàng
            typeProducts tempN = new typeProducts();

            tempN.typeProduct  = Console.ReadLine();
            item.typeOfProduct = tempN.typeProduct;
            return(item);
        }
コード例 #2
0
        public static typeProducts creatType()
        {
            typeProducts types = new typeProducts();

            Console.WriteLine("Input the Typpe of Code");
            int temp1 = Convert.ToInt32(Console.ReadLine());

            types.code = temp1;
            Console.WriteLine("Input the Type of Name");
            string temp2 = Console.ReadLine();

            types.typeProduct = temp2;
            return(types);
        }
コード例 #3
0
        public static void resolvetype(string select, ref List <typeProducts> typeData)
        {
            switch (select[1])
            {
            case '1':
                Console.WriteLine("A\t\tD\t\tD\t\t");
                typeProducts add    = creatType();
                typeProducts index3 = typeData.Find(x => x.code == add.code);
                if (typeData.IndexOf(index3) == -1)
                {
                    typeData.Add(add);
                }
                else
                {
                    Console.WriteLine("Item code is exist");
                }
                break;

            case '2':
                Console.WriteLine("R\tE\tM\tO\tV\tE");
                typeProducts types = new typeProducts();
                Console.WriteLine("Input the codeItem to remove list item");
                types.code = Convert.ToInt32(Console.ReadLine());
                typeProducts index = typeData.Find(x => x.code == types.code);
                typeData.RemoveAt(typeData.IndexOf(index));
                break;

            case '3':
                Console.WriteLine("E\tD\tI\tT");
                typeProducts types2 = new typeProducts();
                Console.WriteLine("Input the codeItem to edit list item");
                types2.code = Convert.ToInt32(Console.ReadLine());
                typeProducts index2 = typeData.Find(x => x.code == types2.code);
                typeData.RemoveAt(typeData.IndexOf(index2));
                Console.WriteLine("Input the new infomation");
                typeProducts temp = creatType();
                typeData.Add(temp);
                break;

            case '4':
                searchType(typeData);
                break;

            case '5':
                Console.WriteLine("S\tH\tO\tW");
                showtype(typeData);
                break;
            }
        }
コード例 #4
0
        public static void searchType(List <typeProducts> typeProduct)
        {
            Console.WriteLine("Choose the ItemCode or nameItems or...");
            Console.WriteLine("1.Code");
            Console.WriteLine("2.Name");
            int          choose = Convert.ToInt32(Console.ReadLine());
            typeProducts temp   = new typeProducts();

            if (choose < 3 && choose > 0)
            {
                switch (choose)
                {
                case 1:
                    Console.WriteLine("input the Type of Code ");
                    temp.code = Convert.ToInt32(Console.ReadLine());
                    List <typeProducts> codeSearch = new List <typeProducts>();
                    foreach (typeProducts ty in typeProduct)
                    {
                        if (ty.code == temp.code)
                        {
                            codeSearch.Add(ty);
                        }
                    }
                    showtype(codeSearch);
                    break;

                case 2:
                    Console.WriteLine("input the Type of Name");
                    temp.typeProduct = Console.ReadLine();
                    List <typeProducts> nameSearch = new List <typeProducts>();
                    foreach (typeProducts ty in typeProduct)
                    {
                        if (ty.typeProduct == temp.typeProduct)
                        {
                            nameSearch.Add(ty);
                        }
                    }
                    showtype(nameSearch);
                    break;
                }
            }
            else
            {
                searchType(typeProduct);
            }
        }