function addVillage_plant($sessionkey, $appcode, $Village_plantdata)
{
    $main_result = "<VPROFILERESULT>";
    $main_result .= "<AUTHSTATUS>0</AUTHSTATUS>";
    $userId = ValidateSession($sessionkey, $appcode);
    if ($userId > -1) {
        $main_result = "<AUTHSTATUS>1</AUTHSTATUS>";
        $obj_Village_plant = new Village_plant();
        foreach ($Userdata["[UPPERTEMPLATENAME"] as $key => $child) {
            switch ($key) {
                case "PLANTID":
                    $obj_Village_plant->PlantId = $child;
                    break;
                case "VILLAGEID":
                    $obj_Village_plant->VillageId = $child;
                    break;
            }
        }
        $obj_retResult_Village_plant = DAL_manageVillage_plant::addVillage_plant($obj_Village_plant);
        if ($obj_retResult_Village_plant->type == 1) {
            $main_result .= "<RESULTSTATUS>1</RESULTSTATUS>";
            $main_result .= getVillage_plantXml($obj_retResult_Village_plant->data);
        } else {
            $main_result .= "<RESULTSTATUS>0</RESULTSTATUS>";
        }
    }
    $main_result .= "</VPROFILERESULT>";
    return $main_result;
}
 public static function addVillage_plant2($PlantId, $VillageId)
 {
     $obj_retResult = new returnResult();
     $obj_newVillage_plant = new Village_plant();
     $obj_newuser->setVillage_plant($PlantId, $VillageId);
     // $isExist = BL_manageVillage_plant::isExist($obj_newVillage_plant->id);
     if (!$isExist) {
         $obj_retResult_Village_plant = DAL_manageVillage_plant::addVillage_plant($obj_newVillage_plant);
         if ($obj_retResult_Village_plant->type == 1) {
             $obj_retResult->type = 1;
             $obj_retResult->msg = "Success";
             $obj_retResult->data = $obj_retResult_Village_plant->data;
         } else {
             $obj_retResult->type = 0;
             $obj_retResult->msg = "Failed";
         }
     } else {
         $obj_retResult->type = 0;
         $obj_retResult->msg = "Sorry! Village_plant already exist";
     }
     return $obj_retResult;
 }