当前位置: 首页>>代码示例>>C++>>正文


C++ Customer类代码示例

本文整理汇总了C++中Customer的典型用法代码示例。如果您正苦于以下问题:C++ Customer类的具体用法?C++ Customer怎么用?C++ Customer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Customer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: if

void MainWindow::on_NewReservation_clicked()
{
    if("" == ui->CustomerIdReservation->text() || "" == ui->RoomNumberReservation->text())
    {
        QMessageBox::about(0,Title,EmptyRes);
        ui->CustomerIdReservation->setFocus();
    }
    else
    {
        if(ui->CheckInDate->date() < QDate::currentDate())
        {
            QMessageBox::about(0,Title,DateBeforeCurrentDate);
            ui->CheckInDate->setDate(QDate(QDate::currentDate()));
        }
        else if(ui->CheckOutDate->date() < ui->CheckInDate->date())
        {
            QMessageBox::about(0,Title,CheckOutBeforeCheckIn);
            ui->CheckOutDate->setDate(ui->CheckInDate->date());
        }
        else
        {
            Room room;
            Customer customer;

            customer.setId(ui->CustomerIdReservation->text());
            room.setRoomNumber(ui->RoomNumberReservation->text().toInt());

            ResM.roomReservation(ui->CheckInDate->date(),ui->CheckOutDate->date(),room,customer);

            ui->CheckInDate->setDate(QDate(QDate::currentDate()));
            ui->CheckOutDate->setDate(QDate(QDate::currentDate()));
            ui->CustomerIdReservation->setText("");
            ui->RoomNumberReservation->setText("");
            ui->CustomerIdReservation->setFocus();
            showRoomGrid();
        }
    }
}
开发者ID:TheolZacharopoulos,项目名称:tl2hotel,代码行数:38,代码来源:mainwindow.cpp

示例2: JS_GetPrivate

JSBool JSCustomer::JSGetProperty(JSContext *cx, JSObject *obj, jsval id,
								 jsval *vp)
{
    if (JSVAL_IS_INT(id)) 
	{
		JSCustomer *p = (JSCustomer *) JS_GetPrivate(cx, obj);
		Customer *customer = p->getCustomer();
        switch (JSVAL_TO_INT(id)) 
		{
		case name_prop:
			{
				std::string name = customer->GetName();
				JSString *str = JS_NewStringCopyN(cx, name.c_str(), name.length());
				*vp = STRING_TO_JSVAL(str);
				break;
			}
		case age_prop:
			*vp = INT_TO_JSVAL(customer->GetAge());
			break;
        }
    }
    return JS_TRUE;
}
开发者ID:tonychanchen,项目名称:SpiderMonkeyTest,代码行数:23,代码来源:JSCustomer.cpp

示例3: ConstructAndAddCustomer

void TextFileDataSource::ConstructAndAddCustomer(std::string line)
{
	enum 
	{
		USER_ID,
		PASSWORD,
		NAME,
		ADDRESS,
		PHONE_NUMBER,
		ACCOUNT_IDS,
		NUM_FIELDS
	};
	
	vector<std::string> lineSplit = stringUtils::splitstring(line, ',');
	vector<std::string> accountIds = stringUtils::splitstring(lineSplit[ACCOUNT_IDS], ';');

	// create customer
	Customer* c = new Customer
	(
		TypeConverter(lineSplit[USER_ID]),
		lineSplit[PASSWORD],
		lineSplit[NAME],
		lineSplit[ADDRESS],
		lineSplit[PHONE_NUMBER]
	);

	// add account ids
	vector<std::string>::iterator vit;
	for (vit = accountIds.begin(); vit != accountIds.end(); ++vit)
	{
		c->addAccount(TypeConverter(*vit));
	}

	_users.add(c->getUserId(), c);

}
开发者ID:bradbow,项目名称:inb305gui,代码行数:36,代码来源:TextFileDataSource.cpp

示例4: addCustomerToList

