Esempio n. 1
0
 def Regis(self):
     aty=inputs(" login : "******"parol: ")
     user = module.User()
     user.is_client=True
     user.add(aty,parol)
     settings.CURRENT_USER_ROLE='Client'
Esempio n. 2
0
def do10(san):
    on_set = set('0123456789')
    engiz_set = set(san)
    if len(engiz_set - on_set) == 0 and san != '':
        print('''Таңда!!! 
                        1- 10>>2
                        2- 10>>8
                        3- 10>>16
                        4- +
                        5- -
                        6- *
                        7- /
                        0-quit''''')
        while True:
            tandau = inputs('\nТаңдауыңды енгіз:')
            if tandau == '1':
                n102(san)
            elif tandau == '2':
                n108(san)
            elif tandau == '3':
                n1016(san)
            elif tandau=='0':
                print('------------------------')
                break
            elif tandau=='4':
                while True:
                    san1 = inputs('1Сан енгізіңіз:')
                    engiz_set1= set(san1)
                    if len(engiz_set1 - on_set) == 0 and san1 != '':
                        print(add(san,san1))
                        break
            elif tandau=='5':
                while True:
                    on_set = set('0123456789')
                    san1 = inputs('1Сан енгізіңіз:')
                    engiz_set1 = set(san1)
                    if len(engiz_set1 - on_set) == 0 and san1 != '':
                        print(minus(san, san1))
                        break
            elif tandau=='6':
                while True:
                    on_set = set('0123456789')
                    san1 = inputs('1Сан енгізіңіз:')
                    engiz_set1 = set(san1)
                    if len(engiz_set1 - on_set) == 0 and san1 != '':
                        print(multiply(san, san1))
                        break
            elif tandau=='7':
                while True:
                    on_set = set('0123456789')
                    san1 = inputs('1Сан енгізіңіз:')
                    engiz_set1 = set(san1)
                    if len(engiz_set1 - on_set) == 0 and san1 != '':
                        print(division(san, san1))
                        break
Esempio n. 3
0
def staff():
    product_list=[]
    global product_list
    while True:
        print('1-списокке жаңа тауар қосу, 2-бағаларын өзгерту,3-барлық тауарлaрды көру,0-шығу:')
        tandau = inputi('Таңдаңыз'.center(40,'-'))
        if tandau == 1:
            while True:
                product = inputs('Қандай продукты енгізгіңіз келеді? Атын енгізіңіз:')
                price = inputi('Продуктының бағасы:')
                product_list.append((product, price))
                with open('1mall.txt', 'w+') as fil:
                    for i, item in enumerate(product_list):
                        fil.write(str(i) + '\t' + str(item) + '\n')
                surak = inputs("Тізімге жаңа продукт енгізесіз бе? ok -жалғастыру үшін, q -тоқтату үшін :")
                if surak == 'q':
                    break
                elif surak == 'ok':
                    pass
                else:
                    print('Kaita engiz!')
        elif tandau == 2:
            product_list1 = []
            new = []
            for i in product_list:
                new.append(list(i))
            while True:
                surak = inputs("Өзгерту үшін-ok , тоқтау үшін -q: :")
                if surak == 'ok':
                    prod_index = inputi('Қай продуктыны өзгерткіңіз келeді?: ')
                    if prod_index < len(product_list) and prod_index >= 0:
                        prod_item = new[prod_index]
                        print(prod_item[0], end=' ')
                        change_price = inputi('Продуктың жаңа бағасы:')
                        prod_item[1] = change_price
                        for i in new:
                            product_list1.append(tuple(i))
                        product_list = product_list1
                        with open('1mall.txt','w+') as f:
                            for i, item in enumerate(product_list):
                                f.write(str(i) + '\t' + str(item) + '\n')
                    else:
                        print(f" {prod_index} -Өкінішке орай сіз қателестіңіз, бұндай продукт жоқ! ")
                elif surak == 'q':
                    break
                def change():
                    with open('1mall.txt', 'w+') as fil:
                        for i, item in enumerate(product_list):
                            fil.write(str(i) + '\t' + str(item) + '\n')
                change()

        elif tandau==3:
            with
    return product_list
Esempio n. 4
0
    def Registration(self):
        settings.CURRENT_USER_ROLE = ''
        view.Home().welcome()
        while True:
            t = inputs('Registration -1, login-2:')
            if t == '1':
                settings.CURRENT_USER_ROLE = ''
                usr = inputs('username:'******'password:'******'data/users.txt', 'r') as f:
                    data = f.read().split('\n')
                    data.pop()
                    for i in data:
                        a = i.split(',')
                        f_list.append(a)
                    for i in range(len(f_list)):
                        if f_list[i][0] == usr and f_list[i][
                                1] == pwd and f_list[i][3] == 'True':
                            print('bul account saitta tirkelgen')
                            self.Registration()
                        elif f_list[i][0] == usr and f_list[i][
                                1] == pwd and f_list[i][5] == 'True':
                            print('bul account siteta tirkelgen')
                            self.Registration()
                        elif f_list[i][0] == usr and f_list[i][
                                1] == pwd and f_list[i][6] == 'True':
                            print('bul account siteta tirkelgen')
                            self.Registration()
                        elif f_list[i][0] == usr and f_list[i][
                                1] == pwd and f_list[i][4] == 'True':
                            print('bul account siteta tirkelgen')
                            self.Registration()

                    if usr != '' and pwd != '':
                        user = module.User()
                        user.is_client = True
                        user.add(usr, pwd)
                        settings.CURRENT_USER_ROLE = 'Client'
                        settings.CURRENT_USER = usr
                        self.log(usr, pwd, settings.CURRENT_USER_ROLE)
                        self.client()
                    else:
                        print('Енгізген аккаунт қате, дұрыстап енгізіңіз!')

            elif t == '2':
                self.login()
Esempio n. 5
0
 def run(self):
     print("Running the AzatAI Python Shop system self checking")
     self.system_check()
     self.prepare_file()
     if self.fr is False: # super admin already exist
         print("In the case super admin already exist")
         # TODO
     else:
         home = view.Home()
         home.superadmin()
         user_name = inputs('Please input a username for SUPERADMIN:\n')
         user_pw = inputs(f'Please input a password for SUPERADMIN {user_name}:\n')
         user = module.User()
         user.is_admin = True
         user.add(user_name,user_pw)
         settings.SUPER_ADMIN = user_name
         settings.SUPER_ADMIN_PW = user_pw
         settings.CURRENT_USER = user_name
         settings.CURRENT_USER_ROLE = "ADMIN"
         self.admin()
Esempio n. 6
0
 def login(self):
     f_list=[]
     while True:
         username=inputs('username: '******'password: '******'data/users.txt','r') as f:
             d=f.read().split('\n')
             d.pop()
         for i in d:
             f1=i.split(',')
             f_list.append(f1)
         for item in range(len(f_list)):
                 if f_list[item][0] ==username and f_list[item][1] ==pwd and f_list[item][3]=='True':
                     time_format  = "%Y-%m-%d %X %A %B %p %r"
                     time_current = time.strftime(time_format)
                     with open('data/log.txt','a') as f:
                         f.write(f"{'Кірген уақыты : '}{f_list[item][0]}: {'Admin'}: {time_current}")
                         f.write('\n')
                     self.admin()
                 elif f_list[item][0] ==username and f_list[item][1] ==pwd and f_list[item][5]=='True':
                     time_format  = "%Y-%m-%d %X %A %B %p %r"
                     time_current = time.strftime(time_format)
                     with open('data/log.txt','a') as f:
                         f.write(f"{'Кірген уақыты : '}{f_list[item][0]}: {'Client'}: {time_current}")
                         f.write('\n')
                     self.Client()
                 elif f_list[item][0] ==username and f_list[item][1] ==pwd and f_list[item][4]=='True':
                     time_format  = "%Y-%m-%d %X %A %B %p %r"
                     time_current = time.strftime(time_format)
                     with open('data/log.txt','a') as f:
                         f.write(f"{'Кірген уақыты : '}{f_list[item][0]}: {'Staff'}: {time_current}")
                         f.write('\n')
                     self.staff()
                 elif f_list[item][0] ==username and f_list[item][1] ==pwd and f_list[item][6]=='True':
                     time_format  = "%Y-%m-%d %X %A %B %p %r"
                     time_current = time.strftime(time_format)
                     with open('data/log.txt','a') as f:
                         f.write(f"{'Кірген уақыты : '}{f_list[item][0]}: {'Manager'}: {time_current}")
                         f.write('\n')
                     self.manager()
