Esempio n. 1
0
    bool CountryCardPage::populateFromDatabase()
    {
      static const char* querySql = "select " \
        "c.\"FULL_NAME\", c.\"SHORT_NAME\", " \
        "c.\"TRIGRAM_CYRILLIC_CODE\", c.\"TRIGRAM_LATIN_CODE\", " \
        "c.\"TWO_LETTER_LATIN_CODE\", c.\"NUMERIC_CODE\", " \
        "c.\"CREATE_USER_ID\", cu.\"LOGIN\", " \
        "c.\"UPDATE_USER_ID\", uu.\"LOGIN\", " \
        "c.\"CREATE_TIME\", c.\"UPDATE_TIME\" " \
        "from \"COUNTRY\" c " \
        "join \"USER\" cu on c.\"CREATE_USER_ID\" = cu.\"USER_ID\" " \
        "join \"USER\" uu on c.\"UPDATE_USER_ID\" = uu.\"USER_ID\" " \
        "where c.\"COUNTRY_ID\" = ?";

      if (entityId())
      {      
        QSqlQuery query(databaseModel()->database());
        if (query.prepare(querySql))
        {
          query.bindValue(0, entityId().get());
          if (query.exec())
          {
            if (query.next())
            {   
              entityData_.countryId = entityId().get();
              entityData_.fullName  = query.value(0).toString();
              entityData_.shortName = query.value(1).toString();
              entityData_.trigramCyrillicCode = query.value(2).toString();
              entityData_.trigramLatinCode    = query.value(3).toString();
              entityData_.twoLetterLatinCode  = query.value(4).toString();
              entityData_.numericCode  = query.value(5).toInt();
              entityData_.createUserId = query.value(6).toLongLong();
              createUserName_          = query.value(7).toString();
              entityData_.updateUserId = query.value(8).toLongLong();
              updateUserName_          = query.value(9).toString();              
              entityData_.createTime   = databaseModel()->convertFromServer(query.value(10).toDateTime());
              entityData_.updateTime   = databaseModel()->convertFromServer(query.value(11).toDateTime());
              return true;
            }
          }
        }
      }
      return false;
    }
Esempio n. 2
0
void AutoenterpriseCardPage::updateWidgets()
{
  const Mode currentMode = mode();

  bool readOnly = viewMode == currentMode;
  WidgetUtility::setReadOnly(dataAwareWidgets_, readOnly);

  bool peristance = createMode != currentMode && entityId();
  int generalTabIndex = ui_.tabWidget->indexOf(ui_.generalTab);      
  ui_.tabWidget->setTabEnabled(generalTabIndex, peristance);            

  switch (currentMode)
  {
  case viewMode:
    if (entityId())
    {
      updateWindowTitle(tr("Autoenterprises - %1").arg(entityData_.shortName));
    }        
    showRequiredMarkers(false);
    break;

  case editMode:
    if (entityId())
    {
      if (contentsChanged_)
      {
        updateWindowTitle(tr("Autoenterprises - %1* - edit")
            .arg(entityData_.shortName));
      }
      else
      {
        updateWindowTitle(tr("Autoenterprises - %1 - edit")
            .arg(entityData_.shortName));
      }        
    }
    showRequiredMarkers(true);
    break;

  case createMode:
    updateWindowTitle(tr("Autoenterprises - New autoenterprise*"));
    showRequiredMarkers(true);
    break;
  }      
}
Esempio n. 3
0
void UnitPosition::update(const int deltaMs)
{
  TilePos oldP = _tilePosition;
  EntityPosition::update(deltaMs);
  if(oldP != _tilePosition)
  {
    EntityMap& eMap = gameworld().entityMap();
    eMap.eraseUnit(oldP);
    eMap.registerUnit(_tilePosition, entityId());
  }
}
/* ****************************************************************************
*
* mapGetContextEntityTypes - 
*/
HttpStatusCode mapGetContextEntityTypes
(
  const std::string&                    typeName,
  DiscoverContextAvailabilityResponse*  response,
  ConnectionInfo*                       ciP
)
{
  DiscoverContextAvailabilityRequest  request;
  EntityId                            entityId(".*", typeName, "true");

  request.entityIdVector.push_back(&entityId);
  return mongoDiscoverContextAvailability(&request, response, ciP->tenant, ciP->uriParam, ciP->servicePathV);
}
Esempio n. 5
0
 void DeppointCardPage::populateWidgets()
 {
   if (entityId())
   {      
     // Contents page
     ui_.fullNameEdit->setText(entityData_.fullName);
     ui_.shortNameEdit->setText(entityData_.shortName);
     ui_.remarksText->setPlainText(entityData_.remark ? entityData_.remark.get() : QString());
     // General data page
     ui_.createTimeEdit->setText(entityData_.createTime.toString(Qt::DefaultLocaleShortDate));
     ui_.updateTimeEdit->setText(entityData_.updateTime.toString(Qt::DefaultLocaleShortDate));
     ui_.createUserEdit->setText(createUserName_);
     ui_.updateUserEdit->setText(updateUserName_);
     populateExportData();
     contentsChanged_ = false;
   }
 }
