Beispiel #1
0
 def payProcess(self,clientId,msgDict,sessionkey):
     try:
         masterdb = DatabaseAgent(conf.mdbName,conf.muserName,conf.host,conf.mdbPassword,conf.port)
         masterdb.initConnection()
         dbpass = masterdb.fetchData("regusers",["password"],{"clientid":clientId})
         password = dbpass[0][0]
         admindb = DatabaseAgent(clientId,clientId,conf.host,password,conf.port)
         admindb.initConnection()
         accountDb = admindb.fetchData("accountinfo",["labourerid","timestamp"],{"approveid":msgDict["approveId"]})
         print("accoutndb........................",accountDb)
         timeStamp = accountDb[0][1]
         labourerId = accountDb[0][0]
         print("time stamp............................",timeStamp)            
         admindb.connection
         hash = hashlib.md5(str(datetime.datetime.now()) .encode()).hexdigest()
         transationId = hash[:10]
         accinfoCont = " set paystatus =' paid ' "+" where  "
         accountcont = " set transationid = '"+str(transationId) +" ' where "
         payflag = " set payflag = 'True'"+", issuer = '"+sessionMange.session[sessionkey]["userid"]+"',reciverid = '"+labourerId +"',transationid = '"+str(transationId)+"' where  "
         if admindb.updateTable(accinfoCont,"accountinfo",{"approveid":msgDict["approveId"]}):
             if admindb.updateTable(payflag,"payment",{"timestamp":timeStamp}):
                 if admindb.updateTable(accountcont,"account",{"timestamp":timeStamp}):
                     response = {"Header":{"status":"success","module":"labfinace"},"Body":{"message":"amount payed sucessfully","data":""},"Signature":{"signature":"","Key":""}}
                     return response                           
         else:
             response = {"Header":{"status":"fail","module":"labfinace"},"Body":{"message":"amout can't paid","data":""},"Signature":{"signature":"","Key":""}}
             return response   
     except Exception as expc:
         # self.syslog.eventHandle("labourerclassManage","exception","exception on labourerclassManage module",str(expc))  
         self.log.logEvent("labourerclassManage",2,"occured expection is"+str(expc),clientId,sessionMange.session[sessionkey]["userid"]) 
         print("exception is occured at",str(expc))            
 def deleteProjects(self, clientId, msgDict, sessionkey):
     masterDb = DatabaseAgent(conf.mdbName, conf.muserName, conf.host,
                              conf.mdbPassword, conf.port)
     masterDb.initConnection()
     cond = {"clientid": clientId}
     dbData = masterDb.fetchData("regusers", ["password"], cond)
     password = dbData[0][0]
     adminDb = DatabaseAgent(clientId, clientId, conf.host, password, 5432)
     adminDb.initConnection()
     delete = " set delete = 'True' where "
     condition = {"projectid": msgDict["projectId"]}
     try:
         if adminDb.updateTable(delete, "projects",
                                condition) and adminDb.updateTable(
                                    delete, "sites", condition):
             self.log.logEvent("projectManage", 3,
                               "project deleted successfully", clientId,
                               sessionMange.session[sessionkey]["userid"])
             response = {
                 "Header": {
                     "status": "success",
                     "module": "projectManage"
                 },
                 "Body": {
                     "message": "project deleted successfully",
                     "data": ""
                 },
                 "Signature": {
                     "signature": "",
                     "Key": ""
                 }
             }
             return response
         else:
             self.log.logEvent("projectManage", 3,
                               "project deleted db error occured", clientId,
                               sessionMange.session[sessionkey]["userid"])
             response = {
                 "Header": {
                     "status": "fail",
                     "module": "projectManage"
                 },
                 "Body": {
                     "message": "project can't deleted",
                     "data": ""
                 },
                 "Signature": {
                     "signature": "",
                     "Key": ""
                 }
             }
             return response
     except Exception as expc:
         # self.syslog.eventHandle("projectmanagement","exception","exception on projectManage module",str(expc))
         self.log.logEvent(
             "projectManage", 3,
             " all role permission listed occured " + str(expc), clientId,
             sessionMange.session[sessionkey]["userid"])
