function addProduct($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::addProduct($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 addProduct2($ProductId, $ProductName, $ExpireDuration, $Description)
 {
     $obj_retResult = new returnResult();
     $obj_newProduct = new Product();
     $obj_newuser->setProduct($ProductId, $ProductName, $ExpireDuration, $Description);
     // $isExist = BL_manageProduct::isExist($obj_newProduct->id);
     if (!$isExist) {
         $obj_retResult_Product = DAL_manageProduct::addProduct($obj_newProduct);
         if ($obj_retResult_Product->type == 1) {
             $obj_retResult->type = 1;
             $obj_retResult->msg = "Success";
             $obj_retResult->data = $obj_retResult_Product->data;
         } else {
             $obj_retResult->type = 0;
             $obj_retResult->msg = "Failed";
         }
     } else {
         $obj_retResult->type = 0;
         $obj_retResult->msg = "Sorry! Product already exist";
     }
     return $obj_retResult;
 }