function updateVillage_neartowns($sessionkey, $appcode, $Village_neartownsdata) { $main_result = "<VPROFILERESULT>"; $main_result .= "<AUTHSTATUS>0</AUTHSTATUS>"; $userId = ValidateSession($sessionkey, $appcode); if ($userId > -1) { $main_result = "<AUTHSTATUS>1</AUTHSTATUS>"; $obj_Village_neartowns = new Village_neartowns(); foreach ($Userdata["[UPPERTEMPLATENAME"] as $key => $child) { switch ($key) { case "VILLAGEID": $obj_Village_neartowns->VillageId = $child; break; case "TOWNID": $obj_Village_neartowns->TownId = $child; break; case "DISTANCE": $obj_Village_neartowns->Distance = $child; break; case "DESCRIPTION": $obj_Village_neartowns->Description = $child; break; } } $obj_retResult_Village_neartowns = DAL_manageVillage_neartowns::updateVillage_neartowns($obj_Village_neartowns); if ($obj_retResult_Village_neartowns->type == 1) { $main_result .= "<RESULTSTATUS>1</RESULTSTATUS>"; $main_result .= getVillage_neartownsXml($obj_retResult_Village_neartowns->data); } else { $main_result .= "<RESULTSTATUS>0</RESULTSTATUS>"; } } $main_result .= "</VPROFILERESULT>"; return $main_result; }
public static function addVillage_neartowns($obj_Village_neartowns) { $db = config::dbconfig(); $obj_retresult = new returnResult(); $obj_Village_neartowns->TownId = DAL_manageVillage_neartowns::getLastVillage_neartownsId() + 1; $sql = "INSERT INTO tbl_village_neartowns (VillageId,TownId,Distance,Description) \n\t\tVALUES (" . common::noSqlInject($obj_Village_neartowns->VillageId) . "," . common::noSqlInject($obj_Village_neartowns->TownId) . "," . common::noSqlInject($obj_Village_neartowns->Distance) . "," . "'" . common::noSqlInject($obj_Village_neartowns->Description) . "'" . ");"; $rs = mysql_query($sql); if (mysql_affected_rows() > 0) { $obj_retresult->type = 1; $obj_retresult->msg = "success"; $obj_retresult->data = $obj_Village_neartowns; } else { $obj_retresult->type = 0; $obj_retresult->msg = "failed"; } return $obj_retresult; }
public static function isChildVillage_neartowns($TownId, $ChildTownId) { $ischild = false; $obj_retResult = DAL_manageVillage_neartowns::getVillage_neartownsListByTownId($ChildTownId); //get child node if ($obj_retResult->type == 1) { $arr_Village_neartownsList = $obj_retResult->data; $obj_Village_neartowns = $arr_Village_neartownsList[0]; $arrParentIds = explode(",", $obj_Village_neartowns->Url); foreach ($arrParentIds as $Village_neartownsParentId) { if ($Village_neartownsParentId == $TownId) { $ischild = true; } } } return $ischild; }