From 8906845bf0a6d1e95bf7f75bad2697eca6ef992a Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Thu, 19 Apr 2018 16:14:23 +0530 Subject: [PATCH] university changes done --- .../application/models/University_model.php | 36 ++++++++++++------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/Apollo/api/application/models/University_model.php b/Apollo/api/application/models/University_model.php index a9a10188..9e6ada2d 100755 --- a/Apollo/api/application/models/University_model.php +++ b/Apollo/api/application/models/University_model.php @@ -19,8 +19,9 @@ class University_model extends CI_Model */ // get university list - public function get_university_list() { + public function get_university_list($loginUserBranchId=null) { $this->db->select('*'); + $this->db->where('BranchCode',$loginUserBranchId); $this->db->order_by('CreatedOn', 'DESC'); $this->db->from(UNIVERSITY); $univDetails = $this->db->get(); @@ -50,11 +51,12 @@ class University_model extends CI_Model } // check exist details - public function check_Univ_Exist($data, $check) { - // check update for mobile number + public function check_Univ_Exist($data, $check,$branchCode) { + // check univ with branch code $this->db->select('*'); $this->db->from(UNIVERSITY); $this->db->where('UniversityID', $data); + $this->db->where('BranchCode', $branchCode); if ($this->db->get()->first_row()) { $result['existUniv'] = true; $result['message'] = "This University Id is already exist!"; @@ -66,15 +68,25 @@ class University_model extends CI_Model // add university details public function insert_Univ($arr) { - $this->db->insert(UNIVERSITY, $arr); - if ($this->db->affected_rows() == '1') { - $result['addUniv'] = true; - $result['message'] = "Successfully University details added"; - } else { - $result['addUniv'] = false; - $result['message'] = "Something went wrong.please try again"; - } - return $result; + $this->db->select('*'); + $this->db->from(UNIVERSITY); + $this->db->where('UniversityID', $arr['UniversityID']); + $this->db->where('BranchCode', $arr['BranchCode']); + if ($this->db->get()->first_row()) { + $result['addUniv'] = false; + $result['message'] = "This University Id is already exist!"; + } else { + $this->db->insert(UNIVERSITY, $arr); + if ($this->db->affected_rows() == '1') { + $result['addUniv'] = true; + $result['message'] = "Successfully University details added"; + } else { + $result['addUniv'] = false; + $result['message'] = "Something went wrong.please try again"; + } + return $result; + } + } public function addActivity($arrayDetails=null,$jsonData=null)