Exemplo n.º 1
0
        public void Insert(KhachHang kh)
        {
            int          makh = CongCu.TachSo(maKH) + 1;
            StreamWriter sw   = File.AppendText(txtfile);

            sw.WriteLine("KH" + makh + "\t" + kh.tenKH + "\t" + kh.diaChi + "\t" + kh.soDT);
            sw.Close();
        }
Exemplo n.º 2
0
        public void Insert(HDBan hdb)
        {
            int          mahdb = CongCu.TachSo(maHDB) + 1;
            StreamWriter sw    = File.AppendText(txtfile);

            sw.WriteLine("HDB" + mahdb + "\t" + hdb.maNV + "\t" + hdb.maKH + "\t" + hdb.ngayBan + "\t" + hdb.tongTien);
            sw.Close();
        }
Exemplo n.º 3
0
        public void Insert(HDNhap hdn)
        {
            int          mahdn = CongCu.TachSo(maHDN) + 1;
            StreamWriter sw    = File.AppendText(txtfile);

            sw.WriteLine("HDN" + mahdn + "\t" + hdn.maNV + "\t" + hdn.maNCC + "\t" + hdn.ngayNhap + "\t" + hdn.tongTien);
            sw.Close();
        }
Exemplo n.º 4
0
        public void Insert(NhanVien nv)
        {
            int          manv = CongCu.TachSo(maNV) + 1;
            StreamWriter sw   = File.AppendText(txtfile);

            sw.WriteLine("NV" + manv + "\t" + nv.tenNV + "\t" + nv.ngaySinh + "\t" + nv.gioiTinh + "\t" + nv.diaChi + "\t" + nv.soDT + "\t" + nv.loaiNV + "\t" + nv.pass);
            sw.Close();
        }
Exemplo n.º 5
0
        public void Insert(NCC ncc)
        {
            int          mancc = CongCu.TachSo(maNCC) + 1;
            StreamWriter sw    = File.AppendText(txtfile);

            sw.WriteLine("NCC" + mancc + "\t" + ncc.tenNCC + "\t" + ncc.diaChi + "\t" + ncc.soDT);
            sw.Close();
        }
Exemplo n.º 6
0
        public void Xoa(int x, int y, ConsoleColor background_color, ConsoleColor text_color)
        {
            do
            {
                Console.BackgroundColor = background_color;
                Console.ForegroundColor = text_color;
                string      mahdb   = "";
                ICTHDBanBLL cthdban = new CTHDBanBLL();
                IHDBanBLL   hdban   = new HDBanBLL();
                HDBanBLL    hdbBLL  = new HDBanBLL();

                Console.Clear();
                IO.Box(0, 0, 28, 114, ConsoleColor.Black, ConsoleColor.White);
                IO.BoxTitle("                                             XÓA HÓA ĐƠN BÁN", x, y, 8, 110);
                IO.Writexy("Nhập mã hóa đơn bán cần xóa:", x + 4, y + 3);
                IO.Writexy("------------------------------------------------------------------------------------------------------------", x + 1, y + 4);
                IO.Writexy("Nhập ! để thoát...", x + 4, y + 6);
                Hien(x + 13, y + 8, hdban.LayDSHDBan(), 5, 0);

                do
                {
                    Console.SetCursorPosition(x + 33, y + 3);
                    mahdb = Console.ReadLine();
                    if (mahdb == "")
                    {
                        IO.Clear(x + 3, y + 5, 60, ConsoleColor.Black);
                        IO.Writexy("Nhập lại mã hóa đơn bán...", x + 4, y + 5, ConsoleColor.Black, ConsoleColor.White);
                    }
                    else if (mahdb == "!")
                    {
                        return;
                    }
                    else
                    {
                        if (hdbBLL.KT_MaHDB(CongCu.ChuanHoaMa(mahdb)) == false)
                        {
                            IO.Clear(x + 3, y + 5, 60, ConsoleColor.Black);
                            IO.Writexy("Không tồn tại mã hóa đơn bán này...", x + 4, y + 5, ConsoleColor.Black, ConsoleColor.White);
                            IO.Clear(x + 32, y + 3, 60, ConsoleColor.Black);
                        }
                        else
                        {
                            mahdb = CongCu.ChuanHoaMa(mahdb);
                            hdban.XoaHDBan(mahdb);
                            cthdban.XoaCTHDBan(mahdb);
                            IO.Clear(x + 3, y + 5, 60, ConsoleColor.Black);
                            IO.Clear(x + 32, y + 3, 60, ConsoleColor.Black);
                            IO.Writexy("Hóa đơn nhập đã được xóa...", x + 4, y + 5);
                            Hien(x + 13, y + 8, hdban.LayDSHDBan(), 5, 1);
                        }
                    }
                } while (mahdb == "" || hdbBLL.KT_MaHDB(CongCu.ChuanHoaMa(mahdb)) == false);
            } while (true);
        }
