예제 #1
0
 public static function addBusiness($obj_Business)
 {
     $db = config::dbconfig();
     $obj_retresult = new returnResult();
     $obj_Business->BusinessId = DAL_manageBusiness::getLastBusinessId() + 1;
     $sql = "INSERT INTO tbl_business (BusinessId,Name,Description,Address,telephone,fax,website,email,BusinessTypeId,BusinessSubTypeId) \n\t\tVALUES (" . common::noSqlInject($obj_Business->BusinessId) . "," . "'" . common::noSqlInject($obj_Business->Name) . "'" . "," . "'" . common::noSqlInject($obj_Business->Description) . "'" . "," . "'" . common::noSqlInject($obj_Business->Address) . "'" . "," . "'" . common::noSqlInject($obj_Business->telephone) . "'" . "," . "'" . common::noSqlInject($obj_Business->fax) . "'" . "," . "'" . common::noSqlInject($obj_Business->website) . "'" . "," . "'" . common::noSqlInject($obj_Business->email) . "'" . "," . common::noSqlInject($obj_Business->BusinessTypeId) . "," . common::noSqlInject($obj_Business->BusinessSubTypeId) . ");";
     $rs = mysql_query($sql);
     if (mysql_affected_rows() > 0) {
         $obj_retresult->type = 1;
         $obj_retresult->msg = "success";
         $obj_retresult->data = $obj_Business;
     } else {
         $obj_retresult->type = 0;
         $obj_retresult->msg = "failed";
     }
     return $obj_retresult;
 }
예제 #2
0
 public static function isChildBusiness($BusinessId, $ChildBusinessId)
 {
     $ischild = false;
     $obj_retResult = DAL_manageBusiness::getBusinessListByBusinessId($ChildBusinessId);
     //get child node
     if ($obj_retResult->type == 1) {
         $arr_BusinessList = $obj_retResult->data;
         $obj_Business = $arr_BusinessList[0];
         $arrParentIds = explode(",", $obj_Business->Url);
         foreach ($arrParentIds as $BusinessParentId) {
             if ($BusinessParentId == $BusinessId) {
                 $ischild = true;
             }
         }
     }
     return $ischild;
 }
예제 #3
0
function updateBusiness($sessionkey, $appcode, $Businessdata)
{
    $main_result = "<VPROFILERESULT>";
    $main_result .= "<AUTHSTATUS>0</AUTHSTATUS>";
    $userId = ValidateSession($sessionkey, $appcode);
    if ($userId > -1) {
        $main_result = "<AUTHSTATUS>1</AUTHSTATUS>";
        $obj_Business = new Business();
        foreach ($Userdata["[UPPERTEMPLATENAME"] as $key => $child) {
            switch ($key) {
                case "BUSINESSID":
                    $obj_Business->BusinessId = $child;
                    break;
                case "NAME":
                    $obj_Business->Name = $child;
                    break;
                case "DESCRIPTION":
                    $obj_Business->Description = $child;
                    break;
                case "ADDRESS":
                    $obj_Business->Address = $child;
                    break;
                case "TELEPHONE":
                    $obj_Business->telephone = $child;
                    break;
                case "FAX":
                    $obj_Business->fax = $child;
                    break;
                case "WEBSITE":
                    $obj_Business->website = $child;
                    break;
                case "EMAIL":
                    $obj_Business->email = $child;
                    break;
                case "BUSINESSTYPEID":
                    $obj_Business->BusinessTypeId = $child;
                    break;
                case "BUSINESSSUBTYPEID":
                    $obj_Business->BusinessSubTypeId = $child;
                    break;
            }
        }
        $obj_retResult_Business = DAL_manageBusiness::updateBusiness($obj_Business);
        if ($obj_retResult_Business->type == 1) {
            $main_result .= "<RESULTSTATUS>1</RESULTSTATUS>";
            $main_result .= getBusinessXml($obj_retResult_Business->data);
        } else {
            $main_result .= "<RESULTSTATUS>0</RESULTSTATUS>";
        }
    }
    $main_result .= "</VPROFILERESULT>";
    return $main_result;
}