void DialogProgTache::accept()
{
    Agenda* ag = &Agenda::getInstance();
    try
    {
        verification();
        //ajout des parties de la tache dans l'agenda
        if(ui->parties->isChecked())
        {
            verificationParties();
            ag->ajouterProgrammationPartieTache(vec_date, vec_titre, vec_debut, vec_duree, tache, projet);
        }
        //sinon ajout de la tache unitaire dans l'agenda
        else
        {
            ag->ajouterProgrammation(2, ui->date->date(), tache->getTitre(), tache->getDescription(),ui->horaire->time(),
                                     tache->getDuree(),"", "", tache, projet);
        }
        close();
    }
    catch(CalendarException e)
    {
        QMessageBox::critical(this, "Erreur", e.getInfo());
    }

}
示例#2
0
Agenda::Agenda(Agenda &agenda) {

	fichero = agenda.getFichero();
	_bd = agenda.getGestorDB();
	_contactos = agenda.getContactos();
	_frecuentes = agenda.getFrecuentes();
}
示例#3
0
文件: main.cpp 项目: VadimDez/Agenda
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    Agenda w;
    w.show();

    return a.exec();
}
示例#4
0
int main() {


	Agenda* agenda = new Agenda();

	int opt = 0;

	do{
		opt = menu();
		switch(opt){

		case 1:
			cout << "Agregar Contacto" << endl;
			agenda->agregar();
		break;
		case 2:
			cout << "Listar Contactos" << endl;
			agenda->lista();
		break;
		case 3:
			cout << "Actualizar Contactos" << endl;
			agenda->actualizar();
		break;
		case 4:
			cout << "Eliminar Contacto" << endl;
			agenda->borrar();
		break;
		case 5:
			cout << "Salir" << endl;
		break;
		}
		system("pause>null");
		system("cls");

	}while(opt!=5);


	//archivo << "Contacto agregado" <<endl;

/*	temp = agenda->getPrimerElemento();
	string nom ="";
	int tel = 0;

	ifstream lectura("contactos.txt");

	lectura.close();*/










	return 0;
}
TEST(Agenda, insertarCopiarYborrarAgenda){
	Contacto c;
	c.setNombre("Adam Compuesto");
	c.setDNI("1");
	Contacto c2;
	c2.setNombre("Alex Compuestoo");
	c2.setDNI("2");
	Contacto c3[2];
	c3[0]=c;
	c3[1]=c2;

	Agenda a;
	a.insertarPaciente(c);
	a.insertarPaciente(c2);

	EXPECT_EQ(c3, a.getPacientes());
	EXPECT_EQ("Adam Compuesto",a[0].getNombre());
	EXPECT_EQ("Alex Compuestoo",a[1].getNombre());

	Agenda b;
	b=a;

	EXPECT_EQ("Adam Compuesto",b[0].getNombre());
	EXPECT_EQ("Alex Compuestoo",b[1].getNombre());

	Contacto c4[1];
	Contacto c4[0]=c;
	b.eliminarPaciente("2");
	EXPECT_EQ(c4,b.getPacientes());

	a.borrarAgenda();
}
void DialogProgTache::verification()
{
    //si il s'agit d'une programmation de parties de taches, les verifiactions ont déjà été faites
    if(!ui->parties->isChecked())
    {
        if(tache->getDispo() > ui->date->date()) throw CalendarException("Tache pas encore disponible");
        if(tache->getEcheance() < ui->date->date()) throw CalendarException("Echéance dépassée");
        Agenda* ag = &Agenda::getInstance();
        //boucles sur les precedences pour vérifier la cohérence
        std::vector<Precedence*> vec = PrecedenceManager::getInstance().findPrecedence(projet, tache);
        for(std::vector<Precedence*>::iterator ite = vec.begin(); ite != vec.end(); ++ite)
        {
            //boucle sur ttes les précédences dt la tache succ ou pred est celle que l'on programme
            if(tache->getTitre() == (*ite)->getSucc().getTitre() || tache->getTitre() == (*ite)->getPred().getTitre())
            {
                for(Agenda::Iterator it = ag->begin(); it != ag->end(); ++it)//boucle sur ttes les taches déjà programmées
                {
                    //verif que c'est bien une prog de tache
                    if((*it).type() == 2)
                    {
                        //si la tache est la tache antérieure de la précédence
                        if(tache->getTitre() == (*ite)->getSucc().getTitre())
                        {
                            ProgrammationTacheUnitaire* ptu = dynamic_cast<ProgrammationTacheUnitaire*>(&(*it));
                            if(ptu->getDate() > ui->date->date() ||
                              (ptu->getDate() == ui->date->date() && ptu->getDebut() > ui->horaire->time()))
                            {
                                throw CalendarException("Incohérence avec les contraintes de Précédences");
                            }
                        }
                        //sinon la tache est la tache postérieure de la précédence
                        else
                        {
                            ProgrammationTacheUnitaire* ptu = dynamic_cast<ProgrammationTacheUnitaire*>(&(*it));
                            if(ptu->getDate() < ui->date->date() ||
                              (ptu->getDate() == ui->date->date() && ptu->getDebut() < ui->horaire->time()))
                            {
                                throw CalendarException("Incohérence avec les contraintes de Précédences");
                            }
                        }
                    }
                }
            }
        }
    }
}
示例#7
0
void Organigrama::pedir_cita2(Agenda& ag, int nivel) {
    int level_aux = 0;
    int id_offi;
    bool found;
    int depth;
    int day = ag.consultar_dia_act()+1;
    bool end = false;
    int num_day = ag.consultar_num_dias();
    int limit_day = day+ num_day;

    while (not end and day < limit_day) {
        id_offi = assign_offi_less_level(a, ag, day, level_aux, nivel, found, depth);
        if (found) end = true;
        else ++day;
    }
    if (end) ag.anadir_cita(id_offi, day);
}
示例#8
0
int main(int argc, char const *argv[])
{
	cout << "Digite control + C para sair" << endl;
	Agenda agenda;
	while (1){
		string nome, profissao;
		Cadastro cadastro;
		cout << "Entre com o nome:" << endl;
		cin >> nome;
		cadastro.setNome(nome);
		cout << "Entre com a profissao" << endl;
		cin >> profissao;
		cadastro.setProfissao(profissao);
		agenda.insertCad(cadastro);
		cout << "------------------------" << endl;
		agenda.verAgenda();
		cout << "------------------------" << endl;
	}

	return 0;
}
示例#9
0
int Organigrama::assign_offi_less_level(Arbre<int> &a, Agenda &agenda, int day, int& level_aux, int level, bool &found, int& depth)
{
    int id;
    if (level_aux <= level and not a.es_buit()) {
        int root = a.arrel();
        int id_cita;
        agenda.consultar_cita(root, day, id_cita);
        if (id_cita == 0) {
            found = true;
            depth = 0;
            id = root;
        }
        else {
            ++level_aux;
            Arbre<int> a1, a2;
            a.fills(a1, a2);
            int depth1, depth2;
            bool found1, found2;
            int id_1, id_2;
            id_1 = assign_offi_less_level(a1, agenda, day, level_aux, level, found1, depth1);
            id_2 = assign_offi_less_level(a2, agenda, day, level_aux, level, found2, depth2);

            if (found1 and found2) {
                depth1 = depth1 + 1;
                depth2 = depth2 + 1;
                if (depth1 <= depth2) {
                    depth = depth1;
                    id = id_1;
                }
                else {
                    depth = depth2;
                    id = id_2;
                }
            }

            else if (found1) {
                depth = depth1 + 1;
                id = id_1;
            }
            else if (found2) {
                depth = depth2 + 1;
                id = id_2;
            }
            found = found1 or found2;
            --level_aux;
            a.plantar(root, a1, a2);
        }
    }
    else found = false;
    if (found) return id;
    else return -1;
}
void DialogProgEvt::accept()
{
    try
    {
        if(ui->titre->text() == "" || ui->desc->toPlainText() == "")
        {
            throw CalendarException("Veuillez entrer un titre et une description");
        }
        Agenda* ag = &Agenda::getInstance();
        //ajoute le bon type d'évènement en fonction en fonction des informations entrées
        if(ui->un_jour->isChecked())
        {
            if(ui->is_rdv->isChecked())
            {
                ag->ajouterProgrammation(1,ui->date->date(),ui->titre->text(),ui->desc->toPlainText(),
                                         ui->horaire->time(),
                                         Duree(ui->duree->time().hour(), ui->duree->time().minute()),
                                         ui->lieu->text(), ui->personnes->toPlainText());
            }
            else
            {
                ag->ajouterProgrammation(0,ui->date->date(),ui->titre->text(),ui->desc->toPlainText(),
                                         ui->horaire->time(),
                                         Duree(ui->duree->time().hour(), ui->duree->time().minute()));
            }
        }
        else
        {
            ag->ajouterProgrammationPlsJour(ui->date->date(),ui->titre->text(),ui->desc->toPlainText(),
                                            ui->horaire->time(), ui->date_fin->date(), ui->horaire_fin->time());
        }
        close();
    }
    catch(CalendarException e)
    {
        QMessageBox::critical(0, "Erreur", e.getInfo());

    }
}
示例#11
0
 _T2Interrupt(void)
{
	Agenda *current = agenda_list;

	IFS0bits.T2IF = 0;

	while (current)
	{
		// agenda must be active with a positive non-null cycle value
		if(current->activate == 1 && current->cycle > 0) 
		{
			current->counter++;
			// check if the agenda event must be triggered
			if(current->counter > current->cycle-1) // a cycle value of 1 will be performed every interupt
			{
				current->function();	// trigger the associeted function
				current->counter=0;		// reset the counter
			}
		}
		current = current->next;
	}
  return;
}
TEST(Agenda, buscarYmodificarPaciente){
	Agenda a;
	Contacto c;
	c.setNombre("Adam");
	c.setDNI("1");
	a.insertarPaciente(c);

	EXPECT_EQ(true,a.buscarPaciente("1"));

	EXPECT_EQ(c,a.visualizarPaciente("1"));

	Contacto modificado;
	modificado = c;
	modificado.setNombre("OtroNombre");
	a.modificarPaciente(c.getDNI(),modificado);
	EXPECT_EQ("OtroNombre",a.visualizarPaciente(c.getDNI()).getNombre());
}
示例#13
0
void menu()
{
    int opcion, cantidad, numero, otroNumero;
    bool loop = true;
    string nombre, apellido, direccion;
    string titulo, autor, isbn;

    Cliente* c = new Cliente();
    Libro* l = new Libro();
    Orden* o = new Orden();

    Agenda* agendaX = new Agenda();
    Inventario* inventarioX = new Inventario();
    Pedidos* p = new Pedidos();


    while(loop){
        system("cls");
        cout<<"Libreria X"<<endl;
        cout<<"1- Crear Cliente"<<endl;
        cout<<"2- Ingresar libro al inventario"<<endl;
        cout<<"3- Crear orden"<<endl;
        cout<<"4- Despachar órdenes"<<endl;
        cout<<"5- Salir"<<endl;
        cin>>opcion;

        switch(opcion)
        {
        case 1:
            system("cls");
            cout<<"Crear Cliente"<<endl;
            cout<<"Introduzca el nombre del cliente: "<<endl;
            cin>>nombre;
            cout<<"Introduzca el apellido del cliente: "<<endl;
            cin>>apellido;
            cout<<"Introduzca la direccion del cliente: "<<endl;
            cin>>direccion;
            c = new Cliente(nombre, apellido, direccion);

            agendaX->agregar(c);
            agendaX->listarClientes();
            system("pause");
            break;
        case 2:
            system("cls");
            cout<<"Ingresar libro al inventario"<<endl;

            cout<<"Introduzca el titulo del libro: "<<endl;
            cin>>titulo;
            cout<<"Introduzca el autor del libro: "<<endl;
            cin>>autor;
            cout<<"Introduzca el ISBN del libro: "<<endl;
            cin>>isbn;
            cout<<"Introduzca la cantidad de libros en existencia: "<<endl;
            cin>>cantidad;
            l = new Libro(titulo, autor, isbn, cantidad);
            inventarioX->agregarLibro(l);
            inventarioX->desplegarInventario();
            system("pause");
            break;
        case 3:
            system("cls");
            cout<<"Crear orden"<<endl;
            inventarioX->desplegarInventario();
            cout<<"Introduzca el numero del libro a ordenar"<<endl;
            cin>>numero;
            system("cls");
            agendaX->listarClientes();
            cout<<"Introduzca el numero del cliente"<<endl;
            cin>>otroNumero;
            o = new Orden(agendaX->getCliente(otroNumero),inventarioX->getLibro(numero));
            p->agregarOrden(o);
            break;
        case 4:
            system("cls");
            cout<<"Despachar órdenes"<<endl;
            p->desplegarOrdenes(inventarioX);
            system("pause");

            break;
        case 5:
            system("cls");
            cout<<"Salir"<<endl;
            cout<<"Jafet Gabriel Benítez Hidalgo [2013-1651]"<<endl;
            loop = false;
            break;
        }
    }
}
示例#14
0
int main(){
  
  Agenda agenda;
  agenda.set_N();
  agenda.set_D();
  
  Cites cit;
  cit.set_K();
  agenda.set_H();
  Funcionaris func;
  func.llegir_funcionaris();
  
  agenda.dimensionar_agenda();
  cit.set_grandaria_cua(cit.get_K(), agenda.get_N(), agenda.get_H());
  
  int op = readint();
  int dia_registro; 
  
  while (op != -5){
    if (op == -1){
      dia_registro = readint();
      if (dia_registro > agenda.get_dia_actual()) agenda.actualizar_dia_actual(dia_registro, cit);
      int tipus = readint();
      int enter_1 = readint();
      int enter_2 = readint();
      func.peticion_cita(agenda, tipus, enter_1, enter_2);
    }
    else if (op == -2){
      dia_registro = readint();
      if (dia_registro > agenda.get_dia_actual()) agenda.actualizar_dia_actual(dia_registro, cit);
      int tipus = readint();
      int funcionari = readint();
      int enter_1 = readint();
      int enter_2 = readint();
      if (tipus == 1)
	agenda.peticion_vacaciones(enter_1, enter_2,funcionari);
      if (tipus == 2)
	func.anular_hora(agenda, enter_1, enter_2, funcionari);
    }
    else if(op == -3){
      dia_registro = readint();
      if (dia_registro > agenda.get_dia_actual()) agenda.actualizar_dia_actual(dia_registro, cit);
      cit.escribir_citas_realizadas(dia_registro);
    }
    else if (op == -4){
      dia_registro = readint();
      if (dia_registro > agenda.get_dia_actual()) agenda.actualizar_dia_actual(dia_registro, cit);
      agenda.consultar_citas_vivas();
    }
    op = readint();
  }
}
示例#15
0
void menuBuscarPaciente(Agenda &a) {

	string apellido;
	string dni;
	string modifica;
	string busqueda;
	list <Contacto> :: iterator it;
	list <Contacto> auxC;
	Contacto contAux;
	unsigned int tam;
	int salir=0;
	int controlador=0;

	do {

		borraPantalla();
		cout << "Consultar Paciente\n";
		cout << "------------------\n\n";

		cin.ignore();
		cout << "Seleccione el apellido...: "; //Introduce el apellido de la persona a buscar
		getline (cin, apellido);

		cout << endl;

		auxC=a.buscarPaciente(apellido); //Busca contactos con ese apellido y devuelve una lista
		tam=auxC.size();

		if (tam == 0){

			cout << "No se ha encontrado. ¿Quiere seguir buscando? (S/N)...: ";
			cin >> 	busqueda;

			if (busqueda=="N" || busqueda=="n"){
				salir=1;
			}
		}

	} while (tam == 0 && salir==0);

	if (salir==0){

		if (tam == 1){ //Si hay una sola persona

			contAux=auxC.front();

			//Muestra por pantalla los datos del contacto.
			mostrarContacto (contAux);

			//Llamando a la función buscarPaciente mandándole el DNI llama a la función
			//masFrecuentes(DNI) para actualizar el campo frecuente_
			a.buscarPaciente(apellido, contAux.getDni());

			cout << endl;

			cout << "Desea modificar el contacto? (S/N) "; // Indica si desea modicarlo
			cin >> modifica;

			if (modifica=="S" || modifica=="s"){
				ModificarBorrarPaciente( a, contAux );
			}

		} else { //Hay más de una persona con el mismo apellido

			for (it = auxC.begin() ; it != auxC.end() ; it++) {
TEST(Agenda, getYsetNumPacientes){
	Agenda a;
	a.setNumPacientes(2);
	EXPECT_EQ(2, a.getNumPacientes());
}