示例#1
0
        // form propestise find
        public static void FormCommonFind(string Tittle, int index)
        {
            Console.BackgroundColor = ConsoleColor.Black;
            Console.ForegroundColor = ConsoleColor.White;
            Console.Clear();
            string blank = " ";
            string boder = "|";
            int    hang  = 10;
            int    cot   = 25;
            int    left  = 40;
            int    top   = 5;

            for (int i = 1; i < hang; i++)
            {
                if (i == 1 || i == 2 || i == 3)
                {
                    Console.BackgroundColor = ConsoleColor.Cyan;
                }
                else
                {
                    Console.BackgroundColor = ConsoleColor.White;
                }

                Console.CursorTop  = top + i - 1;
                Console.CursorLeft = left - 1;
                Console.Write(boder);
                for (int j = 1; j < cot; j++)
                {
                    Console.CursorTop  = top + i - 1;
                    Console.CursorLeft = left + j - 1;
                    Console.Write(blank);
                }
                Console.Write(boder);
                Console.WriteLine();
            }
            Console.CursorTop       = top + 1;
            Console.CursorLeft      = left + 2;
            Console.ForegroundColor = ConsoleColor.White;
            Console.BackgroundColor = ConsoleColor.Cyan;
            Console.Write("{0}?", Tittle);
            Console.CursorLeft      = 0;
            Console.CursorTop       = 0;
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine(" Để thoát chon ESC");

            // chuc năng trong tim kiem
            Arch_HH(1);
            ArrayList ArrayHH  = Program.DuLieuMauHangHoa();
            ArrayList ArrayLH  = Program.DuLieuMauLoaiHang();
            int       selected = OptionFind();

            if (Tittle == "Hàng Hóa")
            {
                if (selected == 1)
                {
                    //sửa
                    Console.Clear();
                    Edit.SuaHH(ref ArrayHH, ref ArrayLH, "Edit HH", selected, 1);
                }
                if (selected == 2)
                {
                    //xóa
                    Console.Clear();
                    Delete.XoaHH(ref ArrayHH, ref ArrayLH, "Delete HH", selected);
                }
                if (selected == -1)
                {
                    //back main
                    Program.AppMain();
                }
            }
            if (Tittle == "Loại Hàng")
            {
                if (selected == 1)
                {
                    //sửa
                    Console.Clear();
                    EditLH.SuaLH(ref ArrayLH, ref ArrayHH, "Edit HH", selected, 1);
                }
                if (selected == 2)
                {
                    //xóa
                    Console.Clear();
                    DeleteLH.XoaLH(ref ArrayLH, ref ArrayHH, "Delete HH", selected, 1);
                }
                if (selected == -1)
                {
                    //back main
                    Program.AppMain();
                }
            }


            // lựa chon chưc nang
        }
示例#2
0
        //----điều hướng
        static void DieuHuong(int select, ref ArrayList ArrayHH, ref ArrayList ArrayLH)
        {
            switch (select)
            {
            case 0:
                Add.ThemHangHoa(ref ArrayHH, ref ArrayLH);
                return;

            case 1:
                Console.CursorVisible = false;
                Edit.SuaHangHoa(ref ArrayHH, ref ArrayLH);
                return;

            case 2:
                Console.CursorVisible = false;
                Delete.XoaHangHoa(ref ArrayHH, ref ArrayLH);
                return;

            case 3:
                Find.TimKiemHangHoa(ArrayHH, ArrayLH);
                return;

            case 4:
                AddLH.ThemLoaiHang(ref ArrayLH, ref ArrayHH);
                return;

            case 5:
                Console.CursorVisible = false;
                EditLH.SuaLoaiHang(ref ArrayLH, ref ArrayHH, 0);
                return;

            case 6:
                Console.CursorVisible = false;
                DeleteLH.XoaLoaiHang(ref ArrayLH, ref ArrayHH, 0);
                return;

            case 7:
                FindLH.TimKiemLoaiHang(ArrayLH, ArrayHH);
                return;

            case 8:
                Console.CursorVisible = false;
                //Caculator.PageMainCacu();
                FappyBird.FontGameFB();

                return;

            case 9:
                Console.CursorVisible = false;
                MiniGame.SelectLevelGame();
                return;

            case 10:
                Console.CursorVisible = false;
                About.Information();
                return;

            case 11:
                Console.CursorVisible = false;
                Console.Clear();
                return;
            }
        }
示例#3
0
        //
        public static void inputSeclectLH(ref ArrayList ArrayLH, ref ArrayList ArrayHH, int stt, int select, string ChucNang)
        {
            ConsoleKeyInfo input;

            input = Console.ReadKey(true);
            int top = 0;

            if (ChucNang == "Find LH")
            {
                top = 6;
            }
            switch (input.Key)
            {
            case ConsoleKey.UpArrow:
                if (select == 0)
                {
                    HienThiLH(ArrayLH, stt, select, top);
                    inputSeclectLH(ref ArrayLH, ref ArrayHH, stt, select, ChucNang);
                }
                else
                {
                    select--;
                    HienThiLH(ArrayLH, stt, select, top);
                    inputSeclectLH(ref ArrayLH, ref ArrayHH, stt, select, ChucNang);
                }
                return;

            case ConsoleKey.DownArrow:
                if (select == ArrayLH.Count - 1)
                {
                    HienThiLH(ArrayLH, stt, select, top);
                    inputSeclectLH(ref ArrayLH, ref ArrayHH, stt, select, ChucNang);
                }
                else
                {
                    select++;
                    HienThiLH(ArrayLH, stt, select, top);
                    inputSeclectLH(ref ArrayLH, ref ArrayHH, stt, select, ChucNang);
                }
                return;

            case ConsoleKey.Enter:
                switch (ChucNang)
                {
                case "Delete LH":
                    Console.CursorVisible = false;
                    DeleteLH.XoaLH(ref ArrayLH, ref ArrayHH, ChucNang, select, 0);
                    return;

                case "Edit LH":
                    Console.CursorVisible = true;
                    Console.Clear();
                    EditLH.SuaLH(ref ArrayLH, ref ArrayHH, ChucNang, select, 1);
                    return;

                case "Find LH":
                    Form.FormCommonFind("Loại Hàng", select);
                    return;
                }
                return;

            case ConsoleKey.Escape:
                Console.CursorVisible = false;
                Tittle.TieuDe();
                int index = 1;
                if (ChucNang == "Delete LH")
                {
                    index = 6;
                }
                if (ChucNang == "Edit LH")
                {
                    index = 5;
                }
                Select.LuaChonChinh(ref ArrayHH, ref ArrayLH, index);
                break;

            default:
                inputSeclectLH(ref ArrayLH, ref ArrayHH, stt, select, ChucNang);
                break;
            }
        }