private static void AgregarPasante() { Boolean added = false, canceled = false; String name = "", password1 = "a", password2 = "b"; Console.WriteLine("\nRegistrarme"); while (!added && !canceled && password1 != password2) { name = (String)CompleteField("Email", true); canceled = name == "-1"; if (canceled) { CanceledOperation(); } else { password1 = (String)CompleteField("Contraseña", false); password2 = (String)CompleteField("Contraseña", false); if (password1 != password2) { Console.WriteLine("\nLas contrasenas no coinciden, intente de nuevo!\n\n"); } else { pasante = new DtoPasante { user_name = name, password = password2 }; added = wcfPasante.Agregar(name, password2); EvaluateOperation(added, "Registro", "usuario", "email", false, true, true, true); if (!added) { password1 = "a"; password2 = "b"; } else { Ingresar(true); } } } } }
private static void Ingresar(Boolean salt = false) { Boolean canceled = false; String user_name = "", password = ""; Console.WriteLine("\nIngresar"); while (!autenticado && !canceled) { if (pasante == null) { user_name = (String)CompleteField("Email", true); canceled = user_name == "-1"; if (canceled) { CanceledOperation(); } else { password = (String)CompleteField("Contraseña", false); pasante = new DtoPasante { user_name = user_name, password = password }; } } if (pasante != null) { autenticado = wcfPasante.Ingresar(pasante); if (!autenticado) { pasante = null; } if (!salt) { EvaluateOperation(autenticado, "Ingreso", "usuario", "nombre de usuario", true, true, true, true); } } } }
private static void ModificarPasante() { Boolean modified = false, canceled = false; String password1 = "a", password2 = "b"; Console.WriteLine("\nCambiar Contrasena"); while (!modified && !canceled && password1 != password2) { password1 = (String)CompleteField("Contraseña", true); canceled = password1 == "-1"; if (canceled) { CanceledOperation(); } else { password2 = (String)CompleteField("Contraseña", false); if (password1 != password2) { Console.WriteLine("\nLas contrasenas no coinciden, intente de nuevo!\n\n"); } else { pasante = new DtoPasante { user_name = pasante.user_name, password = password2 }; modified = wcfPasante.Modificar(pasante.user_name, password2); if (!modified) { password1 = "a"; password2 = "b"; } EvaluateOperation(modified, "Modificación", "usuario", "contraseña", true, false, true, false); } } } }
private static void EliminarPasante() { Boolean deleted = false, canceled = false; String password = ""; Console.WriteLine("\nDarme de Baja"); while (!deleted && !canceled) { password = (String)CompleteField("Contraseña", true); canceled = password == "-1"; if (canceled) { CanceledOperation(); } else { pasante = new DtoPasante { user_name = pasante.user_name, password = password }; deleted = wcfPasante.Eliminar(pasante); EvaluateOperation(deleted, "Eliminación", "usuario", "contrsaeña", true, false, true, false); if (deleted) { autenticado = false; pasante = null; } } } }
private static void ProcesarMenu(int opcion) { switch (opcion) { case -1: autenticado = false; pasante = null; break; case 1: if (!autenticado) { Ingresar(); } else { AgregarBarrio(); } break; case 2: if (!autenticado) { AgregarPasante(); } else { ModificarBarrio(); } break; case 3: ListarBarrios(); break; case 4: EliminarBarrio(); break; case 5: ListarBarrio(); break; case 6: GenerarReporteBarrio(); break; case 7: AgregarVivienda(); break; case 8: ModificarVivienda(); break; case 9: ListarViviendas(); break; case 10: EliminarVivienda(); break; case 11: ListarVivienda(); break; case 12: GenerarReporteVivienda(); break; case 13: AgregarParametro(); break; case 14: ModificarParametro(); break; case 15: ListarParametros(); break; case 16: EliminarParametro(); break; case 17: ListarParametro(); break; case 18: GenerarReporteParametro(); break; case 19: ModificarPasante(); break; case 20: EliminarPasante(); break; } }