Beispiel #3
0
 def requstApprove(self,clientId,msgDist,sessionkey):
     masterdb = DatabaseAgent(conf.mdbName,conf.muserName,conf.host,conf.mdbPassword,conf.port)
     masterdb.initConnection()
     dbpass = masterdb.fetchData("regusers",["password"],{"clientid":clientId})
     password = dbpass[0][0]
     admindb = DatabaseAgent(clientId,clientId,conf.host,password,conf.port)
     admindb.initConnection()
     randomid = str(random.randint(10000000000,1000000000000))[:8]
     approveCont = " set approvestatus = 'approved', approveid = "+randomid+" where "
     try:
         if admindb.updateTable(approveCont,"accountinfo",{"labourerid":msgDist["labourerId"]}):
             response = {"Header":{"status":"success","module":"labfinace"},"Body":{"message":"labourer requst is approved","data":""},"Signature":{"signature":"","Key":""}}
             return response                
         else:
             response = {"Header":{"status":"fail","module":"labfinace"},"Body":{"message":"labourer requst is can't approved","data":""},"Signature":{"signature":"","Key":""}}
             return response   
     except Exception as expc:
         # self.syslog.eventHandle("labourerclassManage","exception","exception on labourerclassManage module",str(expc))  
         self.log.logEvent("labourerclassManage",2,"occured expection is"+str(expc),clientId,sessionMange.session[sessionkey]["userid"])   
 def deleteLabourer(self,clientId,msgDict,sessionkey):
     masterDb = DatabaseAgent(conf.mdbName,conf.muserName,conf.host,conf.mdbPassword,conf.port)
     masterDb.initConnection()
     cond = {"clientid":clientId}
     dbData = masterDb.fetchData("regusers",["password"],cond)
     password = dbData[0][0]
     adminDb = DatabaseAgent(clientId, clientId, conf.host,password, 5432)
     adminDb.initConnection()
     delete = " set delete = 'True' where "
     condition = {"labourerid": msgDict["labourerId"]}
     try:
         if adminDb.updateTable(delete,"labourer",condition):
             self.log.logEvent("labourerManage",2,"labourer deleted successfully",clientId,sessionMange.session[sessionkey]["userid"])
             response = {"Header":{"status":"success","module":"labourerManage"},"Body":{"message":"labourer deleted successfully","data":""},"Signature":{"signature":"","Key":""}}
             return response              
         else:
             self.log.logEvent("labourerManage",2,"labourer deletd successfully",clientId,sessionMange.session[sessionkey]["userid"])
             response = {"Header":{"status":"fail","module":"labourerManage"},"Body":{"message":"labouer cant deleted","data":""},"Signature":{"signature":"","Key":""}}
             return response           
     except Exception as expc:
         # self.syslog.eventHandle("labourerManage","exception","exception on labourerManage module",str(expc))
         self.log.logEvent("labourerManage",2,"occured expection is"+str(expc),clientId,sessionMange.session[sessionkey]["userid"])               
Beispiel #5
0
 def shiftDeleted(self,clientId,msgDict,sessionkey):
     masterDb = DatabaseAgent(conf.mdbName,conf.muserName,conf.host,conf.mdbPassword,conf.port)
     masterDb.initConnection()
     cond = {"clientid":clientId}
     dbData = masterDb.fetchData("regusers",["password"],cond)
     password = dbData[0][0]
     adminDb = DatabaseAgent(clientId, clientId, conf.host,password, 5432)
     adminDb.initConnection()
     delete = " set delete = 'True' where "
     condition = {"shiftid":msgDict["shiftId"]}
     reval = False
     try:
         if adminDb.updateTable(delete,"shift",condition):
             self.log.logEvent("shiftManage",2,msgDict["shiftId"]+"labourer shift deleted successfully",clientId,sessionMange.session[sessionkey]["userid"])
             response = {"Header":{"status":"success","module":"ShiftManage"},"Body":{"message":"shift deleted succes","data":""},"Signature":{"signature":"","Key":""}}
             return response            
         else:
             self.log.logEvent("shiftManage",2,msgDict["shiftId"]+"labourer shift cant deleted",clientId,sessionMange.session[sessionkey]["userid"])
             response = {"Header":{"status":"fail","module":"ShiftManage"},"Body":{"message":"shift canot deleted","data":""},"Signature":{"signature":"","Key":""}}
             return response     
     except Exception as expc: 
         print("oocured exception is",expc) 
         self.log.logEvent("shiftmanage",2,"labourer shift delete successfully",clientId,sessionMange.session[sessionkey]["userid"])
