function updateProduct($sessionkey, $appcode, $Productdata) { $main_result = "<VPROFILERESULT>"; $main_result .= "<AUTHSTATUS>0</AUTHSTATUS>"; $userId = ValidateSession($sessionkey, $appcode); if ($userId > -1) { $main_result = "<AUTHSTATUS>1</AUTHSTATUS>"; $obj_Product = new Product(); foreach ($Userdata["[UPPERTEMPLATENAME"] as $key => $child) { switch ($key) { case "PRODUCTID": $obj_Product->ProductId = $child; break; case "PRODUCTNAME": $obj_Product->ProductName = $child; break; case "EXPIREDURATION": $obj_Product->ExpireDuration = $child; break; case "DESCRIPTION": $obj_Product->Description = $child; break; } } $obj_retResult_Product = DAL_manageProduct::updateProduct($obj_Product); if ($obj_retResult_Product->type == 1) { $main_result .= "<RESULTSTATUS>1</RESULTSTATUS>"; $main_result .= getProductXml($obj_retResult_Product->data); } else { $main_result .= "<RESULTSTATUS>0</RESULTSTATUS>"; } } $main_result .= "</VPROFILERESULT>"; return $main_result; }
public static function addProduct($obj_Product) { $db = config::dbconfig(); $obj_retresult = new returnResult(); $obj_Product->ProductId = DAL_manageProduct::getLastProductId() + 1; $sql = "INSERT INTO tbl_product (ProductId,ProductName,ExpireDuration,Description) \n\t\tVALUES (" . common::noSqlInject($obj_Product->ProductId) . "," . "'" . common::noSqlInject($obj_Product->ProductName) . "'" . "," . "'" . common::noSqlInject($obj_Product->ExpireDuration) . "'" . "," . "'" . common::noSqlInject($obj_Product->Description) . "'" . ");"; $rs = mysql_query($sql); if (mysql_affected_rows() > 0) { $obj_retresult->type = 1; $obj_retresult->msg = "success"; $obj_retresult->data = $obj_Product; } else { $obj_retresult->type = 0; $obj_retresult->msg = "failed"; } return $obj_retresult; }
public static function isChildProduct($ProductId, $ChildProductId) { $ischild = false; $obj_retResult = DAL_manageProduct::getProductListByProductId($ChildProductId); //get child node if ($obj_retResult->type == 1) { $arr_ProductList = $obj_retResult->data; $obj_Product = $arr_ProductList[0]; $arrParentIds = explode(",", $obj_Product->Url); foreach ($arrParentIds as $ProductParentId) { if ($ProductParentId == $ProductId) { $ischild = true; } } } return $ischild; }