Esempio n. 7
0
 def logout(self):
     while True:
         settings.CURRENT_USER_ROLE=""
         home_admin = view.Home()
         home_admin.welcome()
         k=inputs("Registration '1' and Login '2'")
         if k=='1' and settings.FIRST_RUN==True:
             self.Regis()
             self.Client()
         elif k=='2':
             self.login()
         else:
             print('kayta engiz')
Esempio n. 8
0
 def login(self):
     usr = inputs('username:'******'password:'******'data/users.txt', 'r') as f:
         data = f.read().split('\n')
         data.pop()
         for i in data:
             a = i.split(',')
             f_list.append(a)
         for i in range(len(f_list)):
             if f_list[i][0] == usr and f_list[i][1] == pwd and f_list[i][
                     3] == 'True':
                 settings.CURRENT_USER_ROLE = 'Admin'
                 settings.CURRENT_USER = usr
                 self.log(usr, pwd, settings.CURRENT_USER_ROLE)
                 self.admin()
             elif f_list[i][0] == usr and f_list[i][1] == pwd and f_list[i][
                     5] == 'True':
                 settings.CURRENT_USER_ROLE = 'Client'
                 settings.CURRENT_USER = usr
                 self.log(usr, pwd, settings.CURRENT_USER_ROLE)
                 self.client()
             elif f_list[i][0] == usr and f_list[i][1] == pwd and f_list[i][
                     6] == 'True':
                 settings.CURRENT_USER_ROLE = 'Manager'
                 settings.CURRENT_USER = usr
                 self.log(usr, pwd, settings.CURRENT_USER_ROLE)
                 self.manager()
             elif f_list[i][0] == usr and f_list[i][1] == pwd and f_list[i][
                     4] == 'True':
                 settings.CURRENT_USER_ROLE = 'Staff'
                 settings.CURRENT_USER = usr
                 self.log(usr, pwd, settings.CURRENT_USER_ROLE)
                 self.staff()
         else:
             print('сіз бұл сайтқа тіркелмегенсіз')
             self.Registration()
Esempio n. 9
0
def tanu():
    while True:
        byn_set = set('10')
        san_set8 = set('01234567')
        on_set=set('0123456789')
        hex_set=set('0xABCDEF123456789')
        san=inputs('Сан енгізіңіз:')
        engiz_set = set(san)
        if len(engiz_set - byn_set) == 0 and san != '':
            do2(san)
        elif len(engiz_set - san_set8) == 0 and san != '':
            do8(san)
        elif len(engiz_set - on_set) == 0 and san != '':
            do10(san)
        elif len(engiz_set-hex_set)==0 and san!='':
            do16(san)
Esempio n. 10
0
def manager():
    while True:
        print(
            '1-барлық продукты тізімін көру,2-тізімнен продуктыны өшіру, 3-сатылған продуктылардың тізімін көру, 4-табыс, 0-шығу:'
        )
        tandau = inputi('Tandanyz'.center(40, '-'))
        if tandau == 1:
            with open('1mall.txt', 'r') as f:
                print(f.read())
        elif tandau == 2:
            while True:
                n2 = []
                with open('1mall.txt', 'r') as fi8:
                    data = fi8.read()
                    data_split = data.split('\n')
                    for i in data_split:
                        i3 = i.split('-')
                        n2.append(tuple(i3))
                n2.pop()
                for index, item in enumerate(n2):
                    print(index, item)
                engiz = inputs('Жалғастыру үшін-ok , тоқтау үшін -q: ')
                if engiz == 'ok':
                    tandau1 = inputi('Тізімдегі қай продуктыны өшіресіз? ')
                    if tandau1 >= 0 and tandau1 < len(n2):
                        n2.remove(n2[tandau1])
                        with open('1mall.txt', 'w') as d5:
                            for i in n2:
                                d5.write(i[0] + '-' + i[1] + '\n')
                    else:
                        print('Бұндай продукты тізімде жоқ!')
                elif engiz == 'q':
                    break
        elif tandau == 3:
            with open('zakaz.txt', 'r') as z:
                print(z.read())
        elif tandau == 0:
            break
        else:
            print('Қайта енгіз')
Esempio n. 11
0
    def manager(self):
        view.Home().welcome()
        while True:
            tanda = inputs('1-Жалғастыру, 2-loqout , 3-басты бет \n')
            if tanda == '1':
                view.Home().welcome()
                while True:
                    tandau = inputi(
                        '1-барлық продукты тізімін көру,2-тізімнен продуктыны өшіру, 3-сатылған продуктылардың тізімін көру, 4-басты бет, 5-logout:'
                    )
                    if tandau == 1:
                        with open('1mall.txt', 'r') as f:
                            print(f.read())
                        while True:
                            engiz4 = inputs(
                                ' басты бетке оралу -q, logout -1, артқа қайту-2: '
                            )
                            if engiz4 == 'q':
                                self.manager()
                            elif engiz4 == '1':
                                self.managerlogout()
                            elif engiz4 == '2':
                                break
                    elif tandau == 2:
                        n2 = []
                        with open('1mall.txt', 'r') as fi8:
                            data = fi8.read()
                            data_split = data.split('\n')
                            for i in data_split:
                                i3 = i.split('-')
                                n2.append(tuple(i3))
                        n2.pop()
                        for index, item in enumerate(n2):
                            print(index, item)
                        while True:
                            engiz = inputs(
                                'Жалғастыру үшін-ok , басты бет -q, logout -1,  артқа қайту-2: '
                            )
                            if engiz == 'ok':
                                tandau1 = inputi(
                                    'Тізімдегі қай продуктыны өшіресіз? ')
                                if tandau1 >= 0 and tandau1 < len(n2):
                                    n2.remove(n2[tandau1])
                                    with open('1mall.txt', 'w') as d5:
                                        for i in n2:
                                            d5.write(i[0] + '-' + i[1] + '\n')
                                    break
                                else:
                                    print('Бұндай продукты тізімде жоқ!')
                            elif engiz == 'q':
                                self.manager()
                            elif engiz == '1':
                                self.managerlogout()
                            elif engiz == '2':
                                break
                    elif tandau == 3:
                        with open('zakaz.txt', 'r') as z:
                            print(z.read())
                            while True:
                                engiz4 = inputs(
                                    ' басты бетке оралу -q, logout -1,артқа қайту -2: '
                                )
                                if engiz4 == 'q':
                                    self.manager()
                                elif engiz4 == '1':
                                    self.managerlogout()
                                elif engiz4 == '2':
                                    break
                    elif tandau == 4:
                        self.manager()
                    elif tandau == 5:
                        self.managerlogout()

            elif tanda == '2':
                self.managerlogout()
            elif tanda == '3':
                self.manager()
