Пример #1
0
 protected function getGoogleContacts()
 {
     $objContacts = new GetContacts();
     $arrContacts = $objContacts->GetGContacts($this->txtUser, $this->txtPassword);
     $contactCount = sizeof($arrContacts);
     foreach ($arrContacts as $person) {
         $count = Peopledetails::QueryCount(QQ::Equal(QQN::Peopledetails()->Email, $person['contactMail']));
         if ($count != 0) {
             $objPerson = Peopledetails::QuerySingle(QQ::Equal(QQN::Peopledetails()->Email, $person['contactMail']));
         } else {
             $objPerson = new Peopledetails();
         }
         $objPerson->FullName = $person['contactName'];
         $objPerson->Phone = $person['contactPhone'];
         $objPerson->Address = $person['contactAddr'];
         $objPerson->Email = $person['contactMail'];
         $objPerson->Save();
     }
     QApplication::DisplayAlert('Successfully imported ' . $contactCount . 'contacts from Google Contacts');
 }
 public function MetaDataBinder()
 {
     $condition = QQ::Equal(QQN::Peopledetails()->Owner, $_SESSION['User']);
     // Remember!  We need to first set the TotalItemCount, which will affect the calcuation of LimitClause below
     if ($this->Paginator) {
         $this->TotalItemCount = Peopledetails::QueryCount($condition);
     }
     // Setup the $objClauses Array
     $objClauses = array();
     // If a column is selected to be sorted, and if that column has a OrderByClause set on it, then let's add
     // the OrderByClause to the $objClauses array
     if ($objClause = $this->OrderByClause) {
         array_push($objClauses, $objClause);
     }
     // Add the LimitClause information, as well
     if ($objClause = $this->LimitClause) {
         array_push($objClauses, $objClause);
     }
     // Set the DataSource to be a Query result from Peopledetails, given the clauses above
     //$condition = QQ::Equal(QQN::Peopledetails()->Owner,$_SESSION['User']);
     $this->DataSource = Peopledetails::QueryArray($condition, $objClauses);
     //$this->DataSource = Peopledetails::LoadAll($objClauses);
 }
Пример #3
0
 protected function LendBasket()
 {
     foreach ($this->objBasket->GetBasket() as $item) {
         $objItem = Myassets::QuerySingle(QQ::Equal(QQN::Myassets()->Id, $item->Id));
         $objPerson = Peopledetails::QuerySingle(QQ::Equal(QQN::Peopledetails()->Id, $this->strBorrower));
         $objShareDetails = new Sharedetails();
         $objShareDetails->Asin = $objItem->Asin;
         $objShareDetails->Email = $objPerson->Email;
         /*Logic to get the return date*/
         $today = new QDateTime(QDateTime::Now);
         $daySpan = new QDateTimeSpan();
         $daySpan->AddDays(30);
         $returnDate = $today->Add($daySpan);
         $objShareDetails->TakenDate = QDateTime::Now(false);
         $objShareDetails->ReturnDate = $returnDate;
         $objShareDetails->Title = $objItem->Title;
         $objShareDetails->FullName = $objPerson->FullName;
         $objShareDetails->Save();
     }
 }
Пример #4
0
 public static function GetSoapArrayFromArray($objArray)
 {
     if (!$objArray) {
         return null;
     }
     $objArrayToReturn = array();
     foreach ($objArray as $objObject) {
         array_push($objArrayToReturn, Peopledetails::GetSoapObjectFromObject($objObject, true));
     }
     return unserialize(serialize($objArrayToReturn));
 }
 /**
  * Static Helper Method to Create using PK arguments
  * You must pass in the PK arguments on an object to load, or leave it blank to create a new one.
  * If you want to load via QueryString or PathInfo, use the CreateFromQueryString or CreateFromPathInfo
  * static helper methods.  Finally, specify a CreateType to define whether or not we are only allowed to 
  * edit, or if we are also allowed to create a new one, etc.
  * 
  * @param mixed $objParentObject QForm or QPanel which will be using this PeopledetailsMetaControl
  * @param integer $intId primary key value
  * @param QMetaControlCreateType $intCreateType rules governing Peopledetails object creation - defaults to CreateOrEdit
  * @return PeopledetailsMetaControl
  */
 public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
 {
     // Attempt to Load from PK Arguments
     if (strlen($intId)) {
         $objPeopledetails = Peopledetails::Load($intId);
         // Peopledetails was found -- return it!
         if ($objPeopledetails) {
             return new PeopledetailsMetaControl($objParentObject, $objPeopledetails);
         } else {
             if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
                 throw new QCallerException('Could not find a Peopledetails object with PK arguments: ' . $intId);
             }
         }
         // If EditOnly is specified, throw an exception
     } else {
         if ($intCreateType == QMetaControlCreateType::EditOnly) {
             throw new QCallerException('No PK arguments specified');
         }
     }
     // If we are here, then we need to create a new record
     return new PeopledetailsMetaControl($objParentObject, new Peopledetails());
 }
Пример #6
0
 public static function GetContacts($strKeyword = null)
 {
     if (!is_null($strKeyword)) {
         $condition = QQ::AndCondition(QQ::OrCondition(QQ::Like(QQN::Peopledetails()->FullName, '%' . $strKeyword . '%'), QQ::Like(QQN::Peopledetails()->Email, '%' . $strKeyword . '%'), QQ::Like(QQN::Peopledetails()->Address, '%' . $strKeyword . '%'), QQ::Like(QQN::Peopledetails()->Phone, '%' . $strKeyword . '%')), QQ::Equal(QQN::Peopledetails()->Owner, $_SESSION['User']));
         $objPeopleArray = Peopledetails::QueryArray($condition);
         return $objPeopleArray;
     } else {
         $condition = QQ::Equal(QQN::Peopledetails()->Owner, $_SESSION['User']);
         $objPeopleArray = Peopledetails::QueryArray($condition);
         return $objPeopleArray;
     }
 }