Exemplo n.º 1
0
Arquivo: Ticket.hpp Projeto: LSTS/dune
      //! Compare another ticket with this object.
      //! Only interface and destination are compared.
      //! @return true if tickets hold same basic information,
      //! false otherwise.
      bool
      compare(const Ticket ticket)
      {
        if (m_ticket.interface == ticket.getInterface() &&
            m_ticket.destination == ticket.getDestination())
          return true;

        return false;
      }
Exemplo n.º 2
0
Ticket* OTicketDAO::getTicket(int id)
{
	for(int i =0; i < tickets.size(); i++)
	{
		Ticket* temp = tickets.at(i);
		if(temp->getTicketID() == id)
			return temp;
	}
	return 0;
}
Exemplo n.º 3
0
//Geeft de positie van een element in de array; Enkel noodzakelijk om de database te simuleren
int OTicketDAO::getPositie(int id)
{
	for(int i = 0; i < tickets.size(); i++)
	{
		Ticket* temp = tickets.at(i);
		if(temp->getTicketID() == id)
			return i;
	}
	return -1;
}
Ticket Lotto(int Tot, int Ran) { // generate and return randomized & sorted array of lottery numbers
    Ticket temp; // create a ticket that will be returned once generated with random lottery numbers with respect to arguments passed to function
    int i = 0;

    if (Tot < 5) { // check for the first argument passed to function
        cout << "Invalid number range, resetting to default: [1-5]" << endl; // if range of lottery number max is below 5, change it to min allowed - 5
        Tot = 5;
    }

    if (Ran < 2) { // check the second argument, if less than 2, set it to default value of 2, we need at least 2 winning numbers to play with
        cout << "Invalid ticket request, setting number of winning numbers to default - 2." << endl;
        Ran = 2;
    }

    for (i = 0; i < Tot; i++) // generate non-random sequence of numbers from 1 to Tot and store it in vector<int> array
        temp.push_back(i+1);

    for (i = 0; i < Ran; i++) // shuffle the numbers "Ran" many times to have better randomization of numbers
        random_shuffle(temp.begin(), temp.end());

    temp.erase(temp.begin()+Ran, temp.end()); // erase unnecessary numbers from Ran+, numbers from 1 to Ran are kept in.
    sort(temp.begin(), temp.end()); // finally, sort the numbers

    return temp; // and return the sorted and randomized array
}
Exemplo n.º 5
0
vector<Ticket*> OTicketDAO::vindTicketDoorID(int ID)
{
	vector<Ticket*> results = vector<Ticket*>();
	for(int i =0; i < tickets.size(); i++)
	{
		Ticket* temp = tickets.at(i);
		if(temp->getTicketID() == ID)
			results.push_back(temp);
	}
	return results;
}
Exemplo n.º 6
0
Status TransportLayerLegacy::_runTicket(Ticket ticket) {
    if (!_running.load()) {
        return TransportLayer::ShutdownStatus;
    }

    if (ticket.expiration() < Date_t::now()) {
        return Ticket::ExpiredStatus;
    }

    AbstractMessagingPort* amp;

    {
        stdx::lock_guard<stdx::mutex> lk(_connectionsMutex);

        auto conn = _connections.find(ticket.sessionId());
        if (conn == _connections.end()) {
            return TransportLayer::TicketSessionUnknownStatus;
        }

        // "check out" the port
        conn->second.inUse = true;
        amp = conn->second.amp.get();
    }

    auto legacyTicket = checked_cast<LegacyTicket*>(getTicketImpl(ticket));
    auto res = legacyTicket->_fill(amp);

    {
        stdx::lock_guard<stdx::mutex> lk(_connectionsMutex);

        auto conn = _connections.find(ticket.sessionId());
        invariant(conn != _connections.end());

#ifdef MONGO_CONFIG_SSL
        // If we didn't have an X509 subject name, see if we have one now
        if (!conn->second.sslPeerInfo) {
            auto info = amp->getX509PeerInfo();
            if (info.subjectName != "") {
                conn->second.sslPeerInfo = info;
            }
        }
#endif
        conn->second.inUse = false;

        if (conn->second.ended) {
            Listener::globalTicketHolder.release();
            _connections.erase(conn);
        }
    }

    return res;
}
    bool  ListenerSSL::_checkHalt(void)
    {
      while (this->_th->TryGet())
	{
	  Ticket  *t = this->_th->CurTicket;
	  if (t->GetAction() == CORE_HALT_MODULE)
	    {
	      this->_th->Drop("CORE", CORE_HALTED_MODULE);
	      return (true);
	    }
	}
      return (false);
    }
