Exemple #1
0
 function AddStaff($pdo = null)
 {
     //............................. آیا فرد قبلا با این نوع شخص در سیستم ثبت شده است؟.....................
     $qry = " select staff_id from HRM_staff where PersonID = " . $this->PersonID . " and person_type = " . $this->person_type;
     $res = PdoDataAccess::runquery($qry);
     if (count($res) > 0 && $res[0]['staff_id'] > 0) {
         return true;
     }
     $this->staff_id = manage_staff::LastID($pdo) + 1;
     if (PdoDataAccess::insert("HRM_staff", $this, $pdo) === false) {
         return false;
     }
     $daObj = new DataAudit();
     $daObj->ActionType = DataAudit::Action_add;
     $daObj->MainObjectID = $this->staff_id;
     $daObj->TableName = "HRM_staff";
     $daObj->execute($pdo);
     return true;
 }