function addPerson_telephone($sessionkey, $appcode, $Person_telephonedata)
{
    $main_result = "<VPROFILERESULT>";
    $main_result .= "<AUTHSTATUS>0</AUTHSTATUS>";
    $userId = ValidateSession($sessionkey, $appcode);
    if ($userId > -1) {
        $main_result = "<AUTHSTATUS>1</AUTHSTATUS>";
        $obj_Person_telephone = new Person_telephone();
        foreach ($Userdata["[UPPERTEMPLATENAME"] as $key => $child) {
            switch ($key) {
                case "PHONEID":
                    $obj_Person_telephone->PhoneId = $child;
                    break;
                case "PHONENUMBER":
                    $obj_Person_telephone->PhoneNumber = $child;
                    break;
                case "TYPE":
                    $obj_Person_telephone->Type = $child;
                    break;
                case "PERSONID":
                    $obj_Person_telephone->PersonId = $child;
                    break;
            }
        }
        $obj_retResult_Person_telephone = DAL_managePerson_telephone::addPerson_telephone($obj_Person_telephone);
        if ($obj_retResult_Person_telephone->type == 1) {
            $main_result .= "<RESULTSTATUS>1</RESULTSTATUS>";
            $main_result .= getPerson_telephoneXml($obj_retResult_Person_telephone->data);
        } else {
            $main_result .= "<RESULTSTATUS>0</RESULTSTATUS>";
        }
    }
    $main_result .= "</VPROFILERESULT>";
    return $main_result;
}
 public static function addPerson_telephone2($PhoneId, $PhoneNumber, $Type, $PersonId)
 {
     $obj_retResult = new returnResult();
     $obj_newPerson_telephone = new Person_telephone();
     $obj_newuser->setPerson_telephone($PhoneId, $PhoneNumber, $Type, $PersonId);
     // $isExist = BL_managePerson_telephone::isExist($obj_newPerson_telephone->id);
     if (!$isExist) {
         $obj_retResult_Person_telephone = DAL_managePerson_telephone::addPerson_telephone($obj_newPerson_telephone);
         if ($obj_retResult_Person_telephone->type == 1) {
             $obj_retResult->type = 1;
             $obj_retResult->msg = "Success";
             $obj_retResult->data = $obj_retResult_Person_telephone->data;
         } else {
             $obj_retResult->type = 0;
             $obj_retResult->msg = "Failed";
         }
     } else {
         $obj_retResult->type = 0;
         $obj_retResult->msg = "Sorry! Person_telephone already exist";
     }
     return $obj_retResult;
 }