Пример #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
 /**
  * Load a single Peopledetails object,
  * by Id Index(es)
  * @param integer $intId
  * @return Peopledetails
  */
 public static function LoadById($intId)
 {
     return Peopledetails::QuerySingle(QQ::Equal(QQN::Peopledetails()->Id, $intId));
 }
Пример #5
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;
     }
 }
 /**
  * Used internally by the Meta-based Add Column tools.
  *
  * Given a QQNode or a Text String, this will return a Peopledetails-based QQNode.
  * It will also verify that it is a proper Peopledetails-based QQNode, and will throw an exception otherwise.
  *
  * @param mixed $mixContent
  * @return QQNode
  */
 protected function ResolveContentItem($mixContent)
 {
     if ($mixContent instanceof QQNode) {
         if (!$mixContent->_ParentNode) {
             throw new QCallerException('Content QQNode cannot be a Top Level Node');
         }
         if ($mixContent->_RootTableName == 'peopledetails') {
             if ($mixContent instanceof QQReverseReferenceNode && !$mixContent->_PropertyName) {
                 throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.');
             }
             $objCurrentNode = $mixContent;
             while ($objCurrentNode = $objCurrentNode->_ParentNode) {
                 if (!$objCurrentNode instanceof QQNode) {
                     throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.');
                 }
                 if ($objCurrentNode instanceof QQReverseReferenceNode && !$objCurrentNode->_PropertyName) {
                     throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.');
                 }
             }
             return $mixContent;
         } else {
             throw new QCallerException('Content QQNode has a root table of "' . $mixContent->_RootTableName . '". Must be a root of "peopledetails".');
         }
     } else {
         if (is_string($mixContent)) {
             switch ($mixContent) {
                 case 'Id':
                     return QQN::Peopledetails()->Id;
                 case 'FullName':
                     return QQN::Peopledetails()->FullName;
                 case 'Address':
                     return QQN::Peopledetails()->Address;
                 case 'Phone':
                     return QQN::Peopledetails()->Phone;
                 case 'Email':
                     return QQN::Peopledetails()->Email;
                 case 'Owner':
                     return QQN::Peopledetails()->Owner;
                 default:
                     throw new QCallerException('Simple Property not found in PeopledetailsDataGrid content: ' . $mixContent);
             }
         } else {
             if ($mixContent instanceof QQAssociationNode) {
                 throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.');
             } else {
                 throw new QCallerException('Invalid Content type');
             }
         }
     }
 }