function updateVillage_enterance($sessionkey, $appcode, $Village_enterancedata)
{
    $main_result = "<VPROFILERESULT>";
    $main_result .= "<AUTHSTATUS>0</AUTHSTATUS>";
    $userId = ValidateSession($sessionkey, $appcode);
    if ($userId > -1) {
        $main_result = "<AUTHSTATUS>1</AUTHSTATUS>";
        $obj_Village_enterance = new Village_enterance();
        foreach ($Userdata["[UPPERTEMPLATENAME"] as $key => $child) {
            switch ($key) {
                case "TBLID":
                    $obj_Village_enterance->TblId = $child;
                    break;
                case "VILLAGEID":
                    $obj_Village_enterance->VillageId = $child;
                    break;
                case "DIRECTION":
                    $obj_Village_enterance->Direction = $child;
                    break;
                case "DESCRIPTION":
                    $obj_Village_enterance->Description = $child;
                    break;
            }
        }
        $obj_retResult_Village_enterance = DAL_manageVillage_enterance::updateVillage_enterance($obj_Village_enterance);
        if ($obj_retResult_Village_enterance->type == 1) {
            $main_result .= "<RESULTSTATUS>1</RESULTSTATUS>";
            $main_result .= getVillage_enteranceXml($obj_retResult_Village_enterance->data);
        } else {
            $main_result .= "<RESULTSTATUS>0</RESULTSTATUS>";
        }
    }
    $main_result .= "</VPROFILERESULT>";
    return $main_result;
}
 public static function addVillage_enterance($obj_Village_enterance)
 {
     $db = config::dbconfig();
     $obj_retresult = new returnResult();
     $obj_Village_enterance->TblId = DAL_manageVillage_enterance::getLastVillage_enteranceId() + 1;
     $sql = "INSERT INTO tbl_village_enterance (TblId,VillageId,Direction,Description) \n\t\tVALUES (" . common::noSqlInject($obj_Village_enterance->TblId) . "," . common::noSqlInject($obj_Village_enterance->VillageId) . "," . "'" . common::noSqlInject($obj_Village_enterance->Direction) . "'" . "," . "'" . common::noSqlInject($obj_Village_enterance->Description) . "'" . ");";
     $rs = mysql_query($sql);
     if (mysql_affected_rows() > 0) {
         $obj_retresult->type = 1;
         $obj_retresult->msg = "success";
         $obj_retresult->data = $obj_Village_enterance;
     } else {
         $obj_retresult->type = 0;
         $obj_retresult->msg = "failed";
     }
     return $obj_retresult;
 }
 public static function isChildVillage_enterance($TblId, $ChildTblId)
 {
     $ischild = false;
     $obj_retResult = DAL_manageVillage_enterance::getVillage_enteranceListByTblId($ChildTblId);
     //get child node
     if ($obj_retResult->type == 1) {
         $arr_Village_enteranceList = $obj_retResult->data;
         $obj_Village_enterance = $arr_Village_enteranceList[0];
         $arrParentIds = explode(",", $obj_Village_enterance->Url);
         foreach ($arrParentIds as $Village_enteranceParentId) {
             if ($Village_enteranceParentId == $TblId) {
                 $ischild = true;
             }
         }
     }
     return $ischild;
 }