Esempio n. 12
0
    def admin(self):
        while True:
            f_list=[]
            user = module.User()
            user.is_admin=True
            settings.CURRENT_USER_ROLE="ADMIN"
            home_admin = view.Home()
            home_admin.welcome()
            admin_choice = inputi("Please select your choice: logout - '1' , adamdar tizimin korginiz kelse - '2', adamdar kirgen jane wikkan uakiti-'3' : ")
            if admin_choice==1:
                view.Home()
                k=inputs("Registration '1' and Login '2'")
                if k=='1':
                    self.Regis()
                    self.Client()
                elif k=='2':
                    self.login()
            elif admin_choice==2:
                print("index, Login, Password, Create date,                                   admin, staff, client, manager")
                with open('data/users.txt','r') as f:
                    d=f.read().split('\n')
                    d.pop()
                for i in d:
                    f1=i.split(',')
                    f_list.append(f1)
                for index,each in enumerate(f_list):
                    print(index,each)
                # for index,item  in enumerate(range(len(f_list))):
                #     if f_list[item][5]=="True":
                #         print(index,f_list[item])
                oz=inputi(' Адам статусын өзгерткіңіз келсе "1", logout -- "2" ,basty bet -"3" : ')
                if oz==1:
                    try:
                        if len(f_list)>1:
                                x=inputi('Өзгертетін адамның index енгізіңіз: ')
                                while True:
                                        q=inputi('''Client-->Staff = '1',  Client-->manager = '2'
                                        Staff-->Manager = '3': ''')
                                        for index,i in enumerate(range(len(f_list))):
                                            if q==1 and f_list[i][5]=="True":
                                                    if x==index:
                                                        user = module.User()
                                                        f_list[i][4]='True'
                                                        user.is_staff=True
                                                        f_list[i][5]='False'
                                                        user.is_client=False
                                                        f_list.insert(x,f_list[x])
                                                        del f_list[x+1]
                                                        print("index, Login, Password, Create date,                                  admin, staff, client, manager")
                                                        for index, i1 in enumerate(range(len(f_list))):
                                                                print(index,f_list[i1])
                                                                with open('data/users.txt','w') as f:
                                                                    for i2 in range(len(f_list)):
                                                                        f.write(str(f_list[i2][0])+','+ str(f_list[i2][1])+','+ str(f_list[i2][2])+','+str(f_list[i2][3])+','+str(f_list[i2][4])+','+str(f_list[i2][5])+','+str(f_list[i2][6])+'\n')
                                                    g=inputs('logout "1", basty bet "2" , zhalgastiru "3" : ')
                                                    home_admin.list_user(3)
                                                    if g=='1':
                                                        self.end()
                                                        view.Home()
                                                        self.logout()
                                                    elif g=='2':
                                                        self.admin()
                                                    elif g=='3':
                                                        pass

                                            elif q==2 and f_list[i][5]=="True":
                                                    if x==index:
                                                        user = module.User()
                                                        f_list[i][6]='True'
                                                        user.is_manager=True
                                                        f_list[i][5]='False'
                                                        user.is_client=False
                                                        f_list.insert(x,f_list[x])
                                                        del f_list[x+1]
                                                        print("index, Login, Password, Create date,                                  admin, staff, client, manager")
                                                        for index, i1 in enumerate(range(len(f_list))):
                                                                print(index,f_list[i1])
                                                                with open('data/users.txt','w') as f:
                                                                    for i2 in range(len(f_list)):
                                                                        f.write(str(f_list[i2][0])+','+ str(f_list[i2][1])+','+ str(f_list[i2][2])+','+str(f_list[i2][3])+','+str(f_list[i2][4])+','+str(f_list[i2][5])+','+str(f_list[i2][6])+'\n')
                                                    g=inputs('logout "1", basty bet "2", Zhalgastiru "3" : ')
                                                    home_admin.list_user(3)
                                                    if g=='1':
                                                        self.end()
                                                        view.Home()
                                                        self.logout()
                                                    elif g=='2':
                                                        self.admin()
                                                    elif g=='3':
                                                        pass

                                            elif q==3 and f_list[i][4]=="True":
                                                    if x==index:
                                                            user = module.User()
                                                            f_list[i][6]='True'
                                                            user.is_manager=True
                                                            f_list[i][4]='False'
                                                            user.is_staff=False
                                                            f_list.insert(x,f_list[x])
                                                            del f_list[x+1]
                                                            print("index, Login, Password, Create date,                                  admin, staff, client, manager")
                                                            for index, i1 in enumerate(range(len(f_list))):
                                                                    print(index,f_list[i1])
                                                                    with open('data/users.txt','w') as f:
                                                                        for i2 in range(len(f_list)):
                                                                            f.write(str(f_list[i2][0])+','+ str(f_list[i2][1])+','+ str(f_list[i2][2])+','+str(f_list[i2][3])+','+str(f_list[i2][4])+','+str(f_list[i2][5])+','+str(f_list[i2][6])+'\n')

                                                    g=inputs('logout "1", basty bet "2" , Zhalgastiru "2": ')
                                                    home_admin.list_user(3)
                                                    if g=='1':
                                                        self.end()
                                                        view.Home()
                                                        self.logout()
                                                    elif g=='2':
                                                        self.admin()
                                                    elif g=='3':
                                                        pass

                                            elif q not in [1,2,3] and f_list[i][4]!="True" and f_list[i][5]!="True" and f_list[i][6]!="True":
                                                while True:
                                                    print(" Ozgeris zhasalmaidy , tomendegi nuskalardy tandaniz ")
                                                    g=inputs(' logout - "1", basty bet- "2" , zhalgastirgin kelse - "3" ')
                                                    home_admin.list_user(3)
                                                    if g=='1':
                                                        self.end()
                                                        self.logout()
                                                    elif g=='2':
                                                        self.admin()
                                                    elif g=='3':
                                                        pass






                        else:
                                    print(' Сайтқа тіркелген адам табылмады ')
                                    g=inputs(' logout - "1", basty bet- "2" ')
                                    home_admin.list_user(3)
                                    if g=='1':
                                        self.end()
                                        self.logout()
                                    elif g=='2':
                                        self.admin()

                    except(ValueError):
                        pass
                elif oz==2:
                        self.end()
                        view.Home()
                        self.logout()
                elif oz==3:
                        self.admin()


            elif admin_choice==3:
                while True:
                    with open('data/log.txt','r') as f:
                        d=f.read().split('\n')
                        d.pop()
                    for i in d:
                        f1=i.split(',')
                        f_list.append(f1)
                    for index,each in enumerate(f_list):
                        print(index,each)
                    g=inputs(' logout - "1", basty bet- "2" ')
                    home_admin.list_user(3)
                    if g=='1':
                        self.end()
                        self.logout()
                    elif g=='2':
                        self.admin()
                                        
Esempio n. 13
0
 def manager(self):
      while True:
         user = module.User()
         user.is_manager=True
         settings.CURRENT_USER_ROLE="Manager"
         home_admin = view.Home()
         home_admin.welcome()
         sh=inputs(' жалғастырғыңыз келсе "1" ,  logout "2" , basty bet "3" : ')
         if sh=='1':
            while True:
             q=inputs('''тауарларды көргіңіз келсе "1" , сатылған тауарды көргіңіз келсе "2", тауардың бірін өшіргіңіз келсе "3", logout "4" , basty bet "5" : ''')
             if q=='1':
                 new_tauar=[]
                 with open('tauarlar_tizimi.txt','r+') as e:
                     r=e.read()
                     r_split=r.split('\n')
                     r_split.pop()
                 for each in r_split:
                     r2_split=each.split("-")
                     new_tauar.append(tuple(r2_split))
                 for index,item in enumerate(new_tauar):
                     print(index,item)
             elif q=='2':
                 with open('tauarr','r') as f:
                         g=f.read()
                         print(g)
             elif q=='3':
                 new_tauar=[]
                 new1_tauar=[]
                 with open('tauarlar_tizimi.txt','r+') as e:
                     r=e.read()
                     r_split=r.split('\n')
                     r_split.pop()
                 for each in r_split:
                     r2_split=each.split("-")
                     new_tauar.append(tuple(r2_split))
                 for index,item in enumerate(new_tauar):
                     print(index,item)
                 x=inputi(" Жоятын тауар номерін енгізіңіз : ")
                 for index,item in enumerate(new_tauar):
                     if x==index:
                         new_tauar.remove(new_tauar[index])
                         for each in new_tauar:
                             new1_tauar.append(each)
                         for index,i1 in enumerate(new1_tauar):
                             print(index,i1)
                         with open('tauarlar_tizimi.txt','w') as f:
                             for i in new1_tauar:
                                 f.write(str(i[0])+ '-' +str(i[1]) +'\n')
             elif q=='4':
                 self.end()
                 view.Home()
                 self.logout()
             elif q=='5':
                 self.manager()
         elif sh=='2':
             self.end()
             view.Home()
             self.logout()
         elif sh=='3':
             self.manager()