// PUBLIC FUNCTIONS
bool MainWindow::addCustomerToList(Customer customer) {

    QString messageResult = _dbManager->addCustomer(customer);
    if( messageResult != NULL)
    {

        QMessageBox::critical(this, tr("Save attempt failed"), "Could not save \"" + customer.getCompanyName() + "\" into the database: \n" + messageResult);
        ui->statusBar->showMessage("Add to database unsuccessful: " + customer.getCompanyName());
        return false;
    } else {

        ui->statusBar->showMessage("Successfully added \"" + customer.getCompanyName() + "\" to the databse");

        // Close the current tab
        ui->tableTabWidget->removeTab(ui->tableTabWidget->currentIndex());

        // Open the company invoice tab
        QWidget *customerInvoiceTab = new AllCompanyInvoices(0, this, &customer);
        ui->tableTabWidget->setCurrentIndex(ui->tableTabWidget->addTab(customerInvoiceTab, customer.getCompanyName() + " Invoices"));
    }

    return true;

}
开发者ID:kerly,项目名称:Easy_Invoice,代码行数:25,代码来源:mainwindow.cpp

示例5: startService

void Server::startService(Customer& c){
	// pre: Q is not full and sim_->events is not full
	// post: start serving Customer c if available, otherwise puts c in Queue
	// Exception: _SERVER_QUEUEFULL if Q is full, _SERVER_EVENTSFULL if events is full
	if (!available()){
		if (!Q->enqueue(c)) throw _SERVER_QUEUEFULL;
	} else {
		// record stats
		waitTime += sim_->now() + c.time();
		lastStart = sim_->now();
		current = c;
		
		// reschedule
		busy = true;
		time_ = sim_->now() + (*exp)(*gen);
		if (sim_->insert(this)==_ORDEREDSET__SETFULL) throw _SERVER_EVENTSFULL;
	}
}
开发者ID:paul-Young,项目名称:HW7,代码行数:18,代码来源:Server.cpp

示例6: getAccountData

void Bank::getAccountData(QString login, QString pass)
{
    string line;
    Customer* cus = &getCustomer("Customer", "Reach", "New York");
    cus->addDebitAccount(login.toStdString(), pass.toStdString());
    size_t moneyAmount(100500);
    cus->getDebitAccount().putMoney(moneyAmount);
    _accounts.push_back(&(cus->getDebitAccount()));

    size_t limit(10000);
    size_t getted(1000);

    cus->addCreditAccount(limit, login.toStdString(), pass.toStdString());
    cus->getCreditAccount().getMoney(getted);

    _accounts.push_back(&(cus->getCreditAccount()));
};
开发者ID:TheBiggestDaddy,项目名称:ATM,代码行数:17,代码来源:Bank.cpp

示例7: A

bool DoubleLinkList::putCustomer (int s, int e, int o) {
    bool x = false;
    Customer* temp1;
    Customer A(o);

    temp1 = A.putOneCustomer (FwdListPointer, s, e, o);

    if (temp1 != NULL)
    {   if (FwdListPointer == NULL && RevListPointer == NULL)
            FwdListPointer = RevListPointer = temp1;
        else
        {
            FwdListPointer->putPriorPointer (temp1);
            FwdListPointer = temp1;
        }
        x = true;
    }
    return x;
}
开发者ID:johnsliao,项目名称:CS-341,代码行数:19,代码来源:main.cpp

示例8: execute

