public static function addResource(en\resource $rs)
 {
     $conn = connection::getConnectionObject();
     $con = $conn->getConnection();
     $sql = $con->prepare("INSERT INTO resource VALUES (?,?)");
     $resid = $rs->getResourceId();
     $supid = $rs->getSupplierId();
     $sql->bind_param("ss", $resid, $supid);
     if ($sql->execute() == TRUE) {
         echo "New record created successfully in RESOURCE table";
     } else {
         echo "Error in resource adding: <br>";
     }
 }
 public function saveLocationAction()
 {
     $eqpm = new en\Location();
     $rs = new en\resource();
     $eqpm->setResourceId($_POST["resource_id"]);
     $eqpm->setType($_POST["locationtype"]);
     $eqpm->setSession($_POST["sessionlimit"]);
     $eqpm->setName($_POST["locationName"]);
     $rs->setResourceId($_POST["resource_id"]);
     $rs->setSupplierId($_POST["supplier_id"]);
     cont\ResourceDBaccess::addResource($rs);
     cont\LocationDBaccess::addLocation($eqpm);
     return $this->render('applicationLocationsBundle:Default:index.html.twig');
 }
 public function addNewEquipmentSaveAction()
 {
     $eqpm = new en\equipment();
     $eqpm->setEquipmentName($_POST["equipmentName"]);
     $eqpm->setDate($_POST["date"]);
     echo $eqpm->getDate();
     $eqpm->setQuantity($_POST["quantity"]);
     $eqpm->setResourceId($_POST["resourceId"]);
     $rs = new en\resource();
     $rs->setResourceId($_POST["resourceId"]);
     $rs->setSupplierId($_POST["supplierId"]);
     $added = cont\EquipmentDBacess::saveToEquipment($eqpm, $rs);
     if ($added) {
         return $this->render('applicationequipmentBundle:Forms:addedSuccessfullyMessage.html.twig');
     } else {
         echo "not added";
         return $this->render('applicationMainBundle:Default:index.html.twig');
     }
 }