public Hijos GetHijosById(int?id) { Hijos entity = null; using (SqlConnection connection = new SqlConnection(connectionString)) { SqlCommand comando = new SqlCommand("SelectHijosById", connection); comando.CommandType = CommandType.StoredProcedure; comando.Parameters.AddWithValue("@IdDerHab", id); connection.Open(); SqlDataReader lector = comando.ExecuteReader(); if (lector.Read()) { entity = new Hijos(); entity.IdDerHab = Convert.ToInt32(lector["IdDerHab"]); entity.IdPersonal = Convert.ToInt32(lector["IdPersonal"]); entity.ApPaterno = lector["ApPaterno"].ToString(); entity.ApMaterno = lector["ApMaterno"].ToString(); entity.Nombre1 = lector["Nombre1"].ToString(); entity.Nombre2 = lector["Nombre2"].ToString(); entity.NombreCompleto = lector["NombreCompleto"].ToString(); entity.FhcNac = Convert.ToDateTime(lector["FhcNac"].ToString()); } connection.Close(); } return(entity); }
internal void SepararNodo(string llave, T dato, int hijoDerecho, Nodo <T> nuevoNodo, ref string llavePorSubir, ref T datoPorSubir) { if (!Lleno) { throw new Exception("Uno nodo solo puede separarse si está lleno"); } Llaves.Add("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); Datos.Add(dato); Hijos.Add(Utilidades.apuntadoVacio); AgregarDato(llave, dato, hijoDerecho, false); int mitad = (Orden / 2); llavePorSubir = Utilidades.FormatearLlave(Llaves[mitad]); datoPorSubir = Datos[mitad]; Llaves[mitad] = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; int j = 0; for (int i = mitad + 1; i < Llaves.Count; i++) { nuevoNodo.Llaves[j] = Llaves[i]; nuevoNodo.Datos[j] = Datos[i]; Llaves[i] = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; j++; } j = 0; for (int i = mitad + 1; i < Hijos.Count; i++) { nuevoNodo.Hijos[j] = Hijos[i]; Hijos[i] = Utilidades.apuntadoVacio; j++; } Llaves.RemoveAt(Llaves.Count - 1); Datos.RemoveAt(Datos.Count - 1); Hijos.RemoveAt(Hijos.Count - 1); }
public static List <Hijos> ObtenerHijo(string usuario) { List <Hijos> listaHijos = new List <Hijos>(); // string sql = "select Users.Nombre from users where Identificacion = '456789'and Nombre = 'Jose'"; string sql = "select users.Correo from Hijo inner join users on users.Correo = Hijo.Correo where hijo.Tutor='" + usuario + "'"; using (SqlConnection con = new SqlConnection(Configuracion.CadenaConexion)) { con.Open(); using (SqlCommand comando = new SqlCommand(sql, con)) { using (SqlDataReader reader = comando.ExecuteReader()) { while (reader.Read()) { Hijos hijo = new Hijos() { Nombre = reader.GetString(0), }; listaHijos.Add(hijo); } } } con.Close(); return(listaHijos); } }
public Nodo RemoveEdge(int position) { Nodo edge = null; if (Hijos.Count > position) { edge = Hijos[position]; edge.Padres = null; Hijos.RemoveAt(position); } return(edge); }
public Nodo eliminarHijo(int posicion) { Nodo nodo = null; if (Hijos.Count > posicion) { nodo = Hijos[posicion]; nodo.Padre = null; Hijos.RemoveAt(posicion); } return(nodo); }
public Nodo EliminarHijo(int position) { Nodo Hijo = null; if (Hijos.Count > position) { Hijo = Hijos[position]; Hijo.Padre = null; Hijos.RemoveAt(position); } return(Hijo); }
public void InsertarHijo(Nodo hijo) { for (int x = 0; x < Hijos.Count; x++) { if (this.CompareTo(hijo, x) > 0) { Hijos.Insert(x, hijo); return; } } Hijos.Add(hijo); hijo.Padre = this; }
public void insertarNodo(Nodo nodo) { for (int x = 0; x < Hijos.Count; x++) { if (compararMedicamentos(Hijos[x].Llaves[0], nodo.Llaves[0])) { Hijos.Insert(x, nodo); return; } } Hijos.Add(nodo); nodo.Padre = this; }
public void InsertarHijo(NodoB son) { for (int x = 0; x < Hijos.Count; x++) { if (this.CompareTo(son, x) > 0) { Hijos.Insert(x, son); return; } } Hijos.Add(son); son.Padre = this; }
public void InsertEdge(Nodo hijo1) { for (int x = 0; x < Hijos.Count; x++) { if (Hijos[x].Keys[0] > hijo1.Keys[0]) { Hijos.Insert(x, hijo1); return; } } Hijos.Add(hijo1); hijo1.Padres = this; }
public void InsertarHijo(Nodo Hijo) { for (int x = 0; x < Hijos.Count; x++) { if (Hijos[x].Valores[0].CompareTo(Hijo.Valores[0]) > 0) { Hijos.Insert(x, Hijo); return; } } Hijos.Add(Hijo); Hijo.Padre = this; }
public void limpiarHijos() { if (Hijos.Count != 0) { for (int i = 0; i < Hijos.Count; i++) { Hijos[i] = Generador.hacerNulo(); } } else { for (int i = 0; i < Orden; i++) { Hijos.Add(Generador.hacerNulo()); } } }
internal void SepararNodo(string llave, T dato, int hijoDerecho, NodoB <T> nuevoNodo, ref string llavePorSubir, ref T datoPorSubir) { if (!Lleno) { throw new Exception("Uno nodo solo puede separarse si está lleno"); } // Incrementar el tamaño de las listas en una posición Llaves.Add("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"); Datos.Add(dato); Hijos.Add(Utilidades.ApuntadorVacio); // Agregar los nuevos elementos en orden AgregarDato(llave, dato, hijoDerecho, false); // Obtener los valores a subir int mitad = (Orden / 2); llavePorSubir = Llaves[mitad]; datoPorSubir = Datos[mitad]; Llaves[mitad] = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"; // Llenar las llaves y datos que pasan al nuevo nodo int j = 0; for (int i = mitad + 1; i < Llaves.Count; i++) { nuevoNodo.Llaves[j] = Llaves[i]; nuevoNodo.Datos[j] = Datos[i]; Llaves[i] = "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"; j++; } // Llenar los hijos que pasan al nuevo nodo j = 0; for (int i = mitad + 1; i < Hijos.Count; i++) { nuevoNodo.Hijos[j] = Hijos[i]; Hijos[i] = Utilidades.ApuntadorVacio; j++; } Llaves.RemoveAt(Llaves.Count - 1); Datos.RemoveAt(Datos.Count - 1); Hijos.RemoveAt(Hijos.Count - 1); }
public void AddHijos(Hijos entity) { using (SqlConnection connection = new SqlConnection(connectionString)) { SqlCommand comando = new SqlCommand("InsertHijos", connection); comando.CommandType = CommandType.StoredProcedure; comando.Parameters.AddWithValue("@IdPersonal", entity.IdPersonal); comando.Parameters.AddWithValue("@ApPaterno", entity.ApPaterno); comando.Parameters.AddWithValue("@ApMaterno", entity.ApMaterno); comando.Parameters.AddWithValue("@Nombre1", entity.Nombre1); comando.Parameters.AddWithValue("@Nombre2", entity.Nombre2); comando.Parameters.AddWithValue("@FhcNac", entity.FhcNac); connection.Open(); comando.ExecuteNonQuery(); connection.Close(); } }
public override void GenerarHijos(bool EsTurnoPC) { char c = EsTurnoPC ? 'X' : 'O'; for (int i = 0; i < Estado.Length; i++) { if (Estado[i] == ' ') { if (Hijos == null) { Hijos = new List <Nodo>(); } NodoDama n = new NodoDama(); n.Estado = (char[])Estado.Clone(); n.Estado[i] = c; Hijos.Add(n); } } }
public List <TKey> hijosyvaloresActuales(TKey llaveAComparar, ref List <TData> datos, ref List <int> hijos) { int condition = nodoLlaves.Count; List <TKey> Maximuns = new List <TKey>(); for (int i = 0; i < condition; i++) { if (nodoLlaves[i].CompareTo(llaveAComparar) == 1) { Maximuns.Add(nodoLlaves[i]); datos.Add(datosNodo[i]); Hijos.Add(Hijos[i + 1]); Hijos[i + 1] = Generador.hacerNulo(); } } for (int i = 0; i < Maximuns.Count; i++) { nodoLlaves.Remove(Maximuns[i]); datosNodo.Remove(datos[i]); } return(Maximuns); }
public void insertarGrupoDeHijos(List <int> grupoHijos, int inicio, int posicionDeInsercion) { inicio++; for (int i = 0; i < grupoHijos.Count; i++) { Hijos.Add(Generador.hacerNulo()); } int temporal = 0; int GroupCount = 0; for (int i = inicio; i < Hijos.Count - 1; i++) { temporal = Hijos[i]; Hijos[i] = grupoHijos[GroupCount]; grupoHijos[GroupCount] = temporal; if (GroupCount == grupoHijos.Count) { GroupCount = 0; } } Hijos[Count - 1] = temporal; Hijos[inicio] = posicionDeInsercion; }
public List <TKey> HijosAndValuesToBrother(TKey llaveAComparar, ref List <TData> datos, ref List <int> hijos) { int condicionPrincipal = nodoLlaves.Count; List <TKey> maximos = new List <TKey>(); for (int i = 0; i < condicionPrincipal; i++) { if (nodoLlaves[i].CompareTo(llaveAComparar) == 1) { maximos.Add(nodoLlaves[i]); datos.Add(datosNodo[i]); Hijos.Add(Hijos[i]); Hijos[i] = Generador.hacerNulo(); } } Hijos.Add(Hijos[condicionPrincipal]); Hijos[condicionPrincipal] = Generador.hacerNulo(); for (int i = 0; i < maximos.Count; i++) { nodoLlaves.Remove(maximos[i]); datosNodo.Remove(datos[i]); } return(maximos); }
public void AddHijos(Hijos entity) { instancia.AddHijos(entity); }
public bool RemoveEdge(Nodo R) { return(Hijos.Remove(R)); }
public bool EsHoja() { return(Hijos.Any(x => x != null)); }
public bool eliminarHijo(Nodo n) { return(Hijos.Remove(n)); }
internal void SeparacionNodo(T _data, int derecho, Nodo <T> Nodo, T SubirData, ICreateFixedSizeText <T> createFixedSizeText) { int medio = 0; if (Padre.Equals(MetodosNecesarios.NullPointer)) { Data.Add(_data); Hijos.Add(MetodosNecesarios.NullPointer); InsertarDatos(_data, derecho, false); medio = Data.Count / 2; SubirData = Data[medio]; Data[medio] = createFixedSizeText.CreateNull(); int j = 0; for (int i = medio + 1; i < Data.Count; i++) { Nodo.Data[j] = Data[i]; Data[i] = createFixedSizeText.CreateNull(); j++; } j = 0; for (int i = medio + 1; i < Hijos.Count; i++) { Nodo.Hijos[j] = Hijos[i]; Hijos[j] = MetodosNecesarios.NullPointer; j++; } Data.RemoveAt(Data.Count - 1); Hijos.RemoveAt(Hijos.Count - 1); } else { Data.Add(_data); Hijos.Add(MetodosNecesarios.NullPointer); InsertarDatos(_data, derecho, false); medio = Data.Count / 2; SubirData = Data[medio]; Data[medio] = createFixedSizeText.CreateNull(); int j = 0; for (int i = medio + 1; i < Hijos.Count; i++) { Nodo.Data[j] = Data[i]; Data[i] = createFixedSizeText.CreateNull(); j++; } j = 0; for (int i = medio + 1; i < Hijos.Count; i++) { Nodo.Hijos[j] = Hijos[i]; Hijos[i] = MetodosNecesarios.NullPointer; j++; } Data.RemoveAt(Data.Count - 1); Hijos.RemoveAt(Hijos.Count - 1); } }
public void UpdateHijos(Hijos entity) { instancia.UpdateHijos(entity); }