function addPerson($sessionkey, $appcode, $Persondata)
{
    $main_result = "<VPROFILERESULT>";
    $main_result .= "<AUTHSTATUS>0</AUTHSTATUS>";
    $userId = ValidateSession($sessionkey, $appcode);
    if ($userId > -1) {
        $main_result = "<AUTHSTATUS>1</AUTHSTATUS>";
        $obj_Person = new Person();
        foreach ($Userdata["[UPPERTEMPLATENAME"] as $key => $child) {
            switch ($key) {
                case "PERSONID":
                    $obj_Person->PersonId = $child;
                    break;
                case "FULLNAME":
                    $obj_Person->FullName = $child;
                    break;
                case "NICKNAME":
                    $obj_Person->NickName = $child;
                    break;
                case "OTHERNAMES":
                    $obj_Person->OtherNames = $child;
                    break;
                case "DRIVINGLICENCENO":
                    $obj_Person->DrivingLicenceNo = $child;
                    break;
                case "PASSPORTNO":
                    $obj_Person->PassportNo = $child;
                    break;
                case "PERMANENTADDRESS":
                    $obj_Person->PermanentAddress = $child;
                    break;
                case "EMAIL":
                    $obj_Person->Email = $child;
                    break;
                case "WEBSITE":
                    $obj_Person->Website = $child;
                    break;
                case "DESCRIPTION":
                    $obj_Person->Description = $child;
                    break;
                case "GENDER":
                    $obj_Person->Gender = $child;
                    break;
                case "DOB":
                    $obj_Person->DOB = $child;
                    break;
                case "HEIGHT":
                    $obj_Person->Height = $child;
                    break;
                case "WEIGHT":
                    $obj_Person->Weight = $child;
                    break;
                case "HAIRCOLOR":
                    $obj_Person->HairColor = $child;
                    break;
                case "EYECOLOR":
                    $obj_Person->EyeColor = $child;
                    break;
                case "BLOODTYPE":
                    $obj_Person->BloodType = $child;
                    break;
                case "OCCUPATION":
                    $obj_Person->Occupation = $child;
                    break;
                case "MONTHLYINCOME":
                    $obj_Person->MonthlyIncome = $child;
                    break;
                case "FUTURETARGETS":
                    $obj_Person->FutureTargets = $child;
                    break;
                case "FUTURENEEDS":
                    $obj_Person->FutureNeeds = $child;
                    break;
                case "DOD":
                    $obj_Person->DOD = $child;
                    break;
                case "PICTURE":
                    $obj_Person->Picture = $child;
                    break;
                case "NIC":
                    $obj_Person->NIC = $child;
                    break;
                case "STATUS":
                    $obj_Person->Status = $child;
                    break;
            }
        }
        $obj_retResult_Person = DAL_managePerson::addPerson($obj_Person);
        if ($obj_retResult_Person->type == 1) {
            $main_result .= "<RESULTSTATUS>1</RESULTSTATUS>";
            $main_result .= getPersonXml($obj_retResult_Person->data);
        } else {
            $main_result .= "<RESULTSTATUS>0</RESULTSTATUS>";
        }
    }
    $main_result .= "</VPROFILERESULT>";
    return $main_result;
}
 public static function addPerson2($PersonId, $FullName, $NickName, $OtherNames, $DrivingLicenceNo, $PassportNo, $PermanentAddress, $Email, $Website, $Description, $Gender, $DOB, $Height, $Weight, $HairColor, $EyeColor, $BloodType, $Occupation, $MonthlyIncome, $FutureTargets, $FutureNeeds, $DOD, $Picture, $NIC, $Status)
 {
     $obj_retResult = new returnResult();
     $obj_newPerson = new Person();
     $obj_newuser->setPerson($PersonId, $FullName, $NickName, $OtherNames, $DrivingLicenceNo, $PassportNo, $PermanentAddress, $Email, $Website, $Description, $Gender, $DOB, $Height, $Weight, $HairColor, $EyeColor, $BloodType, $Occupation, $MonthlyIncome, $FutureTargets, $FutureNeeds, $DOD, $Picture, $NIC, $Status);
     // $isExist = BL_managePerson::isExist($obj_newPerson->id);
     if (!$isExist) {
         $obj_retResult_Person = DAL_managePerson::addPerson($obj_newPerson);
         if ($obj_retResult_Person->type == 1) {
             $obj_retResult->type = 1;
             $obj_retResult->msg = "Success";
             $obj_retResult->data = $obj_retResult_Person->data;
         } else {
             $obj_retResult->type = 0;
             $obj_retResult->msg = "Failed";
         }
     } else {
         $obj_retResult->type = 0;
         $obj_retResult->msg = "Sorry! Person already exist";
     }
     return $obj_retResult;
 }