Esempio n. 6
0
 void CountryCardPage::populateWidgets()
 {
   if (entityId())
   {      
     // Contents page
     ui_.fullNameEdit->setText(entityData_.fullName);
     ui_.shortNameEdit->setText(entityData_.shortName);
     ui_.trigramCyrillicCodeEdit->setText(entityData_.trigramCyrillicCode);
     ui_.trigramLatinCodeEdit->setText(entityData_.trigramLatinCode);
     ui_.twoLetterLatinCodeEdit->setText(entityData_.twoLetterLatinCode);
     ui_.numericCodeEdit->setText(countryNumericCodeDelegate_->displayText(entityData_.numericCode, QLocale()));
     // General data page
     ui_.createTimeEdit->setText(entityData_.createTime.toString(Qt::DefaultLocaleShortDate));
     ui_.updateTimeEdit->setText(entityData_.updateTime.toString(Qt::DefaultLocaleShortDate));
     ui_.createUserEdit->setText(createUserName_);
     ui_.updateUserEdit->setText(updateUserName_);        
     populateExportData();
     contentsChanged_ = false;
   }
 } 
Esempio n. 7
0
void BankCardPage::populateWidgets()
{
  if (entityId())
  {      
    // Contents page
    ui_.bankCodeEdit->setText(QString::number(entityData_.bankCode));
    ui_.fullNameEdit->setText(entityData_.fullName);
    ui_.shortNameEdit->setText(entityData_.shortName);
    ui_.remarksText->setPlainText(buildQString(entityData_.remark));
    // General data page
    ui_.createTimeEdit->setText(
        entityData_.createTime.toString(Qt::DefaultLocaleShortDate));
    ui_.updateTimeEdit->setText(
        entityData_.updateTime.toString(Qt::DefaultLocaleShortDate));
    ui_.createUserEdit->setText(createUserName_);
    ui_.updateUserEdit->setText(updateUserName_);
    populateExportData();
    contentsChanged_ = false;
  }
}    
Esempio n. 8
0
 void DeppointCardPage::on_database_userUpdated(const model::User& user)
 {
   bool updated = false;
   if (entityId())
   {        
     if (entityData_.createUserId == user.userId)
     {
       createUserName_ = user.userName;
       ui_.createUserEdit->setText(createUserName_);
       updated = true;
     }
     if (entityData_.updateUserId == user.userId)
     {
       updateUserName_ = user.userName;
       ui_.updateUserEdit->setText(updateUserName_);
       updated = true;
     }
     if (updated)
     {          
       updateWidgets();
     }
   }
 }    
Esempio n. 9
0
bool AutoenterpriseCardPage::removeFromDatabase()
{
  static const char* querySql = 
      "delete from \"AUTOENTERPRISE\" where \"AUTOENTERPRISE_ID\" = ?";

  if (QMessageBox::Yes == QMessageBox::question(this, tr("Autoenterprises"), 
      tr("Delete autoenterprise?"), QMessageBox::Yes | QMessageBox::No, 
      QMessageBox::No))
  {
    if (!entityId())
    {
      return false;
    }

    QSqlQuery query(databaseModel()->database());              
    if (!query.prepare(querySql))
    {
      return false;
    }

    query.bindValue(0, entityData_.autoenterpriseId);
    if (!query.exec())
    {
      return false;
    }
      
    setEntityId(OptionalQInt64());

    if (query.numRowsAffected() > 0)
    {
      databaseModel()->notifyRemove(entityData_);
      return true;
    }            
  }
  return false;
}
Esempio n. 10
0
bool BankCardPage::updateDatabase()
{
  static const char* querySql = "update \"BANK\" set " \
      "\"BANK_CODE\" = ?, \"FULL_NAME\" = ?, \"SHORT_NAME\" = ?," \
      " \"REMARK\" = ?, \"UPDATE_USER_ID\" = ?, \"UPDATE_TIME\" = \'NOW\' " \
      "where \"BANK_ID\" = ?";

  if (!entityId())
  {
    return false;
  }

  QSqlQuery query(databaseModel()->database());              
  if (!query.prepare(querySql))
  {
    return false;
  }

  query.bindValue(0, entityData_.bankCode);
  query.bindValue(1, entityData_.fullName);
  query.bindValue(2, entityData_.shortName);
  query.bindValue(3, buildQVariant(entityData_.remark));
  query.bindValue(4, databaseModel()->userId());
  query.bindValue(5, entityData_.bankId);
  if (!query.exec())
  {
    return false;
  }

  if (query.numRowsAffected() > 0)
  {
    databaseModel()->notifyUpdate(entityData_);
    return true;
  }
  return false;
}
Esempio n. 11
0
RepoIdConverter::operator DDS::InstanceHandle_t() const
{
  return entityId();
}