function addVillage($sessionkey, $appcode, $Villagedata) { $main_result = "<VPROFILERESULT>"; $main_result .= "<AUTHSTATUS>0</AUTHSTATUS>"; $userId = ValidateSession($sessionkey, $appcode); if ($userId > -1) { $main_result = "<AUTHSTATUS>1</AUTHSTATUS>"; $obj_Village = new Village(); foreach ($Userdata["[UPPERTEMPLATENAME"] as $key => $child) { switch ($key) { case "VILLAGEID": $obj_Village->VillageId = $child; break; case "NAME": $obj_Village->Name = $child; break; case "VILLAGENUMBER": $obj_Village->VillageNumber = $child; break; case "AGADEVISION": $obj_Village->AgaDevision = $child; break; case "DISTRICT": $obj_Village->District = $child; break; case "PROVINCE": $obj_Village->Province = $child; break; case "GEOGROPHYTYPEID": $obj_Village->GeogrophyTypeId = $child; break; case "FORESTTYPEID": $obj_Village->ForestTypeId = $child; break; case "FORESTDESCRIPTION": $obj_Village->ForestDescription = $child; break; case "TRADITIONALKNOWLEDGE": $obj_Village->TraditionalKnowledge = $child; break; } } $obj_retResult_Village = DAL_manageVillage::addVillage($obj_Village); if ($obj_retResult_Village->type == 1) { $main_result .= "<RESULTSTATUS>1</RESULTSTATUS>"; $main_result .= getVillageXml($obj_retResult_Village->data); } else { $main_result .= "<RESULTSTATUS>0</RESULTSTATUS>"; } } $main_result .= "</VPROFILERESULT>"; return $main_result; }
public static function addVillage2($VillageId, $Name, $VillageNumber, $AgaDevision, $District, $Province, $GeogrophyTypeId, $ForestTypeId, $ForestDescription, $TraditionalKnowledge) { $obj_retResult = new returnResult(); $obj_newVillage = new Village(); $obj_newuser->setVillage($VillageId, $Name, $VillageNumber, $AgaDevision, $District, $Province, $GeogrophyTypeId, $ForestTypeId, $ForestDescription, $TraditionalKnowledge); // $isExist = BL_manageVillage::isExist($obj_newVillage->id); if (!$isExist) { $obj_retResult_Village = DAL_manageVillage::addVillage($obj_newVillage); if ($obj_retResult_Village->type == 1) { $obj_retResult->type = 1; $obj_retResult->msg = "Success"; $obj_retResult->data = $obj_retResult_Village->data; } else { $obj_retResult->type = 0; $obj_retResult->msg = "Failed"; } } else { $obj_retResult->type = 0; $obj_retResult->msg = "Sorry! Village already exist"; } return $obj_retResult; }