示例#1
0
 /**
  * This method is used for create a Product
  *
  * @url GET product/{ProductID}/{ClientID}/{LotID}/{MeasureID}/{CategoryID}/{Name}/{Quantity}
  */
 public function product($ProductID, $ClientID, $LotID, $MeasureID, $CategoryID, $Name, $Quantity)
 {
     $Utils = new Utils();
     $Client = new Client();
     $Lot = new Lot();
     $Measure = new Measure();
     $Category = new Category();
     $Product = new Product();
     if ($Client->findClient($ClientID) && $Lot->findLot($LotID) && $Measure->findMeasure($MeasureID) && $Category->findCategory($CategoryID) && $Product->findProduct($ProductID)) {
         $Product->Client_ID = $Client->Client_ID;
         $Product->Lot_ID = $Lot->Lot_ID;
         $Product->Category = $Category->Category_ID;
         $Product->Measure_ID = $Measure->Measure_ID;
         $Product->Name = $Name;
         $Product->Quantity = $Quantity;
         $productReturn = $Product->gravarDados();
         if ($productReturn) {
             return array('Success' => true, "Msg" => "Product has been alter", "Product_ID" => $productReturn);
         }
         return array('Success' => false, "Msg" => "Can't alter Product");
     }
     return array('Success' => false, "Msg" => "Client, Product or Measure not found");
 }
示例#2
0
 /**
  * This method is used for create a Product Value
  *
  * @url GET productvalue/{ClientID}/{Product_ID}/{Value}
  */
 public function productvalue($ClientID, $Product_ID, $Value)
 {
     $Utils = new Utils();
     $Client = new Client();
     $Product = new Product();
     if ($Client->findClient($ClientID) && $Product->findProduct($Product_ID)) {
         $ProductValue = new ProductValue();
         $ProductValue->Client_ID = $Client->Client_ID;
         $ProductValue->Product_ID = $Product->Product_ID;
         $ProductValue->Value = $Value;
         if ($ProductValue->gravarDados()) {
             return array('Success' => true, "Msg" => "Product Value inserted");
         }
         return array('Success' => false, "Msg" => "Can't insert Product Value into database");
     }
     return array('Success' => false, "Msg" => "Client or Product not found");
 }