コード例 #1
0
void VendorLineEdit::setId(int pId)
{
  if (pId != -1)
  {
    QString sql( "SELECT vend_number, vend_name,"
                 "       vend_address1, vend_address2, vend_address3,"
                 "       vend_city, vend_state, vend_zip, vend_country "
                 "FROM vend "
                 "WHERE ( (vend_id=:vend_id)" );

    if (_type == __activeVendors)
      sql += " AND (vend_active) ";

    sql += ");";

    XSqlQuery vend;
    vend.prepare(sql);
    vend.bindValue(":vend_id", pId);
    vend.exec();
    if (vend.first())
    {
      _id     = pId;
      _valid  = TRUE;
  
      setText(vend.value("vend_number").toString());
      _parsed = TRUE;

      emit nameChanged(vend.value("vend_name").toString());
      emit address1Changed(vend.value("vend_address1").toString());
      emit address2Changed(vend.value("vend_address2").toString());
      emit address3Changed(vend.value("vend_address3").toString());
      emit cityChanged(vend.value("vend_city").toString());
      emit stateChanged(vend.value("vend_state").toString());
      emit zipCodeChanged(vend.value("vend_zip").toString());
      emit countryChanged(vend.value("vend_country").toString());
      emit newId(_id);
      emit valid(TRUE);

      return;
    }
  }

  _id     = -1;
  _valid  = FALSE;

  setText("");

  emit nameChanged("");
  emit address1Changed("");
  emit address2Changed("");
  emit address3Changed("");
  emit cityChanged("");
  emit stateChanged("");
  emit zipCodeChanged("");
  emit countryChanged("");
  emit newId(-1);
  emit valid(FALSE);

  _parsed = TRUE;
}
コード例 #2
0
enum SetResponse itemGroup::set(const ParameterList &pParams)
{
  XSqlQuery itemet;
  XWidget::set(pParams);
  QVariant param;
  bool     valid;

  param = pParams.value("itemgrp_id", &valid);
  if (valid)
  {
    _itemgrpid = param.toInt();
    populate();
    emit newId(_itemgrpid);
  }

  param = pParams.value("mode", &valid);
  if (valid)
  {
    if (param.toString() == "new")
    {
      _mode = cNew;

      itemet.exec("SELECT NEXTVAL('itemgrp_itemgrp_id_seq') AS itemgrp_id;");
      if (itemet.first())
        _itemgrpid = itemet.value("itemgrp_id").toInt();

      sFillList();

      connect(_itemgrpitem, SIGNAL(valid(bool)), _delete, SLOT(setEnabled(bool)));
      connect(_itemgrpparent, SIGNAL(valid(bool)), _deleteParent, SLOT(setEnabled(bool)));
      emit newId(_itemgrpid);
      emit newMode(_mode);
    }
    else if (param.toString() == "edit")
    {
      _mode = cEdit;

      connect(_itemgrpitem, SIGNAL(valid(bool)), _delete, SLOT(setEnabled(bool)));
      connect(_itemgrpparent, SIGNAL(valid(bool)), _deleteParent, SLOT(setEnabled(bool)));
      emit newMode(_mode);
    }
    else if (param.toString() == "view")
    {
      _mode = cView;
      _name->setEnabled(false);
      _descrip->setEnabled(false);
      _catalog->setEnabled(false);
      _new->setEnabled(false);
      _newParent->setEnabled(false);
      _close->setText(tr("&Close"));
      _save->hide();
      emit newMode(_mode);
    }
  }

