function addVillage_climate($sessionkey, $appcode, $Village_climatedata) { $main_result = "<VPROFILERESULT>"; $main_result .= "<AUTHSTATUS>0</AUTHSTATUS>"; $userId = ValidateSession($sessionkey, $appcode); if ($userId > -1) { $main_result = "<AUTHSTATUS>1</AUTHSTATUS>"; $obj_Village_climate = new Village_climate(); foreach ($Userdata["[UPPERTEMPLATENAME"] as $key => $child) { switch ($key) { case "CLIMATEID": $obj_Village_climate->ClimateId = $child; break; case "VILLAGEID": $obj_Village_climate->VillageId = $child; break; case "CLIMATEREAGION": $obj_Village_climate->ClimateReagion = $child; break; case "RAINFALL": $obj_Village_climate->RainFall = $child; break; case "TEMPARATURE": $obj_Village_climate->Temparature = $child; break; case "HUMIDITY": $obj_Village_climate->Humidity = $child; break; } } $obj_retResult_Village_climate = DAL_manageVillage_climate::addVillage_climate($obj_Village_climate); if ($obj_retResult_Village_climate->type == 1) { $main_result .= "<RESULTSTATUS>1</RESULTSTATUS>"; $main_result .= getVillage_climateXml($obj_retResult_Village_climate->data); } else { $main_result .= "<RESULTSTATUS>0</RESULTSTATUS>"; } } $main_result .= "</VPROFILERESULT>"; return $main_result; }
public static function addVillage_climate2($ClimateId, $VillageId, $ClimateReagion, $RainFall, $Temparature, $Humidity) { $obj_retResult = new returnResult(); $obj_newVillage_climate = new Village_climate(); $obj_newuser->setVillage_climate($ClimateId, $VillageId, $ClimateReagion, $RainFall, $Temparature, $Humidity); // $isExist = BL_manageVillage_climate::isExist($obj_newVillage_climate->id); if (!$isExist) { $obj_retResult_Village_climate = DAL_manageVillage_climate::addVillage_climate($obj_newVillage_climate); if ($obj_retResult_Village_climate->type == 1) { $obj_retResult->type = 1; $obj_retResult->msg = "Success"; $obj_retResult->data = $obj_retResult_Village_climate->data; } else { $obj_retResult->type = 0; $obj_retResult->msg = "Failed"; } } else { $obj_retResult->type = 0; $obj_retResult->msg = "Sorry! Village_climate already exist"; } return $obj_retResult; }