ok
Direktori : /home2/selectio/www/y1jobportal.in/admin/apis/ |
Current File : /home2/selectio/www/y1jobportal.in/admin/apis/subcategory.php |
<?php include "../api/config/config.php"; $date = date('Y-m-d', time()); if(isset($_POST['type']) && $_POST['type']=='add_subcategory'){ try{ $pdo->beginTransaction(); $date = date('Y-m-d', time()); $name = $_POST['name']; $category_id = $_POST['category_id']; $statement = $pdo->prepare("INSERT INTO `sub_category`(`name`,`category_id`,`status`) VALUES (?,?,?)"); $result = $statement->execute(array($name,$category_id,1)); if($result){ $last_inserted_id = $pdo->lastInsertId(); $pdo->commit(); $return_arr['message']='Subcategory Details Addded Successfully...'; $return_arr['status']=200; } else{ $return_arr['message']='Something Went Wrong..'; $return_arr['status']=400; } }catch(PDOException $e){ $return_arr['message']="$e"; error_log("Query Error: ".$e); $return_arr['status']=500; $pdo->rollBack(); } echo json_encode($return_arr); } if(isset($_POST['type']) && $_POST['type']=='add_vacancy'){ try{ $pdo->beginTransaction(); $category_id = $_POST['category_id']; $client_id = $_POST['client_id']; $vacancy = $_POST['vacancy']; $minimum_experience = $_POST['minimum_experience']; $salary = $_POST['salary']; $job_description = $_POST['job_description']; $statement = $pdo->prepare("INSERT INTO `tbl_job_vacancy`(`client_id`,`sub_category`,`job_vacancy`,`minimum_experience`,`salary`,`job_description`) VALUES (?,?,?,?,?,?)"); $result = $statement->execute(array($client_id,$category_id,$vacancy,$minimum_experience,$salary,$job_description)); if($result){ $last_inserted_id = $pdo->lastInsertId(); $pdo->commit(); $return_arr['message']='Job Vacancy Details Addded Successfully...'; $return_arr['status']=200; } else{ $return_arr['message']='Something Went Wrong..'; $return_arr['status']=400; } }catch(PDOException $e){ $return_arr['message']="$e"; error_log("Query Error: ".$e); $return_arr['status']=500; $pdo->rollBack(); } echo json_encode($return_arr); } if(isset($_POST['type']) && $_POST['type']=='update_subcategory'){ try{ $pdo->beginTransaction(); $date = date('Y-m-d', time()); $ids = $_POST['ids']; $name = $_POST['name']; $category_id = $_POST['category_id']; $status = $_POST['status']; $statement = $pdo->prepare("UPDATE `sub_category` SET `name`=?, `category_id`=?, `status`=? WHERE id=?"); $result = $statement->execute(array($name,$category_id,$status, $ids)); if($result){ $last_inserted_id = $pdo->lastInsertId(); $pdo->commit(); $return_arr['message']='Subcategory Details Updated Successfully...'; $return_arr['status']=200; } else{ $return_arr['message']='Something Went Wrong..'; $return_arr['status']=400; } }catch(PDOException $e){ $return_arr['message']="$e"; error_log("Query Error: ".$e); $return_arr['status']=500; $pdo->rollBack(); } echo json_encode($return_arr); } if(isset($_POST['type']) && $_POST['type']=='update_vacancy'){ try{ $pdo->beginTransaction(); $ids = $_POST['ids']; $category_id = $_POST['category_id']; $vacancy = $_POST['vacancy']; $minimum_experience = $_POST['minimum_experience']; $salary = $_POST['salary']; $job_description = $_POST['job_description']; $status = $_POST['status']; $statement = $pdo->prepare("UPDATE `tbl_job_vacancy` SET `sub_category`=?, `job_vacancy`=?,`minimum_experience`=?,`salary`=?,`job_description`=?,`status`=? WHERE id=?"); $result = $statement->execute(array($category_id,$vacancy,$minimum_experience,$salary,$job_description,$status, $ids)); if($result){ $last_inserted_id = $pdo->lastInsertId(); $pdo->commit(); $return_arr['message']='Recruitment Details Updated Successfully...'; $return_arr['status']=200; } else{ $return_arr['message']='Something Went Wrong..'; $return_arr['status']=400; } }catch(PDOException $e){ $return_arr['message']="$e"; error_log("Query Error: ".$e); $return_arr['status']=500; $pdo->rollBack(); } echo json_encode($return_arr); } ?>