Exemplo n.º 7
0
        public void XemCTHDB(int x, int y, ConsoleColor background_color, ConsoleColor text_color)
        {
            do
            {
                Console.BackgroundColor = background_color;
                Console.ForegroundColor = text_color;
                string      mahdb   = "";
                ICTHDBanBLL cthdban = new CTHDBanBLL();
                IHDBanBLL   hdban   = new HDBanBLL();
                HDBanBLL    hdbBLL  = new HDBanBLL();

                Console.Clear();
                IO.Box(0, 0, 28, 114, ConsoleColor.Black, ConsoleColor.White);
                IO.BoxTitle("                                    XEM DANH SÁCH CHI TIẾT HÓA ĐƠN NHẬP", x, y, 8, 112);
                IO.Writexy("Nhập mã hóa đơn bán cần xem chi tiết:", x + 2, y + 3);
                IO.Writexy("--------------------------------------------------------------------------------------------------------------", x + 1, y + 4);
                IO.Writexy("Nhập ! để thoát...", x + 4, y + 6);
                Hien(x + 13, y + 8, hdban.LayDSHDBan(), 5, 0);

                do
                {
                    Console.SetCursorPosition(x + 40, y + 3);
                    mahdb = Console.ReadLine();
                    if (mahdb == "")
                    {
                        IO.Clear(x + 3, y + 5, 60, ConsoleColor.Black);
                        IO.Writexy("Nhập lại mã hóa đơn bán...", x + 4, y + 5, ConsoleColor.Black, ConsoleColor.White);
                    }
                    else if (mahdb == "!")
                    {
                        return;
                    }
                    else
                    {
                        if (hdbBLL.KT_MaHDB(CongCu.ChuanHoaMa(mahdb)) == false)
                        {
                            IO.Clear(x + 3, y + 5, 60, ConsoleColor.Black);
                            IO.Writexy("Không tồn tại mã hóa đơn bán này...", x + 4, y + 5, ConsoleColor.Black, ConsoleColor.White);
                            IO.Clear(x + 39, y + 3, 60, ConsoleColor.Black);
                        }
                        else
                        {
                            IO.Clear(x + 3, y + 5, 60, ConsoleColor.Black);
                            IO.Writexy("Hóa đơn bán tìm được...", x + 4, y + 5);
                            mahdb = CongCu.ChuanHoaMa(mahdb);
                            List <CTHDBan> list = cthdban.LayCTHDBan(new CTHDBan(mahdb, null, 0, 0, 0));
                            HienCT_B(x + 13, y + 8, list, 5, 1);
                        }
                    }
                } while (mahdb == "" || hdbBLL.KT_MaHDB(CongCu.ChuanHoaMa(mahdb)) == false);
            } while (true);
        }
Exemplo n.º 8
0
 public void ThemCTHDBan(CTHDBan cthdb)
 {
     if (cthdb.maHDB != "" && cthdb.maMT != "")
     {
         cthdb.maHDB = CongCu.ChuanHoaMa(cthdb.maHDB);
         cthdb.maMT  = CongCu.ChuanHoaMa(cthdb.maMT);
         cthdbDAL.Insert(cthdb);
     }
     else
     {
         throw new Exception("Dữ liệu sai.");
     }
 }
Exemplo n.º 9
0
        public void TimMa(int x, int y, ConsoleColor background_color, ConsoleColor text_color)
        {
            do
            {
                Console.BackgroundColor = background_color;
                Console.ForegroundColor = text_color;
                string     mahdn  = "";
                IHDNhapBLL hdnhap = new HDNhapBLL();
                HDNhapBLL  hdnBLL = new HDNhapBLL();

                Console.Clear();
                IO.Box(0, 0, 28, 114, ConsoleColor.Black, ConsoleColor.White);
                IO.BoxTitle("                                           TÌM KIẾM HÓA ĐƠN NHẬP", x, y, 8, 112);
                IO.Writexy("Nhập mã hóa đơn nhập cần tìm:", x + 2, y + 3);
                IO.Writexy("--------------------------------------------------------------------------------------------------------------", x + 1, y + 4);
                IO.Writexy("Nhập ! để thoát...", x + 4, y + 6);
                Hien(x + 13, y + 8, hdnhap.LayDSHDNhap(), 5, 0);

                do
                {
                    Console.SetCursorPosition(x + 32, y + 3);
                    mahdn = Console.ReadLine();
                    if (mahdn == "")
                    {
                        IO.Clear(x + 3, y + 5, 60, ConsoleColor.Black);
                        IO.Writexy("Nhập lại mã hóa đơn nhập...", x + 4, y + 5, ConsoleColor.Black, ConsoleColor.White);
                    }
                    else if (mahdn == "!")
                    {
                        return;
                    }
                    else
                    {
                        if (hdnBLL.KT_MaHDN(CongCu.ChuanHoaMa(mahdn)) == false)
                        {
                            IO.Clear(x + 3, y + 5, 60, ConsoleColor.Black);
                            IO.Writexy("Không tồn tại mã hóa đơn nhập này...", x + 4, y + 5, ConsoleColor.Black, ConsoleColor.White);
                            IO.Clear(x + 31, y + 3, 60, ConsoleColor.Black);
                        }
                        else
                        {
                            IO.Clear(x + 3, y + 5, 60, ConsoleColor.Black);
                            IO.Writexy("Hóa đơn nhập tìm được...", x + 4, y + 5);
                            mahdn = CongCu.ChuanHoaMa(mahdn);
                            List <HDNhap> list = hdnhap.TimHDNhap(new HDNhap(mahdn, null, null, null, 0));
                            Hien(x + 13, y + 8, list, 5, 1);
                        }
                    }
                } while (mahdn == "" || hdnBLL.KT_MaHDN(CongCu.ChuanHoaMa(mahdn)) == false);
            } while (true);
        }
