university changes done

This commit is contained in:
gandhimathi 2018-04-19 16:14:23 +05:30
parent 1b6eecf99b
commit 8906845bf0

View File

@ -19,8 +19,9 @@ class University_model extends CI_Model
*/ */
// get university list // get university list
public function get_university_list() { public function get_university_list($loginUserBranchId=null) {
$this->db->select('*'); $this->db->select('*');
$this->db->where('BranchCode',$loginUserBranchId);
$this->db->order_by('CreatedOn', 'DESC'); $this->db->order_by('CreatedOn', 'DESC');
$this->db->from(UNIVERSITY); $this->db->from(UNIVERSITY);
$univDetails = $this->db->get(); $univDetails = $this->db->get();
@ -50,11 +51,12 @@ class University_model extends CI_Model
} }
// check exist details // check exist details
public function check_Univ_Exist($data, $check) { public function check_Univ_Exist($data, $check,$branchCode) {
// check update for mobile number // check univ with branch code
$this->db->select('*'); $this->db->select('*');
$this->db->from(UNIVERSITY); $this->db->from(UNIVERSITY);
$this->db->where('UniversityID', $data); $this->db->where('UniversityID', $data);
$this->db->where('BranchCode', $branchCode);
if ($this->db->get()->first_row()) { if ($this->db->get()->first_row()) {
$result['existUniv'] = true; $result['existUniv'] = true;
$result['message'] = "This University Id is already exist!"; $result['message'] = "This University Id is already exist!";
@ -66,15 +68,25 @@ class University_model extends CI_Model
// add university details // add university details
public function insert_Univ($arr) { public function insert_Univ($arr) {
$this->db->insert(UNIVERSITY, $arr); $this->db->select('*');
if ($this->db->affected_rows() == '1') { $this->db->from(UNIVERSITY);
$result['addUniv'] = true; $this->db->where('UniversityID', $arr['UniversityID']);
$result['message'] = "Successfully University details added"; $this->db->where('BranchCode', $arr['BranchCode']);
} else { if ($this->db->get()->first_row()) {
$result['addUniv'] = false; $result['addUniv'] = false;
$result['message'] = "Something went wrong.please try again"; $result['message'] = "This University Id is already exist!";
} } else {
return $result; $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) public function addActivity($arrayDetails=null,$jsonData=null)