#include #include #include #include "VendedorManager.h" VendedorManager::VendedorManager(): _archivo("Vendedores.dat"){ } void PlanillaVendedor(){ std::cout<>numLegajo; vendedor.setNroLegajo(numLegajo); std::cout<<"FECHA INGRESO: "<>numLegajo; std::cout<> legajo; std::cout << std::endl; system("cls"); int indice = _archivo.BuscarId(legajo); Vendedor vendedor; vendedor = _archivo.leerRegistro(indice); if(indice != -1){ vendedor=_archivo.leerRegistro(indice); PlanillaVendedor(); MostrarVendedor(vendedor); std::cout << std::endl<> opcion; system("cls"); if(opcion=='s' || opcion=='S'){ std::cout<>numLegajo; indice=_archivo.BuscarId(numLegajo); if(indice != -1){ vendedor=_archivo.leerRegistro(indice); std::cout<> opcion; system("cls"); if(opcion=='s' || opcion=='S'){ vendedor.setEliminado(true); if(_archivo.Sobreescribir(indice, vendedor)){ std::cout<<"Se elimino con exito."<> opc; system("cls"); switch (opc) { case 1: system("copy Vendedores.dat Vendedores.bkp"); std::cout << "* Backup Realizado con Exito! *" << std::endl; break; case 2: return; default: std::cout << std::endl << "* Opcion Incorrecta! *" << std::endl; return; } } void VendedorManager::restaurarBackupVendedores() { int opc; std::cout<> opc; system("cls"); switch (opc) { case 1: system("copy Vendedores.bkp Vendedores.dat"); std::cout << "* Restauracion Realizado con Exito! *" << std::endl; break; case 2: break; default: std::cout << std::endl << "* Opcion Incorrecta! *" << std::endl; return; } } void VendedorManager::Menu(){ int option; system("cls"); while(true) { system("cls"); std::cout<<"------ MENU VENDEDOR ------- "<>option; system("cls"); switch(option){ case 1: AgregarVendedor(); system("pause"); break; case 2: ListarVendedor(); system("pause"); break; case 3: BuscarVendedor(); system("pause"); break; case 4: EditarVendedor(); system("pause"); break; case 5: EliminarVendedor(); system("pause"); break; case 6: int opc2; while(true){ system("cls"); std::cout<<"------ MENU BACKUP ------- "<>opc2; system("cls"); switch(opc2){ case 1: realizarBackupVendedores(); system("pause"); break; case 2: restaurarBackupVendedores(); system("pause"); break; case 3: break; } if(opc2==3){// Salir del bucle del submenú si se elige la opción 3 break; } system("pause"); } break; case 0: return; } } }