function updateBusiness_product($sessionkey, $appcode, $Business_productdata)
{
    $main_result = "<VPROFILERESULT>";
    $main_result .= "<AUTHSTATUS>0</AUTHSTATUS>";
    $userId = ValidateSession($sessionkey, $appcode);
    if ($userId > -1) {
        $main_result = "<AUTHSTATUS>1</AUTHSTATUS>";
        $obj_Business_product = new Business_product();
        foreach ($Userdata["[UPPERTEMPLATENAME"] as $key => $child) {
            switch ($key) {
                case "BUSINESSID":
                    $obj_Business_product->BusinessId = $child;
                    break;
                case "PRODUCTID":
                    $obj_Business_product->ProductId = $child;
                    break;
            }
        }
        $obj_retResult_Business_product = DAL_manageBusiness_product::updateBusiness_product($obj_Business_product);
        if ($obj_retResult_Business_product->type == 1) {
            $main_result .= "<RESULTSTATUS>1</RESULTSTATUS>";
            $main_result .= getBusiness_productXml($obj_retResult_Business_product->data);
        } else {
            $main_result .= "<RESULTSTATUS>0</RESULTSTATUS>";
        }
    }
    $main_result .= "</VPROFILERESULT>";
    return $main_result;
}
 public static function addBusiness_product($obj_Business_product)
 {
     $db = config::dbconfig();
     $obj_retresult = new returnResult();
     $obj_Business_product->ProductId = DAL_manageBusiness_product::getLastBusiness_productId() + 1;
     $sql = "INSERT INTO tbl_business_product (BusinessId,ProductId) \n\t\tVALUES (" . common::noSqlInject($obj_Business_product->BusinessId) . "," . common::noSqlInject($obj_Business_product->ProductId) . ");";
     $rs = mysql_query($sql);
     if (mysql_affected_rows() > 0) {
         $obj_retresult->type = 1;
         $obj_retresult->msg = "success";
         $obj_retresult->data = $obj_Business_product;
     } else {
         $obj_retresult->type = 0;
         $obj_retresult->msg = "failed";
     }
     return $obj_retresult;
 }
 public static function isChildBusiness_product($ProductId, $ChildProductId)
 {
     $ischild = false;
     $obj_retResult = DAL_manageBusiness_product::getBusiness_productListByProductId($ChildProductId);
     //get child node
     if ($obj_retResult->type == 1) {
         $arr_Business_productList = $obj_retResult->data;
         $obj_Business_product = $arr_Business_productList[0];
         $arrParentIds = explode(",", $obj_Business_product->Url);
         foreach ($arrParentIds as $Business_productParentId) {
             if ($Business_productParentId == $ProductId) {
                 $ischild = true;
             }
         }
     }
     return $ischild;
 }