Exemplo n.º 10
0
        public void Xoa(int x, int y, ConsoleColor background_color, ConsoleColor text_color)
        {
            do
            {
                Console.BackgroundColor = background_color;
                Console.ForegroundColor = text_color;
                string        makh      = "";
                IKhachHangBLL khachhang = new KhachHangBLL();
                KhachHangBLL  khBLL     = new KhachHangBLL();

                Console.Clear();
                IO.Box(0, 0, 28, 114, ConsoleColor.Black, ConsoleColor.White);
                IO.BoxTitle("                                              XÓA KHÁCH HÀNG", x, y, 8, 110);
                IO.Writexy("Nhập mã khách hàng cần xóa:", x + 4, y + 3);
                IO.Writexy("------------------------------------------------------------------------------------------------------------", x + 1, y + 4);
                IO.Writexy("Nhập ! để thoát...", x + 4, y + 6);
                Hien(x + 16, y + 8, khachhang.LayDSKhachHang(), 5, 0);
                do
                {
                    Console.SetCursorPosition(x + 32, y + 3);
                    makh = Console.ReadLine();
                    if (makh == "")
                    {
                        IO.Clear(x + 3, y + 5, 60, ConsoleColor.Black);
                        IO.Writexy("Nhập lại mã khách hàng...", x + 4, y + 5, ConsoleColor.Black, ConsoleColor.White);
                    }
                    else if (makh == "!")
                    {
                        return;
                    }
                    else
                    {
                        if (khBLL.KT_MaKhachHang(CongCu.ChuanHoaMa(makh)) == false)
                        {
                            IO.Clear(x + 3, y + 5, 60, ConsoleColor.Black);
                            IO.Writexy("Không tồn tại mã khách hàng này...", x + 4, y + 5, ConsoleColor.Black, ConsoleColor.White);
                            IO.Clear(x + 31, y + 3, 60, ConsoleColor.Black);
                        }
                        else
                        {
                            makh = CongCu.ChuanHoaMa(makh);
                            khachhang.XoaKhachHang(makh);
                            IO.Clear(x + 3, y + 5, 60, ConsoleColor.Black);
                            IO.Clear(x + 31, y + 3, 60, ConsoleColor.Black);
                            IO.Writexy("Khách hàng đã được xóa...", x + 4, y + 5);
                            Hien(x + 16, y + 8, khachhang.LayDSKhachHang(), 5, 1);
                        }
                    }
                } while (makh == "" || khBLL.KT_MaKhachHang(CongCu.ChuanHoaMa(makh)) == false);
            } while (true);
        }
Exemplo n.º 11
0
        public void Xoa(int x, int y, ConsoleColor background_color, ConsoleColor text_color)
        {
            do
            {
                Console.BackgroundColor = background_color;
                Console.ForegroundColor = text_color;
                string      mamt    = "";
                IMayTinhBLL maytinh = new MayTinhBLL();
                MayTinhBLL  mtBLL   = new MayTinhBLL();

                Console.Clear();
                IO.Box(0, 0, 28, 114, ConsoleColor.Black, ConsoleColor.White);
                IO.BoxTitle("                                               XÓA MÁY TÍNH", x, y, 8, 110);
                IO.Writexy("Nhập mã máy tính cần xóa:", x + 4, y + 3);
                IO.Writexy("------------------------------------------------------------------------------------------------------------", x + 1, y + 4);
                IO.Writexy("Nhập ! để thoát...", x + 4, y + 6);
                Hien(x + 9, y + 8, maytinh.LayDSMayTinh(), 5, 0);
                do
                {
                    Console.SetCursorPosition(x + 30, y + 3);
                    mamt = Console.ReadLine();
                    if (mamt == "")
                    {
                        IO.Clear(x + 3, y + 5, 60, ConsoleColor.Black);
                        IO.Writexy("Nhập lại mã máy tính...", x + 4, y + 5, ConsoleColor.Black, ConsoleColor.White);
                    }
                    else if (mamt == "!")
                    {
                        return;
                    }
                    else
                    {
                        if (mtBLL.KT_MaMayTinh(CongCu.ChuanHoaMa(mamt)) == false)
                        {
                            IO.Clear(x + 3, y + 5, 60, ConsoleColor.Black);
                            IO.Writexy("Không tồn tại mã máy tính này...", x + 4, y + 5, ConsoleColor.Black, ConsoleColor.White);
                            IO.Clear(x + 29, y + 3, 60, ConsoleColor.Black);
                        }
                        else
                        {
                            mamt = CongCu.ChuanHoaMa(mamt);
                            maytinh.XoaMayTinh(mamt);
                            IO.Clear(x + 3, y + 5, 60, ConsoleColor.Black);
                            IO.Clear(x + 29, y + 3, 60, ConsoleColor.Black);
                            IO.Writexy("Máy tính đã được xóa...", x + 4, y + 5);
                            Hien(x + 9, y + 8, maytinh.LayDSMayTinh(), 5, 1);
                        }
                    }
                } while (mamt == "" || mtBLL.KT_MaMayTinh(CongCu.ChuanHoaMa(mamt)) == false);
            } while (true);
        }
