def registerSuperVisorFromOperation(self, data):
     from Controllers.SuperVisor import SuperVisor
     from Controllers.CommonMethods import CommonMethods
     newSupervisor = SuperVisor()
     checkParameters = CommonMethods()
     newSupervisor.full_name = data[0]
     newSupervisor.user_role = "supervisor"
     newSupervisor.username = data[2]
     newSupervisor.password = data[3]
     newSupervisor.phone = data[4]
     newSupervisor.email = data[5]
     checkUserName = checkParameters.checkUserName(newSupervisor.username)
     print(f'checkusername : {checkUserName}')
     checkEmail = checkParameters.checkEmail(newSupervisor.email)
     print(f'checkEmail : {checkEmail}')
     if checkUserName:
         QMessageBox.warning(self, "Username Kontrol",
                             f'{newSupervisor.username} kullanılmaktadır.')
     elif checkEmail:
         QMessageBox.warning(self, "Email Kontrol",
                             f'{newSupervisor.email} kullanılmaktadır.')
     else:
         result = newSupervisor.save()
         print(result)
         if result:
             QMessageBox.information(self, "Kayıt Durumu",
                                     "Kayıt Başarlı Oldu!")
             self.clearForm()
         else:
             QMessageBox.critical(self, "Kayıt Durumu",
                                  "Kayıt Başarısız Oldu!")
    def addUserToSuperVisorShift(self, data):
        from Controllers.SuperVisor import SuperVisor
        user = SuperVisor()
        # getSupervisor2(data[0])

        shiftCollection = CreateConnection()["shift"]
        res = shiftCollection.find_one_and_update({"name": {
            "$eq": data[-1]
        }}, {'$set': {
            "supervisor": user._id
        }})

        if res:
            return True
        else:
            return False
Exemplo n.º 3
0
 def goToMainPage(self, userType, user):
     if userType:
         from SuperVisor import SuperVisorWindow
         admin = Admin()
         admin.id = user['_id']
         admin.full_name = user['full_name']
         admin.username = user['username']
         admin.email = user['email']
         admin.phone = user['phone']
         admin.user_role = user['user_role']
         self.newWindow = SuperVisorWindow(Admin=admin)
         self.destroy(destroyWindow=True)
     else:
         from SuperVisor import SuperVisorWindow
         supervisor = SuperVisor(user["username"])
         supervisor.id = user['_id']
         supervisor.full_name = user['full_name']
         # supervisor.username = user['username']
         supervisor.email = user['email']
         supervisor.phone = user['phone']
         supervisor.user_role = user['user_role']
         self.newWindow = SuperVisorWindow(SuperVisor=supervisor)
         self.destroy(destroyWindow=True)
Exemplo n.º 4
0
 def getMainWindow(self):
     from Views.MainWindow import MainWindowForm
     superVisor = SuperVisor(username="******")
     print(superVisor)
     print(type(superVisor))
     self.mainWindow = MainWindowForm(SuperVisor=superVisor)
Exemplo n.º 5
0
        imgPath = path + "/ui_pages/icons/user.png"
        print(imgPath)
        self.ui.image_vardiyaSorumlusu.setPixmap(QPixmap(imgPath).scaled(263, 211))
        self.ui.image_vardiyaSorumlusu.setScaledContents(True)

    def getVardiyaEkleWindow(self):
        from AddShift import AddShiftWindow
        self.vardiyaEkle = AddShiftWindow()

    def ui_settings(self):
        self.ui.text_AdSoyad.setEnabled(False)
        self.ui.text_AdSoyad.setText(self.person.full_name)
        self.ui.text_Vardiyasi.setText(self.person.vardiya)
        self.ui.cmb_Model.setEnabled(False)
        self.ui.cmb_Metrik.setEnabled(False)


if __name__ == '__main__':
    import sys

    app = QApplication(sys.argv)
    app.setStyle("fusion")
    # newUser = SuperVisor("test", "123123").getSupervisor()
    newUser = SuperVisor(username="******")
    newAdmin = Admin()
    newAdmin.username = "******"
    newAdmin.password = "******"
    vsorumlu = SuperVisorWindow(SuperVisor=newUser)
    vsorumlu.show()
    sys.exit(app.exec_())
    def addSuperVisor(self):
        from Controllers.SuperVisor import SuperVisor
        superVisor = SuperVisor()
        superVisor.username = self.ui.txt_Username.text()
        superVisor.full_name = self.ui.txt_AdiSoyadi.text()
        superVisor.email = self.ui.txt_Email.text()
        superVisor.password = self.ui.txt_Password.text()
        superVisor.imagePath = self.home + self.ui.txt_Username.text()
        self.imagePath = superVisor.imagePath
        res1 = superVisor.checkUsername()
        res2 = superVisor.checkEmail()
        if res1:
            QMessageBox.warning(self, "Uyarı", "Kullanıcı Adı Kullanılmaktadır.")
            return ""
        if res2:
            QMessageBox.warning(self, "Uyarı", "Email Kullanılmaktadır.")
            return ""
        if not (res1 and res2):

            res = self.createFolder(superVisor.imagePath)
            if res:
                superVisor.save()
                QMessageBox.information(self, "Bilgi", "Kayıt Başarılı Oldu")
                self.ui.actionStart_Camera.setEnabled(True)
            else:
                QMessageBox.warning(self, "Uyarı", "Bir Sorun Oluştu!")