Esempio n. 14
0
    def staff(self):
        while True:
            user = module.User()
            user.is_staff=True
            settings.CURRENT_USER_ROLE="Staff"
            home_admin = view.Home()
            home_admin.welcome()
            sh=inputs(' жалғастырғыңыз келсе "1" ,  logout "2" , basty bet "3" : ')
            if sh=='1':
                while True:
                        q=inputs(' тауарларды көргіңіз келсе "1" , тауар қосқыңыз келсе "2", тауар бағасын өзгерткіңіз келсе "3" , logout "4" , basty bet "5" : ')
                        if q=='1':
                            new_tauar=[]
                            with open('tauarlar_tizimi.txt','r+') as e:
                                r=e.read()
                                r_split=r.split('\n')
                                r_split.pop()
                            for each in r_split:
                                r2_split=each.split("-")
                                new_tauar.append(tuple(r2_split))
                            for index,item in enumerate(new_tauar):
                                print(index,item)
                        elif q=='2':
                            new_tauar=[]
                            with open('tauarlar_tizimi.txt','r+') as e:
                                r=e.read()
                                r_split=r.split('\n')
                                r_split.pop()
                            for each in r_split:
                                r2_split=each.split("-")
                                new_tauar.append(tuple(r2_split))
                            for index,item in enumerate(new_tauar):
                                print(index,item)
                            while True:
                                t_engizu=inputs(' тауар енгізгіңіз келсе "1" , тоқтатқыңыз келсе "2": ')
                                if t_engizu=='1':
                                    t_list=[]
                                    tauar_aty=inputs(" тауар атын енгізіңіз : ")
                                    tauar_bagasy=inputf(" тауар бағасын енгізіңіз : ")
                                    t_list.append(tauar_aty)
                                    t_list.append(tauar_bagasy)
                                    new_tauar.append(tuple(t_list))
                                    for index,i in enumerate(new_tauar):
                                        print(index,i)
                                    with open('tauarlar_tizimi.txt','w') as f:
                                        for i in new_tauar:
                                            f.write(str(i[0])+ '-' +str(i[1]) +'\n')
                                elif t_engizu=='2':
                                    break
                        elif q=='3':
                            new_tauar=[]
                            with open('tauarlar_tizimi.txt','r+') as e:
                                r=e.read()
                                r_split=r.split('\n')
                                r_split.pop()
                            for each in r_split:
                                r2_split=each.split("-")
                                new_tauar.append(tuple(r2_split))
                            for index,item in enumerate(new_tauar):
                                print(index,item)

                            x=inputi(" Өзгертетін тауар нөмірін енгізіңіз : ")
                            for index,i in enumerate(new_tauar):
                                if x==index:
                                    tauar_bagasi=inputs(" тауар бағасын енгізіңіз : ")
                                    e=list(new_tauar[x])
                                    e[1]=tauar_bagasi
                                    e1=tuple(e)
                                    new_tauar.insert(x,e1)
                                    del new_tauar[x+1]
                                    for index, i in enumerate(new_tauar):
                                        print(index,i)
                                    with open('tauarlar_tizimi.txt','w') as f:
                                        for i in new_tauar:
                                            f.write(str(i[0])+ '-' +str(i[1]) +'\n')
                        elif q=='4':
                            self.end()
                            view.Home()
                            self.logout()
                        elif q=='5':
                            self.staff()
            elif sh=='2':
                    self.end()
                    view.Home()
                    self.logout()
            elif sh=='3':
                self.staff()
Esempio n. 15
0
 def Client(self):
     while True:
                 user = module.User()
                 user.is_client=True
                 settings.CURRENT_USER_ROLE="Client"
                 home_admin = view.Home()
                 home_admin.welcome()
                 tauar_tizim=[]
                 new_tauar=[]
                 with open('tauarlar_tizimi.txt','r+') as e:
                     r=e.read()
                     r_split=r.split('\n')
                     r_split.pop()
                 for each in r_split:
                     r2_split=each.split("-")
                     new_tauar.append(tuple(r2_split))
                 for index,item in enumerate(new_tauar):
                     print(index,item)
                 while True:
                     sh=inputs(' жалғастырғыңыз келсе "1" ,  logout "2", basty bet "3" : ')
                     if sh=='1':
                         sum_list=[]
                         sum=0
                         st=True
                         karzhy=inputi(" Қаржы көлемін енгізіңіз : ")
                         while True:
                             for index,item in enumerate(new_tauar):
                                 print(index,item)
                             client_zh=inputs(' жалғастырғыңыз келсе "1" , тоқтатқыңыз келсе "2": ')
                             if client_zh=='1':
                                 client_t=inputi("Сатып алғыңыз келетін тауар номерін енгізіңіз : ")
                                 if client_t<len(new_tauar) and client_t>=0:
                                     t_tizim=new_tauar[client_t]
                                     if int(t_tizim[1])<=karzhy:
                                         sum+=int(t_tizim[1])
                                         sum_list.append(sum)
                                         if st:
                                             while st:
                                                 tauar_tizim.append(t_tizim)
                                                 karzhy-=int(t_tizim[1])
                                                 u=subprocess.check_output('date').decode('utf-8')
                                                 tauar_tizim.append(u)
                                                 print(f" Алған тауарыңыз {t_tizim}, сізде қалған қаржыңыз {karzhy}")
                                                 st=False
                                         elif sum>200000:
                                             tauar_tizim.append(t_tizim)
                                             print('Сіз біздің VIP клиентіміз болдыңыз, сізде 15% жеңілдік бар')
                                             karzhy-=(int(t_tizim[1])-int(t_tizim[1])*0.15)
                                             u=subprocess.check_output('date').decode('utf-8')
                                             tauar_tizim.append(u)
                                             print(f" Алған тауарыңыз {t_tizim}, сізде қалған қаржыңыз {karzhy}")
                                     else:
                                          print(f'Кешіріңіз сіздің қаржыңыз тауарды алуға жеткіліксіз !!!')
                                 else:
                                     print('Қате шықты қайта енгізіңіз : ')
                              elif client_zh=='2':
                                 if sum==0:
                                     break
                                 elif sum>0:
                                     name='Сатып алынған тауар тізімі'
                                     print(f''' \n\n1mall online дүкенінен сауда жасағаныңызға көп рахмет !!!
                          {name.center(50,'-')}
                          '''+'\n')
                                     for i in range(0,len(new_tauar),2):
                                         print(new_tauar[i])
                                     j='❤❤❤'
                                     print(f''' {j.center(50,"-")} ''')
                                     print(f" Total : {sum} \n Time: {subprocess.check_output('date').decode('utf-8')} \n     Қолдау көрсеткен компания \n {subprocess.check_output('azt').decode('utf-8')}")
                                     with open('tauarr','a') as f:
                                             for i in new_tauar:
                                                 f.write(str(i)+'\n')
                                     sh=inputs(' жалғастырғыңыз келсе "1" ,  logout "2" , basty bet "3" :  ')
                                     if sh=='1':
                                         pass
                                     elif sh=='2':
                                         self.end()
                                         view.Home()
                                         self.logout()
                                     elif sh=='3':
                                         self.Client()
                     elif sh=='2':
                         self.end()
                         view.Home()
                         self.logout()
                     elif sh=='3':
                         self.Client()
Esempio n. 16
0
]
from pyzt import inputs, inputi

for index, item in enumerate(product_list):
    print(index, item)
# prod_index = inputi('Which product do you want to change : ')
# prod_item = product_list[prod_index]
new = []
for i in product_list:
    new.append(list(i))

product_list1 = []

while True:
    prod_index = inputi('Which product do you want to change : ')
    if prod_index < len(product_list) and prod_index >= 0:
        prod_item = new[prod_index]
        change_price = inputi('Product price:')
        prod_item[1] = change_price
        surak = inputs(
            "Want to change more? 'ok'- to continue , 'q'-for exists:")
        if surak == 'q':
            break
        else:
            pass
    else:
        print(f"Product {prod_index} does not exist! Dudo ")
for i in new:
    product_list1.append(tuple(i))