Exemplo n.º 12
0
        public void Xoa(int x, int y, ConsoleColor background_color, ConsoleColor text_color)
        {
            do
            {
                Console.BackgroundColor = background_color;
                Console.ForegroundColor = text_color;
                string       manv     = "";
                INhanVienBLL nhanvien = new NhanVienBLL();
                NhanVienBLL  nvBLL    = new NhanVienBLL();

                Console.Clear();
                IO.Box(0, 0, 28, 114, ConsoleColor.Black, ConsoleColor.White);
                IO.BoxTitle("                                               XÓA NHÂN VIÊN", x, y, 8, 112);
                IO.Writexy("Nhập mã nhân viên cần xóa:", x + 4, y + 3);
                IO.Writexy("--------------------------------------------------------------------------------------------------------------", x + 1, y + 4);
                IO.Writexy("Nhập ! để thoát...", x + 4, y + 6);
                Hien(x, y + 8, nhanvien.LayDSNhanVien(), 5, 0);
                do
                {
                    Console.SetCursorPosition(x + 31, y + 3);
                    manv = Console.ReadLine();
                    if (manv == "")
                    {
                        IO.Clear(x + 3, y + 5, 60, ConsoleColor.Black);
                        IO.Writexy("Nhập lại mã nhân viên...", x + 4, y + 5, ConsoleColor.Black, ConsoleColor.White);
                    }
                    else if (manv == "!")
                    {
                        return;
                    }
                    else
                    {
                        if (nvBLL.KT_MaNhanVien(CongCu.ChuanHoaMa(manv)) == false)
                        {
                            IO.Clear(x + 3, y + 5, 60, ConsoleColor.Black);
                            IO.Writexy("Không tồn tại mã nhân viên này...", x + 4, y + 5, ConsoleColor.Black, ConsoleColor.White);
                            IO.Clear(x + 30, y + 3, 60, ConsoleColor.Black);
                        }
                        else
                        {
                            manv = CongCu.ChuanHoaMa(manv);
                            nhanvien.XoaNhanVien(manv);
                            IO.Clear(x + 3, y + 5, 60, ConsoleColor.Black);
                            IO.Clear(x + 30, y + 3, 60, ConsoleColor.Black);
                            IO.Writexy("Nhân viên đã được xóa...", x + 4, y + 5);
                            Hien(x, y + 8, nhanvien.LayDSNhanVien(), 5, 1);
                        }
                    }
                } while (manv == "" || nvBLL.KT_MaNhanVien(CongCu.ChuanHoaMa(manv)) == false);
            } while (true);
        }
Exemplo n.º 13
0
 public void ThemKhachHang(KhachHang kh)
 {
     if (kh.tenKH != "" && kh.diaChi != "" && kh.soDT != "")
     {
         kh.tenKH  = CongCu.ChuanHoaXau(kh.tenKH);
         kh.diaChi = CongCu.ChuanHoaXau(kh.diaChi);
         kh.soDT   = CongCu.ChuanHoaMa(kh.soDT);
         khDAL.Insert(kh);
     }
     else
     {
         throw new Exception("Dữ liệu sai.");
     }
 }
Exemplo n.º 14
0
 public void ThemNhaCC(NCC nc)
 {
     if (nc.tenncc != "" && nc.diachi != "")
     {
         nc.tenncc = CongCu.ChuanHoaXau(nc.tenncc);
         nc.diachi = CongCu.ChuanHoaXau(nc.diachi);
         nc.sdt    = CongCu.CatXau(nc.sdt);
         NCCDA.Insert(nc);
     }
     else
     {
         throw new Exception("Du lieu sai!");
     }
 }
Exemplo n.º 15
0
        public void TimTen(int x, int y, ConsoleColor background_color, ConsoleColor text_color)
        {
            do
            {
                Console.BackgroundColor = background_color;
                Console.ForegroundColor = text_color;
                string      tenmt   = "";
                IMayTinhBLL maytinh = new MayTinhBLL();
                MayTinhBLL  mtBLL   = new MayTinhBLL();

                Console.Clear();
                IO.Box(0, 0, 28, 114, ConsoleColor.Black, ConsoleColor.White);
                IO.BoxTitle("                                             TÌM KIẾM MÁY TÍNH", x, y, 8, 110);
                IO.Writexy("Nhập tên máy tính cần tìm:", x + 2, y + 3);
                IO.Writexy("------------------------------------------------------------------------------------------------------------", x + 1, y + 4);
                IO.Writexy("Nhập ! để thoát...", x + 4, y + 6);
                Hien(x + 9, y + 8, maytinh.LayDSMayTinh(), 5, 0);
                do
                {
                    Console.SetCursorPosition(x + 29, y + 3);
                    tenmt = Console.ReadLine();
                    if (tenmt == "")
                    {
                        IO.Clear(x + 3, y + 5, 60, ConsoleColor.Black);
                        IO.Writexy("Nhập lại tên máy tính...", x + 4, y + 5, ConsoleColor.Black, ConsoleColor.White);
                    }
                    else if (tenmt == "!")
                    {
                        return;
                    }
                    else
                    {
                        if (mtBLL.KT_TenMayTinh(CongCu.ChuanHoaXau(tenmt)) == false)
                        {
                            IO.Clear(x + 3, y + 5, 60, ConsoleColor.Black);
                            IO.Writexy("Không tồn tại tên máy tính này...", x + 4, y + 5, ConsoleColor.Black, ConsoleColor.White);
                            IO.Clear(x + 28, y + 3, 60, ConsoleColor.Black);
                        }
                        else
                        {
                            IO.Clear(x + 3, y + 5, 60, ConsoleColor.Black);
                            IO.Writexy("Máy tính tìm được...", x + 4, y + 5);
                            tenmt = CongCu.ChuanHoaXau(tenmt);
                            List <MayTinh> list = maytinh.TimMayTinh(new MayTinh(null, tenmt, null, 0, 0));
                            Hien(x + 9, y + 8, list, 5, 1);
                        }
                    }
                } while (tenmt == "" || mtBLL.KT_TenMayTinh(CongCu.ChuanHoaXau(tenmt)) == false);
            } while (true);
        }
