function updateGeographytype($sessionkey, $appcode, $Geographytypedata) { $main_result = "<VPROFILERESULT>"; $main_result .= "<AUTHSTATUS>0</AUTHSTATUS>"; $userId = ValidateSession($sessionkey, $appcode); if ($userId > -1) { $main_result = "<AUTHSTATUS>1</AUTHSTATUS>"; $obj_Geographytype = new Geographytype(); foreach ($Userdata["[UPPERTEMPLATENAME"] as $key => $child) { switch ($key) { case "GEOGROPHYTYPEID": $obj_Geographytype->GeogrophyTypeId = $child; break; case "NAME": $obj_Geographytype->Name = $child; break; case "DESCRIPTION": $obj_Geographytype->Description = $child; break; } } $obj_retResult_Geographytype = DAL_manageGeographytype::updateGeographytype($obj_Geographytype); if ($obj_retResult_Geographytype->type == 1) { $main_result .= "<RESULTSTATUS>1</RESULTSTATUS>"; $main_result .= getGeographytypeXml($obj_retResult_Geographytype->data); } else { $main_result .= "<RESULTSTATUS>0</RESULTSTATUS>"; } } $main_result .= "</VPROFILERESULT>"; return $main_result; }
public static function addGeographytype($obj_Geographytype) { $db = config::dbconfig(); $obj_retresult = new returnResult(); $obj_Geographytype->GeogrophyTypeId = DAL_manageGeographytype::getLastGeographytypeId() + 1; $sql = "INSERT INTO tbl_geographytype (GeogrophyTypeId,Name,Description) \n\t\tVALUES (" . common::noSqlInject($obj_Geographytype->GeogrophyTypeId) . "," . "'" . common::noSqlInject($obj_Geographytype->Name) . "'" . "," . "'" . common::noSqlInject($obj_Geographytype->Description) . "'" . ");"; $rs = mysql_query($sql); if (mysql_affected_rows() > 0) { $obj_retresult->type = 1; $obj_retresult->msg = "success"; $obj_retresult->data = $obj_Geographytype; } else { $obj_retresult->type = 0; $obj_retresult->msg = "failed"; } return $obj_retresult; }
public static function isChildGeographytype($GeogrophyTypeId, $ChildGeogrophyTypeId) { $ischild = false; $obj_retResult = DAL_manageGeographytype::getGeographytypeListByGeogrophyTypeId($ChildGeogrophyTypeId); //get child node if ($obj_retResult->type == 1) { $arr_GeographytypeList = $obj_retResult->data; $obj_Geographytype = $arr_GeographytypeList[0]; $arrParentIds = explode(",", $obj_Geographytype->Url); foreach ($arrParentIds as $GeographytypeParentId) { if ($GeographytypeParentId == $GeogrophyTypeId) { $ischild = true; } } } return $ischild; }