public struMencion[] getMencionesForEdit(System.Byte Id) { clsMencion Mencion = new clsMencion(); DataTable dtMenciones = Mencion.getLista(); Mencion = null; clsCurso Curso = new clsCurso(); clsCurso.struMencion[] MisMenciones = Curso.getMenciones(Id); Curso = null; struMencion[] result = new struMencion[dtMenciones.Rows.Count]; for (int x = 0; x <= (dtMenciones.Rows.Count - 1); x++) { result[x].Id = System.Convert.ToByte(dtMenciones.Rows[x]["Id"]); result[x].Nombre = System.Convert.ToString(dtMenciones.Rows[x]["Nombre"]); for (int y = 0; y <= (MisMenciones.Length - 1); y++) { System.Diagnostics.Debug.WriteLine("Id: " + result[x].Id + ", " + result[x].Nombre + ": " + System.Convert.ToByte(dtMenciones.Rows[x]["Id"]) + " = " + MisMenciones[y].Id); if (System.Convert.ToByte(dtMenciones.Rows[x]["Id"]) == MisMenciones[y].Id) { result[x].Selected = true; break; } } } return(result); }
public System.String getSctringMenciones(System.Byte Id) { clsCurso Curso = new clsCurso(); clsCurso.struMencion[] Menciones = Curso.getMenciones(Id); Curso = null; string strMenciones = string.Empty; for (int x = 0; x <= (Menciones.Length - 1); x++) { if (strMenciones != string.Empty) { strMenciones += x < (Menciones.Length - 1)?", ": " y "; } strMenciones += Menciones[x].Nombre; } return(strMenciones); }