Exemplo n.º 16
0
        public void TimTen(int x, int y, ConsoleColor background_color, ConsoleColor text_color)
        {
            do
            {
                Console.BackgroundColor = background_color;
                Console.ForegroundColor = text_color;
                string       hoten    = "";
                INhanVienBLL nhanvien = new NhanVienBLL();
                NhanVienBLL  nvBLL    = new NhanVienBLL();

                Console.Clear();
                IO.Box(0, 0, 28, 114, ConsoleColor.Black, ConsoleColor.White);
                IO.BoxTitle("                                              TÌM KIẾM NHÂN VIÊN", x, y, 8, 112);
                IO.Writexy("Nhập họ tên nhân viên cần tìm:", x + 2, y + 3);
                IO.Writexy("--------------------------------------------------------------------------------------------------------------", x + 1, y + 4);
                IO.Writexy("Nhập ! để thoát...", x + 4, y + 6);
                Hien(x, y + 8, nhanvien.LayDSNhanVien(), 5, 0);
                do
                {
                    Console.SetCursorPosition(x + 33, y + 3);
                    hoten = Console.ReadLine();
                    if (hoten == "")
                    {
                        IO.Clear(x + 3, y + 5, 60, ConsoleColor.Black);
                        IO.Writexy("Nhập lại tên nhân viên...", x + 4, y + 5, ConsoleColor.Black, ConsoleColor.White);
                    }
                    else if (hoten == "!")
                    {
                        return;
                    }
                    else
                    {
                        if (nvBLL.KT_TenNhanVien(CongCu.ChuanHoaXau(hoten)) == false)
                        {
                            IO.Clear(x + 3, y + 5, 60, ConsoleColor.Black);
                            IO.Writexy("Không tồn tại tên nhân viên này...", x + 4, y + 5, ConsoleColor.Black, ConsoleColor.White);
                            IO.Clear(x + 32, y + 3, 60, ConsoleColor.Black);
                        }
                        else
                        {
                            IO.Clear(x + 3, y + 5, 60, ConsoleColor.Black);
                            IO.Writexy("Nhân viên tìm được...", x + 4, y + 5);
                            hoten = CongCu.ChuanHoaXau(hoten);
                            List <NhanVien> list = nhanvien.TimNhanVien(new NhanVien(null, hoten, null, null, null, null, null, null));
                            Hien(x, y + 8, list, 5, 1);
                        }
                    }
                } while (hoten == "" || nvBLL.KT_TenNhanVien(CongCu.ChuanHoaXau(hoten)) == false);
            } while (true);
        }
Exemplo n.º 17
0
 public void ThemCTHDNhap(CTHDNhap cthdn)
 {
     if (cthdn.maHDN != "" && cthdn.maMT != "" && cthdn.tenMT != "")
     {
         cthdn.maHDN = CongCu.ChuanHoaMa(cthdn.maHDN);
         cthdn.maMT  = CongCu.ChuanHoaMa(cthdn.maMT);
         cthdn.tenMT = CongCu.ChuanHoaXau(cthdn.tenMT);
         cthdnDAL.Insert(cthdn);
     }
     else
     {
         throw new Exception("Dữ liệu sai.");
     }
 }
Exemplo n.º 18
0
 public void ThemHDBan(HDBan hdb)
 {
     if (hdb.maNV != "" && hdb.maKH != "" && hdb.ngayBan != "")
     {
         hdb.maNV    = CongCu.ChuanHoaMa(hdb.maNV);
         hdb.maKH    = CongCu.ChuanHoaMa(hdb.maKH);
         hdb.ngayBan = CongCu.ChuanHoaMa(hdb.ngayBan);
         hdbDAL.Insert(hdb);
     }
     else
     {
         throw new Exception("Dữ liệu sai.");
     }
 }