  return NoError;
}
コード例 #3
0
void PlanOrdLineEdit::setId(int pId)
{
  XSqlQuery planord;
  planord.prepare( "SELECT formatPloNumber(planord_id) AS plnumber,"
                   "       warehous_code, item_number, uom_name,"
                   "       item_descrip1, item_descrip2,"
                   "       formatQty(planord_qty) AS qty,"
                   "       formatDate(planord_duedate) AS duedate "
                   "FROM planord, itemsite, item, warehous, uom "
                   "WHERE ( (planord_itemsite_id=itemsite_id)"
                   " AND (itemsite_item_id=item_id)"
                   " AND (item_inv_uom_id=uom_id)"
                   " AND (itemsite_warehous_id=warehous_id)"
                   " AND (planord_id=:planord_id) );" );
  planord.bindValue(":planord_id", pId);
  planord.exec();
  if (planord.first())
  {
    _id    = pId;
    _valid = TRUE;

    setText(planord.value("plnumber").toString());

    emit newId(_id);
    emit warehouseChanged(planord.value("warehous_code").toString());
    emit itemNumberChanged(planord.value("item_number").toString());
    emit uomChanged(planord.value("uom_name").toString());
    emit itemDescrip1Changed(planord.value("item_descrip1").toString());
    emit itemDescrip2Changed(planord.value("item_descrip2").toString());
    emit dueDateChanged(planord.value("duedate").toString());
    emit qtyChanged(planord.value("qty").toString());
    emit valid(TRUE);
  }
  else
  {
    _id    = -1;
    _valid = FALSE;

    setText("");

    emit newId(-1);
    emit warehouseChanged("");
    emit itemNumberChanged("");
    emit uomChanged("");
    emit itemDescrip1Changed("");
    emit itemDescrip2Changed("");
    emit dueDateChanged("");
    emit qtyChanged("");
    emit valid(FALSE);
  }
  
  if (_mapper->model() &&
    _mapper->model()->data(_mapper->model()->index(_mapper->currentIndex(),_mapper->mappedSection(this))).toString() != text())
      _mapper->model()->setData(_mapper->model()->index(_mapper->currentIndex(),_mapper->mappedSection(this)), text());
}
コード例 #4
0
ファイル: combiningfeedview.cpp プロジェクト: songhtdo/vespa
void
CombiningFeedView::findPrevDbdId(const document::GlobalId &gid,
                                 DocumentOperation &op)
{
    uint32_t subDbIdLim = _metaStores.size();
    uint32_t skipSubDbId = std::numeric_limits<uint32_t>::max();
    DbDocumentId newId(op.getDbDocumentId());
    if (newId.valid()) {
        skipSubDbId = newId.getSubDbId();
    }
    for (uint32_t subDbId = 0; subDbId < subDbIdLim; ++subDbId) {
        if (subDbId == skipSubDbId)
            continue;
        const documentmetastore::IStore *metaStore = _metaStores[subDbId];
        if (metaStore == NULL)
            continue;
        documentmetastore::IStore::Result inspectRes(metaStore->inspectExisting(gid));
        if (inspectRes._found) {
            op.setPrevDbDocumentId(DbDocumentId(subDbId,
                                           inspectRes._lid));
            op.setPrevMarkedAsRemoved(subDbId == getRemFeedViewId());
            op.setPrevTimestamp(inspectRes._timestamp);
            break;
        }
    }
}
コード例 #5
0
ファイル: QtWindow.cpp プロジェクト: Scylardor/pokedex
void	QtWindow::showNextPokemon()
{
  QString	newId("");

  if (this->currentPkmnId_ < 493)
    {
      this->currentPkmnId_++;
      newId = QString::number(this->currentPkmnId_);
      if (this->currentPkmnId_ < 10)
	{
	  newId.prepend("00");
	}
      else if (this->currentPkmnId_ >= 10 && this->currentPkmnId_ < 100)
	{
	  newId.prepend("0");
	}

      Pokemon	*matching = this->database_->getPokemon(newId);

      if (matching != NULL)
	{
	  showPokemonInfos(matching);
	}
    }
}
コード例 #6
0
ファイル: prospect.cpp プロジェクト: Fortyseven/qt-client
void prospect::sCheckNumber()
{
  _number->setText(_number->text().trimmed().toUpper());

  if (_mode == cNew)
  {
    if (-1 != _NumberGen && _number->text().toInt() != _NumberGen)
    {
      XSqlQuery query;
      query.prepare( "SELECT releaseCRMAccountNumber(:Number);" );
      query.bindValue(":Number", _NumberGen);
      query.exec();
      _NumberGen = -1;
    }

    XSqlQuery getq;
    getq.prepare( "SELECT prospect_id "
               "FROM prospect "
               "WHERE (prospect_number=:prospect);" );
    getq.bindValue(":prospect", _number->text());
    getq.exec();
    if (getq.first())
    {
      _prospectid = getq.value("prospect_id").toInt();
      _mode = cEdit;
      sPopulate();
      emit newId(_prospectid);
      _name->setFocus();
    }
  }
}
コード例 #7
0
void ShiptoEdit::sNew()
{
  if (canOpen())
  {
    if (!_x_privileges->check(_newPriv))
      return;

    ParameterList params;
    params.append("mode", "new");
    params.append("cust_id", _custid);

    QWidget* w = 0;
    if (parentWidget()->window())
    {
      if (parentWidget()->window()->isModal())
        w = _guiClientInterface->openWindow(_uiName, params, parentWidget()->window() , Qt::WindowModal, Qt::Dialog);
      else
        w = _guiClientInterface->openWindow(_uiName, params, parentWidget()->window() , Qt::NonModal, Qt::Window);
    }

    if (w->inherits("QDialog"))
    {
      QDialog* newdlg = qobject_cast<QDialog*>(w);
      int id = newdlg->exec();
      if (id != QDialog::Rejected)
      {
        silentSetId(id);
        emit newId(_id);
        emit valid(_id != -1);
      }
    }
  }
}
コード例 #8
0
void ShiptoEdit::setId(int pId)
{
  if (pId != -1)
  {
    XSqlQuery shipto( QString( "SELECT shipto_num, shipto_name, shipto_address1, shipto_cust_id "
                               "FROM shipto "
                               "WHERE (shipto_id=%1);" )
                      .arg(pId) );
    if (shipto.first())
    {
      _id = pId;
      _valid = TRUE;

      setText(shipto.value("shipto_num").toString());

      if (shipto.value("shipto_cust_id").toInt() != _custid)
      {
        _custid = shipto.value("shipto_cust_id").toInt();
        emit newCustid(_id);
      }

      emit newId(_id);
      emit valid(_valid);
      emit nameChanged(shipto.value("shipto_name").toString());
      emit address1Changed(shipto.value("shipto_address1").toString());
    }
  }
  else
  {
    clear();

    _custid = -1;
    emit newCustid(_custid);
  }
}
コード例 #9
0
void WorkCenterLineEdit::setId(int pId)
{
  QString sql("SELECT wrkcnt_code"
              "  FROM wrkcnt"
              " WHERE (wrkcnt_id=:id);");

  XSqlQuery query;
  query.prepare(sql);
  query.bindValue(":id", pId);
  query.exec();
  if(query.first())
  {
    _id = pId;
    _valid = true;
    _workcenter = query.value("wrkcnt_code").toString();
  }
  else
  {
    _id = -1;
    _valid = false;
    _workcenter = "";
  }

  setText(_workcenter);
  emit newId(_id);
  emit valid(_valid);

  _parsed = true;
}
コード例 #10
0
ファイル: idevice.cpp プロジェクト: gaoxiaojun/qtcreator
IDevice::IDevice(const QString &type, Origin origin, Core::Id id) : d(new Internal::IDevicePrivate)
{
    d->type = type;
    d->origin = origin;
    QTC_CHECK(origin == ManuallyAdded || id.isValid());
    d->id = id.isValid() ? id : newId();
}
コード例 #11
0
ファイル: idevice.cpp プロジェクト: gaoxiaojun/qtcreator
void IDevice::fromMap(const QVariantMap &map)
{
    d->type = typeFromMap(map);
    d->displayName = map.value(QLatin1String(DisplayNameKey)).toString();
    d->id = Core::Id(map.value(QLatin1String(IdKey), newId().name()).toByteArray().constData());
    d->origin = static_cast<Origin>(map.value(QLatin1String(OriginKey), ManuallyAdded).toInt());
}
コード例 #12
0
// ---------------------------------------------------------------------------
// Create new ID.
// ---------------------------------------------------------------------------
//
void CCenRepDatabaseUtil::CreateEntryIdL( TInt& aNewId )
    {
    TInt newId( KNoEntryId );

    TInt err = iRepository->Get( iIdCounterKey, newId );

    if ( KErrNone == err  )
        {
        if ( 0 < newId )
            {
            // Store next available ID
            err = iRepository->Set( iIdCounterKey, newId + 1 );
            }
        else
            {
            // Range of ID exceeded
            err = KErrOverflow;
            }
        }
    else if ( KErrNotFound == err )
        {
        // Create new key (should always be found)
        SetOrCreateKeyL( iIdCounterKey, KNoEntryId + 1 );
        }

    aNewId = newId;

    User::LeaveIfError( err );
    }