Exemplo n.º 8
0
void formUpdBug::loadInfoTicket(Ticket source)
{

idTk = source.getIdTicket();
    ui->titleTicket->setText(source.getNameTicket());
    ui->description->setText(source.getDescrTicket());
    ui->dateCrea->setDateTime(QDateTime::fromString(source.getCreateDt(),"yyyy-MM-ddTHH:mm:ss"));
    ui->dateAssign->setDateTime(QDateTime::fromString(source.getSetUserDate(),"yyyy-MM-ddTHH:mm:ss"));
    ui->dateEnd->setDateTime(QDateTime::fromString(source.getEndDate(),"yyyy-MM-ddTHH:mm:ss"));
    ui->etatComboBox->setCurrentIndex(ui->etatComboBox->findText(source.getEtat()));
    ui->usrComboBox->setCurrentIndex(ui->usrComboBox->findText(source.getDev()));
    ui->createComboBox->setCurrentIndex(ui->createComboBox->findText(source.getCreateName()));


}
 void  ListenerSSL::_checkOpenClose(void)
 {
   while (this->_th->TryGet())
   {
     Ticket  *t = this->_th->CurTicket;
     if (t->GetAction() == LISTENER_OPENPORT)
     {
       if (t->CData->GetType() == "Buffer")
         this->_openPort(((Buffer *)t->CData)->getDataToInt());
       this->_th->Drop("", CORE_DELETE_TICKET);
       // checker retour
     }
     else
       if (t->GetAction() == LISTENER_CLOSEPORT)
       {
         if (t->CData->GetType() == "Buffer")
           this->_closePort(((Buffer *)t->CData)->getDataToInt());
         this->_th->Drop("", CORE_DELETE_TICKET);
         // checker retour
       }
   }
 }
