Ejemplo n.º 1
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;
            }
        }
Ejemplo n.º 2
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
        }
Ejemplo n.º 3
0
        //
        public static void inputSeclectFind(ArrayList ArrayHH, ArrayList ArrayLH, int stt, int select, string ChucNang)
        {
            ConsoleKeyInfo input;
            int            top = 0;

            if (ChucNang == "Find HH" || ChucNang == "Find LH" || ChucNang == "Find")
            {
                top = 6;
            }
            while (true)
            {
                input = Console.ReadKey(true);
                switch (input.Key)
                {
                case ConsoleKey.UpArrow:
                    if (select == 0)
                    {
                        HienThi(ArrayHH, stt, select, top); break;
                    }
                    else
                    {
                        select--;
                        HienThi(ArrayHH, stt, select, top); break;
                    }

                case ConsoleKey.DownArrow:
                    if (select == ArrayHH.Count - 1)
                    {
                        HienThi(ArrayHH, stt, select, top); break;
                    }
                    else
                    {
                        select++;
                        HienThi(ArrayHH, stt, select, top); break;
                    }

                case ConsoleKey.Enter:
                    switch (ChucNang)
                    {
                    case "Delete HH":
                        Console.CursorVisible = false;
                        Delete.XoaHH(ref ArrayHH, ref ArrayLH, ChucNang, select);
                        return;

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

                    case "Find HH":
                        Console.CursorVisible = true;
                        Form.FormCommonFind("Hàng Hóa", select);
                        return;

                    case "Find LH":
                        return;
                    }
                    return;

                case ConsoleKey.Escape:
                    Console.CursorVisible = false;
                    Tittle.TieuDe();
                    ArrayHH = Program.DuLieuMauHangHoa();
                    ArrayLH = Program.DuLieuMauLoaiHang();
                    Select.LuaChonChinh(ref ArrayHH, ref ArrayLH, 3);
                    break;

                default:
                    inputSeclect(ref ArrayHH, ref ArrayLH, stt, select, ChucNang);
                    break;
                }
            }
        }
Ejemplo n.º 4
0
        //---switch dieu huong
        static void inputSeclect(ref ArrayList ArrayHH, ref ArrayList ArrayLH, int stt, int select, string ChucNang)
        {
            ConsoleKeyInfo input;

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

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

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

            case ConsoleKey.Enter:
                switch (ChucNang)
                {
                case "Delete HH":
                    Console.CursorVisible = false;
                    Delete.XoaHH(ref ArrayHH, ref ArrayLH, ChucNang, select);
                    return;

                case "Edit HH":
                    Console.CursorVisible = true;
                    Console.Clear();
                    Edit.SuaHH(ref ArrayHH, ref ArrayLH, ChucNang, select, 1);
                    return;
                    // case "Find HH":
                    //  Form.FormCommonFind("Hang hoa");
                    //  return;
                }
                return;

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

            default:
                inputSeclect(ref ArrayHH, ref ArrayLH, stt, select, ChucNang);
                break;
            }
        }
Ejemplo n.º 5
0
        //function second- hien thi item sua
        public static void SuaHH(ref ArrayList ArrayHH, ref ArrayList ArrayLH, string ChucNang, int index, int selected)
        {
            Struct.HOANGHOA item = (Struct.HOANGHOA)ArrayHH[index];
            Form.FormHangHoa("SỬA HÀNG HÓA");
            Console.ForegroundColor = ConsoleColor.White;
            Console.BackgroundColor = ConsoleColor.DarkYellow;
            Console.CursorTop       = 0;
            Console.CursorLeft      = 18;
            Console.WriteLine(" Lựa chọn [UP/DOWN] ");
            Console.CursorTop  = 0;
            Console.CursorLeft = 40;
            Console.WriteLine(" Select [ENTER] ");
            Console.CursorTop  = 0;
            Console.CursorLeft = 58;
            Console.WriteLine(" Home [ESC] ");
            Console.CursorTop       = 27;
            Console.CursorLeft      = 0;
            Console.ForegroundColor = ConsoleColor.White;
            Console.BackgroundColor = ConsoleColor.Blue;
            Console.WriteLine(" Crt + S để lưu lại.");
            FormEditItem(selected, item);
            bool loop = true;

            while (loop)
            {
                ConsoleKeyInfo input;
                input = Console.ReadKey(true);
                if ((input.Modifiers & ConsoleModifiers.Control) != 0 && input.Key == ConsoleKey.S)
                {
                    bool flagSave;
                    flagSave = Form.FormXacNhan(10, 40, 5, 40, ChucNang);
                    if (flagSave)
                    {
                        loop = false;
                        ArrayHH.RemoveAt(index);
                        ArrayHH.Insert(index, item);
                        Console.Clear();
                        Edit.SuaHangHoa(ref ArrayHH, ref ArrayLH);
                        return;
                    }
                    else
                    {
                        loop = false;
                        Console.ForegroundColor = ConsoleColor.Black;
                        Console.BackgroundColor = ConsoleColor.Gray;
                        Console.Clear();
                        SuaHH(ref ArrayHH, ref ArrayLH, ChucNang, index, selected);
                    }
                }
                switch (input.Key)
                {
                case ConsoleKey.UpArrow:
                    if (selected == 1)
                    {
                        selected = 8;
                    }
                    else
                    {
                        selected--;
                    }
                    BgSelectedItem(selected, ref item);
                    break;

                case ConsoleKey.DownArrow:
                    if (selected == 8)
                    {
                        selected = 1;
                    }
                    else
                    {
                        selected++;
                    }
                    BgSelectedItem(selected, ref item);
                    break;

                case ConsoleKey.Enter:
                    Console.CursorVisible = true;
                    item = EditItem(selected, ref item);
                    selected++;
                    BgSelectedItem(selected, ref item);
                    break;

                case ConsoleKey.Escape:
                    loop = false;
                    Console.CursorVisible = false;
                    Tittle.TieuDe();
                    Select.LuaChonChinh(ref ArrayHH, ref ArrayLH, 0);
                    break;

                default:
                    break;
                }
            }
        }