def ShowFriend(self, id): if self.isSignIn(): conOb = cn() conOb.Open() conOb.Showfriend(self.id) else: print("*****>>>Ban chua dang nhap<<<*****\n")
def Showmessen(self, id): if self.isSignIn(): conOb = cn() conOb.Open() print('danh sach friend: \n') conOb.Showfriend(self.id) print("nhap ten ban muon ...:\n") frien = input() id2 = conOb.TranNameToId(frien) conOb.ShowMessSen(self.id, id2)
def Showmesdrec(self, id): if self.isSignIn(): conOb = cn() conOb.Open() print('danh sach friend: \n') conOb.Showfriend(self.id) print("nhap ten ban muon ...:\n") frien = input() id2 = conOb.TranNameToId(frien) print(id2, self.id) conOb.ShowMessRec(id2, self.id) with cn.con: conOb.Statusmes(id2, self.id)
def SignIn(self): print("Nhap vao username: \n") username = input() print("Nhap vao password: \n") password = input() conOb = cn() conOb.Open() with cn.con: if conOb.CheckSignIn(username, password) > 0: print("Dang nhap thanh cong!\n") self.id = conOb.CheckSignIn(username, password) self.flag = 1 else: print("Dang nhap that bai!\n") self.flag = 0
def SenMess(self, id): if self.isSignIn(): conOb = cn() conOb.Open() #conOb.Showfriend(self.id) print("Chon nguoi dung: \n") name = input() id2 = conOb.TranNameToId(name) dt = time.ctime() #print(dt) if id2 > 0: print("To : ", name) print("soan tin nhan:\n") mess = input() with cn.con: if conOb.Checkfriend(self.id, id2) != 0: conOb.WriteToMess(self.id, id2, mess, dt)
def SignUp(self): print("*******>>>nhap thong tin dang ki<<******") print("username:"******"password:"******"fullname:") fullname = input() print("city:") city = input() print("birthday") birthday = input() print(username) print(password) print(fullname) print(city) print(birthday) conOb = cn() conOb.Open() with cn.con: conOb.SignUp(username, password, fullname, birthday, city)
def AddFriend(self, id): if self.isSignIn() == 1: print(self.id) print("Nhap ten ban muon them: ") name = input() conOb = cn() conOb.Open() id2 = conOb.TranNameToId(name) #print(id2) if id2 > 0: if conOb.Checkfriend(self.id, id2) != 0: with cn.con: conOb.WriteToFriend(self.id, id2) #conOb.Showfriend(self.id) else: print( ">>>Ban da bi nguoi nay chan hoac ban nhap ten cua minh<<<\n\n" ) else: print("*******>>>Tai khoan khong ton tai<<<***********\n") else: print("*****>>>Ban chua dang nhap<<<*****\n")