public function load_client_details_by_enrolled_name($client_details)
 {
     //Create a container object which will hold complete information required to display the complete order page
     $container = new stdClass();
     //Establish mysqli connection
     $mysqli_connection = new mysqli(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
     if ($mysqli_connection->connect_errno) {
         $container->show_failure_message = true;
         $container->error_message = "Failed to connect to MySQL: (" . $mysqli_connection->connect_errno . ") " . $mysqli_connection->connect_error;
         return $container;
     }
     $client_details_array = array();
     $access = new ClientDetailsAccess($mysqli_connection);
     $client_details_array = $access->load_client_details_by_enrolled_name($client_details->client_enrolled_by);
     //Validate whether order loading is successful or not.
     if ($access->m_status == false) {
         $container->show_failure_message = true;
         $container->error_message = "No Record found";
         //Close the connection
         $mysqli_connection->close();
         return $container;
     }
     $container->success = true;
     $container->client_details_array = $client_details_array;
     return $container;
 }
 public function load_client_details_by_phone_number($phone_number)
 {
     //$client_details = array("Error"=> "Data Not Found", "status"=>"false");
     //return $client_details;
     //Create a container object which will hold complete information required to display the complete order page
     $container = new stdClass();
     //Establish mysqli connection
     $mysqli_connection = new mysqli(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
     if ($mysqli_connection->connect_errno) {
         echo "Failed to connect to MySQL: (" . $mysqli_connection->connect_errno . ") " . $mysqli_connection->connect_error;
         //$container->show_failure_message = true;
         return $container;
     }
     //Set auto-commit to FALSE explicitly
     if (!$mysqli_connection->autocommit(FALSE)) {
         return;
     }
     $access = new ClientDetailsAccess($mysqli_connection);
     $client_details = $access->load_by_client_phone_number($phone_number);
     //Validate whether order loading is successful or not.
     if ($access->m_status == false || $access->m_status_code == STATUS_FETCH_NO_DATA) {
         $container->show_failure_message = true;
         //Close the connection
         $mysqli_connection->close();
         $client_details = array("Error" => "Data Not Found", "status" => "false");
     }
     return $client_details;
 }
 public function load_client_details_by_phone_number($phone_number)
 {
     //Establish mysqli connection
     $mysqli_connection = new mysqli(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
     if ($mysqli_connection->connect_errno) {
         echo "Failed to connect to MySQL: (" . $mysqli_connection->connect_errno . ") " . $mysqli_connection->connect_error;
         $client_details = array("Error" => "Database error occured", "status" => "false");
         return $client_details;
     }
     //Set auto-commit to FALSE explicitly
     if (!$mysqli_connection->autocommit(FALSE)) {
         return;
     }
     $access = new ClientDetailsAccess($mysqli_connection);
     $client_details = $access->load_by_client_phone_number($phone_number);
     //Validate whether order loading is successful or not.
     if ($access->m_status == false || $access->m_status_code == STATUS_FETCH_NO_DATA) {
         //Close the connection
         $mysqli_connection->close();
         //$client_details = array("Error"=> "Data Not Found", "status"=>"false");
     }
     return $client_details;
 }
 public function update_client_details($client_details)
 {
     //Create a container object which will hold complete information required to display the complete order page
     $container = new stdClass();
     //Establish mysqli connection
     $mysqli_connection = new mysqli(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
     if ($mysqli_connection->connect_errno) {
         echo "Failed to connect to MySQL: (" . $mysqli_connection->connect_errno . ") " . $mysqli_connection->connect_error;
         $container->show_failure_message = true;
         return $container;
     }
     //Set auto-commit to FALSE explicitly
     if (!$mysqli_connection->autocommit(FALSE)) {
         return;
     }
     $client_details_do = new ClientDetailsDO();
     $client_details_do->m_client_id = $client_details->client_id;
     $client_details_do->m_status = $client_details->client_status;
     $access = new ClientDetailsAccess($mysqli_connection);
     $success = $access->update_client_details($client_details_do);
     //Validate whether order loading is successful or not.
     if ($success == false) {
         $container->show_failure_message = true;
         //Close the connection
         $mysqli_connection->close();
         return $container;
     }
     if (!$mysqli_connection->commit()) {
         $container->show_failure_message = true;
         $container->failure_message = "Sorry for the Inconvenience. We are unable to cancel this Order.";
         $mysqli_connection->close();
         return $container;
     }
     $container->success = true;
     return $container;
 }