コード例 #1
0
 public void Nhap()
 {
     Console.Clear();
     Console.WriteLine("NHẬP THÔNG TIN SẢN PHẨM");
     Sanpham sp = new Sanpham();
     string nhapthem;
     do { 
         do
         {
             Console.Write("Nhap ma san pham:"); sp.Masp = Console.ReadLine();
         } while (string.IsNullOrEmpty(sp.Masp));
         do {
             Console.Write("Nhap ma loai:"); sp.Maloai = (Console.ReadLine());
         } while (string.IsNullOrEmpty(sp.Maloai));
         do {
             Console.Write("Nhap ten san pham :"); sp.Tensp = Console.ReadLine();
         } while (string.IsNullOrEmpty(sp.Tensp));
         do {
             Console.Write("Nhap so luong san pham:"); sp.Soluong = int.Parse(Console.ReadLine());
         } while (sp.Soluong<0);
         do {
             Console.Write("Nhap gia ban san pham :"); sp.Giaban = int.Parse(Console.ReadLine());
         } while (sp.Giaban<10000);
         do {
             Console.Write("Nhap Nha san xuat :"); sp.Nhasx = Console.ReadLine();
         } while (string.IsNullOrEmpty(sp.Nhasx));
         spBLL.ThemSanPham(sp);
         Console.Write("Bạn có muốn nhập tiếp không ?(Y or y để nhập tiếp,nhấn bất kì để thoát )");
         do
         {
             nhapthem = Console.ReadLine();
         } while (nhapthem == "");
     } while (nhapthem == "Y" || nhapthem == "y");
 }
コード例 #2
0
        public void Nhap()
        {
            Console.Clear();
            Console.WriteLine("NHAP THONG TIN SAN PHAM");
            SanPham sp = new SanPham();

            Console.Write("Nhap ten san pham:"); sp.Tensp  = Console.ReadLine();
            Console.Write("Nhap gia san pham:"); sp.Giaban = int.Parse(Console.ReadLine());
            spDLL.ThemSanPham(sp);
        }