function addTown($sessionkey, $appcode, $Towndata) { $main_result = "<VPROFILERESULT>"; $main_result .= "<AUTHSTATUS>0</AUTHSTATUS>"; $userId = ValidateSession($sessionkey, $appcode); if ($userId > -1) { $main_result = "<AUTHSTATUS>1</AUTHSTATUS>"; $obj_Town = new Town(); foreach ($Userdata["[UPPERTEMPLATENAME"] as $key => $child) { switch ($key) { case "TOWNID": $obj_Town->TownId = $child; break; case "TOWNNAME": $obj_Town->TownName = $child; break; case "DESCRIPTION": $obj_Town->Description = $child; break; } } $obj_retResult_Town = DAL_manageTown::addTown($obj_Town); if ($obj_retResult_Town->type == 1) { $main_result .= "<RESULTSTATUS>1</RESULTSTATUS>"; $main_result .= getTownXml($obj_retResult_Town->data); } else { $main_result .= "<RESULTSTATUS>0</RESULTSTATUS>"; } } $main_result .= "</VPROFILERESULT>"; return $main_result; }
public static function addTown2($TownId, $TownName, $Description) { $obj_retResult = new returnResult(); $obj_newTown = new Town(); $obj_newuser->setTown($TownId, $TownName, $Description); // $isExist = BL_manageTown::isExist($obj_newTown->id); if (!$isExist) { $obj_retResult_Town = DAL_manageTown::addTown($obj_newTown); if ($obj_retResult_Town->type == 1) { $obj_retResult->type = 1; $obj_retResult->msg = "Success"; $obj_retResult->data = $obj_retResult_Town->data; } else { $obj_retResult->type = 0; $obj_retResult->msg = "Failed"; } } else { $obj_retResult->type = 0; $obj_retResult->msg = "Sorry! Town already exist"; } return $obj_retResult; }