Ejemplo n.º 1
0
 def filter(cls, socket):
     while True:
         choice = menu(
             title="Фильтрация по заказам",
             options=[
                 "По id",
                 "По услуге",
                 "По покупателю",
                 "По количеству",
                 "Вывод",
             ],
         )
         if choice == "1":
             send(socket=socket, data=choice)
             obj = {
                 "min": integer_input("Введите минимальный id"),
                 "max": integer_input("Введите максимальный id"),
             }
             while int(obj["min"]) > int(obj["max"]):
                 print(
                     "Минимальное значение не должно быть больше максимального"
                 )
                 obj = {
                     "min": integer_input("Введите минимальный id"),
                     "max": integer_input("Введите максимальный id"),
                 }
             send(socket=socket, data=obj)
         elif choice == "2":
             send(socket=socket, data=choice)
             clear()
             receive_and_print(socket=socket)
             send(socket=socket, data=integer_input("Введите id услуги"))
         elif choice == "3":
             send(socket=socket, data=choice)
             clear()
             receive_and_print(socket=socket)
             send(socket=socket,
                  data=integer_input("Введите id покупателя"))
         elif choice == "4":
             send(socket=socket, data=choice)
             obj = {
                 "min": integer_input("Введите минимальное количество"),
                 "max": integer_input("Введите максимальное количество"),
             }
             while int(obj["min"]) > int(obj["max"]):
                 print(
                     "Минимальное значение не должно быть больше максимального"
                 )
                 obj = {
                     "min": integer_input("Введите минимальное количество"),
                     "max":
                     integer_input("Введите максимальное количество"),
                 }
             send(socket=socket, data=obj)
         elif choice == "5":
             send(socket=socket, data=choice)
             cls.print(socket=socket)
         elif choice == "6":
             send(socket=socket, data=BREAK)
             break
Ejemplo n.º 2
0
 def edit(cls, socket):
     clear()
     receive_and_print(socket=socket)
     id_ = integer_input("Введите id")
     send(socket=socket, data=id_)
     response = receive(socket=socket)
     if response == GOOD:
         while True:
             choice = menu(title="Изменение услуги",
                           options=["Название", "Цену"])
             if choice == "1":
                 send(socket=socket, data=choice)
                 name = string_input("Введите название")
                 send(socket=socket, data=name)
                 print("Успешно изменено")
                 enter_to_continue()
             elif choice == "2":
                 send(socket=socket, data=choice)
                 price = integer_input("Введите цену")
                 send(socket=socket, data=price)
                 print("Успешно изменено")
                 enter_to_continue()
             elif choice == "3":
                 send(socket=socket, data=BREAK)
                 break
     else:
         print("Неверный id")
         enter_to_continue()
Ejemplo n.º 3
0
 def delete(cls, socket):
     clear()
     receive_and_print(socket=socket)
     id_ = integer_input("Введите id")
     send(socket=socket, data=id_)
     response = receive(socket=socket)
     if response == GOOD:
         print("Проблема удалена")
     else:
         print("Неверный id")
     enter_to_continue()
Ejemplo n.º 4
0
 def add(cls, socket):
     clear()
     receive_and_print(socket=socket)
     service_id = integer_input("Введите id заказываемой услуги")
     send(socket=socket, data=service_id)
     response = receive(socket=socket)
     if response == ERROR:
         print("Неверный id")
     else:
         quantity = integer_input("Введите количество")
         send(socket=socket, data=quantity)
         print("Заказ добавлен успешно")
     enter_to_continue()
Ejemplo n.º 5
0
    def vote(cls, socket):
        clear()
        receive_and_print(socket=socket)
        id_ = integer_input("Введите id")

        send(socket=socket, data=id_)
        decisions = receive(socket=socket)
        if decisions == ERROR:
            print("Неверный id")
            enter_to_continue()
            return
        clear()
        decisions = loads(decisions)
        for id in decisions:
            assessment = max_min_10_input(
                f"Введите оценку решению от одного до 10\n {decisions[id]}")
            decisions[id] = int(assessment)
            clear()
        send(socket=socket, data=decisions)
        print("Спасибо, ваши голоса будут учитаны")
        enter_to_continue()
Ejemplo n.º 6
0
    def print(cls, socket):
        clear()
        choice = type_of_output_input(
            "1. Проблемы с неоконченным голосованием\n"
            "2. Проблемы с оконченным голосованием")
        if choice == "1":
            send(socket=socket, data=choice)
            clear()
            receive_and_print(socket=socket)
            enter_to_continue()
        elif choice == "2":
            clear()
            send(socket=socket, data=choice)
            clear()
            receive_and_print(socket=socket)
            send(
                socket=socket,
                data=integer_input(
                    "Введите id проблемы для детального просмотра"),
            )
            response = receive(socket=socket)
            if response == ERROR:
                print("Неверный id")
                enter_to_continue()
                return
            receive_and_print(socket=socket)

            enter_to_continue()
Ejemplo n.º 7
0
 def print_voted(cls, socket):
     clear()
     receive_and_print(socket=socket)
     enter_to_continue()