Exemplo n.º 19
0
        public void TimMa(int x, int y, ConsoleColor background_color, ConsoleColor text_color)
        {
            do
            {
                Console.BackgroundColor = background_color;
                Console.ForegroundColor = text_color;
                string   mancc  = "";
                INCC_BLL nhacc  = new NCC_BLL();
                NCC_BLL  nccBLL = new NCC_BLL();

                Console.Clear();
                IO.Box(0, 0, 28, 114, ConsoleColor.Black, ConsoleColor.White);
                IO.BoxTitle("                                      TÌM KIẾM NHÀ CUNG CẤP", x, y, 8, 101);
                IO.Writexy("Nhập mã nhà cung cấp cần tìm:", x + 2, y + 3);
                IO.Writexy("---------------------------------------------------------------------------------------------------", x + 1, y + 4);
                IO.Writexy("Nhập ! để thoát...", x + 4, y + 6);
                Hien(x + 11, y + 8, nhacc.LayDSNCC(), 5, 0);
                do
                {
                    Console.SetCursorPosition(x + 32, y + 3);
                    mancc = Console.ReadLine();
                    if (mancc == "")
                    {
                        IO.Clear(x + 3, y + 5, 60, ConsoleColor.Black);
                        IO.Writexy("Nhập lại mã nhà cung cấp...", x + 4, y + 5, ConsoleColor.Black, ConsoleColor.White);
                    }
                    else if (mancc == "!")
                    {
                        return;
                    }
                    else
                    {
                        if (nccBLL.KT_MaNCC(CongCu.ChuanHoaMa(mancc)) == false)
                        {
                            IO.Clear(x + 3, y + 5, 60, ConsoleColor.Black);
                            IO.Writexy("Không tồn tại mã nhà cung cấp này...", x + 4, y + 5, ConsoleColor.Black, ConsoleColor.White);
                            IO.Clear(x + 31, y + 3, 60, ConsoleColor.Black);
                        }
                        else
                        {
                            IO.Clear(x + 3, y + 5, 60, ConsoleColor.Black);
                            IO.Writexy("Nhà cung cấp tìm được...", x + 4, y + 5);
                            mancc = CongCu.ChuanHoaMa(mancc);
                            List <NCC> list = nhacc.TimNCC(new NCC(mancc, null, null, null));
                            Hien(x + 11, y + 8, list, 5, 1);
                        }
                    }
                } while (mancc == "" || nccBLL.KT_MaNCC(CongCu.ChuanHoaMa(mancc)) == false);
            } while (true);
        }
Exemplo n.º 20
0
 public void ThemNCC(NCC ncc)
 {
     if (ncc.tenNCC != "" && ncc.diaChi != "" && ncc.soDT != "")
     {
         ncc.tenNCC = CongCu.ChuanHoaXau(ncc.tenNCC);
         ncc.diaChi = CongCu.ChuanHoaXau(ncc.diaChi);
         ncc.soDT   = CongCu.ChuanHoaMa(ncc.soDT);
         nccDAL.Insert(ncc);
     }
     else
     {
         throw new Exception("Dữ liệu sai.");
     }
 }
Exemplo n.º 21
0
        public void TimTen(int x, int y, ConsoleColor background_color, ConsoleColor text_color)
        {
            do
            {
                Console.BackgroundColor = background_color;
                Console.ForegroundColor = text_color;
                string        hoten     = "";
                IKhachHangBLL khachhang = new KhachHangBLL();
                KhachHangBLL  khBLL     = new KhachHangBLL();

                Console.Clear();
                IO.Box(0, 0, 28, 114, ConsoleColor.Black, ConsoleColor.White);
                IO.BoxTitle("                                           TÌM KIẾM KHÁCH HÀNG", x, y, 8, 110);
                IO.Writexy("Nhập họ tên khách hàng cần tìm:", x + 2, y + 3);
                IO.Writexy("------------------------------------------------------------------------------------------------------------", x + 1, y + 4);
                IO.Writexy("Nhập ! để thoát...", x + 4, y + 6);
                Hien(x + 16, y + 8, khachhang.LayDSKhachHang(), 5, 0);
                do
                {
                    Console.SetCursorPosition(x + 34, y + 3);
                    hoten = Console.ReadLine();
                    if (hoten == "")
                    {
                        IO.Clear(x + 3, y + 5, 60, ConsoleColor.Black);
                        IO.Writexy("Nhập lại tên khách hàng...", x + 4, y + 5, ConsoleColor.Black, ConsoleColor.White);
                    }
                    else if (hoten == "!")
                    {
                        return;
                    }
                    else
                    {
                        if (khBLL.KT_TenKhachHang(CongCu.ChuanHoaXau(hoten)) == false)
                        {
                            IO.Clear(x + 3, y + 5, 60, ConsoleColor.Black);
                            IO.Writexy("Không tồn tại tên khách hàng này...", x + 4, y + 5, ConsoleColor.Black, ConsoleColor.White);
                            IO.Clear(x + 33, y + 3, 60, ConsoleColor.Black);
                        }
                        else
                        {
                            IO.Clear(x + 3, y + 5, 60, ConsoleColor.Black);
                            IO.Writexy("Khách hàng tìm được...", x + 4, y + 5);
                            hoten = CongCu.ChuanHoaXau(hoten);
                            List <KhachHang> list = khachhang.TimKhachHang(new KhachHang(null, hoten, null, null));
                            Hien(x + 16, y + 8, list, 5, 1);
                        }
                    }
                } while (hoten == "" || khBLL.KT_TenKhachHang(CongCu.ChuanHoaXau(hoten)) == false);
            } while (true);
        }
Exemplo n.º 22
0
 public void ThemMayTinh(MayTinh mt)
 {
     if (mt.maMT != "" && mt.tenMT != "" && mt.maNCC != "")
     {
         mt.maMT  = CongCu.ChuanHoaMa(mt.maMT);
         mt.tenMT = CongCu.ChuanHoaXau(mt.tenMT);
         mt.maNCC = CongCu.ChuanHoaMa(mt.maNCC);
         mtDAL.Insert(mt);
     }
     else
     {
         throw new Exception("Dữ liệu sai.");
     }
 }