コード例 #13
0
void AddressCluster::setId(const int pId)
{
  if (pId == _id)
    return;
  silentSetId(pId);
  emit newId(pId);  
}
コード例 #14
0
ファイル: flow.c プロジェクト: evanrmurphy/PicoLisp
// (new ['flg|num] ['typ ['any ..]]) -> obj
any doNew(any ex) {
   any x, y, *h;
   cell c1, c2;

   x = cdr(ex);
   if (isCell(y = EVAL(car(x))))
      Push(c1, consSym(y,Nil));
   else {
      if (isNil(y))
         data(c1) = consSym(Nil,Nil);
      else {
         y = newId(ex, isNum(y)? (int)unDig(y)/2 : 1);
         if (data(c1) = findHash(y, h = Extern + ehash(y)))
            tail(data(c1)) = y;
         else
            *h = cons(data(c1) = consSym(Nil,y), *h);
         mkExt(data(c1));
      }
      Save(c1);
      x = cdr(x),  val(data(c1)) = EVAL(car(x));
   }
   TheKey = T,  TheCls = NULL;
   if (y = method(data(c1)))
      evMethod(data(c1), y, cdr(x));
   else {
      Push(c2, Nil);
      while (isCell(x = cdr(x))) {
         data(c2) = EVAL(car(x)),  x = cdr(x);
         put(data(c1), data(c2), EVAL(car(x)));
      }
   }
   return Pop(c1);
}
コード例 #15
0
ファイル: idevice.cpp プロジェクト: acacid/qt-creator
void IDevice::fromMap(const QVariantMap &map)
{
    d->type = typeFromMap(map);
    d->displayName = map.value(QLatin1String(DisplayNameKey)).toString();
    d->id = Core::Id::fromSetting(map.value(QLatin1String(IdKey)));
    if (!d->id.isValid())
        d->id = newId();
    d->origin = static_cast<Origin>(map.value(QLatin1String(OriginKey), ManuallyAdded).toInt());

    d->sshParameters.host = map.value(QLatin1String(HostKey)).toString();
    d->sshParameters.port = map.value(QLatin1String(SshPortKey), 22).toInt();
    d->sshParameters.userName = map.value(QLatin1String(UserNameKey)).toString();
    d->sshParameters.authenticationType
        = static_cast<AuthType>(map.value(QLatin1String(AuthKey), DefaultAuthType).toInt());
    d->sshParameters.password = map.value(QLatin1String(PasswordKey)).toString();
    d->sshParameters.privateKeyFile = map.value(QLatin1String(KeyFileKey), defaultPrivateKeyFilePath()).toString();
    d->sshParameters.timeout = map.value(QLatin1String(TimeoutKey), DefaultTimeout).toInt();
    d->sshParameters.hostKeyCheckingMode = static_cast<QSsh::SshHostKeyCheckingMode>
            (map.value(QLatin1String(HostKeyCheckingKey), QSsh::SshHostKeyCheckingNone).toInt());
    const QVariant optionsVariant = map.value(QLatin1String(SshOptionsKey));
    if (optionsVariant.isValid())  // false for QtC < 3.4
        d->sshParameters.options = QSsh::SshConnectionOptions(optionsVariant.toInt());

    d->freePorts = Utils::PortList::fromString(map.value(QLatin1String(PortsSpecKey),
        QLatin1String("10000-10100")).toString());
    d->machineType = static_cast<MachineType>(map.value(QLatin1String(MachineTypeKey), DefaultMachineType).toInt());
    d->version = map.value(QLatin1String(VersionKey), 0).toInt();

    d->debugServerPath = map.value(QLatin1String(DebugServerKey)).toString();
}
コード例 #16
0
void InvoiceLineEdit::setId(const int pId)
{
  XSqlQuery query;
  query.prepare( "SELECT cohead_id, invchead_cust_id, invchead_invcnumber "
                 "FROM invchead LEFT OUTER JOIN cohead ON (invchead_ordernumber=cohead_number) "
                 "WHERE (invchead_id=:id);" );
  query.bindValue(":id", pId);
  query.exec();
  if (query.first())
  {
    _custid = query.value("invchead_cust_id").toInt();
    _coheadid = query.value("cohead_id").toInt();
    _invoiceNumber = query.value("invchead_invcnumber").toString();
    _id = pId;
    _valid = true;

    setText(_invoiceNumber);
  }
  else
  {
    _custid = -1;
    _coheadid = -1;
    _invoiceNumber = "";
    _id = -1;
    _valid = false;

    setText("");
  }

  emit newCustid(_custid);
  emit newCoheadid(_coheadid);
  emit newInvoiceNumber(_invoiceNumber);
  emit newId(_id);
  emit valid(_valid);
}
コード例 #17
0
ファイル: networkPNLH.cpp プロジェクト: JacobCWard/PyPNL
bool NetworkPNL::SetNodeId(int node, const char *id)
{
    String newId(id);

    newId << " - new name for node #" << node;
    MarkCallFunction("SetNodeId", true, newId.c_str());
    return Graph().SetNodeName(node, String(id));
}
コード例 #18
0
ファイル: event.cpp プロジェクト: grimtraveller/muse
EventBase::EventBase(const EventBase& ev, bool duplicate_not_clone)
  : PosLen(ev)
      {
      refCount  = 0;
      _selected = ev._selected;
      _type     = ev._type;
      _uniqueId = newId();
      _id = duplicate_not_clone ? _uniqueId : ev._id;
      }
