예제 #1
0
        public static void start_user_menu()
        {
strt:
            Console.Clear();
            Console.Clear();
            foreach (string h in punkt)
            {
                Console.WriteLine(h);
            }
            arrow_menu am  = new arrow_menu(punkt);
            int        num = am.keyss();


            switch (num)
            {
            case 0:
            {
                string strings;
                Console.Clear();
                Console.WriteLine("введите имя файла\n");
                string name = Console.ReadLine();
                Console.Clear();
                StreamReader sr = new StreamReader("..\\..\\..\\info\\" + name + ".txt");
                while (!sr.EndOfStream)
                {
                    strings = sr.ReadLine();
                    Console.WriteLine(strings);
                }
                Console.WriteLine("\n\nНажмине enter\n");
                Console.ReadKey();
                sr.Close();
                goto strt;
            }

            case 1:
            {
                break;
            }
            }
        }
예제 #2
0
        public static void start_admin_menu()
        {
strt:
            Console.Clear();
            foreach (string h in punkt)
            {
                Console.WriteLine(h);
            }
            arrow_menu am  = new arrow_menu(punkt);
            int        num = am.keyss();


            switch (num)
            {
            case 0:
            {
                try
                {
                    Console.Clear();
                    Console.WriteLine("введите имя файла\n");
                    string name = Console.ReadLine();
                    if (name == "0")
                    {
                        goto strt;
                    }
                    else
                    {
                        File.Create("..\\..\\..\\info\\" + name + ".txt");
                        Console.Clear();
                        Console.WriteLine("файл " + name + "удален!");
                        goto strt;
                    }
                }catch (Exception e)
                {
                    Console.WriteLine("ошибка: " + e.Message);
                    Thread.Sleep(1000);
                    goto strt;
                }
            }

            case 1:
            {
                try
                {
                    Console.Clear();
                    DirectoryInfo dir = new DirectoryInfo("..\\..\\..\\info\\");
                    foreach (var item in dir.GetFiles())
                    {
                        Console.WriteLine(item.Name);
                    }
                    Console.WriteLine("введите имя файла\n");
                    string       name = Console.ReadLine();
                    StreamWriter sw   = new StreamWriter("..\\..\\..\\info\\" + name + ".txt", true);
                    Console.Clear();
                    Console.WriteLine("введите текст, который будет добавлен\n");
                    string text = Console.ReadLine();
                    sw.WriteLine(text);
                    sw.Close();

                    goto strt;
                }catch (Exception e)
                {
                    Console.WriteLine("ошибка " + e.Message);
                    Thread.Sleep(1000);
                    goto strt;
                }
            }

            case 2:
                Console.Clear();
                DirectoryInfo dire = new DirectoryInfo("..\\..\\..\\info\\");
                foreach (var item in dire.GetFiles())
                {
                    Console.WriteLine(item.Name);
                }
                Console.Write("\n\n");
                Console.WriteLine("введите имя файла");
                try
                {
                    string   file_name = Console.ReadLine();
                    string[] strings   = File.ReadAllLines("..\\..\\..\\info\\" + file_name + ".txt");
                    Console.Clear();
                    for (int i = 0; i < strings.Length; i++)
                    {
                        Console.WriteLine(strings[i]);
                    }
                    Console.WriteLine("\n\nнажмите enter");
                    Console.ReadKey();
                    goto strt;
                }catch (Exception e)
                {
                    Console.Clear();
                    Console.WriteLine("ошибка: " + e.Message);
                    Thread.Sleep(1000);
                    goto strt;
                }

            case 3:
            {
                Console.Clear();
                DirectoryInfo dir = new DirectoryInfo("..\\..\\..\\info\\");
                foreach (var item in dir.GetFiles())
                {
                    Console.WriteLine(item.Name);
                }
                Console.Write("\n\n");
                Console.WriteLine("введите имя файла\n");
                string name = Console.ReadLine();
                try
                {
                    File.Delete("..\\..\\..\\info\\" + name + ".txt");

                    goto strt;
                }catch (Exception e)
                {
                    Console.Clear();
                    Console.WriteLine("ошибка: " + e.Message);
                    Thread.Sleep(1000);
                    goto strt;
                }
            }

            case 4:
            {
                string[]     users = File.ReadAllLines("..\\..\\..\\info\\users.txt");
                StreamWriter sw    = new StreamWriter("..\\..\\..\\info\\users.txt");
                Console.Clear();
                Console.WriteLine("имена пользователей");
                for (int i = 0; i < users.Length; i++)
                {
                    Console.WriteLine(users[i].Split(';')[0]);
                }
                Console.WriteLine("\nвведите имя пользователя");
                string name = Console.ReadLine();
                if (name == "0")
                {
                    goto strt;
                }
                else
                {
                    for (int i = 0; i < users.Length; i++)
                    {
                        string[] del_name = users[i].Split(';');
                        if (name != del_name[0])
                        {
                            sw.WriteLine(users[i]);
                        }
                    }

                    sw.Close();
                    goto strt;
                }
            }

            case 5:
                register.start_register_screen();
                goto strt;

            case 6:
                break;
            }
        }
