Ejemplo n.º 1
0
        public void Xoa(int x, int y, ConsoleColor background_color, ConsoleColor text_color)
        {
            do
            {
                Console.BackgroundColor = background_color;
                Console.ForegroundColor = text_color;
                string       mahdn    = "";
                ICTHDNhapBLL cthdnhap = new CTHDNhapBLL();
                IHDNhapBLL   hdnhap   = new HDNhapBLL();
                HDNhapBLL    hdnBLL   = new HDNhapBLL();

                Console.Clear();
                IO.Box(0, 0, 28, 114, ConsoleColor.Black, ConsoleColor.White);
                IO.BoxTitle("                                             XÓA HÓA ĐƠN NHẬP", x, y, 8, 110);
                IO.Writexy("Nhập mã hóa đơn nhập 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, hdnhap.LayDSHDNhap(), 5, 0);

                do
                {
                    Console.SetCursorPosition(x + 34, 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 + 33, y + 3, 60, ConsoleColor.Black);
                        }
                        else
                        {
                            mahdn = CongCu.ChuanHoaMa(mahdn);
                            hdnhap.XoaHDNhap(mahdn);
                            cthdnhap.XoaCTHDNhap(mahdn);
                            IO.Clear(x + 3, y + 5, 60, ConsoleColor.Black);
                            IO.Clear(x + 33, y + 3, 60, ConsoleColor.Black);
                            IO.Writexy("Hóa đơn nhập đã được xóa...", x + 4, y + 5);
                            Hien(x + 13, y + 8, hdnhap.LayDSHDNhap(), 5, 1);
                        }
                    }
                } while (mahdn == "" || hdnBLL.KT_MaHDN(CongCu.ChuanHoaMa(mahdn)) == false);
            } while (true);
        }
Ejemplo n.º 2
0
        public void XemCTHDN(int x, int y, ConsoleColor background_color, ConsoleColor text_color)
        {
            do
            {
                Console.BackgroundColor = background_color;
                Console.ForegroundColor = text_color;
                string       mahdn    = "";
                ICTHDNhapBLL cthdnhap = new CTHDNhapBLL();
                IHDNhapBLL   hdnhap   = new HDNhapBLL();
                HDNhapBLL    hdnBLL   = new HDNhapBLL();

                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 nhập 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, hdnhap.LayDSHDNhap(), 5, 0);

                do
                {
                    Console.SetCursorPosition(x + 41, 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 + 40, 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 <CTHDNhap> list = cthdnhap.LayCTHDNhap(new CTHDNhap(mahdn, null, null, 0, 0, 0));
                            HienCT_N(x, y + 8, list, 5, 1);
                        }
                    }
                } while (mahdn == "" || hdnBLL.KT_MaHDN(CongCu.ChuanHoaMa(mahdn)) == false);
            } while (true);
        }