public Models.UserInformation GetLogin(string username, string password) { var query = db.SP_Login(username, password); var result = query.FirstOrDefault(); if (result == null) { return(null); } var user = new Models.UserInformation() { Birthday = result.Birthday, Email = result.Email, FirstName = result.FirstName, LastName = result.LastName, ID = result.IDUser, NickName = result.NickName, Country = result.Country, Level = result.Level, TotalPoints = result.TotalPoints, RegistrationDate = result.RegistrationDate }; return(user); }
//VERIFICAR LAS TAREAS public ActionResult RolUser(IFormCollection collection) { string RolTeam = collection["TeamMember"]; string UserDeveloperOrPM = collection["NameUser"]; //ELIMINAR USUARIOS ANTERIORES if (Singleton.Instance.RolUser.Count() != 0) { Singleton.Instance.RolUser.ExtractAtStart(); } //INICIO DE SESIÓN var LoginUser = new Models.UserInformation { TeamMember = RolTeam, NameUser = UserDeveloperOrPM }; //GUARDAR LOS DATOS DEL USUARIO Singleton.Instance.RolUser.InsertAtStart(LoginUser); //MOSTRAR LA VISTA if (RolTeam == "Developer") { ReadFileC(UserDeveloperOrPM, false); return(RedirectToAction(nameof(IndexDeveloper))); } else { ReadFileC(UserDeveloperOrPM, true); return(RedirectToAction(nameof(IndexProjectManager))); } }
public ActionResult DeleteUser(IFormCollection collection) { //CREA OBJETO PARA INSERTAR EN LA LISTA DE VACUNADOS var DeletedUser = new Models.VaccinationData { Nombre = collection["Nombre"], Apellido = collection["Apellido"], DPI = Convert.ToInt64(collection["DPI"]), Edad = Convert.ToInt32(collection["Edad"]), Fecha = Convert.ToDateTime(collection["Fecha"]), Dosis = Convert.ToInt32(collection["Dosis"]), Farmacéutica = collection["Farmacéutica"] }; //BUSCA EL ELEMENTO EN LA LISTA DE ESPERA PARA ELIMINARLO var information = new Models.UserInformation { DPI = DeletedUser.DPI }; Node <UserInformation> FoundElement = Singleton.Instance.WaitingList.Search(information, UserInformation.CompareDPI, Singleton.Instance.WaitingList.Count()); if (FoundElement != null) { Singleton.Instance.VaccinationList.InsertAtEnd(DeletedUser); Singleton.Instance.WaitingList.ExtractAtPosition(FoundElement.value.ID); if (FoundElement.next != null) { Node <UserInformation> next = FoundElement.next; for (int i = FoundElement.value.ID + 1; i <= Singleton.Instance.WaitingList.Count(); i++) { next.value.ID--; next = next.next; } } return(RedirectToAction(nameof(Index))); } else { //NO DISPONIBLE return(RedirectToAction(nameof(DPI_FALSE))); } }
// GET: ExecutionController public ActionResult Index() { if (Singleton.Instance.WaitingList.isEmpty()) { for (int i = 0; i < Singleton.Instance.Number_of_people; i++) { if (Singleton.Instance.PriorityUsers.isEmpty() == false) { //OBTIENE ELEMENTO DE MAYOR PRIORIDAD DE LA COLA HeapNode <PriorityInformation> deleted_element = Singleton.Instance.PriorityUsers.HeapDelete(); var SearchInformation = new Models.UserInformation { DPI = deleted_element.value.DPI }; //ENCONTRANDO EL ELEMENTO EN LA TABLA HASH var NextUser = new Models.UserInformation { Nombre = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchInformation).value.Nombre, Apellido = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchInformation).value.Apellido, DPI = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchInformation).value.DPI, Departamento = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchInformation).value.Departamento, Municipio = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchInformation).value.Municipio, Edad = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchInformation).value.Edad, Teléfono = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchInformation).value.Teléfono, Grupo = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchInformation).value.Grupo, N_Registro = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchInformation).value.N_Registro, Fecha = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchInformation).value.Fecha, ID = i }; //AGREGA EL ELEMENTO A LA LISTA DE ESPERA Singleton.Instance.WaitingList.InsertAtEnd(NextUser); Singleton.Instance.ListInformation.ExtractAtPosition(0); } else { i = Singleton.Instance.Number_of_people; } } } return(View(Singleton.Instance.WaitingList)); }
public ActionResult Reassign(int id, IFormCollection collection) { try { //VERIFICA SI LA FECHA ESTÁ DISPONIBLE Node <DateTime> found_date = Singleton.Instance.DateList.Search(Convert.ToDateTime(collection["Fecha"]), DateTime.Compare, Singleton.Instance.DateList.Count()); if (found_date != null)//SI LA FECHA NO ESTÁ DISPONIBLE { return(RedirectToAction(nameof(DateNotAvailable))); } else { //SI LA FECHA ESTÁ DISPONIBLE ASIGNAR NUEVA FECHA var information = new Models.UserInformation { ID = id }; //BUSCA EL ELEMENTO EN LA LISTA DE ESPERA Y LO ELIMINA Node <UserInformation> FoundElement = Singleton.Instance.WaitingList.Search(information, UserInformation.CompareID, Singleton.Instance.WaitingList.Count()); FoundElement.value.Fecha = Convert.ToDateTime(collection["Fecha"]); Singleton.Instance.WaitingList.ExtractAtPosition(id); //REASIGNA ID if (FoundElement.next != null) { Node <UserInformation> next = FoundElement.next; for (int i = id + 1; i <= Singleton.Instance.WaitingList.Count(); i++) { next.value.ID--; next = next.next; } } //ASIGNA LA NUEVA FECHA EN LA TABLA HASH information.DPI = FoundElement.value.DPI; Singleton.Instance.HashTableUserInformation.ReturnHash(information).value.Fecha = FoundElement.value.Fecha; Singleton.Instance.HashTableUserInformation.ReturnHash(information).value.ID = Singleton.Instance.ListInformation.Count() + 1; //INSERTA DE NUEVO EL ELEMENTO EN LA COLA var EditedUser = new Models.PriorityInformation { DPI = FoundElement.value.DPI, Priority = FoundElement.value.Grupo, N_order = Singleton.Instance.Order.Count() + 1, date = Convert.ToDateTime(collection["Fecha"]) }; Singleton.Instance.Order.InsertAtEnd(1); Singleton.Instance.PriorityUsers.HeapInsert(EditedUser, EditedUser); //LO INSERTA DE NUEVO EN LA LISTA DE CALENDARIZACIÓN Singleton.Instance.ListInformation.InsertAtEnd(FoundElement.value); return(RedirectToAction(nameof(Index))); } } catch { return(View()); } }
public ActionResult Place(IFormCollection collection) { string Place = collection["Lugar"]; string Municipio = ""; string Departamento = ""; int DPIVer = Convert.ToString(collection["DPI"]).Length; bool Correct = true; if (DPIVer != 13) { Correct = false; } if (Correct == true) { Region usuarioActual = new Region(); Singleton.Instance.LugarActualDeSesión.Add(usuarioActual); int count = 0; for (int i = 0; i < Place.Length; i++) { string Part1 = Place.Substring(i, 1); if (Part1 == ",") { Departamento = Place.Substring(0, count); Municipio = Place.Remove(0, count + 1); } else { count++; } } var UserLogin = new Models.UserInformation { Departamento = Departamento, Municipio = Municipio }; Singleton.Instance.LocationData.InsertAtStart(UserLogin); if (usuarioActual.DataUser(Departamento, Municipio) != null) { Singleton.Instance.LugarDeSesión = usuarioActual.LoginUser(Municipio); } var EmployeeLogin = new Models.Employee { Nombre = collection["Nombre"], DPI = Convert.ToInt64(collection["DPI"]), Lugar = collection["Lugar"] }; Singleton.Instance.LugarDeSesión.EmployeeData.InsertAtStart(EmployeeLogin); return(RedirectToAction(nameof(Index))); } else { return(RedirectToAction(nameof(DPI_ERROR_EMP))); } }
public ActionResult SearchPatient(IFormCollection collection) { string searchby = collection["SearchBy"]; if (searchby == "Nombre")//Búsqueda por nombre { var SearchedUser = new Models.Data.NameUser { Name = collection["Buscar"], }; TreeNode <NameUser> found_element = Singleton.Instance.IndexName.Search(SearchedUser, Singleton.Instance.IndexName.ReturnRoot()); if (found_element != null) { //Por lo menos encuentra un elemento var SearchInformation = new Models.UserInformation { DPI = found_element.value.DPI_AVL }; //Busca el elemento en la Tabla Hash para agregarlo a la lista de resultados var Result = new Models.UserInformation { Nombre = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchInformation).value.Nombre, Apellido = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchInformation).value.Apellido, DPI = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchInformation).value.DPI, Edad = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchInformation).value.Edad, Departamento = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchInformation).value.Departamento, Trabajo = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchInformation).value.Trabajo, Grupo = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchInformation).value.Grupo, }; Singleton.Instance.SearchResults.InsertAtStart(Result); return(RedirectToAction(nameof(ShowSearchResults))); } else { return(RedirectToAction(nameof(ElementNotFound))); } } else if (searchby == "Apellido") { var SearchedUser = new Models.Data.LastNameUser { LastName = collection["Buscar"], }; TreeNode <LastNameUser> found_element = Singleton.Instance.IndexLastName.Search(SearchedUser, Singleton.Instance.IndexLastName.ReturnRoot()); if (found_element != null) { var SearchInformation = new Models.UserInformation { DPI = found_element.value.DPI_AVL }; var Result = new Models.UserInformation { Nombre = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchInformation).value.Nombre, Apellido = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchInformation).value.Apellido, DPI = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchInformation).value.DPI, Edad = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchInformation).value.Edad, Departamento = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchInformation).value.Departamento, Trabajo = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchInformation).value.Trabajo, Grupo = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchInformation).value.Grupo, }; Singleton.Instance.SearchResults.InsertAtStart(Result); return(RedirectToAction(nameof(ShowSearchResults))); } else { return(RedirectToAction(nameof(ElementNotFound))); } } else { var SearchedUser = new Models.Data.DPIUser { DPI = Convert.ToInt64(collection["Buscar"]), }; TreeNode <DPIUser> found_element = Singleton.Instance.IndexDPI.Search(SearchedUser, Singleton.Instance.IndexDPI.ReturnRoot()); if (found_element != null) { var SearchInformation = new Models.UserInformation { DPI = found_element.value.DPI }; var Result = new Models.UserInformation { Nombre = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchInformation).value.Nombre, Apellido = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchInformation).value.Apellido, DPI = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchInformation).value.DPI, Edad = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchInformation).value.Edad, Departamento = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchInformation).value.Departamento, Trabajo = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchInformation).value.Trabajo, Grupo = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchInformation).value.Grupo, }; Singleton.Instance.SearchResults.InsertAtStart(Result); return(RedirectToAction(nameof(ShowSearchResults))); } else { return(RedirectToAction(nameof(ElementNotFound))); } } }
//VER DIA Y CALENDARIZAR TODO public ActionResult Date(IFormCollection collection) { if (Singleton.Instance.ListInformation.isEmpty() == false) { return(View(Singleton.Instance.ListInformation)); } else { //DÍA INICIAL DateTime StartLine = Convert.ToDateTime(collection["Inicio"]); int day = Convert.ToInt32(StartLine.Day); int month = Convert.ToInt32(StartLine.Month); int year = Convert.ToInt32(StartLine.Year); int Hour = Convert.ToInt32(StartLine.Hour); int minutes = Convert.ToInt32(StartLine.Minute); int StartMinutes = Convert.ToInt32(collection["Minutos"]); bool Repeat = false; //TIEMPO FINAL DateTime EndLine = Convert.ToDateTime(collection["Fin"]); int EndHour = EndLine.Hour; int EndMinutes = EndLine.Minute; int StartHour = Convert.ToInt32(StartLine.Hour); //DATOS PARA REALIZAR LA VACUNACIÓN - TIEMPO DE VACUNACIÓN int time = Convert.ToInt32(collection["Minutos"]); Singleton.Instance.Number_of_people = Convert.ToInt32(collection["Capacidad"]); //ORGANIZANDO FECHAS int counting = Singleton.Instance.PriorityUsers.CountObj(); int id = 0; bool TimeTV = true; if (StartHour == EndHour) { if (EndMinutes < minutes + time) { TimeTV = false; } else { Repeat = true; } } //VERIFICANDO QUE SEA POSIBLE if (EndHour == StartHour + 1) { int Part44 = minutes + time; if (Part44 > 60) { int Part1 = 60 - (Part44 - time); int minutes1 = StartMinutes - Part1; if (EndMinutes < minutes1) { TimeTV = false; } else { Repeat = true; } } } if (TimeTV == true) { //EMPEZANDO A ORGANIZAR FECHAS for (int i = 0; i < counting; i++) { //VERIFICANDO LOS MINUTOS if (minutes < 60 && (Hour == EndHour && Repeat == true) || minutes < 60 && (Hour < EndHour)) { //RECOPILAR INFORMACIÓN DE LAS PERSONAS for (int j = 0; j < Singleton.Instance.Number_of_people; j++) { id++; //HAY ELEMENTOS EN LA COLA DE PRIORIDAD if (Singleton.Instance.PriorityUsers.isEmpty() == false) { //BUSCAR DPI PARA LA TABLA HASH HeapNode <PriorityInformation> DPI_Information = Singleton.Instance.PriorityUsers.HeapDelete(); var SearchingInformation = new Models.UserInformation { DPI = DPI_Information.value.DPI }; string minutes_string; if (minutes == 60) { minutes_string = "00"; } else if (minutes < 10) { minutes_string = "0" + minutes; } else { minutes_string = Convert.ToString(minutes); } //ENCONTRANDO EL ELEMENTO EN LA TABLA HASH var UserDate = new Models.UserInformation { Nombre = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchingInformation).value.Nombre, Apellido = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchingInformation).value.Apellido, DPI = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchingInformation).value.DPI, Departamento = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchingInformation).value.Departamento, Municipio = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchingInformation).value.Municipio, Edad = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchingInformation).value.Edad, Teléfono = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchingInformation).value.Teléfono, Grupo = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchingInformation).value.Grupo, N_Registro = Singleton.Instance.HashTableUserInformation.ReturnHash(SearchingInformation).value.N_Registro, Fecha = Convert.ToDateTime(day + "/" + month + "/" + year), ID = id }; UserDate.Fecha = UserDate.Fecha.AddHours(Convert.ToDouble(Hour)); UserDate.Fecha = UserDate.Fecha.AddMinutes(Convert.ToDouble(minutes_string)); DPI_Information.priority.date = UserDate.Fecha; Singleton.Instance.HashTableUserInformation.ReturnHash(SearchingInformation).value.Fecha = UserDate.Fecha; Singleton.Instance.DateList.InsertAtEnd(UserDate.Fecha); //AGREGAR A LA LISTA if (Singleton.Instance.ListInformation.Count() == 0) { Singleton.Instance.ListInformation.InsertAtStart(UserDate); } else { Singleton.Instance.ListInformation.InsertAtEnd(UserDate); } } } //SUMAR MINUTOS minutes += time; Repeat = false; i = i + (Singleton.Instance.Number_of_people - 1); } else { //VER NUEVA FECHA //COMPARAR HORAS if ((Hour < EndHour) || Hour == EndHour) { Hour++; int Part1 = 60 - (minutes - time); minutes = StartMinutes - Part1; bool NextDay = false; if (Hour == EndHour) { if (minutes < EndMinutes) { int minutes2 = minutes + time; if (minutes2 < EndMinutes) { NextDay = false; Repeat = true; } else { NextDay = true; } } else { NextDay = true; } } if (Hour > EndHour) { NextDay = true; } if (NextDay == true) { //SIGUIENTE DÍA day = NewDate.NextDateDay(month, day, year); month = NewDate.NextDateMonth(month, day, year); year = NewDate.NewYear(month, day, year); Hour = StartHour; minutes = StartLine.Minute; Repeat = true; } i--; } } } for (int i = 0; i < Singleton.Instance.ListInformation.Count(); i++) { var ReturnHeap = new Models.PriorityInformation { Priority = Singleton.Instance.ListInformation.ElementAt(i).Grupo, DPI = Singleton.Instance.ListInformation.ElementAt(i).DPI, N_order = Singleton.Instance.ListInformation.ElementAt(i).N_Registro }; Singleton.Instance.PriorityUsers.HeapInsert(ReturnHeap, ReturnHeap); } return(View(Singleton.Instance.ListInformation)); } else { return(RedirectToAction(nameof(SameTimeError))); } } }
public ActionResult AddUser(IFormCollection collection) { //VARIABLES PARA TABLA HASH int team = 0; string Text = ""; //VARIABLES QUE AYUDAN A VERIFICAR EL GRUPO string sickness = collection["Enfermedad"]; string job = collection["Trabajo"]; //REVISAR SI PUEDE RECIBIR LA VACUNA int age = Convert.ToInt32(collection["Edad"]); string Pregnant = collection["SiEsApto"]; int VerDPI = Convert.ToString(collection["DPI"]).Length; bool Correct = true; if (Pregnant == null) { Pregnant = "No"; } if (VerDPI != 13) { Correct = false; } //VERIFICAR SI ES APTO if (age >= 18 && Pregnant == "No" && Correct == true) { //VERIFICAR A QUE GRUPO PERTENECEN //Grupo 1 - Sistema de salud if (job == "Trabajador de salud primera línea") { team = 1; } else if (job == "Trabajador de salud no de primera línea" || job == "Comadrona" || job == "Promotor voluntario" || job == "Terapeuta maya") { team = 2; } else if (job == "Estudiante de ciencias de la salud") { team = 3; } else if (job == "Trabajador como cuerpos de socorro" || job == "Trabajador de una funeraria" || job == "Trabajador en instituciones de adultos mayores") { team = 4; } else if (job == "Personas internadas en hogares o en asilos") { team = 5; } else if (job == "Trabajador administrativo del sector salud") { team = 6; } //Grupo 2 y 4 - Clasificar por edad if (team == 0) { if (age >= 70 && sickness != " ") { team = 7; } else if (age >= 70) { team = 8; } else if (age >= 50) { team = 9; } //Grupo 3 - Clasificar por trabajo if (job == "Trabajador del sector de seguridad nacional" && team == 0) { team = 10; } else if ((job == "Trabajador de la municipalidad" || job == "Trabajador de entidades que prestan servicios esenciales") && team == 0) { team = 11; } else if (job == "Trabajador del sector de educación" && team == 0) { team = 12; } else if (job == "Trabajador del sector de justicia" && team == 0) { team = 13; } if (age >= 40 && job == "Otro") { team = 14; } else if (age >= 18 && job == "Otro") { team = 15; } } //INFORMACIÓN DEL USUARIO var NewUser = new Models.UserInformation { Nombre = collection["Nombre"], Apellido = collection["Apellido"], DPI = Convert.ToInt64(collection["DPI"]), Edad = age, Departamento = Singleton.Instance.LocationData.ElementAt(0).Departamento, Municipio = Singleton.Instance.LocationData.ElementAt(0).Municipio, Dirección = collection["Dirección"], Teléfono = Convert.ToInt32(collection["Teléfono"]), Email = collection["Email"], Trabajo = job, Enfermedad = sickness, SiEsApto = "Si", Grupo = team, N_Registro = Singleton.Instance.Order.Count() }; //REVISAR QUE NO SEA UN DATO REPETIDO if (Singleton.Instance.HashTableUserInformation.ValueRepeat(NewUser) == false) { //INGRESAR A LA TABLA HASH Singleton.Instance.HashTableUserInformation.AddHashTable(NewUser); //INGRESAR A LA LISTA DE PRIORIDAD var NewPriority = new Models.PriorityInformation { Priority = team, DPI = Convert.ToInt64(collection["DPI"]), N_order = Singleton.Instance.Order.Count() }; Singleton.Instance.PriorityUsers.HeapInsert(NewPriority, NewPriority); //INGRESAR AL ÁRBOL AVL POR NOMBRE var NewUserName = new Models.Data.NameUser { Name = collection["Nombre"], DPI_AVL = Convert.ToInt64(collection["DPI"]) }; Singleton.Instance.IndexName.Insert(NewUserName); //INGRESAR AL ÁRBOL AVL POR APELLIDO var NewUserLastName = new Models.Data.LastNameUser { LastName = collection["Apellido"], DPI_AVL = Convert.ToInt64(collection["DPI"]) }; Singleton.Instance.IndexLastName.Insert(NewUserLastName); //INGRESAR AL ÁRBOL AVL POR DPI var NewDPI = new Models.Data.DPIUser { DPI = Convert.ToInt64(collection["DPI"]) }; Singleton.Instance.IndexDPI.Insert(NewDPI); if (Singleton.Instance.Order.Count() == 0) { Singleton.Instance.Order.InsertAtStart(0); } else { Singleton.Instance.Order.InsertAtEnd(0); } var NewUserExtra = new Models.UserInformation { Nombre = collection["Nombre"], Apellido = collection["Apellido"], DPI = Convert.ToInt64(collection["DPI"]) }; if (Singleton.Instance.OrderNum.Count() == 0) { Singleton.Instance.OrderNum.InsertAtStart(NewUserExtra); } else { Singleton.Instance.OrderNum.InsertAtEnd(NewUserExtra); } //GUARDAR EN UN ARCHIVO DE TEXTO if (Singleton.Instance.Order.Count() == 1) { Text = collection["Nombre"] + "," + collection["Apellido"] + "," + Convert.ToInt64(collection["DPI"]) + "," + age + "," + Singleton.Instance.LocationData.ElementAt(0).Departamento + "," + Singleton.Instance.LocationData.ElementAt(0).Municipio + "," + collection["Dirección"] + "," + Convert.ToInt32(collection["Teléfono"]) + "," + collection["Email"] + "," + job + "," + sickness + "," + team + "," + Singleton.Instance.Order.Count(); } else { Text = "\n" + collection["Nombre"] + "," + collection["Apellido"] + "," + Convert.ToInt64(collection["DPI"]) + "," + age + "," + Singleton.Instance.LocationData.ElementAt(0).Departamento + "," + Singleton.Instance.LocationData.ElementAt(0).Municipio + "," + collection["Dirección"] + "," + Convert.ToInt32(collection["Teléfono"]) + "," + collection["Email"] + "," + job + "," + sickness + "," + team + "," + Singleton.Instance.Order.Count(); } //ESCRIBIR EN UN TEXTO StreamWriter writer = new StreamWriter("Datos Ingresados.txt", true); writer.Write(Text); writer.Close(); //MOSTRAR EL MENU return(RedirectToAction(nameof(Index))); } else { //MOSTRAR QUE EL DATO YA EXISTE return(RedirectToAction(nameof(Exist))); } } else { if (Correct == false) { return(RedirectToAction(nameof(DPI_ERROR))); } else { //MOSTRAR VISTA DE QUE EL CIUDADANO NO ES APTO PARA RECIBIR LA VACUNA return(RedirectToAction(nameof(CanNot))); } } }
//RECUPERANDO DATOS ANTERIORES public void ReadFileC() { //RECOPILAR INFORMACIÓN ANTERIOR string filePath = bingPathToAppDir(); StreamReader streamReader = new StreamReader(filePath); string CurrentLine; while (!streamReader.EndOfStream) { CurrentLine = streamReader.ReadLine(); if (CurrentLine != "") { string[] FileInformationList = CurrentLine.Split(','); int pos = 0; string NombreF = FileInformationList[pos]; pos++; string ApellidoF = FileInformationList[pos]; pos++; long DPIF = Convert.ToInt64(FileInformationList[pos]); pos++; int EdadF = Convert.ToInt16(FileInformationList[pos]); pos++; string DepartamentoF = FileInformationList[pos]; pos++; string MunicipioF = FileInformationList[pos]; pos++; string DirecciónF = FileInformationList[pos]; pos++; int TelefonoF = Convert.ToInt32(FileInformationList[pos]); pos++; string EmailF = FileInformationList[pos]; pos++; string TrabajoF = FileInformationList[pos]; pos++; string EnfermedadF = FileInformationList[pos]; pos++; int GrupoF = Convert.ToInt32(FileInformationList[pos]); pos++; int NRF = Convert.ToInt32(FileInformationList[pos]); if (MunicipioF == Singleton.Instance.LocationData.ElementAt(0).Municipio) { var NewUser = new Models.UserInformation { Nombre = NombreF, Apellido = ApellidoF, DPI = DPIF, Edad = EdadF, Departamento = DepartamentoF, Municipio = MunicipioF, Dirección = DirecciónF, Teléfono = TelefonoF, Email = EmailF, Trabajo = TrabajoF, Enfermedad = EnfermedadF, Grupo = GrupoF, N_Registro = NRF }; //REVISAR QUE NO SEA UN DATO REPETIDO if (Singleton.Instance.HashTableUserInformation.ValueRepeat(NewUser) == false) { //INGRESAR A LA TABLA HASH Singleton.Instance.HashTableUserInformation.AddHashTable(NewUser); //INGRESAR A LA LISTA DE PRIORIDAD var NewPriority = new Models.PriorityInformation { Priority = GrupoF, DPI = DPIF, N_order = NRF }; Singleton.Instance.PriorityUsers.HeapInsert(NewPriority, NewPriority); //INGRESAR AL ÁRBOL AVL POR NOMBRE var NewUserName = new Models.Data.NameUser { Name = NombreF, DPI_AVL = DPIF }; Singleton.Instance.IndexName.Insert(NewUserName); //INGRESAR AL ÁRBOL AVL POR APELLIDO var NewUserLastName = new Models.Data.LastNameUser { LastName = ApellidoF, DPI_AVL = DPIF }; Singleton.Instance.IndexLastName.Insert(NewUserLastName); //INGRESAR AL ÁRBOL AVL POR DPI var NewDPI = new Models.Data.DPIUser { DPI = DPIF }; Singleton.Instance.IndexDPI.Insert(NewDPI); var NewUserExtra = new Models.UserInformation { Nombre = NombreF, Apellido = ApellidoF, DPI = DPIF }; //ORDEN DE LLEGADA if (Singleton.Instance.Order.Count() == 0) { Singleton.Instance.Order.InsertAtStart(1); } else { Singleton.Instance.Order.InsertAtEnd(1); } if (Singleton.Instance.OrderNum.Count() == 0) { Singleton.Instance.OrderNum.InsertAtStart(NewUserExtra); } else { Singleton.Instance.OrderNum.InsertAtEnd(NewUserExtra); } } } else { if (Singleton.Instance.Order.Count() == 0) { Singleton.Instance.Order.InsertAtStart(1); } } } } //CERRAR LA LECTURA DEL ARCHIVO streamReader.Close(); }