function updatePerson_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::updatePerson_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_telephone($obj_Person_telephone)
 {
     $db = config::dbconfig();
     $obj_retresult = new returnResult();
     $obj_Person_telephone->PhoneId = DAL_managePerson_telephone::getLastPerson_telephoneId() + 1;
     $sql = "INSERT INTO tbl_person_telephone (PhoneId,PhoneNumber,Type,PersonId) \n\t\tVALUES (" . common::noSqlInject($obj_Person_telephone->PhoneId) . "," . "'" . common::noSqlInject($obj_Person_telephone->PhoneNumber) . "'" . "," . common::noSqlInject($obj_Person_telephone->Type) . "," . common::noSqlInject($obj_Person_telephone->PersonId) . ");";
     $rs = mysql_query($sql);
     if (mysql_affected_rows() > 0) {
         $obj_retresult->type = 1;
         $obj_retresult->msg = "success";
         $obj_retresult->data = $obj_Person_telephone;
     } else {
         $obj_retresult->type = 0;
         $obj_retresult->msg = "failed";
     }
     return $obj_retresult;
 }
 public static function isChildPerson_telephone($PhoneId, $ChildPhoneId)
 {
     $ischild = false;
     $obj_retResult = DAL_managePerson_telephone::getPerson_telephoneListByPhoneId($ChildPhoneId);
     //get child node
     if ($obj_retResult->type == 1) {
         $arr_Person_telephoneList = $obj_retResult->data;
         $obj_Person_telephone = $arr_Person_telephoneList[0];
         $arrParentIds = explode(",", $obj_Person_telephone->Url);
         foreach ($arrParentIds as $Person_telephoneParentId) {
             if ($Person_telephoneParentId == $PhoneId) {
                 $ischild = true;
             }
         }
     }
     return $ischild;
 }