Exemplo n.º 10
0
Ticket* OTicketDAO::bewaarTicket(Ticket* ticket)
{
	if(ticket->getTicketID() == -1)
	{
		//Dit is een nieuw adres en simuleert de toekenning van een sequentiële ID door de database
		Ticket* temp = tickets.at(tickets.size()-1);
		int nieuweID = temp->getTicketID()+1;
		ticket->setTicketID(nieuweID);
	}
	Ticket* temp = getTicket(ticket->getTicketID());
	if(temp == 0)
	{
		tickets.push_back(ticket);
		return ticket;
	}
	else
	{
		//Ticket updaten
		temp->setTicketID(ticket->getTicketID());
		return temp;
	}

	return 0;
}
Exemplo n.º 11
0
void formUpdBug::on_save_clicked()
{
    Ticket bug;

    bug.setIdTicket(idTk);
    bug.setNameTicket(ui->titleTicket->text());
    bug.setDescrTicket(ui->description->toPlainText());
    bug.setCreateName(ui->createComboBox->currentText());
    bug.setDev(ui->usrComboBox->currentText());
    bug.setEtat(ui->etatComboBox->currentText());

    emit save_upd_ticket(bug);

}
Exemplo n.º 12
0
Ticket Cine::ingresarASalaC(Sala s, const Ticket &t){
    Lista<pair<Sala, int> > es=espectadores_;
    int i=0;
    int se=0;
    while (i<es.longitud()) {
        if (((es.iesimo(i)).first)==s) {
        se=i;
        }
        i++;
    }

    espectadores_.agregarAtras(make_pair(s,espectadoresC(s)+1));
    espectadores_.sacar(es.iesimo(se));
    ticketsVendidos_.eliminarPosicion(ticketsVendidos_.posicion(t));
    Pelicula p=t.peliculaT();
    Ticket res=Ticket(p,s,true);
    return res;
}
Exemplo n.º 13
0
Status TransportLayerLegacy::_runTicket(Ticket ticket) {
    if (!_running.load()) {
        return TransportLayer::ShutdownStatus;
    }

    if (ticket.expiration() < Date_t::now()) {
        return Ticket::ExpiredStatus;
    }

    // get the weak_ptr out of the ticket
    // attempt to make it into a shared_ptr
    auto legacyTicket = checked_cast<LegacyTicket*>(getTicketImpl(ticket));
    auto session = legacyTicket->getSession();
    if (!session) {
        return TransportLayer::TicketSessionClosedStatus;
    }

    auto conn = session->conn();
    if (conn->closed) {
        return TransportLayer::TicketSessionClosedStatus;
    }

    Status res = Status::OK();
    try {
        res = legacyTicket->fill(conn->amp.get());
    } catch (...) {
        res = exceptionToStatus();
    }

#ifdef MONGO_CONFIG_SSL
    // If we didn't have an X509 subject name, see if we have one now
    auto& sslPeerInfo = SSLPeerInfo::forSession(legacyTicket->getSession());
    if (sslPeerInfo.subjectName.empty()) {
        auto info = conn->amp->getX509PeerInfo();
        if (!info.subjectName.empty()) {
            sslPeerInfo = info;
        }
    }
#endif

    return res;
}
Exemplo n.º 14
0
void SiriTokenProvider::PushBackTicket( const Ticket& t,bool bLock)
{
    if(t.IsExpired())
        return;
    if(bLock)
    {
        FastMutex::ScopedLock lock(_mutex_tickets);
        list<string>::iterator it=std::find(assistant_in_uses.begin(),assistant_in_uses.end(),t.assistantId);
        list<Ticket>::iterator itr=std::find(g_tickets.begin(),g_tickets.end(),t);
        if((itr==g_tickets.end()) && (it==assistant_in_uses.end()))
        {
            g_tickets.push_back(t);
        }
    }
    else
    {
        list<string>::iterator it=std::find(assistant_in_uses.begin(),assistant_in_uses.end(),t.assistantId);
        list<Ticket>::iterator itr=std::find(g_tickets.begin(),g_tickets.end(),t);
        if((itr==g_tickets.end()) && (it==assistant_in_uses.end()))
        {
            g_tickets.push_back(t);
        }
    }
}
Exemplo n.º 15
0
void UserProcessingCenter::handleKerberosLogin(CMazeMsg* context)
{
    //cout<<":: kerberos login:: "<<endl;
    debug("kerberos login request");
	char *pbuf = context->getMsg();
	int rt = context->getLen();
	MBlockSocket *pclient = context->getSocket();
	UserDatabase *userdb = UserDatabase::getInstance();

	KMsgHead kmsghead;
	if(kmsghead.unserialize(pbuf,rt)!=-1)
	{
		switch(kmsghead.msgtype)
		{
			case USER_LOGIN_REQUEST:
			{
				//cout<<"::kerberos login::"<<endl;
				UserLoginRequest  req;
				if(req.unserialize(pbuf,rt)!=-1)
				{
					USERDB	*userinfo = new USERDB;

					//debug("recv req from user %d to  @time %d"<<req.uid<<"  "<<req.ts);

					bool logfind=false;

					if(req.uid!=0)
					{
                    	debug("recv req from user id to  @time--->"<<req.uid<<"  "<<req.ts);

						logfind=(userdb->get_record( req.uid,userinfo) == 0);
						debug("find user %d 's user info"<<req.uid);
					}
					else
					{
	                    debug("recv req from user email to  @time---->"<<req.emailAddr<<"  "<<req.ts);

						string emailAddr=req.emailAddr;
						string badEmail = string("*****@*****.**");
						if(emailAddr == badEmail)
						{
							cout<<"--------bad email--------"<<endl;
							logfind = false;
							
						}
						else
						{
							logfind=(userdb->get_record(emailAddr,userinfo) == 0);
							debug("find user %s 's user info"<<emailAddr.c_str());
						}
					}


					if(logfind)
					{
						//generate ticket and send it back to User here...
						UserLoginReply reply;
						strncpy(reply.userInfo.NickName,userinfo->NickName,24);
						strncpy(reply.userInfo.MailAddr,userinfo->MailAddr,128);
						reply.userInfo.UID=userinfo->UID;
						reply.userInfo.IP=pclient->GetPeerName().GetIP();	//TODO
						reply.userInfo.ServerPort=pclient->GetPeerName().GetPort();	//TODO
						reply.userInfo.Account=userinfo->Account;
						reply.userInfo.Level=userinfo->Level;
						reply.userInfo.LastAccountAddTime=(unsigned)userinfo->LastAddAccount;

						//get user password(key) from user database;
						string userKey=userinfo->Pwd;
						//get tgs key from config or database.
						string tgsKey ="tgskey";
						//generate a random string to be the session key shared by user and tgs.
						string sessionKey=GenRandomKey();

						unsigned ts=(unsigned)time(NULL);//the time-stamp of the ticket release.

						reply.ts   =ts;
						reply.life =TGS_TICKET_LIFE;//the life of the ticket below
						reply.privilege=0;//TODO privilege of user..
						reply.head.src=0;
						reply.head.dst=req.uid;
						reply.head.status=0;

						reply.sessionKey.set(sessionKey.c_str(),sessionKey.length());

						Ticket ticket;
						ticket.uid=req.uid;
						ticket.uaddr=0;	//TODO
						ticket.ts=ts;
						ticket.life=TGS_TICKET_LIFE;
						ticket.privilege=0;//TODO; 
						ticket.sessionKey.set(sessionKey.c_str(),sessionKey.length());

						reply.cipheredTicket=ticket.serializeAndEncrypt(tgsKey.c_str(),tgsKey.length());
						RawData result=reply.serializeAndEncrypt(userKey.c_str(),userKey.length());

						debug("AS:\tGrant ticket and session key {%s} to user %d\n"<<sessionKey.c_str()<<req.uid);
						unsigned int ip = pclient->GetPeerName().GetIP();
						string ip_str=pclient->GetPeerName().ip();
						pclient->SendPacket(result.data,result.len);

						char buf[256];
						time_t timep=time(NULL);
						struct tm *p=localtime(&timep);
						sprintf(buf,"%d_%0.2d_%0.2d_login.txt",(1900+p->tm_year),(1+p->tm_mon),p->tm_mday);
						Configuration config = Configuration::getInstance();
						string logDir = config.get("log");
						string logName = logDir + buf;
						ofstream loginLogOutput(logName.c_str(),ofstream::app);
						sprintf(buf,"%.2d:%.2d:%.2d  %10d    %15s kerbroslogin ",p->tm_hour,p->tm_min,p->tm_sec,userinfo->UID,ip_str.c_str());
						loginLogOutput<<buf<<endl;
						
					}
					else
					{
						//no user...info...
						debug("login ip:"<<pclient->GetPeerName().ToString());

						debug("no user %d %s info in out database !"<<req.uid<<req.emailAddr);
					}
					delete userinfo;
					//clean resources used above.
				}

				break;
			}//end of case

			case COMMIT_KEYS_REQUEST:
			{
				printf("recv a commit keys request from %d \n",kmsghead.src);
				RawData reqdata(pbuf,rt);
				CommitKeysRequest req;
							
				string upasswd=userdb->getUserPasswd(kmsghead.src);
				req.decryptAndUnserialize(reqdata,upasswd.c_str(),upasswd.length());

				string pubKey(req.pubKey.data,req.pubKey.len);
				string privKey(req.privKey.data,req.privKey.len);

				bool rtv=userdb->putUserKeys(req.head.src,pubKey,privKey);

				CommitKeysReply reply;
				reply.head.status=(rtv)?0:-1;

				RawData replydata=reply.serialize();
				pclient->SendPacket(replydata.data,replydata.len);
				
				break;
			}//end of case

			case PUBLIC_KEY_REQUEST:
			{

				debug("recv a public key request from %d"<<kmsghead.src);

				RawData reqdata(pbuf,rt);
				PublicKeyRequest req;
				req.unserialize(reqdata);

				string pubKey,privKey;
				bool rtv=userdb->getUserKeys(req.uid,pubKey,privKey);

				PublicKeyReply reply;
				reply.pubKey.set(pubKey.c_str(),pubKey.length());
				reply.head.status=(rtv)?0:-1;

				RawData replydata=reply.serialize();
				pclient->SendPacket(replydata.data,replydata.len);
				break;

			}//end of case
						
			case PRIVATE_KEY_REQUEST:
			{

				debug("recv a private key request from %d "<<kmsghead.src);

				RawData reqdata(pbuf,rt);
				PrivateKeyRequest req;
				req.unserialize(reqdata);

				string upasswd=userdb->getUserPasswd(kmsghead.src);
				string pubKey,privKey;
				bool rtv=userdb->getUserKeys(kmsghead.src,pubKey,privKey);

				PrivateKeyReply reply;
				reply.privKey.set(privKey.c_str(),privKey.length());

				RawData replydata=reply.serializeAndEncrypt(upasswd.c_str(),upasswd.length());
				pclient->SendPacket(replydata.data,replydata.len);
				break;

			}
			default:
				break;
		}//end switch();

	}//end if(kmsghead.unserialize()....
}
int main() {

    int lotMaxR, winN, matchingN = 0; // lotMaxR = max range number for lottery numbers to be drawn, from 1 to lotMaxR

    do {
        cout << "Enter lottery range, from 1 to (5 or greater): "; // ask to input maximum range of possible lottery draw number
    } while(cin >> lotMaxR && lotMaxR < 5); // get proper number from user until 5 or more is entered

    do {
        cout << "Enter how many numbers to draw (2 or greater): "; // ask for how many spots on the lotto card or winning numbers to draw in lottery play
    } while(cin >> winN && winN < 2);  // ask for input until 2 or number is entered

    Ticket winners = Lotto(lotMaxR,winN); // generate random numbers  for winning numbers
    Ticket myticket = Lotto(lotMaxR,winN); // generate random numbers for user's playing ticket, something like QuickPick

    cout << "Winning numbers: ";
    DisplayTicket(winners); // display winning numbers
    cout << "Your ticket numbers: ";
    DisplayTicket(myticket); // display playing user's numbers

    cout << "Number(s) matched on your ticket: "; // display matching numbers from both arrays (lottery drawn numbers and user's quick pick)
    for (int i = 0; i < winN; i++)
        if (find(winners.begin(), winners.end(), myticket[i]) != winners.end()) { // compare each winning number to user's picked numbers
            cout << myticket[i] << " "; // if matched, display the number
            matchingN++; // and increase the number of matched numbers
        }

        if (matchingN == 0) // if no numbers were matched display the message
            cout << "None" << endl;
        else
            cout << endl;

        if (matchingN == winN && matchingN > 5) // if all winning numbers guessed correctly and the total number of them is 6 or more - almost impossible win, display epic congratulations message!
            cout << "You've guessed all numbers!!! BEER IS ON ME!";
        else if (matchingN == winN && matchingN == 2 ) // special occasion: if out of 2 winning numbers 2 guessed correctly, display FREE ticket prize msg
            cout << "Congratulations, you've won min 2x2 game! Prize: 10 FREE tickets!" << endl;
        else if (matchingN > 5) // display messages for each number of correctly guessed numbers, the greater the number the more fun and expensive prize....or maybe not :)
            cout << "Congratulations, You've guessed " << matchingN << " winning numbers!!!" << endl;
        else
            switch(matchingN) {
            case 5:
                cout << "Congratilations, You've guessed 5 winning numbers!!!!" << endl;
                break;

            case 4:
                cout << "Congratulations, You've guessed 4 winning numbers!!" << endl;
                break;

            case 3:
                cout << "Congratulations, You've guessed 3 winning numbers!!" << endl;
                break;

            default:
                cout << "You've guessed " << matchingN << " winning number(s)!!" << endl;
                break;
        }

        cout << "\nBye!\n"; // all is done, good bye
        system("pause");
        return 0;
}
void DisplayTicket(const Ticket & t) { // function displays victor<int> array or defined as Ticket
    for (int i = 0; i < t.size(); i++) // go through each element until t.size(), the max number of elements, is reached
        cout << t[i] << " "; // display the element
    cout << endl;
}
Exemplo n.º 18
0
int createSalesTicket(ConnectNotice &cn)
{
    char    noteText[4096];
    char    summary[4096];
    Ticket  newTick;
    sprintf(summary, "Qwest DSL - %s %s", cn.connType, cn.custCirc);
    newTick.setName(cn.custName);
    newTick.setSummary(summary);
    newTick.setOpened();
    newTick.setModified();
    newTick.setStatus(Ticket::Unexamined);
    newTick.setType(Ticket::Sales);
    newTick.create();


    strcpy(noteText, "The following Qwest connect notice has been recieved and no matching phone numbers could be found for it.<P>\n");
    strcat(noteText, "Action ");
    strcat(noteText, cn.connType);
    strcat(noteText, "<BR>\n");

    strcat(noteText, "Notice Date ");
    strcat(noteText, cn.noticeDate);
    strcat(noteText, "<BR>\n");

    strcat(noteText, "Name ");
    strcat(noteText, cn.custName);
    strcat(noteText, "<BR>\n");
    
    strcat(noteText, "Addr1 ");
    strcat(noteText, cn.addr1);
    strcat(noteText, "<BR>\n");

    strcat(noteText, "Addr2 ");
    strcat(noteText, cn.addr2);
    strcat(noteText, "<BR>\n");

    strcat(noteText, "Addr3 ");
    strcat(noteText, cn.addr3);
    strcat(noteText, "<BR>\n");

    strcat(noteText, "Select ");
    strcat(noteText, cn.isSelect);
    strcat(noteText, "<BR>\n");

    strcat(noteText, "CBR Number ");
    strcat(noteText, cn.cbr);
    strcat(noteText, "<BR>\n");

    strcat(noteText, "DSL Phone ");
    strcat(noteText, cn.custCirc);
    strcat(noteText, "<BR>\n");

    strcat(noteText, "Blarg Circuit ");
    strcat(noteText, cn.hostCirc);
    strcat(noteText, "<BR>\n");

    strcat(noteText, "Due Date ");
    strcat(noteText, cn.dueDate);
    strcat(noteText, "<BR>\n");

    strcat(noteText, "Speed ");
    strcat(noteText, cn.speed);
    strcat(noteText, "<BR>\n");

    strcat(noteText, "VPI ");
    strcat(noteText, cn.vpi);
    strcat(noteText, "<BR>\n");

    strcat(noteText, "VCI ");
    strcat(noteText, cn.vci);
    strcat(noteText, "<BR>\n");

    newTick.addLogEntry(Ticket::Normal, "%s", noteText);

    ADB tmpDB;
    cn.ticketNo = newTick.ticketNo();
    tmpDB.dbcmd("update QwestDSLNotices set TicketNo = %ld where NoticeID = %ld", cn.ticketNo, cn.noticeID);

    return 1;
}
Exemplo n.º 19
0
void scanOrphans()
{
    ADB     connDB;
    ADB     phoneDB;
    ADB     workDB;
    char    tmpPhone[1024];
    string  workStr;
    long    custID;
    char    noteText[4096];

    connDB.query("select * from QwestDSLNotices where CustomerID = 0");
    if (!connDB.rowCount) return;
    while (connDB.getrow()) {
        strcpy(tmpPhone, "");
        workStr = connDB.curRow["DSLNumber"];
        strcat(tmpPhone, workStr.substr(0, 3).c_str());
        strcat(tmpPhone, "%%");
        strcat(tmpPhone, workStr.substr(3, 3).c_str());
        strcat(tmpPhone, "%%");
        strcat(tmpPhone, workStr.substr(6, 4).c_str());
        strcat(tmpPhone, "%%");

        //printf("select * from PhoneNumbers where PhoneNumber LIKE '%s'\n", tmpPhone);
        phoneDB.query("select * from PhoneNumbers where PhoneNumber LIKE '%s'", tmpPhone);
        if (phoneDB.rowCount) {
            // Found a matching phone number
            phoneDB.getrow();
            custID = atol(phoneDB.curRow["RefID"]);
            workDB.dbcmd("update QwestDSLNotices set CustomerID = %ld where NoticeID = %ld", custID, atol(connDB.curRow["NoticeID"]));

            // Now, add the notice into the customer notes.
            ADBTable    notesDB("Notes");
            notesDB.setValue("AutoNote",    1);
            notesDB.setValue("AddedBy",     "Auto");
            notesDB.setValue("NoteDate",    connDB.curRow["NoticeDate"]);
            notesDB.setValue("CustomerID",  custID);
            notesDB.setValue("NoteType",    "Qwest DSL");
            notesDB.setValue("Category",    connDB.curRow["Action"]);
            notesDB.setValue("SubCategory", "Connect Notice");
            notesDB.setValue("Subject",     connDB.curRow["Action"]);
            strcpy(noteText, "");
            strcat(noteText, "Action ");
            strcat(noteText, connDB.curRow["Action"]);
            strcat(noteText, "\n");

            strcat(noteText, "Name ");
            strcat(noteText, connDB.curRow["Name"]);
            strcat(noteText, "\n");
            
            strcat(noteText, "Addr1 ");
            strcat(noteText, connDB.curRow["Addr1"]);
            strcat(noteText, "\n");

            strcat(noteText, "Addr2 ");
            strcat(noteText, connDB.curRow["Addr2"]);
            strcat(noteText, "\n");

            strcat(noteText, "Addr3 ");
            strcat(noteText, connDB.curRow["Addr3"]);
            strcat(noteText, "\n");

            strcat(noteText, "Select ");
            strcat(noteText, connDB.curRow["Select256"]);
            strcat(noteText, "\n");

            strcat(noteText, "CBR Number ");
            strcat(noteText, connDB.curRow["CBR"]);
            strcat(noteText, "\n");

            strcat(noteText, "DSL Phone ");
            strcat(noteText, connDB.curRow["DSLNumber"]);
            strcat(noteText, "\n");

            strcat(noteText, "Blarg Circuit ");
            strcat(noteText, connDB.curRow["BlargCircuit"]);
            strcat(noteText, "\n");

            strcat(noteText, "Due Date ");
            strcat(noteText, connDB.curRow["DueDate"]);
            strcat(noteText, "\n");

            strcat(noteText, "Speed ");
            strcat(noteText, connDB.curRow["LineSpeed"]);
            strcat(noteText, "\n");

            strcat(noteText, "VPI ");
            strcat(noteText, connDB.curRow["VPI"]);
            strcat(noteText, "\n");

            strcat(noteText, "VCI ");
            strcat(noteText, connDB.curRow["VCI"]);
            strcat(noteText, "\n");

            notesDB.setValue("NoteText", noteText);
            notesDB.ins();

            // Now that the note has been inserted, check for any
            // tickets that may be opened on this line still.
            if (atol(connDB.curRow["TicketNo"])) {
                // We have a ticket.  Load it up.
                Ticket  tmpTick;
                tmpTick.setTicketNo(atol(connDB.curRow["TicketNo"]));
                if (tmpTick.status() != Ticket::Closed) {
                    // The ticket is open.  Set the customer ID and
                    // close it.
                    tmpTick.setCustomerID(custID);
                    tmpTick.setStatus(Ticket::Closed);
                    tmpTick.addLogEntry(Ticket::Normal, "DSL Number %s found for Customer ID %ld.  Auto-closing ticket.", connDB.curRow["DSLNumber"], custID);
                }
            }
        }
    }
}
Exemplo n.º 20
0
int main(int argc, const char * argv[]) {
    
    //initialize input variables
    Date_Time DT = *new Date_Time;
    string SN;
    string VN;
    aSeat ST = *new aSeat;
    
    //ensure working program
    cout << "This is program Test_Ticket\n";
    
    //get inputs
    cout << "Please Enter Paramaters for Ticket\n";
    cout << "Show Name: ";
    getline(cin, SN);
    cout << "Venue Name: ";
    getline(cin, VN);
    cout << "Day: ";
    cin >> DT.day;
    Clear_Keyboard_Input_Buffer();
    cout << "Month: ";
    cin >> DT.month;
    Clear_Keyboard_Input_Buffer();
    cout << "Year: ";
    cin >> DT.year;
    Clear_Keyboard_Input_Buffer();
    cout << "Hour: ";
    cin >> DT.hour;
    Clear_Keyboard_Input_Buffer();
    cout << "Minute: ";
    cin >> DT.minute;
    Clear_Keyboard_Input_Buffer();
    cout << "Seat Row: ";
    cin >> ST.row;
    Clear_Keyboard_Input_Buffer();
    cout << "Seat Number: ";
    cin >> ST.num;
    Clear_Keyboard_Input_Buffer();
    cout << endl;
    
    //create ticket
    Ticket *ticket = new Ticket(SN, VN, DT, ST);
    
    //display initial ticket using display()
    cout << "Initial Ticket: " << endl;
    ticket->Display();
    
    //display initial ticket using accessor fuctions
    cout << endl << "Using accessor functions: " << endl;
    cout << "Show_Name = " << ticket->Show_Name() << endl;
    cout << "Venue_Name = " << ticket->Venue_Name() << endl;
    cout << "Date = " << ticket->When().month << "/" << ticket->When().day << "/" << ticket->When().year << endl;
    cout << "Time = " << setw(2)<< setfill('0') << ticket->When().hour << ":" << setw(2) << setfill('0') << ticket->When().minute << endl;
    cout << "Seat " << ticket->Seat().row << ticket->Seat().num << endl;
    if (ticket->Sold() == false) {
        cout << "Not Sold" << endl;
    }
    else{
        cout << "Sold" << endl;
    }
    
    //sell the ticket with Sell()
    cout << endl << "Calling sell for ticket" << endl;
    ticket->Sell();
    
    //display ticket after sale using Display()
    cout << endl << "After ticket sold:" << endl;
    ticket->Display();
    
    delete ticket;
    
    cin.get(); //hold window open
    return 0;
}
Exemplo n.º 21
0
void TestCine()
{
  Cine a((Nombre) "Cine1");

  if(a.nombreC()!="Cine1") fallo=1,cout<<"Falla nombreC"<<endl;

  a.abrirSalaC(1);
  a.abrirSalaC(3);
  a.abrirSalaC(5);

  if(a.salasC().longitud()!=3) fallo=1,cout<<"Falla abrirSalaC"<<endl;
  if(!a.salasC().pertenece(1)) fallo=1,cout<<"Falla abrirSalaC"<<endl;
  if(!a.salasC().pertenece(3)) fallo=1,cout<<"Falla abrirSalaC"<<endl;
  if(!a.salasC().pertenece(5)) fallo=1,cout<<"Falla abrirSalaC"<<endl;

  a.agregarPeliculaC(pelis[0],1);
  a.agregarPeliculaC(pelis[1],3);
  a.agregarPeliculaC(pelis[2],5);

  if(a.peliculasC().longitud()!=3) fallo=1,cout<<"Falla agregarPeliculaC"<<endl;
  if(!a.peliculasC().pertenece(pelis[0])) fallo=1,cout<<"Falla agregarPeliculaC"<<endl;
  if(!a.peliculasC().pertenece(pelis[1])) fallo=1,cout<<"Falla agregarPeliculaC"<<endl;
  if(!a.peliculasC().pertenece(pelis[2])) fallo=1,cout<<"Falla agregarPeliculaC"<<endl;

  a.cerrarSalaC(1);
  if(a.salasC().longitud()!=2) fallo=1,cout<<"Falla cerrarSalaC"<<endl;
  if(!a.salasC().pertenece(3)) fallo=1,cout<<"Falla cerrarSalaC"<<endl;
  if(!a.salasC().pertenece(5)) fallo=1,cout<<"Falla cerrarSalaC"<<endl;
  if(a.peliculasC().longitud()!=2) fallo=1,cout<<"Falla cerrarSalaC"<<endl;
  if(!a.peliculasC().pertenece(pelis[1])) fallo=1,cout<<"Falla cerrarSalaC"<<endl;
  if(!a.peliculasC().pertenece(pelis[2])) fallo=1,cout<<"Falla cerrarSalaC"<<endl;

  if(!(a.peliculaC(3)==pelis[1])) fallo=1,cout<<"Falla peliculaC" <<endl;
  if(!(a.peliculaC(5)==pelis[2])) fallo=1,cout<<"Falla peliculaC" <<endl;


  a.pasarA3DUnaPeliculaC("Peli2");
  if(!a.peliculaC(3).es3DP()) fallo=1,cout<<"Falla pasarA3D" <<endl;

  Ticket t;
  t = a.venderTicketC("Peli3");
  if(t.usadoT()) fallo=1,cout<<"Falla venderTicketC"<<endl;
  if(t.salaT()!=5) fallo=1,cout<<"Falla venderTicketC"<<endl;
  if(!(t.peliculaT()==pelis[2])) fallo=1,cout<<"Falla venderTicketC"<<endl;
  a.venderTicketC("Peli3");

  if(a.ticketsVendidosSinUsarC().longitud()!=2) fallo=1,cout<<"Falla ticketsVendidosSinUsarC"<<endl;
  if(!a.ticketsVendidosSinUsarC().pertenece(t)) fallo=1,cout<<"Falla ticketsVendidosSinUsarC"<<endl;

  a.ingresarASalaC(5,t);
  if(a.espectadoresC(5)!=1) fallo=1,cout<<"Falla ingresarASalaC"<<endl;
  if(a.ticketsVendidosSinUsarC().longitud()!=1) fallo=1,cout<<"Falla ingresarASalaC"<<endl;
  if(!a.ticketsVendidosSinUsarC().pertenece(t)) fallo=1,cout<<"Falla ingresarASalaC"<<endl;
  t = a.ingresarASalaC(5,t);
  if(a.espectadoresC(5)!=2) fallo=1,cout<<"Falla ingresarASalaC"<<endl;
  if(a.ticketsVendidosSinUsarC().longitud()!=0) fallo=1,cout<<"Falla ingresarASalaC"<<endl;
  if(!t.usadoT()) fallo=1,cout<<"Falla ingresarASalaC"<<endl;

  a.cerrarSalasC(1);

  if(a.peliculasC().longitud()!=1) fallo=1,cout<<"Falla cerrarSalasC1"<<endl;
  if(!a.peliculasC().pertenece(pelis[2])) fallo=1,cout<<"Falla cerrarSalasC2"<<endl;

  ///void cerrarSalasDeLaCadenaC(Lista<Cine> &cs, int e) const;
}