function addLocation($sessionkey, $appcode, $Locationdata) { $main_result = "<VPROFILERESULT>"; $main_result .= "<AUTHSTATUS>0</AUTHSTATUS>"; $userId = ValidateSession($sessionkey, $appcode); if ($userId > -1) { $main_result = "<AUTHSTATUS>1</AUTHSTATUS>"; $obj_Location = new Location(); foreach ($Userdata["[UPPERTEMPLATENAME"] as $key => $child) { switch ($key) { case "LOCATIONID": $obj_Location->LocationId = $child; break; case "NAME": $obj_Location->Name = $child; break; case "LOCATIONTYPE": $obj_Location->LocationType = $child; break; case "DESCRIPTION": $obj_Location->Description = $child; break; } } $obj_retResult_Location = DAL_manageLocation::addLocation($obj_Location); if ($obj_retResult_Location->type == 1) { $main_result .= "<RESULTSTATUS>1</RESULTSTATUS>"; $main_result .= getLocationXml($obj_retResult_Location->data); } else { $main_result .= "<RESULTSTATUS>0</RESULTSTATUS>"; } } $main_result .= "</VPROFILERESULT>"; return $main_result; }
public static function addLocation2($LocationId, $Name, $LocationType, $Description) { $obj_retResult = new returnResult(); $obj_newLocation = new Location(); $obj_newuser->setLocation($LocationId, $Name, $LocationType, $Description); // $isExist = BL_manageLocation::isExist($obj_newLocation->id); if (!$isExist) { $obj_retResult_Location = DAL_manageLocation::addLocation($obj_newLocation); if ($obj_retResult_Location->type == 1) { $obj_retResult->type = 1; $obj_retResult->msg = "Success"; $obj_retResult->data = $obj_retResult_Location->data; } else { $obj_retResult->type = 0; $obj_retResult->msg = "Failed"; } } else { $obj_retResult->type = 0; $obj_retResult->msg = "Sorry! Location already exist"; } return $obj_retResult; }