public static function addPerson_vocationaltraining($obj_Person_vocationaltraining)
 {
     $db = config::dbconfig();
     $obj_retresult = new returnResult();
     $obj_Person_vocationaltraining->VocationalTrainId = DAL_managePerson_vocationaltraining::getLastPerson_vocationaltrainingId() + 1;
     $sql = "INSERT INTO tbl_person_vocationaltraining (VocationalTrainId,FieldName,CourseName,InstituteId,StartDate,EndDate,CertificateType,PersonId) \n\t\tVALUES (" . common::noSqlInject($obj_Person_vocationaltraining->VocationalTrainId) . "," . "'" . common::noSqlInject($obj_Person_vocationaltraining->FieldName) . "'" . "," . "'" . common::noSqlInject($obj_Person_vocationaltraining->CourseName) . "'" . "," . common::noSqlInject($obj_Person_vocationaltraining->InstituteId) . "," . "'" . common::noSqlInject($obj_Person_vocationaltraining->StartDate) . "'" . "," . "'" . common::noSqlInject($obj_Person_vocationaltraining->EndDate) . "'" . "," . "'" . common::noSqlInject($obj_Person_vocationaltraining->CertificateType) . "'" . "," . common::noSqlInject($obj_Person_vocationaltraining->PersonId) . ");";
     $rs = mysql_query($sql);
     if (mysql_affected_rows() > 0) {
         $obj_retresult->type = 1;
         $obj_retresult->msg = "success";
         $obj_retresult->data = $obj_Person_vocationaltraining;
     } else {
         $obj_retresult->type = 0;
         $obj_retresult->msg = "failed";
     }
     return $obj_retresult;
 }
function updatePerson_vocationaltraining($sessionkey, $appcode, $Person_vocationaltrainingdata)
{
    $main_result = "<VPROFILERESULT>";
    $main_result .= "<AUTHSTATUS>0</AUTHSTATUS>";
    $userId = ValidateSession($sessionkey, $appcode);
    if ($userId > -1) {
        $main_result = "<AUTHSTATUS>1</AUTHSTATUS>";
        $obj_Person_vocationaltraining = new Person_vocationaltraining();
        foreach ($Userdata["[UPPERTEMPLATENAME"] as $key => $child) {
            switch ($key) {
                case "VOCATIONALTRAINID":
                    $obj_Person_vocationaltraining->VocationalTrainId = $child;
                    break;
                case "FIELDNAME":
                    $obj_Person_vocationaltraining->FieldName = $child;
                    break;
                case "COURSENAME":
                    $obj_Person_vocationaltraining->CourseName = $child;
                    break;
                case "INSTITUTEID":
                    $obj_Person_vocationaltraining->InstituteId = $child;
                    break;
                case "STARTDATE":
                    $obj_Person_vocationaltraining->StartDate = $child;
                    break;
                case "ENDDATE":
                    $obj_Person_vocationaltraining->EndDate = $child;
                    break;
                case "CERTIFICATETYPE":
                    $obj_Person_vocationaltraining->CertificateType = $child;
                    break;
                case "PERSONID":
                    $obj_Person_vocationaltraining->PersonId = $child;
                    break;
            }
        }
        $obj_retResult_Person_vocationaltraining = DAL_managePerson_vocationaltraining::updatePerson_vocationaltraining($obj_Person_vocationaltraining);
        if ($obj_retResult_Person_vocationaltraining->type == 1) {
            $main_result .= "<RESULTSTATUS>1</RESULTSTATUS>";
            $main_result .= getPerson_vocationaltrainingXml($obj_retResult_Person_vocationaltraining->data);
        } else {
            $main_result .= "<RESULTSTATUS>0</RESULTSTATUS>";
        }
    }
    $main_result .= "</VPROFILERESULT>";
    return $main_result;
}
 public static function isChildPerson_vocationaltraining($VocationalTrainId, $ChildVocationalTrainId)
 {
     $ischild = false;
     $obj_retResult = DAL_managePerson_vocationaltraining::getPerson_vocationaltrainingListByVocationalTrainId($ChildVocationalTrainId);
     //get child node
     if ($obj_retResult->type == 1) {
         $arr_Person_vocationaltrainingList = $obj_retResult->data;
         $obj_Person_vocationaltraining = $arr_Person_vocationaltrainingList[0];
         $arrParentIds = explode(",", $obj_Person_vocationaltraining->Url);
         foreach ($arrParentIds as $Person_vocationaltrainingParentId) {
             if ($Person_vocationaltrainingParentId == $VocationalTrainId) {
                 $ischild = true;
             }
         }
     }
     return $ischild;
 }