コード例 #19
0
ファイル: event.cpp プロジェクト: grimtraveller/muse
EventBase::EventBase(EventType t)
      {
      _type     = t;
      Pos::setType(_type == Wave ? FRAMES : TICKS);
      refCount  = 0;
      _selected = false;
      _uniqueId = newId();
      _id = _uniqueId;
      }
コード例 #20
0
void printSinglecopyDocument::setId(int docid)
{
  if (_data->_docid != docid)
  {
    _data->_docid = docid;
    sPopulate();
    emit newId(_data->_docid);
  }
}
コード例 #21
0
bool TrackContainer<Object>::createTrack(Object &object, int initT)
{
    int id = newId();
    if(id == -1)
        return 0;
    TrackT *track = new TrackT(id);
    track->insert(object, initT);
    tracks.push_back(track);
}
コード例 #22
0
void ItemLineEdit::setId(int pId)
{
    if (pId != _id)
    {
        silentSetId(pId);
        emit privateIdChanged(_id);
        emit newId(_id);
    }
}
コード例 #23
0
ファイル: woCluster.cpp プロジェクト: AlFoX/qt-client
void WomatlCluster::sPopulateInfo(int pWomatlid)
{
  if (pWomatlid == -1)
  {
    _itemNumber->setCurrentIndex(0);
    _uom->setText("");
    _descrip1->setText("");
    _descrip2->setText("");
    _qtyFxd->setText("");
    _qtyPer->setText("");
    _scrap->setText("");
    _qtyRequired->setText("");
    _qtyIssued->setText("");

    _id = -1;
    _valid = FALSE;
    _required = 0;
    _issued = 0;

    emit newId(-1);
    emit newQtyScrappedFromWIP(0.0);
    emit valid(FALSE);
  }
  else if (_womatl.findFirst("womatlid", pWomatlid) != -1)
  {
    _uom->setText(_womatl.value("uom_name").toString());
    _descrip1->setText(_womatl.value("item_descrip1").toString());
    _descrip2->setText(_womatl.value("item_descrip2").toString());
    _qtyFxd->setDouble(_womatl.value("qtyfxd").toDouble());
    _qtyPer->setDouble(_womatl.value("qtyper").toDouble());
    _scrap->setDouble(_womatl.value("scrap").toDouble());
    _qtyRequired->setDouble(_womatl.value("qtyreq").toDouble());
    _qtyIssued->setDouble(_womatl.value("qtyiss").toDouble());

    _id = pWomatlid;
    _valid = TRUE;
    _required = _womatl.value("_qtyreq").toDouble();
    _issued = _womatl.value("_qtyiss").toDouble();

    emit newId(_id);
    emit newQtyScrappedFromWIP(_womatl.value("qtywipscrap").toDouble());
    emit valid(TRUE);
  }
}
コード例 #24
0
void ContactCluster::setId(const int pId)
{
    if (pId == _id)
	return;
    else
    {
	silentSetId(pId);
	emit newId(pId);
    }
}
コード例 #25
0
// 添加用户,同时为用户创建一个ufd
int MFD::add(char *s) {
  if (n == MAX_USER) return e_max;
  if (find(s) >= 0) return e_dup;
  int new_uid = newId();
  users[new_uid].init((const char *)s, new_uid);
  UFD new_ufd; new_ufd.init();
  iwrite(&new_ufd, UFD_SZ, superblock.ufd+new_uid*UFD_SZ);
  n++;
  return 0;
}
コード例 #26
0
void ItemLineEdit::setId(int pId)
{
  bool changed = (pId != _id);
  silentSetId(pId);
  if (changed)
  {
    emit privateIdChanged(_id);
    emit newId(_id);
  }
}
コード例 #27
0
ファイル: newidtest.cpp プロジェクト: alriddoch/cyphesis
int main()
{
    database_flag = false;

    std::string id;

    long int_id = newId(id);

    assert(!id.empty());
    assert(int_id > 0);

    database_flag = true;

    int_id = newId(id);

    assert(!id.empty());
    assert(int_id > 0);

    return 0;
}
コード例 #28
0
void CLineEdit::setId(int pId)
{
  if (_id == pId)
    return;
    
  setSilentId(pId);

//  Emit the item information signals
  emit newId(_id);
  emit valid(_valid);
}
コード例 #29
0
void ItemLineEdit::setId(int pId)
{
  if (DEBUG) qDebug("%s::setId(%d) entered", qPrintable(objectName()), pId);
  bool changed = (pId != _id);
  silentSetId(pId);
  if (changed)
  {
    emit privateIdChanged(_id);
    emit newId(_id);
  }
}
コード例 #30
0
void ShiptoEdit::clear()
{
  _id = -1;
  _valid = FALSE;

  setText("");

  emit nameChanged("");
  emit address1Changed("");
  emit newId(_id);
  emit valid(_valid);
}