//--------------------------------Execute---------------------------------//
//this method performs the actions for the Borrow object, using the
//store as a parameter to access the inventory and alter accordingly
//it also uses the file stream to read in the information
//according to formatting specifications, setting it for this specified
//derived transaction class
bool Borrow::execute(ifstream& file, Store& st)
{
	int custIdx;
	file >> custIdx;
	Customer* cust = st.getCustomer(custIdx);
	//read the custtomer index and get the customer at that index
	//from the store, if the store doesn't have the customer at that
	//spot then the customer has not been created and we cannot do anything
	if (cust == NULL)
	{
		cout << "Invalid Customer ID. Transaction could not be executed.\n";
		//no need for clean up since Customer is still NULL
		return false;
	}
	else
	{
		char format;
		file >> format;
		//read in the format, the format is specified to only be DVDs
		if (format != 'D')
		{
			cout << "Invalid format. Transaction could not be executed.\n";
			//no need for clean up since Formaat is not dynamic
			return false;
		}
		else
		{
			char genre;
			file >> genre;
			//read in the genre and then use the stores movie factory
			//to create a temporary movie of this genre,
			//however, if the genre did not correspond to an appropriate
			//movie, return false
			Movie* tempMov = st.getMovieFact().createIt(genre);
			if (tempMov == NULL)
			{
				cout << "Invalid movie. Transaction could not be "
					<< "executed.\n";
				//no need for clean up since tempMov is still NULL
				return false;
			}
			else
			{
				//everything worked, now we try to set the data
				//from the format specifications of a borrow
				//movie, and if this didn't work, the movie was 
				//created so we must clean this up. otherwise, we try
				//to borrow the movie from the inventory
				if (!tempMov->readTrans(file))
				{
					delete tempMov;
					tempMov = NULL;
					return false;
				}
				else
				{
					Movie* mov = NULL;
					//use a movie locator and a movie return value
					//to try to borrow the movie from the stores
					//inventory, if the borrow couldn't occur
					//we must delete the temporary movie
					if (!st.getInventory().borrowMovie(mov, tempMov))
					{
						cout << "Invalid movie. Transaction could not be "
							<< "executed.\n";
						delete tempMov;
						tempMov = NULL;

						return false;
					}
					else
					{
						//otherwise everything has worked out so far
						//so we set the data of the borrow transaction
						//because we already know the movie
						//and the customer is accurate
						setData(cust, mov);
						//if we couldn't borrow we must clean up
						if (!cust->borrowMovie(mov))
						{
							cout << "Invalid movie." <<
								"Transaction could not be "
								<< "executed.\n";
							delete tempMov;
							tempMov = NULL;
							return false;
						}
						//otherwise everything worked out perfectly
						//so the data is set and the customer
						//adds this transaction to his/her trans hist
						//and clean up our temp mov
						cust->addTransaction(this);
						delete tempMov;
						tempMov = NULL;
//.........这里部分代码省略.........
开发者ID:chrisadubois,项目名称:moviestore,代码行数:101,代码来源:borrow.cpp

示例9: setNroCustomers

void CVRP::init(VRP V) {
	cout.setf(ios::fixed | ios::showpoint);
	cout.precision(2);
	std::cout.imbue(
			std::locale(std::cout.getloc(), new punct_facet<char, ','>));

	bool init1 = false;

	if (init1) {
		setNroCustomers(V.getBusStops().size() + 1);
		Customer depot(V.getCoorSchool().getX(), V.getCoorSchool().getY(),
				V.getCoorSchool().getCapacity());

		std::vector<Stop> a;
		a.insert(a.begin() + 0, V.getCoorSchool());
		std::vector<Stop> b = V.getBusStops();
		//Set AllCustomer but not depot
		std::vector<Customer> allCustNotDepot;
		for (size_t i = 0; i < V.getBusStops().size(); i++) {
			Stop stop = V.getBusStops().at(i);
			Customer customer(stop.getX(), stop.getY(), stop.getCapacity());
			allCustNotDepot.insert(allCustNotDepot.begin() + i, customer);
		}
		setAllCustNoDepot(allCustNotDepot);

		a.insert(a.end(), b.begin(), b.end());
		std::vector<Customer> allCustomers;
		for (size_t i = 0; i < a.size(); i++) {
			Stop stop = a.at(i);
			Customer customer(stop.getX(), stop.getY(), stop.getCapacity());
			allCustomers.insert(allCustomers.begin() + i, customer);
		}

		for (size_t i = 0; i < allCustomers.size(); i++) {
			Customer customer = allCustomers.at(i);
			cout << "(" << customer.getX() << ", " << customer.getY() << ", "
					<< customer.getDemand() << ")" << endl;
		}
		setDepot(depot);
		setAllCustomers(allCustomers);
		setK(V.getK());
		setC(V.getCk());
		setKmin(V.getKmin());
	} else {
		setNroCustomers(V.getBusAssigned().size() + 1);
		Customer depot(V.getCoorSchool().getX(), V.getCoorSchool().getY(),
				V.getCoorSchool().getCapacity());

		std::vector<Stop> a;
		a.insert(a.begin() + 0, V.getCoorSchool());
		std::vector<Stop> b = V.getBusAssigned();

		//Set AllCustomer but not depot
		std::vector<Customer> allCustNotDepot;
		for (size_t i = 0; i < V.getBusAssigned().size(); i++) {
			Stop stop = V.getBusAssigned().at(i);
			Customer customer(stop.getX(), stop.getY(), stop.getCapacity());
			allCustNotDepot.insert(allCustNotDepot.begin() + i, customer);
		}
		setAllCustNoDepot(allCustNotDepot);

		a.insert(a.end(), b.begin(), b.end());
		std::vector<Customer> allCustomers;
		for (size_t i = 0; i < a.size(); i++) {
			Stop stop = a.at(i);
			Customer customer(stop.getX(), stop.getY(), stop.getCapacity());
			allCustomers.insert(allCustomers.begin() + i, customer);
		}
		cout << "List of customers! the first customert is the depot." << endl;
		for (size_t i = 0; i < allCustomers.size(); i++) {
			Customer customer = allCustomers.at(i);
			cout << "(" << customer.getX() << ", " << customer.getY() << ", "
					<< customer.getDemand() << ")" << endl;
		}
		setDepot(depot);
		setAllCustomers(allCustomers);
		setK(V.getK());
		setC(V.getCk());
		setKmin(V.getKmin());
	}
	//Validation of the numbers of enters to the depot
	//Initialization of x
	//Initialization of d

	std::vector<Customer> allCustomers = getAllCustomers();
	int nro_customers = getNroCustomers();
	double** d_cvpr = new double*[nro_customers];
	double** s_cvpr = new double*[nro_customers];
	bool** x_cvpr = new bool*[nro_customers];

	for (int i = 0; i < nro_customers; i++) {
		d_cvpr[i] = new double[nro_customers];
		x_cvpr[i] = new bool[nro_customers];
		s_cvpr[i] = new double[nro_customers];
	}
	cout << "Save the distance in a d array of array" << endl;
	for (int i = 0; i < nro_customers; i++) {
		Customer customer = allCustomers.at(i);
		cout << "(" << customer.getX() << ", " << customer.getY() << ")"
				<< endl;
//.........这里部分代码省略.........
开发者ID:Marvinsky,项目名称:SBRP,代码行数:101,代码来源:Cvrp.cpp

示例10:

History::History(Customer cust, Business bus)
{
	customerHistoryID = cust.getID();
}
开发者ID:oscar-gt,项目名称:VideoStoreFinalProject,代码行数:4,代码来源:History.cpp

示例11: compareCustomers

bool CVRP::compareCustomers(Customer c1, Customer c2) {
	if ((c1.getX() == c2.getX()) && (c1.getY() == c2.getY())) {
		return true;
	}
	return false;
}
开发者ID:Marvinsky,项目名称:SBRP,代码行数:6,代码来源:Cvrp.cpp

示例12: createCustomer

Customer* Customer::createCustomer(Node* customer_node, struct_MAN* struct_man)
{
	Customer* customer = Customer::create();
	customer->setCustomer(customer_node, struct_man);
	return customer;
}
开发者ID:LandDream,项目名称:E-home-Noodle,代码行数:6,代码来源:Customer.cpp

示例13: if

// Set the data object from the widgets.
void
CardTransfer::widgetToData()
{
    _gltxFrame->getData(_curr);
    _curr.setMemo(_memo->text());
    _curr.setCardId(_from->getId());
    _quasar->db()->setActive(_curr, !_inactive->isChecked());

    _gltxFrame->getData(_link);
    _link.setNumber(_toNumber->text());
    _link.setShiftId(_toShift->getId());
    _link.setMemo(_memo->text());
    _link.setCardId(_to->getId());
    _quasar->db()->setActive(_link, !_inactive->isChecked());

    fixed amount = _amount->getFixed();
    Id transferAcct = _account->getId();
    Card card;

    Id fromAcct;
    _quasar->db()->lookup(_curr.cardId(), card);
    DataObject::DataType fromType = card.dataType();
    if (card.dataType() == DataObject::CUSTOMER) {
	Customer customer;
	_quasar->db()->lookup(card.id(), customer);
	fromAcct = customer.accountId();
    } else if (card.dataType() == DataObject::VENDOR) {
	Vendor vendor;
	_quasar->db()->lookup(card.id(), vendor);
	fromAcct = vendor.accountId();
    }

    Id toAcct;
    _quasar->db()->lookup(_link.cardId(), card);
    DataObject::DataType toType = card.dataType();
    if (card.dataType() == DataObject::CUSTOMER) {
	Customer customer;
	_quasar->db()->lookup(card.id(), customer);
	toAcct = customer.accountId();
    } else if (card.dataType() == DataObject::VENDOR) {
	Vendor vendor;
	_quasar->db()->lookup(card.id(), vendor);
	toAcct = vendor.accountId();
    }

    // Process fromAcct and transfer acct on first card
    _curr.cards().clear();
    _curr.cards().push_back(CardLine(_curr.cardId(), -amount));
    _curr.accounts().clear();
    if (fromType == DataObject::CUSTOMER) {
        _curr.accounts().push_back(AccountLine(fromAcct, -amount));
        _curr.accounts().push_back(AccountLine(transferAcct, amount));
    } else if (fromType == DataObject::VENDOR) {
        _curr.accounts().push_back(AccountLine(fromAcct, amount));
        _curr.accounts().push_back(AccountLine(transferAcct, -amount));
    }

    // Process toAcct and transfer acct on second card
    _link.cards().clear();
    if (fromType == toType) {
        _link.cards().push_back(CardLine(_link.cardId(), amount));
        _link.accounts().clear();
        if (toType == DataObject::CUSTOMER) {
            _link.accounts().push_back(AccountLine(toAcct, amount));
            _link.accounts().push_back(AccountLine(transferAcct, -amount));
        } else if (toType == DataObject::VENDOR) {
            _link.accounts().push_back(AccountLine(toAcct, -amount));
            _link.accounts().push_back(AccountLine(transferAcct, amount));
       }
    } else {
        _link.cards().push_back(CardLine(_link.cardId(), -amount));
        _link.accounts().clear();
        if (toType == DataObject::CUSTOMER) {
            _link.accounts().push_back(AccountLine(toAcct, -amount));
            _link.accounts().push_back(AccountLine(transferAcct, amount));
        } else if (toType == DataObject::VENDOR) {
            _link.accounts().push_back(AccountLine(toAcct, amount));
            _link.accounts().push_back(AccountLine(transferAcct, -amount));
	}
    }
}
开发者ID:cwarden,项目名称:quasar,代码行数:82,代码来源:card_transfer.cpp

示例14: operator

	bool operator()(const Customer& cust) const
	{
		return code == cust.Code();
	}
开发者ID:harpreettakhi,项目名称:harpreettakhi-code,代码行数:4,代码来源:findtest.cpp

示例15: run

    void run()
    {
        int period_index = 0; // 0 a 6
        // Use util->max/minPeopleFlow
        int minFlow = util->minPeopleFlow[period_index];
        int maxFlow = util->maxPeopleFlow[period_index];
        cout << "NEW FLOW IS FROM " << minFlow << " TO " << maxFlow <<endl;

        int timeNextCustomer = util->getRand(minFlow, maxFlow);
        cout <<"First curstomer arrives in " << util->getMinute(timeNextCustomer) << "min and " << util->getSeconds(timeNextCustomer)<< " seconds" << endl;

        while(util->time <= 24 * 3600)
        {
            this->changePeriod(period_index, minFlow, maxFlow);




            int rand = util->getRand(util->minTimeAtCashier, util->maxTimeAtCachier);

            // CHECK ARRIVING CUSTOMER
            if(timeNextCustomer == 0)
            {
                // NEW CUSTOMER ARRIVE AT THE TIME CURRENT
                cout << "New Customer Arrived at "<< util->getHour(util->time) << ":" <<util->getMinute(util->time) <<"!" << endl;
                Customer *customer = new Customer(util->time);

                if (cashierList->getSize() == 0) // First cashier
                {
                    Cashier *cashier = new Cashier();
                    this->cashierList->insert(cashier);
                    cashier->customersLine->insert(customer);
                    cout << "Openning the first cashier!" << endl;
                }
                else
                {
                    // VERIFY CASHIERS AND PROCESS CUSTOMERS WAIT
                    Node<Cashier*> *node = this->cashierList->getFirst();
                    int listSize = this->cashierList->getSize();
                    for(int i=0; i<= listSize && node!=NULL; i++)
                    {
                        Cashier *cashier = node->getValue();
                        cashier->processCashier(rand);
                        if (cashier->customersLine->getSize()>0)
                        {
                            Customer *firstCustomer = cashier->getFirstCustomer();
                            int leftCustomerWaitTime = util->maxWaitLine - firstCustomer->getWaitingTime(util->time);

                            // ATTENTION!!! CUSTOMER WAITING ALERT!
                            if (cashier->busyTime > leftCustomerWaitTime) // NOT ENOUGH TIME
                            {
                                Cashier *available = getAvailableCashier(leftCustomerWaitTime);

                                if (available != NULL)
                                {
                                    available->customersLine->insert(firstCustomer);
                                }
                                else
                                {
                                    // NO OTHER CASHIER AVAILABLE
                                    Cashier *newCashier = new Cashier();
                                    newCashier->customersLine->insert(firstCustomer);
                                    cashier->customersLine->remove(firstCustomer);
                                    rand = util->getRand(util->minTimeAtCashier, util->maxTimeAtCachier);
                                    newCashier->processCashier(rand);
                                    this->cashierList->insert(newCashier);
                                    cout << "Openning an emergencial cashier! Customer waiting for more than " << util->getMinute(firstCustomer->getWaitingTime(util->time)) << " min"  << endl;
                                }
                            }
                        }

                        node = node->getNext();
                    } // End for


                    // ADD NEW CUSTOMER
                    node = this->cashierList->getFirst();
                    int minLine = 1000000, index = 0;
                    for(int i=0; i<= this->cashierList->getSize() && node!=NULL; i++)
                    {
                        Cashier *cashier = node->getValue();
                        if(cashier->getLineSize() < minLine)
                        {
                            minLine = cashier->getLineSize();
                            index = i;
                        }
                        node = node->getNext();
                    } // End for
                    LinkedList<Cashier*> *list = this->cashierList;
                    Cashier *cashier = list->getValueAt(index);
                    LinkedList<Customer*> *list1 = cashier->customersLine;
                    list1->insert(customer);
                } // END ELSE LIST NOT EMPTY

                // PREPARE NEXT CUSTOMER ARRIVING
                timeNextCustomer = util->getRand(minFlow, maxFlow);
                cout <<"Next curstomer arrives in " << util->getMinute(timeNextCustomer) << "min and " << util->getSeconds(timeNextCustomer)<< " seconds"<<endl;

            } // END CHECK ARRIVING CUSTOMER
            else
//.........这里部分代码省略.........
开发者ID:amandapriscilla,项目名称:portfolio,代码行数:101,代码来源:projeto.cpp


注:本文中的Customer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。