print(product_list1)
Esempio n. 17
0
                elif surak == 'q':
                    break
                def change():
                    with open('1mall.txt', 'w+') as fil:
                        for i, item in enumerate(product_list):
                            fil.write(str(i) + '\t' + str(item) + '\n')
                change()

        elif tandau==3:
            with
    return product_list





while True:
    usr=inputs('plz input your login: '******'plz input your password: '******'aistaff' and pwds=='staff':
        staff()
        break
    elif usr=='aimanager' and pwds=='manager':
        manager()
    elif usr=='x' and pwds=='y':
        client()
        break
    else:
        print('Invalid account!!!')

Esempio n. 18
0
product_list = [
    ('Iphone 11 pro max', 700000),
    ('Nike', 15000),
    ('Azat coffe', 750),
    ('Watch', 150000),
    ('Surface', 399000),
]
shopping_list = []
salary = inputi("Input your salary: ")
print(salary)
print(enumerate(product_list))
while True:
    for index, item in enumerate(product_list):
        print(index, item)
    choice = inputs("Input 'ok' to continue, 'q' for exist: ")
    if choice == 'ok':
        user_choice = inputi('Which product do you want to buy: ')
        if user_choice < len(product_list) and user_choice >= 0:
            p_item = product_list[user_choice]
            if p_item[1] <= salary:
                shopping_list.append(p_item)
                salary -= p_item[1]
                print(
                    f"Added {p_item} into shopping cart, your current balance is {salary}"
                )
            else:
                print(
                    f"Sorry, only {salary} left on your credit. You can't buy")
        else:
            print(f"Product {user_choice} does not exist! Dudo ")
Esempio n. 19
0
def staff():
    while True:
        print(
            '1-списокке жаңа тауар қосу, 2-бағаларын өзгерту,3-барлық тауарлaрды көру,0-шығу:'
        )
        tandau = inputi('Таңдаңыз'.center(40, '-'))
        if tandau == 1:
            while True:
                n = []
                with open('1mall.txt', 'r') as fi:
                    data = fi.read()
                    data_split = data.split('\n')
                    for i in data_split:
                        i2 = i.split('-')
                        n.append(tuple(i2))
                n.pop()
                for index, item in enumerate(n):
                    print(index, item)
                product = inputs(
                    'Қандай продукты енгізгіңіз келеді? Атын енгізіңіз:')
                price = inputi('Продуктының бағасы:')
                n.append(tuple([product, price]))
                with open('1mall.txt', 'w') as fil:
                    for item in n:
                        fil.write(str(item[0]) + '-' + str(item[1]) + '\n')
                surak = inputs(
                    "Тізімге жаңа продукт енгізесіз бе? ok -жалғастыру үшін, q -тоқтату үшін :"
                )
                if surak == 'q':
                    break
                elif surak == 'ok':
                    pass
                else:
                    print('Kaita engiz!')
        elif tandau == 2:

            while True:
                n1 = []
                with open('1mall.txt', 'r') as fi7:
                    data = fi7.read()
                    data_split = data.split('\n')
                    for i in data_split:
                        i3 = i.split('-')
                        n1.append(tuple(i3))
                n1.pop()
                for index, item in enumerate(n1):
                    print(index, item)
                surak = inputs("Өзгерту үшін-ok , тоқтау үшін -q: :")
                if surak == 'ok':
                    prod_index = inputi('Қай продуктыны өзгерткіңіз келeді?: ')
                    if prod_index < len(n1) and prod_index >= 0:
                        prod_item = list(n1[prod_index])
                        print(prod_item[0], end=' ')
                        change_price = inputi('Продуктың жаңа бағасы:')
                        prod_item.insert(1, change_price)
                        prod_item.pop()
                        n1.insert(prod_index, tuple(prod_item))
                        n1.pop(prod_index + 1)
                        with open('1mall.txt', 'w') as d4:
                            for item in n1:
                                d4.write(
                                    str(item[0]) + '-' + str(item[1]) + '\n')
                    else:
                        print(
                            f" {prod_index} -Өкінішке орай сіз қателестіңіз, бұндай продукт жоқ! "
                        )
                elif surak == 'q':
                    break
        elif tandau == 3:
            print('Продукты тізімі:')
            with open('1mall.txt', 'r') as f1:
                print(f1.read())
        elif tandau == 0:
            break
        else:
            print('Қайта таңдаңыз!!!')
Esempio n. 20
0
def client():
    sum = 0
    shopping_list = []
    name = inputs('Сәлеметсіз бе?Атыңызды жазыңыз: ')
    print(f'{name.capitalize()} қош келдіңіз!!!')
    surau = inputi('Сіздің жалақыңыз қанша?: ')
    zhalaky = surau
    while True:
        surau1 = inputs("Онлайн шоппингті жалғастыру -'ok', тоқтату-'q' ")
        if surau1 == 'ok':
            print('Бізде бар продуктылар тізімі: ')
            n2 = []
            with open('1mall.txt', 'r') as fi8:
                data = fi8.read()
                data_split = data.split('\n')
                for i in data_split:
                    i3 = i.split('-')
                    n2.append(tuple(i3))
            n2.pop()
            for index, item in enumerate(n2):
                print(index, item)
            surau3 = inputi("Қай продуктыны сатып алғыңыз келеді? ")
            if surau3 < len(n2) and surau3 >= 0:
                p_item = list(n2[surau3])
                p_int = int(p_item[1])
                if p_int <= surau:
                    shopping_list.append(tuple(p_item))
                    with open('clients.txt', 'r') as client_vip:
                        a = client_vip.read()
                    if name in a:
                        print(
                            'Сіз VIP клиeнтсіз, осы таңдалған тауарға -15% Скидка болады!!!'
                        )
                        sum1 = p_int - p_int * 0.15
                        surau -= sum1
                    else:
                        sum += p_int
                        surau -= p_int
                    print(
                        f'Сіз таңдаған продукты жәшікке салынды, сіздің қазіргі балансыңыз {surau}'
                    )
                    timenow = subprocess.check_output(['date']).decode()
                    with open('zakaz.txt', 'a') as file:
                        file.write(
                            str(p_item[0]) + '-' + str(p_item[1]) + '-' +
                            timenow)
                    if sum >= 200000:
                        with open('clients.txt', 'a') as client_file:
                            if name not in a:
                                client_file.write(name + '\n')
                            else:
                                pass
                else:
                    print('Кешіріңіз, бірақ сіздің балансыңыз жетпейді!!!')
            else:
                print(f"Бізде {surau3}-бұл продукт жоқ,  кешіріңіз... ")
        elif surau1 == 'q':
            if sum > 0:
                ch = set()
                print('1mall онлайн магазин')
                print(''.center(30, '-'))
                timenow = subprocess.check_output(['date']).decode()
                print(timenow)
                for i in shopping_list:
                    sd = (i, shopping_list.count(i))
                    ch.add(sd)
                for each in ch:
                    print(each)
                print(''.center(30, '-'))
                print(f"ИТОГ         ={zhalaky-surau}")
                print('Сатып алғаныңыз үшін рахмет!')
                break
            else:
                break
Esempio n. 21
0
def do2(san):
    byn_set = set('10')
    engiz_set = set(san)
    if len(engiz_set - byn_set) == 0 and san != '':
        print('''Таңда!!! 
                1- 2>>10
                2- 2>>8
                3- 2>>16
                4- +
                5- -
                6- *
                7- /
                0-quit''''')
        while True:
            tandau = inputs('\nТаңдауыңды енгіз:')
            if tandau=='1':
                print(n210(san))
            elif tandau=='2':
                n28(san)
            elif tandau=='3':
                n216(san)

            elif tandau=='4':
                while True:
                    byn_set = set('10')
                    san1 = inputs('1Сан енгізіңіз:')
                    engiz_set1= set(san1)
                    if len(engiz_set1 - byn_set) == 0 and san1 != '':
                        a = n210(san)
                        a1=n210(san1)
                        a3=add(a,a1)
                        n102(a3)
                        break
            elif tandau=='5':
                while True:
                    byn_set = set('10')
                    san1 = inputs('1Сан енгізіңіз:')
                    engiz_set1= set(san1)
                    if len(engiz_set1 - byn_set) == 0 and san1 != '':
                        a = n210(san)
                        a1=n210(san1)
                        a3=minus(a,a1)
                        n102(a3)
                        break
            elif tandau=='6':
                while True:
                    byn_set = set('10')
                    san1 = inputs('1Сан енгізіңіз:')
                    engiz_set1= set(san1)
                    if len(engiz_set1 - byn_set) == 0 and san1 != '':
                        a = n210(san)
                        a1=n210(san1)
                        a3=multiply(a,a1)
                        n102(a3)
                        break
            elif tandau=='7':
                while True:
                    byn_set = set('10')
                    san1 = inputs('1Сан енгізіңіз:')
                    engiz_set1= set(san1)
                    if len(engiz_set1 - byn_set) == 0 and san1 != '':
                        a = n210(san)
                        a1=n210(san1)
                        a3=division(a,a1)
                        n102(a3)
                        break
            elif tandau=='0':
                print('------------------------')
                break
Esempio n. 22
0
def do8(san):
    san_set8 = set('01234567')
    engiz_set = set(san)
    if len(engiz_set - san_set8) == 0 and san != '':
        print('''Таңда!!! 
        1- 8>>10
        2- 8>>2
        3- 8>>16
        4- +
        5- -
        6- *
        7- /
        0-quit''''')
        while True:
            tandau=inputs('\nТаңдауыңды енгіз:')
            if tandau=='1':
                print(n810(san))
            elif tandau=='2':
                n82(san)
            elif tandau=='3':
                n816(san)
            elif tandau=='0':
                print('------------------------')
                break
            elif tandau == '4':
                while True:
                    san1 = inputs('1Сан енгізіңіз:')
                    engiz_set1 = set(san1)
                    if len(engiz_set1 - san_set8) == 0 and san1 != '':
                        a = n810(san)
                        a1 = n810(san1)
                        a3 = add(a, a1)
                        n108(a3)
                        break
            elif tandau == '5':
                while True:
                    san1 = inputs('1Сан енгізіңіз:')
                    engiz_set1 = set(san1)
                    if len(engiz_set1 - san_set8) == 0 and san1 != '':
                        a = n810(san)
                        a1 = n810(san1)
                        a3 = minus(a, a1)
                        n108(a3)
                        break
            elif tandau == '6':
                while True:
                    san1 = inputs('1Сан енгізіңіз:')
                    engiz_set1 = set(san1)
                    if len(engiz_set1 - san_set8) == 0 and san1 != '':
                        a = n810(san)
                        a1 = n810(san1)
                        a3 = multiply(a, a1)
                        n108(a3)
                        break
            elif tandau == '7':
                while True:
                    san1 = inputs('1Сан енгізіңіз:')
                    engiz_set1 = set(san1)
                    if len(engiz_set1 - san_set8) == 0 and san1 != '':
                        a = n810(san)
                        a1 = n810(san1)
                        a3 = division(a, a1)
                        n108(a3)
                        break
Esempio n. 23
0
    def client(self):
        view.Home().welcome()
        while True:
            tanda = inputs('1-Жалғастыру, 2-loqout , 3-басты бет \n')
            if tanda == '1':
                view.Home().welcome()
                sum = 0
                shopping_list = []
                print('Бізде бар продуктылар тізімі: ')
                n3 = []
                with open('1mall.txt', 'r') as fi8:
                    data = fi8.read()
                    data_split = data.split('\n')
                    for i in data_split:
                        i3 = i.split('-')
                        n3.append(tuple(i3))
                n3.pop()
                for index, item in enumerate(n3):
                    print(index, item)
                surau = inputi('Сіздің жалақыңыз қанша?: ')
                zhalaky = surau
                while True:
                    surau1 = inputs(
                        "Онлайн шоппингті жалғастыру -'ok', онлайн шоппингті тоқтату-'q', logout -1, басты бет-q1 "
                    )
                    if surau1 == 'ok':
                        print('Бізде бар продуктылар тізімі: ')
                        n2 = []
                        with open('1mall.txt', 'r') as fi8:
                            data = fi8.read()
                            data_split = data.split('\n')
                            for i in data_split:
                                i3 = i.split('-')
                                n2.append(tuple(i3))
                        n2.pop()
                        for index, item in enumerate(n2):
                            print(index, item)
                        surau3 = inputi(
                            "Қай продуктыны сатып алғыңыз келеді? ")
                        if surau3 < len(n2) and surau3 >= 0:
                            p_item = list(n2[surau3])
                            p_int = int(p_item[1])
                            if p_int <= surau:
                                shopping_list.append(tuple(p_item))
                                sum += p_int
                                surau -= p_int
                                print(
                                    f'Сіз таңдаған продукты жәшікке салынды, сіздің қазіргі балансыңыз {surau}'
                                )
                                timenow = subprocess.check_output(['date'
                                                                   ]).decode()
                                with open('zakaz.txt', 'a') as file:
                                    file.write(
                                        str(p_item[0]) + '-' + str(p_item[1]) +
                                        '-' + timenow)

                            else:
                                print(
                                    'Кешіріңіз, бірақ сіздің балансыңыз жетпейді!!!'
                                )
                        else:
                            print(
                                f"Бізде {surau3}-бұл продукт жоқ,  кешіріңіз... "
                            )
                    elif surau1 == 'q':
                        if sum > 0:

                            ch = set()
                            print('1mall онлайн магазин')
                            print(''.center(30, '-'))
                            timenow = subprocess.check_output(['date'
                                                               ]).decode()
                            print(timenow)
                            for i in shopping_list:
                                sd = (i, shopping_list.count(i))
                                ch.add(sd)
                            for each in ch:
                                print(each)
                            print(''.center(30, '-'))
                            with open('a.txt', 'r') as file:
                                data1 = file.read()
                            f_list = []
                            with open('data/log.txt', 'r') as f:
                                data = f.read().split('\n')
                                data.pop()
                                for i in data:
                                    a = i.split(',')
                                    f_list.append(a)
                            q = str(f_list[len(f_list) - 1][0])
                            q1 = str(f_list[len(f_list) - 1][1])
                            sum1 = 0
                            if q in data1 and q1 in data1:
                                print(
                                    'Сіз VIP клиeнтсіз,сізге жалпы -15% Скидка болады!!!'
                                )
                                sum1 = sum - sum * 0.15
                                print(f"ИТОГ         ={sum1}")
                                print('Сатып алғаныңыз үшін рахмет!')
                            else:
                                print(f"ИТОГ         ={zhalaky - surau}")
                                print('Сатып алғаныңыз үшін рахмет!')
                            if sum >= 200000:
                                f_list = []
                                with open('data/log.txt', 'r') as f:
                                    data = f.read().split('\n')
                                    data.pop()
                                    for i in data:
                                        a = i.split(',')
                                        f_list.append(a)
                                q = str(f_list[len(f_list) - 1][0])
                                q1 = str(f_list[len(f_list) - 1][1])
                                with open('a.txt', 'a') as file:
                                    file.write(q + ',' + q1 + '\n')
                            while True:
                                tr = inputs(
                                    '''1- басты бетке оралу; q-logout;3-артқа қайту : '''
                                )
                                if tr == '1':
                                    self.client()
                                elif tr == 'q':
                                    self.clientlogout()
                                elif tr == '3':
                                    break

                        else:
                            self.client()

                    elif surau1 == '1':
                        self.clientlogout()
                    elif surau1 == 'q1':
                        self.client()
            elif tanda == '2':
                self.clientlogout()
            elif tanda == '3':
                self.client()
Esempio n. 24
0
from pyzt import inputs, inputi
while True:
    l = []
    san = inputs('engiz:')
    hex_set = set('0xABCDEF123456789')
    engiz_set = set(san)
    if len(engiz_set - hex_set) == 0 and san != '':
        for i in san:
            l.append(i)
        l.remove(l[0])
        l.remove(l[0])
        print(l)
        for i in range(len(l)):
            if l[i] == 'A':
                l[i] = 10
            if l[i] == 'B':
                l[i] = 11
            if l[i] == 'C':
                l[i] = 12
            if l[i] == 'D':
                l[i] = 13
            if l[i] == 'E':
                l[i] = 14
            if l[i] == 'F':
                l[i] = 15
        for i in range(len(l)):
            l[i] = int(l[i])
        print(l)
        sum = 0
        for i in range(len(l)):
            sum += l[len(l) - i - 1] * 16**i
Esempio n. 25
0
    def admin(self):
        view.Home().welcome()
        while True:
            admin_choice = inputi(
                "Please select your choice: 1-logout; 2-тізімдегі адамдарды көру; 3-кірген, шыққан адамдарды көрсету; 4-basty bet \n"
            )
            if admin_choice == 1:
                self.adminlogout()
            elif admin_choice == 2:
                view.Home().welcome()
                print(
                    'usr,pwd,                  date created            ,admin,staff, client , manager  '
                )
                with open('data/users.txt', 'r') as f:
                    data = f.read().split('\n')
                    data.pop()
                    for i in data:
                        print(i)
                    while True:
                        t = inputs(
                            'Сайттағы адамдардың статусын өзгерту -1, logout-2, басты бет-3: '
                        )
                        if t == '1':
                            if len(data) == 1:
                                print(
                                    'Тізімде тек Админ ғана бар, сіз-Админ өз статусыңызды өзгерте ала алмайсыз!!!'
                                )
                                while True:
                                    r1 = inputs(
                                        "q- басты бетке оралу; 1-logout ; 2-артқа қайту: "
                                    )
                                    if r1 == 'q':
                                        self.admin()
                                    elif r1 == '1':
                                        self.adminlogout()
                                    elif r1 == '2':
                                        break
                            elif len(data) > 1:
                                f_list = []
                                with open('data/users.txt', 'r+') as f:
                                    data = f.read().split('\n')
                                    data.pop()
                                    for i in data:
                                        a = i.split(',')
                                        f_list.append(a)
                                    print(
                                        '  usr,  pwd,                      date created                   , admin ,   staff , client , manager  '
                                    )
                                    for i, i1 in enumerate(f_list):
                                        print(i, i1)
                                    while True:
                                        t1 = inputs(
                                            'Статусты өзгерткіңіз келсе сол адам индексін енгізіңіз; q- басты бетке оралу; q1-logout,q2-артқа қайту :  '
                                        )
                                        if t1 == 'q':
                                            self.admin()
                                        elif t1 == 'q1':
                                            self.adminlogout()
                                        elif t1 == 'q2':
                                            break
                                        else:
                                            try:
                                                if int(t1) < len(
                                                        f_list) and int(
                                                            t1) != 0:
                                                    while True:
                                                        t2 = inputs(
                                                            'Client>>Manager-1, Client>>Staff-2 , Staff>>Manager-3:'
                                                        )
                                                        if t2 == '1':
                                                            if f_list[int(
                                                                    t1
                                                            )][5] == 'True' and f_list[int(
                                                                    t1
                                                            )][6] == 'False' and f_list[int(
                                                                    t1
                                                            )][3] != 'True' and f_list[
                                                                    int(
                                                                        t1
                                                                    )][4] != 'True':
                                                                f_list[int(
                                                                    t1
                                                                )][5] = 'False'
                                                                f_list[int(
                                                                    t1
                                                                )][6] = 'True'

                                                                print(
                                                                    '  usr,  pwd,                      date created                   , admin ,   staff , client , manager  '
                                                                )
                                                                with open(
                                                                        'data/users.txt',
                                                                        'w+'
                                                                ) as d1:
                                                                    for i in f_list:
                                                                        for it in i:
                                                                            d1.write(
                                                                                it
                                                                                +
                                                                                ','
                                                                            )
                                                                        d1.write(
                                                                            '\n'
                                                                        )
                                                                        print(
                                                                            i)
                                                                while True:
                                                                    r2 = inputs(
                                                                        "1- басты бетке оралу; q-logout ,2-артқа қайту: "
                                                                    )
                                                                    if r2 == '1':
                                                                        self.admin(
                                                                        )
                                                                    elif r2 == 'q':
                                                                        self.adminlogout(
                                                                        )
                                                                    elif r2 == '2':
                                                                        break

                                                            else:
                                                                while True:
                                                                    tr = inputs(
                                                                        '''Өзгеріс орындалмады, біреуін таңдаңыз:
                                                                    1- басты бетке оралу; q-logout;3-артқа қайту '''
                                                                    )
                                                                    if tr == '1':
                                                                        self.admin(
                                                                        )
                                                                    elif tr == 'q':
                                                                        self.adminlogout(
                                                                        )
                                                                    elif tr == '3':
                                                                        break

                                                        elif t2 == '2':
                                                            if f_list[int(
                                                                    t1
                                                            )][5] == 'True' and f_list[int(
                                                                    t1
                                                            )][4] == 'False' and f_list[int(
                                                                    t1
                                                            )][3] != 'True' and f_list[
                                                                    int(
                                                                        t1
                                                                    )][4] != 'True':
                                                                f_list[int(
                                                                    t1
                                                                )][5] = 'False'
                                                                f_list[int(
                                                                    t1
                                                                )][4] = 'True'
                                                                print(
                                                                    '  usr,  pwd,                      date created                   , admin ,   staff , client , manager  '
                                                                )
                                                                with open(
                                                                        'data/users.txt',
                                                                        'w+'
                                                                ) as d2:
                                                                    for i in f_list:
                                                                        for it in i:
                                                                            d2.write(
                                                                                it
                                                                                +
                                                                                ','
                                                                            )
                                                                        d2.write(
                                                                            '\n'
                                                                        )
                                                                        # with open('data/users.txt', 'r') as d112:
                                                                        #     data11 = d112.read().split('\n')
                                                                        #     data11.pop()
                                                                        #     for i in data11:
                                                                        print(
                                                                            i)
                                                                while True:
                                                                    r2 = inputs(
                                                                        "1- басты бетке оралу; q-logout , 2-артқа қайту: "
                                                                    )
                                                                    if r2 == '1':
                                                                        self.admin(
                                                                        )
                                                                    elif r2 == 'q':
                                                                        self.adminlogout(
                                                                        )
                                                                    elif r2 == '2':
                                                                        break
                                                            else:
                                                                while True:
                                                                    tr = inputs(
                                                                        '''Өзгеріс орындалмады, біреуін таңдаңыз:
                                                                    1- басты бетке оралу; q-logout;3-артқа қайту '''
                                                                    )
                                                                    if tr == '1':
                                                                        self.admin(
                                                                        )
                                                                    elif tr == 'q':
                                                                        self.adminlogout(
                                                                        )
                                                                    elif tr == '3':
                                                                        break

                                                        elif t2 == '3':
                                                            if f_list[int(
                                                                    t1
                                                            )][4] == 'True' and f_list[int(
                                                                    t1
                                                            )][6] == 'False' and f_list[int(
                                                                    t1
                                                            )][3] != 'True' and f_list[
                                                                    int(
                                                                        t1
                                                                    )][5] != 'True':
                                                                f_list[int(
                                                                    t1
                                                                )][4] = 'False'
                                                                f_list[int(
                                                                    t1
                                                                )][6] = 'True'
                                                                print(
                                                                    '  usr,  pwd,                      date created                   , admin ,   staff , client , manager  '
                                                                )
                                                                with open(
                                                                        'data/users.txt',
                                                                        'w+'
                                                                ) as d3:
                                                                    for i in f_list:
                                                                        for it in i:
                                                                            d3.write(
                                                                                it
                                                                                +
                                                                                ','
                                                                            )
                                                                        d3.write(
                                                                            '\n'
                                                                        )
                                                                        # with open('data/users.txt', 'r') as d31:
                                                                        #     data13 = d31.read().split('\n')
                                                                        #     data13.pop()
                                                                        #     for i in data13:
                                                                        print(
                                                                            i)
                                                                while True:
                                                                    r2 = inputs(
                                                                        "1- басты бетке оралу; q-logout,2-артқа қайту : "
                                                                    )
                                                                    if r2 == '1':
                                                                        self.admin(
                                                                        )
                                                                    elif r2 == 'q':
                                                                        self.adminlogout(
                                                                        )
                                                                    elif r2 == '2':
                                                                        break
                                                            else:
                                                                while True:
                                                                    tr = inputs(
                                                                        '''Өзгеріс орындалмады, біреуін таңдаңыз:
                                                                    1- басты бетке оралу; q-logout ; 3-артқа қайту: '''
                                                                    )
                                                                    if tr == '1':
                                                                        self.admin(
                                                                        )
                                                                    elif tr == 'q':
                                                                        self.adminlogout(
                                                                        )
                                                                    elif tr == '3':
                                                                        break
                                                                    else:
                                                                        print(
                                                                            'Kaita engiz'
                                                                        )
                                                        else:
                                                            while True:
                                                                tr = inputs(
                                                                    '''Өзгеріс орындалмады, біреуін таңдаңыз:
                                                                1- басты бетке оралу; q-logout;3-артқа қайту : '''
                                                                )
                                                                if tr == '1':
                                                                    self.admin(
                                                                    )
                                                                elif tr == 'q':
                                                                    self.adminlogout(
                                                                    )
                                                                elif tr == '3':
                                                                    break
                                                                else:
                                                                    print(
                                                                        'Kaita engiz'
                                                                    )
                                                else:
                                                    print('Kaita engiz!!!')
                                            except (ValueError):
                                                print('Kaita engiz')

                        elif t == '2':
                            self.adminlogout()
                        elif t == '3':
                            self.admin()

            elif admin_choice == 3:
                with open('data/log.txt', 'r') as f1:
                    print(f1.read())
                    while True:
                        tanda1 = inputs('1-басты бетке бару, q-loqout:')
                        if tanda1 == '1':
                            self.admin()
                        elif tanda1 == 'q':
                            self.adminlogout()
            elif admin_choice == 4:
                self.admin()
Esempio n. 26
0
def do16(san):
    hex_set = set('0xABCDEF123456789')
    engiz_set = set(san)
    if len(engiz_set - hex_set) == 0 and san != '':
        print('''Таңда!!! 
                                1- 16>>2
                                2- 16>>8
                                3- 16>>10
                                4- +
                                5- -
                                6- *
                                7- /
                                0-quit''''')
        while True:
            tandau = inputs('\nТаңдауыңды енгіз:')
            if tandau == '1':
                n162(san)
            elif tandau == '2':
                n168(san)
            elif tandau == '3':
                print(n1610(san),end='')
            elif tandau == '0':
                print('------------------------')
                break
            elif tandau=='4':
                while True:
                    hex_set = set('0xABCDEF123456789')
                    san1 = inputs('1Сан енгізіңіз:')
                    engiz_set1= set(san1)
                    e = list(san1)
                    if len(engiz_set1 - hex_set) == 0 and san1 != '' and e[0]=='0' and e[1]=='x':
                        a = n1610(san)
                        a1 = n1610(san1)
                        a3 = add(a, a1)
                        n1016(a3)
                        break
            elif tandau=='5':
                while True:
                    hex_set = set('0xABCDEF123456789')
                    san1 = inputs('1Сан енгізіңіз:')
                    engiz_set1 = set(san1)
                    e = list(san1)
                    if len(engiz_set1 - hex_set) == 0 and san1 != '' and e[0]=='0' and e[1]=='x':
                        a = n1610(san)
                        a1 = n1610(san1)
                        a3 = minus(a, a1)
                        n1016(a3)
                        break
            elif tandau=='6':
                while True:
                    hex_set = set('0xABCDEF123456789')
                    san1 = inputs('1Сан енгізіңіз:')
                    engiz_set1 = set(san1)
                    e=list(san1)
                    if len(engiz_set1 - hex_set) == 0 and san1 != '' and e[0]=='0' and e[1]=='x':
                        a = n1610(san)
                        a1 = n1610(san1)
                        a3 = multiply(a, a1)
                        n1016(a3)
                        break
            elif tandau=='7':
                while True:
                    hex_set = set('0xABCDEF123456789')
                    san1 = inputs('1Сан енгізіңіз:')
                    engiz_set1 = set(san1)
                    e = list(san1)
                    if len(engiz_set1 - hex_set) == 0 and san1 != '' and e[0]=='0' and e[1]=='x':
                        a = n1610(san)
                        a1 = n1610(san1)
                        a3 = division(a, a1)
                        n1016(a3)
                        break
Esempio n. 27
0
    def staff(self):
        view.Home().welcome()
        while True:
            tan = inputs('1-Жалғастыру, 2-logout, 3-басты бет')
            if tan == '1':
                view.Home().welcome()
                while True:
                    tandau = inputs(
                        '1-списокке жаңа тауар қосу, 2-бағаларын өзгерту,3-барлық тауарлaрды көру,0-басты бет, q-logout:'
                    )
                    if tandau == '1':
                        while True:
                            n = []
                            with open('1mall.txt', 'r') as fi:
                                data = fi.read()
                                data_split = data.split('\n')
                                for i in data_split:
                                    i2 = i.split('-')
                                    n.append(tuple(i2))
                            n.pop()
                            for index, item in enumerate(n):
                                print(index, item)
                            product = inputs(
                                'Қандай продукты енгізгіңіз келеді? Атын енгізіңіз:'
                            )
                            price = inputi('Продуктының бағасы:')
                            n.append(tuple([product, price]))
                            with open('1mall.txt', 'w') as fil:
                                for item in n:
                                    fil.write(
                                        str(item[0]) + '-' + str(item[1]) +
                                        '\n')
                            while True:
                                surak = inputs(
                                    "Тізімге жаңа продукт енгізесіз бе? ok -жалғастыру үшін, q -басты бет, q1- logout :"
                                )
                                if surak == 'q':
                                    self.staff()
                                elif surak == 'ok':
                                    break
                                elif surak == 'q1':
                                    self.stafflogout()
                                else:
                                    print('Kaita engiz!')
                    elif tandau == '2':
                        n1 = []
                        with open('1mall.txt', 'r') as fi7:
                            data = fi7.read()
                            data_split = data.split('\n')
                            for i in data_split:
                                i3 = i.split('-')
                                n1.append(tuple(i3))
                        n1.pop()
                        for index, item in enumerate(n1):
                            print(index, item)
                        while True:
                            surak = inputs(
                                "Өзгерту үшін-1 , артқа қайту -2, басты бет-3, q-logout: :"
                            )
                            if surak == '1':
                                prod_index = inputi(
                                    'Қай продуктыны өзгерткіңіз келeді?: ')
                                if prod_index < len(n1) and prod_index >= 0:
                                    prod_item = list(n1[prod_index])
                                    print(prod_item[0], end=' ')
                                    change_price = inputi(
                                        'Продуктың жаңа бағасы:')
                                    prod_item.insert(1, change_price)
                                    prod_item.pop()
                                    n1.insert(prod_index, tuple(prod_item))
                                    n1.pop(prod_index + 1)
                                    with open('1mall.txt', 'w') as d4:
                                        for item in n1:
                                            d4.write(
                                                str(item[0]) + '-' +
                                                str(item[1]) + '\n')

                                else:
                                    print(
                                        f" {prod_index} -Өкінішке орай сіз қателестіңіз, бұндай продукт жоқ! "
                                    )
                            elif surak == '2':
                                break
                            elif surak == '3':
                                self.staff()
                            elif surak == 'q':
                                self.stafflogout()

                    elif tandau == '3':
                        print('Продукты тізімі:')
                        with open('1mall.txt', 'r') as f1:
                            print(f1.read())
                            while True:
                                surau = inputs(
                                    'q-logout, 1-басты бет,2-артқа қайту')
                                if surau == 'q':
                                    self.stafflogout()
                                elif surau == '1':
                                    self.staff()
                                elif surau == '2':
                                    break
                    elif tandau == '0':
                        self.staff()
                    elif tandau == 'q':
                        self.stafflogout()
            elif tan == '2':
                self.stafflogout()
            elif tan == '3':
                self.staff()