Exemplo n.º 1
0
        public void Delete()
        {
            DSSanPham n = new DSSanPham();

            n.Show();
            string maSp;

            do
            {
                Console.WriteLine();
                Console.WriteLine();
                Console.Write("\tNhập mã sản phẩm muốn xóa: ");
                maSp = Console.ReadLine();
                maSp = maSp.ToUpper();
                if (maSp.Length == 0)
                {
                    Console.WriteLine("Mời nhập lại !");
                }
            } while (maSp.Length == 0);
            if (TimSanPham(maSp) != null)// nếu hàm tìm sản phẩm có giá trị
            {
                dssanpham.Remove(TimSanPham(maSp));
                deleteTXT(maSp);
                Console.WriteLine();
                Console.WriteLine("Xóa Thành Công !");
            }
            else
            {
                Console.WriteLine("Không tìm thấy sản phẩm cần xóa !");
            }
        }
Exemplo n.º 2
0
        public void Add()
        {
            SanPham   t = new SanPham();
            DSSanPham n = new DSSanPham();

            n.Show();
            do
            {
                do
                {
                    Console.WriteLine("\n");
                    Console.Write("\tNhập mã sản phẩm cần thêm: ");
                    t.MaSP1 = Console.ReadLine();
                    t.MaSP1 = t.MaSP1.ToUpper();
                    if (t.MaSP1.Length == 0)
                    {
                        Console.WriteLine("Nhập lại!! ");
                    }
                } while (t.MaSP1.Length == 0);
                if (n.ktMa(t.MaSP1))
                {
                    Console.WriteLine("\tMã sản phẩm đã tồn lại! Mời nhập lại!!");
                }
                else
                {
                    t.NhapThem();
                    n.ktADD(t.MaSP1, t.TenSP1, t.Size1, t.DonGia1, t.MauSac1, t.Kieudang1, t.Loai1, t.SoLuong1);
                    Console.WriteLine("\nAdd successfully !!!");
                }
            } while (n.ktMa(t.MaSP1));
        }
Exemplo n.º 3
0
        //Sua thong tin san pham
        public void Update()
        {
            SanPham   t = new SanPham();
            DSSanPham n = new DSSanPham();

            n.Show();
            string maSp;

            do
            {
                Console.WriteLine();
                Console.WriteLine();
                Console.Write("\tNhập mã sản phẩm cần sửa: ");
                maSp = Console.ReadLine();
                maSp = maSp.ToUpper();
                if (maSp.Length == 0)
                {
                    Console.WriteLine("Nhập lại!!!");
                }
            } while (maSp.Length == 0);
            if (TimSanPham(maSp) != null)// nếu hàm tìm sp có giá trị
            {
                TimSanPham(maSp).NhapThem();
                GhiTep();
                Console.WriteLine("\tUpdate successfully !!!");
                Console.WriteLine();
                Console.WriteLine("\tSản phẩm sau khi update xong: ");
                Console.WriteLine();
                Console.WriteLine("\t\t   ╔═══════════════════════════════════════════════════════════════════════════════════════════╗");
                Console.WriteLine("\t\t   ║  Mã SP   |   Tên SP       | Size  |  Đơn Giá   |  Màu sắc |  Kiểu Dáng|  Loại | Số Lượng  ║");
                Console.WriteLine("\t\t   ║═══════════════════════════════════════════════════════════════════════════════════════════║");
                TimSanPham(maSp).Show2();
                Console.WriteLine("\t\t   ╚═══════════════════════════════════════════════════════════════════════════════════════════╝");
            }
            else
            {
                Console.WriteLine("Không tìm thấy sản phẩm cần sửa !!!");
            }
        }
Exemplo n.º 4
0
        public void TimKiemTen()
        {
            DSSanPham a = new DSSanPham();

            a.Show();
            string ten1;

            do
            {
                Console.Write("\t\tNhập tên sản phẩm bạn muốn tìm kiếm: ");
                ten1 = Console.ReadLine();
                if (ten1 == "")
                {
                    Console.WriteLine("Nhập lại");
                }
            } while (ten1 == "");
            int f = 0;

            Console.WriteLine("\t\tThông tin danh sách sản phẩm có tên đúng hoặc gần đúng với tên bạn đã tìm!! ");
            for (int i = 0; i < dssanpham.Count; i++)
            {
                if (dssanpham[i].TenSP1.IndexOf(ten1) >= 0)
                {
                    Console.WriteLine();
                    Console.WriteLine("\t\t   ╔═══════════════════════════════════════════════════════════════════════════════════════════╗");
                    Console.WriteLine("\t\t   ║  Mã SP   |   Tên SP       | Size  |  Đơn Giá   |  Màu sắc |  Kiểu Dáng|  Loại | Số Lượng  ║");
                    Console.WriteLine("\t\t   ║═══════════════════════════════════════════════════════════════════════════════════════════║");
                    dssanpham[i].Show2();
                    Console.WriteLine("\t\t   ╚═══════════════════════════════════════════════════════════════════════════════════════════╝");
                    Console.WriteLine();
                    Console.WriteLine();
                    f = 1;
                }
            }
            if (f == 0)
            {
                Console.Write("Không có sản phẩm nào theo tên bạn tìm!!");
            }
        }