Exemplo n.º 1
0
function updateSoiltype($sessionkey, $appcode, $Soiltypedata)
{
    $main_result = "<VPROFILERESULT>";
    $main_result .= "<AUTHSTATUS>0</AUTHSTATUS>";
    $userId = ValidateSession($sessionkey, $appcode);
    if ($userId > -1) {
        $main_result = "<AUTHSTATUS>1</AUTHSTATUS>";
        $obj_Soiltype = new Soiltype();
        foreach ($Userdata["[UPPERTEMPLATENAME"] as $key => $child) {
            switch ($key) {
                case "TBLID":
                    $obj_Soiltype->TblId = $child;
                    break;
                case "SOILTYPEID":
                    $obj_Soiltype->SoilTypeId = $child;
                    break;
                case "SOILTYPENAME":
                    $obj_Soiltype->SoilTypeName = $child;
                    break;
                case "DESCRIPTION":
                    $obj_Soiltype->Description = $child;
                    break;
            }
        }
        $obj_retResult_Soiltype = DAL_manageSoiltype::updateSoiltype($obj_Soiltype);
        if ($obj_retResult_Soiltype->type == 1) {
            $main_result .= "<RESULTSTATUS>1</RESULTSTATUS>";
            $main_result .= getSoiltypeXml($obj_retResult_Soiltype->data);
        } else {
            $main_result .= "<RESULTSTATUS>0</RESULTSTATUS>";
        }
    }
    $main_result .= "</VPROFILERESULT>";
    return $main_result;
}
Exemplo n.º 2
0
 public static function addSoiltype($obj_Soiltype)
 {
     $db = config::dbconfig();
     $obj_retresult = new returnResult();
     $obj_Soiltype->SoilTypeId = DAL_manageSoiltype::getLastSoiltypeId() + 1;
     $sql = "INSERT INTO tbl_soiltype (SoilTypeId,SoilTypeName,Description) \n\t\tVALUES (" . common::noSqlInject($obj_Soiltype->SoilTypeId) . "," . "'" . common::noSqlInject($obj_Soiltype->SoilTypeName) . "'" . "," . "'" . common::noSqlInject($obj_Soiltype->Description) . "'" . ");";
     $rs = mysql_query($sql);
     if (mysql_affected_rows() > 0) {
         $obj_retresult->type = 1;
         $obj_retresult->msg = "success";
         $obj_retresult->data = $obj_Soiltype;
     } else {
         $obj_retresult->type = 0;
         $obj_retresult->msg = "failed";
     }
     return $obj_retresult;
 }
Exemplo n.º 3
0
 public static function isChildSoiltype($TblId, $ChildTblId)
 {
     $ischild = false;
     $obj_retResult = DAL_manageSoiltype::getSoiltypeListByTblId($ChildTblId);
     //get child node
     if ($obj_retResult->type == 1) {
         $arr_SoiltypeList = $obj_retResult->data;
         $obj_Soiltype = $arr_SoiltypeList[0];
         $arrParentIds = explode(",", $obj_Soiltype->Url);
         foreach ($arrParentIds as $SoiltypeParentId) {
             if ($SoiltypeParentId == $TblId) {
                 $ischild = true;
             }
         }
     }
     return $ischild;
 }