Beispiel #6
0
 def unArchiveUser(
     self,
     clientId,
     msgDict,
 ):
     masterDb = DatabaseAgent(conf.mdbName, conf.muserName, conf.host,
                              conf.mdbPassword, conf.port)
     masterDb.initConnection()
     cond = {"clientid": clientId}
     dbData = masterDb.fetchData("regusers", ["password"], cond)
     password = dbData[0][0]
     adminDb = DatabaseAgent(clientId, clientId, conf.host, password, 5432)
     adminDb.initConnection()
     archive = " set archive = 'False' where "
     admin = Admin()
     datdict = {"employeeid": msgDict["employeeId"]}
     try:
         if adminDb.updateTable(archive, "clientusers", datdict):
             self.log.logEvent(
                 "Admin", 2,
                 msgDict["employeeId"] + "Client archived successfully",
                 clientId, sessionMange.session[sessionkey]["userid"])
             response = {
                 "Header": {
                     "status": "success",
                     "module": "admin"
                 },
                 "Body": {
                     "message": "user unarchived successfully",
                     "data": ""
                 },
                 "Signature": {
                     "signature": "",
                     "Key": ""
                 }
             }
             return response
         else:
             self.log.logEvent(
                 "Admin", 2,
                 msgDict["employeeId"] + "Client canot archived", clientId,
                 sessionMange.session[sessionkey]["userid"])
             response = {
                 "Header": {
                     "status": "fail",
                     "module": "admin"
                 },
                 "Body": {
                     "message": "user can't unarchived ",
                     "data": ""
                 },
                 "Signature": {
                     "signature": "",
                     "Key": ""
                 }
             }
             return response
     except Exception as expc:
         self.log.logEvent("Admin", 0, "occured exception is " + str(expc),
                           clientId,
                           sessionMange.session[sessionkey]["userid"])
Beispiel #7
0
 def deleteUser(self, clientId, msgDict, sessionkey):
     masterDb = DatabaseAgent(conf.mdbName, conf.muserName, conf.host,
                              conf.mdbPassword, conf.port)
     masterDb.initConnection()
     cond = {"clientid": clientId}
     dbData = masterDb.fetchData("regusers", ["password"], cond)
     password = dbData[0][0]
     adminDb = DatabaseAgent(clientId, clientId, conf.host, password, 5432)
     adminDb.initConnection()
     delete = " set delete = 'True' where "
     datdict = {"employeeid": msgDict["employeeId"]}
     try:
         if msgDict["employeeId"] == "kcemp1001":
             response = {
                 "Header": {
                     "status": "success",
                     "module": "admin"
                 },
                 "Body": {
                     "message": "admin can't be delete",
                     "data": ""
                 },
                 "Signature": {
                     "signature": "",
                     "Key": ""
                 }
             }
             return response
         else:
             if adminDb.updateTable(delete, "clientusers", datdict):
                 self.log.logEvent(
                     "Admin", 2, msgDict["employeeId"] +
                     "Client user deletd successfully", clientId,
                     sessionMange.session[sessionkey]["userid"])
                 response = {
                     "Header": {
                         "status": "success",
                         "module": "admin"
                     },
                     "Body": {
                         "message": "user delete successfully",
                         "data": ""
                     },
                     "Signature": {
                         "signature": "",
                         "Key": ""
                     }
                 }
                 return response  #self.listClientUser()
             else:
                 self.log.logEvent(
                     "Admin", 2,
                     msgDict["employeeId"] + "Client can't user deleted ",
                     clientId, sessionMange.session[sessionkey]["userid"])
                 response = {
                     "Header": {
                         "status": "success",
                         "module": "admin"
                     },
                     "Body": {
                         "message": "user can't delete",
                         "data": ""
                     },
                     "Signature": {
                         "signature": "",
                         "Key": ""
                     }
                 }
                 return response
     except Exception as expc:
         self.log.logEvent("Admin", 0, "occured exception is " + str(expc),
                           clientId,
                           sessionMange.session[sessionkey]["userid"])