예제 #3
0
        public static void start_skladmen_menu()
        {
strt:
            Console.Clear();
            foreach (string h in punkt)
            {
                Console.WriteLine(h);
            }
            arrow_menu am  = new arrow_menu(punkt);
            int        num = am.keyss();


            switch (num)
            {
            case 0:
            {
                Console.Clear();
                StreamWriter sw = new StreamWriter("..\\..\\..\\info\\sklad.txt", true);
                Console.WriteLine("введите товар, который будет добавлен\n");
                string text = Console.ReadLine();
                if (text == "0")
                {
                    goto strt;
                }
                else
                {
                    Console.WriteLine("введите кол-во товара\n");
                    string count = Console.ReadLine();
                    Console.WriteLine("введите цену товара\n");
                    int price = int.Parse(Console.ReadLine());
                    sw.WriteLine(text + ";" + count + ";" + price);
                    Console.Clear();
                    Console.WriteLine("товар добавлен!");
                    Thread.Sleep(1000);
                    sw.Close();
                    goto strt;
                }
            }

            case 1:
            {
                Console.Clear();
                string[] str = File.ReadAllLines("..\\..\\..\\info\\sklad.txt");
                for (int i = 0; i < str.Length; i++)
                {
                    Console.WriteLine(str[i]);
                }
                Console.ReadKey();
                goto strt;
            }

            case 2:
            {
                try
                {
                    Console.Clear();
                    string[] str = File.ReadAllLines("..\\..\\..\\info\\sklad.txt");
                    for (int i = 0; i < str.Length; i++)
                    {
                        Console.WriteLine(str[i]);
                    }
                    Console.WriteLine("\n\n");
                    Console.WriteLine("введите название товара, который будет спмсан");
                    string name = Console.ReadLine();
                    if (name == "0")
                    {
                        goto strt;
                    }
                    else
                    {
                        Console.WriteLine("введите кол-во товара");
                        int count = Convert.ToInt32(Console.ReadLine());

                        string[]     strs = File.ReadAllLines("..\\..\\..\\info\\sklad.txt");
                        StreamWriter sw   = new StreamWriter("..\\..\\..\\info\\sklad.txt");
                        for (int i = 0; i < strs.Length; i++)
                        {
                            string[] prodcou   = strs[i].Split(';');
                            int      prodcount = int.Parse(prodcou[1]);
                            if (strs[i].Split(';')[0] != name)
                            {
                                sw.WriteLine(strs[i]);
                            }
                            else if (((strs[i].Split(';')[0]) == name) && (count != prodcount))
                            {
                                sw.WriteLine(strs[i].Split(';')[0] + ";" + (prodcount - count));
                            }
                            else if ((strs[i] == name) && (count == prodcount))
                            {
                                Console.WriteLine("товар продан");
                                Thread.Sleep(1000);
                            }
                        }
                        sw.Close();
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine("ошибка: " + e.Message);
                    Thread.Sleep(1000);
                    goto strt;
                }
                goto strt;
            }

            case 3:
                break;
            }
        }
예제 #4
0
        public static void start_kadrovik_menu()
        {
strt:
            Console.Clear();
            foreach (string h in punkt)
            {
                Console.WriteLine(h);
            }
            arrow_menu am  = new arrow_menu(punkt);
            int        num = am.keyss();


            switch (num)
            {
            case 0:
            {
                string[] users = File.ReadAllLines("..\\..\\..\\info\\users.txt");
                Console.WriteLine("имена пользователей");
                for (int i = 0; i < users.Length; i++)
                {
                    Console.WriteLine(users[i].Split(';')[0]);
                }
                Console.Write("\n\npress enter\n");
                Console.ReadKey();
                goto strt;
            }

            case 1:
            {
                register.start_register_screen();
                goto strt;
            }

            case 2:
            {
                string[]     users = File.ReadAllLines("..\\..\\..\\info\\users.txt");
                StreamWriter sw    = new StreamWriter("..\\..\\..\\info\\users.txt");
                Console.Clear();
                Console.WriteLine("имена пользователей");
                for (int i = 0; i < users.Length; i++)
                {
                    Console.WriteLine(users[i].Split(';')[0]);
                }
                Console.WriteLine("\nвведите имя пользователя");
                string name = Console.ReadLine();
                if (name == "0")
                {
                    goto strt;
                }
                else
                {
                    for (int i = 0; i < users.Length; i++)
                    {
                        string[] del_name = users[i].Split(';');
                        if (name != del_name[0])
                        {
                            sw.WriteLine(users[i]);
                        }
                    }
                    Console.Clear();
                    Console.WriteLine("пользователь " + name + " удален!");
                    Thread.Sleep(1000);
                    sw.Close();
                    goto strt;
                }
            }

            case 3:
                break;
            }
        }
예제 #5
0
        public static void start_buh_menu()
        {
strt:
            Console.Clear();
            foreach (string h in punkt)
            {
                Console.WriteLine(h);
            }
            arrow_menu am  = new arrow_menu(punkt);
            int        num = am.keyss();


            switch (num)
            {
            case 0:
            {
                string strings;
                Console.Clear();
                Console.WriteLine("введите имя пользователя\n");
                string name = Console.ReadLine();
                if (name == "0")
                {
                    goto strt;
                }
                else
                {
                    Console.Clear();
                    StreamReader sr = new StreamReader("..\\..\\..\\info\\users.txt");
                    while (!sr.EndOfStream)
                    {
                        strings = sr.ReadLine();
                        if ((strings.Split(';')[0]) == name)
                        {
                            string[] str = strings.Split(';');
                            Console.WriteLine(str[0] + " " + str[3]);
                        }
                    }
                    Console.WriteLine("\n\nНажмине enter\n");
                    Console.ReadKey();
                    sr.Close();
                    goto strt;
                }
            }

            case 1:
            {
                Console.Clear();
                Console.WriteLine("введите имя пользователя\n");
                string name = Console.ReadLine();
                Console.Clear();
                Console.WriteLine("\nвведите сумму\n");
                int amount = Convert.ToInt32(Console.ReadLine());
                Console.Clear();
                if (name == "0")
                {
                    goto strt;
                }
                else
                {
                    string[]     strs = File.ReadAllLines("..\\..\\..\\info\\users.txt");
                    StreamWriter sw   = new StreamWriter("..\\..\\..\\info\\users.txt");
                    for (int i = 0; i < strs.Length; i++)
                    {
                        if ((strs[i].Split(';')[0]) == name)
                        {
                            string[] res = strs[i].Split(';');
                            sw.WriteLine(res[0] + ";" + res[1] + ";" + res[2] + ";" + amount);
                        }
                        else
                        {
                            sw.WriteLine(strs[i]);
                        }
                    }

                    sw.Close();
                    goto strt;
                }
            }

            case 2:
                Console.Clear();
                string[]     users  = File.ReadAllLines("..\\..\\..\\info\\users.txt");
                string[]     bank   = File.ReadAllLines("..\\..\\..\\info\\bank.txt");
                StreamWriter writer = new StreamWriter("..\\..\\..\\info\\users.txt");
                int          summ   = int.Parse(bank[0]);
                int          colvo  = summ / users.Length - 1;
                for (int i = 0; i < users.Length; i++)
                {
                    if (users[i].Split(';')[0] == "root")
                    {
                        writer.WriteLine(users[i]);
                    }
                    else
                    {
                        writer.WriteLine(users[i].Split(';')[0] + ";" + users[i].Split(';')[1] + ";" + users[i].Split(';')[2] + ";" + (int.Parse(users[i].Split(';')[3])) + (int)colvo);
                    }
                }
                goto strt;

            case 3:
                break;
            }
        }