Exemplo n.º 23
0
 public void ThemHDNhap(HDNhap hdn)
 {
     if (hdn.maNV != "" && hdn.maNCC != "" && hdn.ngayNhap != "")
     {
         hdn.maNV     = CongCu.ChuanHoaMa(hdn.maNV);
         hdn.maNCC    = CongCu.ChuanHoaMa(hdn.maNCC);
         hdn.ngayNhap = CongCu.ChuanHoaMa(hdn.ngayNhap);
         hdnDAL.Insert(hdn);
     }
     else
     {
         throw new Exception("Dữ liệu sai.");
     }
 }
Exemplo n.º 24
0
        public void TimMa(int x, int y, ConsoleColor background_color, ConsoleColor text_color)
        {
            do
            {
                Console.BackgroundColor = background_color;
                Console.ForegroundColor = text_color;
                string    mahdb  = "";
                IHDBanBLL hdban  = new HDBanBLL();
                HDBanBLL  hdbBLL = new HDBanBLL();

                Console.Clear();
                IO.Box(0, 0, 28, 114, ConsoleColor.Black, ConsoleColor.White);
                IO.BoxTitle("                                            TÌM KIẾM HÓA ĐƠN BÁN", x, y, 8, 112);
                IO.Writexy("Nhập mã hóa đơn bán cần tìm:", x + 2, y + 3);
                IO.Writexy("--------------------------------------------------------------------------------------------------------------", x + 1, y + 4);
                IO.Writexy("Nhập ! để thoát...", x + 4, y + 6);
                Hien(x + 13, y + 8, hdban.LayDSHDBan(), 5, 0);
                do
                {
                    Console.SetCursorPosition(x + 31, y + 3);
                    mahdb = Console.ReadLine();
                    if (mahdb == "")
                    {
                        IO.Clear(x + 3, y + 5, 60, ConsoleColor.Black);
                        IO.Writexy("Nhập lại mã hóa đơn bán...", x + 4, y + 5, ConsoleColor.Black, ConsoleColor.White);
                    }
                    else if (mahdb == "!")
                    {
                        return;
                    }
                    else
                    {
                        if (hdbBLL.KT_MaHDB(mahdb.ToUpper()) == false)
                        {
                            IO.Clear(x + 3, y + 5, 60, ConsoleColor.Black);
                            IO.Writexy("Không tồn tại mã hóa đơn bán này...", x + 4, y + 5, ConsoleColor.Black, ConsoleColor.White);
                            IO.Clear(x + 30, y + 3, 60, ConsoleColor.Black);
                        }
                        else
                        {
                            IO.Clear(x + 3, y + 5, 60, ConsoleColor.Black);
                            IO.Writexy("Hóa đơn bán tìm được...", x + 4, y + 5);
                            mahdb = CongCu.CatXau(mahdb.ToUpper());
                            List <HDBan> list = hdban.TimHDBan(new HDBan(mahdb, null, null, null, 0));
                            Hien(x + 13, y + 8, list, 5, 1);
                        }
                    }
                } while (mahdb == "" || hdbBLL.KT_MaHDB(mahdb.ToUpper()) == false);
            } while (true);
        }
Exemplo n.º 25
0
        public void TK_Thang(int x, int y, ConsoleColor background_color, ConsoleColor text_color)
        {
            Console.BackgroundColor = background_color;
            Console.ForegroundColor = text_color;
            string thang = "";
            string s;
            double doanhthu = 0;

            Console.Clear();
            IO.Box(0, 0, 28, 114, ConsoleColor.Black, ConsoleColor.White);
            IO.BoxTitle("                                           THỐNG KÊ THEO THÁNG", x, y, 12, 112);
            IO.Writexy("Nhập tháng muốn thống kê:", x + 4, y + 3);
            IO.Writexy("--------------------------------------------------------------------------------------------------------------", x + 1, y + 4);
            IO.Writexy("Nhập tháng thống kê định dạng 'MM/yyyy'...", x + 4, y + 6);
            IO.Writexy("--------------------------------------------------------------------------------------------------------------", x + 1, y + 7);

            do
            {
                Console.SetCursorPosition(x + 30, y + 3);
                thang = Console.ReadLine();
                if (thang == "" || CongCu.CheckMonth(thang) == false)
                {
                    IO.Clear(x + 3, y + 5, 60, ConsoleColor.Black);
                    IO.Writexy("Nhập lại tháng thống kê...", x + 4, y + 5, ConsoleColor.Black, ConsoleColor.White);
                    IO.Clear(x + 29, y + 3, 60, ConsoleColor.Black);
                }
            } while (thang == "" || CongCu.CheckMonth(thang) == false);

            StreamReader sr = new StreamReader(txtfile);

            while ((s = sr.ReadLine()) != null)
            {
                String[] tmp = s.Split('\t');
                String[] d   = tmp[3].Split('/');
                if ((d[1] + "/" + d[2]) == thang)
                {
                    double tt = double.Parse(tmp[4]);
                    doanhthu += tt;
                }
            }
            IO.Writexy("Doanh thu là:", x + 4, y + 9);
            IO.Writexy(doanhthu.ToString(), x + 18, y + 9);
            sr.Close();

            IO.Clear(x + 3, y + 5, 60, ConsoleColor.Black);
            IO.Clear(x + 3, y + 6, 60, ConsoleColor.Black);
            IO.Writexy("Nhấn Enter để thoát...", x + 4, y + 5);
            Console.SetCursorPosition(x + 26, y + 5);
        }
Exemplo n.º 26
0
        public bool KT_DangNhap(string user, string pass)
        {
            NhanVienDAL nvDAL = new NhanVienDAL();
            bool        kt    = false;

            foreach (NhanVien nhanvien in nvDAL.GetData())
            {
                if (nhanvien.maNV == user && nhanvien.pass == CongCu.GetMD5(pass))
                {
                    kt = true;
                    break;
                }
            }
            return(kt);
        }
Exemplo n.º 27
0
        public void TK_Ngay(int x, int y, ConsoleColor background_color, ConsoleColor text_color)
        {
            Console.BackgroundColor = background_color;
            Console.ForegroundColor = text_color;
            string ngay = "";
            string s;
            double doanhthu = 0;

            Console.Clear();
            IO.Box(0, 0, 28, 114, ConsoleColor.Black, ConsoleColor.White);
            IO.BoxTitle("                                            THỐNG KÊ THEO NGÀY", x, y, 12, 112);
            IO.Writexy("Nhập ngày muốn thống kê:", x + 4, y + 3);
            IO.Writexy("--------------------------------------------------------------------------------------------------------------", x + 1, y + 4);
            IO.Writexy("Nhập ngày thống kê định dạng 'dd/MM/yyyy'...", x + 4, y + 6);
            IO.Writexy("--------------------------------------------------------------------------------------------------------------", x + 1, y + 7);

            do
            {
                Console.SetCursorPosition(x + 29, y + 3);
                ngay = Console.ReadLine();
                if (ngay == "" || CongCu.CheckDate(ngay) == false)
                {
                    IO.Clear(x + 3, y + 5, 60, ConsoleColor.Black);
                    IO.Writexy("Nhập lại ngày thống kê...", x + 4, y + 5, ConsoleColor.Black, ConsoleColor.White);
                    IO.Clear(x + 28, y + 3, 60, ConsoleColor.Black);
                }
            } while (ngay == "" || CongCu.CheckDate(ngay) == false);

            StreamReader sr = new StreamReader(txtfile);

            while ((s = sr.ReadLine()) != null)
            {
                String[] tmp = s.Split('\t');
                if (tmp[3] == ngay)
                {
                    double tt = double.Parse(tmp[4]);
                    doanhthu += tt;
                }
            }
            IO.Writexy("Doanh thu là:", x + 4, y + 9);
            IO.Writexy(doanhthu.ToString(), x + 18, y + 9);
            sr.Close();

            IO.Clear(x + 3, y + 5, 60, ConsoleColor.Black);
            IO.Clear(x + 3, y + 6, 60, ConsoleColor.Black);
            IO.Writexy("Nhấn Enter để thoát...", x + 4, y + 5);
            Console.SetCursorPosition(x + 26, y + 5);
        }
Exemplo n.º 28
0
 public void ThemNhanVien(NhanVien nv)
 {
     if (nv.tenNV != "" && nv.ngaySinh != "" && nv.gioiTinh != "" && nv.diaChi != "" && nv.soDT != "" && nv.loaiNV != "" && nv.pass != "")
     {
         nv.tenNV    = CongCu.ChuanHoaXau(nv.tenNV);
         nv.ngaySinh = CongCu.ChuanHoaMa(nv.ngaySinh);
         nv.gioiTinh = CongCu.ChuanHoaXau(nv.gioiTinh);
         nv.diaChi   = CongCu.ChuanHoaXau(nv.diaChi);
         nv.soDT     = CongCu.ChuanHoaMa(nv.soDT);
         nv.loaiNV   = CongCu.HoaDau(nv.loaiNV);
         nv.pass     = CongCu.GetMD5(nv.pass);
         nvDAL.Insert(nv);
     }
     else
     {
         throw new Exception("Dữ liệu sai.");
     }
 }
Exemplo n.º 29
0
        public List <KhachHang> GetData()
        {
            List <KhachHang> list = new List <KhachHang>();
            StreamReader     sr   = File.OpenText(txtfile);
            string           s    = sr.ReadLine();

            while (s != null)
            {
                if (s != "")
                {
                    s = CongCu.CatXau(s);
                    string[] a = s.Split('\t');
                    list.Add(new KhachHang(a[0], a[1], a[2], a[3]));
                }
                s = sr.ReadLine();
            }
            sr.Close();
            return(list);
        }
Exemplo n.º 30
0
        public List <HDNhap> GetData()
        {
            List <HDNhap> list = new List <HDNhap>();
            StreamReader  sr   = File.OpenText(txtfile);
            string        s    = sr.ReadLine();

            while (s != null)
            {
                if (s != "")
                {
                    s = CongCu.CatXau(s);
                    string[] a = s.Split('\t');
                    list.Add(new HDNhap(a[0], a[1], a[2], a[3], double.Parse(a[4])));
                }
                s = sr.ReadLine();
            }
            sr.Close();
            return(list);
        }