Example #1
0
File: Form2.cs Project: tume01/lp2
        /// <summary>
        /// Evento que permite agregar tutor
        /// </summary>
        /// <param name="sender">Generador de evento</param>
        /// <param name="e">Argumentos del evento</param>
        private void button1_Click(object sender, EventArgs e)
        {
            int codigo                = Int32.Parse(textBoxCodigo.Text);
            string nombre             = textBoxNombre.Text;
            int dni                   = Int32.Parse(textBoxDNI.Text);
            string correo             = textBoxCorreo.Text;
            int telefono              = Int32.Parse(textBoxTelefono.Text);
            string regimen            = comboBoxDedicacion.SelectedText;
            int idioma                = comboBoxIdioma.SelectedIndex;
            DateTime fechaInicio      = dateTimePickerInicio.Value;
            DateTime fechaFin         = dateTimePickerFin.Value;
            int anio                  = fechaInicio.Year;
            string gradoAcademico     = comboBoxGrado.SelectedText ;
            Especialidad especialidad = new Especialidad();
            especialidad.Codigo = comboBoxEspecialidad.SelectedIndex+1;
            especialidad.Nombre = "informatica";
            string FechaFin           = fechaInicio.ToString("yyyy-MM-dd");
            string FechaIinicio       = fechaFin.ToString("yyyy-MM-dd");

            Service2Client servicio = new Service2Client();
            Profesor newProfesor = servicio.crearProfesor(codigo,nombre,dni,correo,telefono,"regimen",idioma,anio,"grado",
                                    especialidad,FechaIinicio,FechaIinicio,FechaFin,"categoria");

            ProfesorAgregado = newProfesor;

            MessageBox.Show("Profesor agregado");
            this.Close();
        }
 public Profesor MostrartodosProfesores()
 {
     administradorDatos = new AdministradorDatos();
        profesor = new Profesor();
        profesor = administradorDatos.MostrarTodosProfesores();
        return profesor;
 }
Example #3
0
 public bool AddProfesor(Profesor prof)
 {
     if (FindProfesor(prof))
     {
         return false;
     }
     else
     {
         profesor.Add(prof);
         return true;
     }
 }
Example #4
0
        public ActionResult createReport(string tipo, int id)
        {
            LocalReport lr   = new LocalReport();
            string      path = Path.Combine(Server.MapPath("~/Reportes"), "ReportProyecto.rdlc");

            if (System.IO.File.Exists(path))
            {
                lr.ReportPath = path;
            }
            else
            {
                return(View("Index"));
            }

            string        cnnString = System.Configuration.ConfigurationManager.ConnectionStrings["con"].ConnectionString;
            SqlConnection cnn       = new SqlConnection(cnnString);

            SqlCommand cmdProy  = new SqlCommand();
            SqlCommand cmdProf  = new SqlCommand();
            SqlCommand cmdGrupo = new SqlCommand();
            SqlCommand cmdCurso = new SqlCommand();
            SqlCommand cmdComm  = new SqlCommand();

            cmdProy.Connection  = cnn;
            cmdProf.Connection  = cnn;
            cmdGrupo.Connection = cnn;
            cmdCurso.Connection = cnn;
            cmdComm.Connection  = cnn;

            cmdProy.CommandType  = System.Data.CommandType.StoredProcedure;
            cmdProf.CommandType  = System.Data.CommandType.StoredProcedure;
            cmdGrupo.CommandType = System.Data.CommandType.StoredProcedure;
            cmdCurso.CommandType = System.Data.CommandType.StoredProcedure;
            cmdComm.CommandType  = System.Data.CommandType.StoredProcedure;

            cmdProy.CommandText  = "selectProyecto";
            cmdProf.CommandText  = "selectProfesor";
            cmdGrupo.CommandText = "selectGrupo";
            cmdCurso.CommandText = "selectCurso";
            cmdComm.CommandText  = "selectComentarios";

            cmdProy.Parameters.Add("@idProyecto", SqlDbType.Int).Value  = id;
            cmdProf.Parameters.Add("@idProyecto", SqlDbType.Int).Value  = id;
            cmdGrupo.Parameters.Add("@idProyecto", SqlDbType.Int).Value = id;
            cmdCurso.Parameters.Add("@idProyecto", SqlDbType.Int).Value = id;
            cmdComm.Parameters.Add("@idProyecto", SqlDbType.Int).Value  = id;

            List <Comentario> comment   = new List <Comentario>();
            List <Proyecto>   proyect   = new List <Proyecto>();
            List <Profesor>   professor = new List <Profesor>();
            List <Grupo>      group     = new List <Grupo>();
            List <Curso>      subject   = new List <Curso>();

            cnn.Open();
            using (SqlDataReader dr = cmdProy.ExecuteReader())
            {
                while (dr.Read())
                {
                    Proyecto newItem = new Proyecto();
                    newItem.nombreProyecto = dr.GetString(0);
                    newItem.tecnologia     = dr.GetString(1);
                    newItem.estadoProyecto = dr.GetString(2);
                    newItem.fechaInicio    = dr.GetDateTime(3);
                    proyect.Add(newItem);
                }
            }
            cnn.Close();

            cnn.Open();
            using (SqlDataReader dr = cmdProf.ExecuteReader())
            {
                while (dr.Read())
                {
                    Profesor newItem = new Profesor();
                    newItem.nombreProfesor   = dr.GetString(0);
                    newItem.apellidoProfesor = dr.GetString(1);
                    newItem.emailProfesor    = dr.GetString(2);
                    professor.Add(newItem);
                }
            }
            cnn.Close();

            cnn.Open();
            using (SqlDataReader dr = cmdGrupo.ExecuteReader())
            {
                while (dr.Read())
                {
                    Grupo newItem = new Grupo();
                    newItem.nombreGrupo  = dr.GetString(0);
                    newItem.sede         = dr.GetString(1);
                    newItem.cuatrimestre = dr.GetString(2);
                    group.Add(newItem);
                }
            }
            cnn.Close();

            cnn.Open();
            using (SqlDataReader dr = cmdCurso.ExecuteReader())
            {
                while (dr.Read())
                {
                    Curso newItem = new Curso();
                    newItem.nombreCurso = dr.GetString(0);
                    subject.Add(newItem);
                }
            }
            cnn.Close();

            cnn.Open();
            using (SqlDataReader dr = cmdComm.ExecuteReader())
            {
                while (dr.Read())
                {
                    Comentario newItem = new Comentario();
                    newItem.fecha     = dr.GetDateTime(0);
                    newItem.contenido = dr.GetString(1);
                    comment.Add(newItem);
                }
            }
            cnn.Close();


            ReportDataSource rdProy = new ReportDataSource("DataSetProyecto", proyect);
            ReportDataSource rdProf = new ReportDataSource("DataSetProfesor", professor);
            ReportDataSource rdGrou = new ReportDataSource("DataSetGrupo", group);
            ReportDataSource rdSubj = new ReportDataSource("DataSetCurso", subject);
            ReportDataSource rdComm = new ReportDataSource("DataSetComentario", comment);

            lr.DataSources.Add(rdProy);
            lr.DataSources.Add(rdProf);
            lr.DataSources.Add(rdGrou);
            lr.DataSources.Add(rdSubj);
            lr.DataSources.Add(rdComm);

            string reportType = tipo;
            string mimeType;
            string encoding;
            string fileNameExtension;

            string deviceInfo =

                "<DeviceInfo>" +
                "  <OutputFormat>" + tipo + "</OutputFormat>" +
                "  <PageWidth>8.5in</PageWidth>" +
                "  <PageHeight>11in</PageHeight>" +
                "  <MarginTop>0.5in</MarginTop>" +
                "  <MarginLeft>1in</MarginLeft>" +
                "  <MarginRight>1in</MarginRight>" +
                "  <MarginBottom>0.5in</MarginBottom>" +
                "</DeviceInfo>";

            Warning[] warnings;
            string[]  streams;
            byte[]    renderedBytes;

            renderedBytes = lr.Render(
                reportType,
                deviceInfo,
                out mimeType,
                out encoding,
                out fileNameExtension,
                out streams,
                out warnings);

            return(File(renderedBytes, mimeType));
        }
Example #5
0
        public void validarValorNumerico()
        {
            Profesor p1 = new Profesor(3, "Ariel", "SCHUTZ", "12222333", EntidadesAbstractas.Persona.ENacionalidad.Argentino);

            Assert.IsInstanceOfType(p1.DNI, typeof(int));
        }
Example #6
0
 public void TestPersonaNacionalidadInvalido()
 {
     Profesor p = new Profesor(1001, "Julian", "Laje", "28103254", Persona.ENacionalidad.Extranjero);
 }
Example #7
0
        [TestMethod] public void ValidarValorNumerico()
        {
            Profesor p1 = new Profesor(1, "Juan", "Alba", "12345678", Persona.ENacionalidad.Argentino);

            Assert.IsInstanceOfType(p1.DNI, typeof(int));
        }
Example #8
0
 public void ArgentinoInvalido()
 {
     Profesor profesor = new Profesor(4, "Lionel", "Messi", "105309284", Persona.ENacionalidad.Argentino);
 }
Example #9
0
        static void Main(string[] args)
        {
            bool rta;
            bool rta1;

            Alumno                a1 = new Alumno(1000, "juan", "perez", 12345678);
            Alumno                a2 = new Alumno(1001, "pedro", "gimenez", 23456789);
            Alumno                a3;
            Profesor              p1 = new Profesor("programador", "carlos", "sanchez", 98765432);
            Profesor              p2;
            Aula                  aula = new Aula(10);
            Aula                  aula1;
            XML <Alumno>          listado  = new XML <Alumno>();
            XML <Profesor>        listado1 = new XML <Profesor>();
            XML <List <Alumno> >  listado3 = new XML <List <Alumno> >();
            XML <List <Persona> > listado5 = new XML <List <Persona> >();
            XML <Aula>            listado8 = new XML <Aula>();
            List <Alumno>         listado2 = new List <Alumno>();
            List <Alumno>         listado4 = new List <Alumno>();
            List <Persona>        listado6 = new List <Persona>();
            List <Persona>        listado7 = new List <Persona>();

            listado6.Add(a1);
            listado6.Add(a2);
            listado6.Add(p1);

            listado2.Add(a1);
            listado2.Add(a2);

            aula.Lista.Add(a1);
            aula.Lista.Add(a2);
            aula.Lista.Add(p1);

            Console.Write(aula.ToString());
            Console.WriteLine();

            rta = listado.GuardarXML("alumno.xml", a1);

            if (rta == true)
            {
                Console.WriteLine("Se serializo correctamente");
            }
            else
            {
                Console.WriteLine("No se serializo");
            }
            Console.WriteLine();

            rta1 = listado.LeerXML("alumno.xml", out a3);

            if (rta1 == true)
            {
                Console.WriteLine("Se deserializo correctamente");
                Console.WriteLine(a3.ToString());
            }
            else
            {
                Console.WriteLine("No se deserializo");
            }
            Console.WriteLine();

            rta = listado1.GuardarXML("profesor.xml", p1);

            if (rta == true)
            {
                Console.WriteLine("Se serializo correctamente");
            }
            else
            {
                Console.WriteLine("No se serializo");
            }
            Console.WriteLine();

            rta1 = listado1.LeerXML("profesor.xml", out p2);

            if (rta1 == true)
            {
                Console.WriteLine("Se deserializo correctamente");
                Console.WriteLine(p2.ToString());
            }
            else
            {
                Console.WriteLine("No se deserializo");
            }
            Console.WriteLine();

            rta = listado3.GuardarXML("alumnos.xml", listado2);
            if (rta == true)
            {
                Console.WriteLine("Se serializo correctamente");
            }
            else
            {
                Console.WriteLine("No se serializo");
            }
            Console.WriteLine();

            rta1 = listado3.LeerXML("alumnos.xml", out listado4);

            if (rta1 == true)
            {
                Console.WriteLine("Se deserializo correctamente");
                Console.WriteLine(p2.ToString());
            }
            else
            {
                Console.WriteLine("No se deserializo");
            }
            Console.WriteLine();

            rta = listado5.GuardarXML("personas.xml", listado6);
            if (rta == true)
            {
                Console.WriteLine("Se serializo correctamente");
            }
            else
            {
                Console.WriteLine("No se serializo");
            }
            Console.WriteLine();

            rta1 = listado5.LeerXML("personas.xml", out listado7);

            if (rta1 == true)
            {
                Console.WriteLine("Se deserializo correctamente");
                Console.WriteLine(p2.ToString());
            }
            else
            {
                Console.WriteLine("No se deserializo");
            }
            Console.WriteLine();



            rta = listado8.GuardarXML("aula.xml", aula);
            if (rta == true)
            {
                Console.WriteLine("Se serializo correctamente");
            }
            else
            {
                Console.WriteLine("No se serializo");
            }
            Console.WriteLine();

            rta1 = listado8.LeerXML("aula.xml", out aula1);

            if (rta1 == true)
            {
                Console.WriteLine("Se deserializo correctamente");
                Console.WriteLine(p2.ToString());
            }
            else
            {
                Console.WriteLine("No se deserializo");
            }
            Console.WriteLine();

            Console.ReadKey();
        }
Example #10
0
        static void Main(string[] args)
        {
            Universidad uni = new Universidad();
            Alumno      a1  = new Alumno(1, "Juan", "Lopez", "12234456", EntidadesAbstractas.Persona.ENacionalidad.Argentino, Universidad.EClases.Programacion, Alumno.EEstadoCuenta.Becado);

            uni += a1; // ESTE LO AGREGA LO MAS BIEN
            try
            {
                //MAL EL DNI VS NACIONALIDAD DEBE EXPLOTAR
                Alumno a2 = new Alumno(2, "Juana", "Martinez", "12234458", EntidadesAbstractas.Persona.ENacionalidad.Extranjero, Universidad.EClases.Laboratorio, Alumno.EEstadoCuenta.Deudor);
                uni += a2;
            }
            catch (NacionalidadInvalidaException e)
            {
                //EXPLOTA CORRECTO!
                Console.WriteLine(e.Message);
            }
            try
            {
                //MISMO DNI QUE EL PRIMERO DEBE EXPLOTAR
                Alumno a3 = new Alumno(3, "José", "Gutierrez", "12234456", EntidadesAbstractas.Persona.ENacionalidad.Argentino, Universidad.EClases.Programacion, Alumno.EEstadoCuenta.Becado);
                uni += a3;
            }
            catch (AlumnoRepetidoException e)
            {
                //EXPLOTA CORRECTO
                Console.WriteLine(e.Message);
            }
            //AGREGA A 5 ALUMNOS Y 2 PROFESORES
            Alumno a4 = new Alumno(4, "Miguel", "Hernandez", "92264456", EntidadesAbstractas.Persona.ENacionalidad.Extranjero, Universidad.EClases.Legislacion, Alumno.EEstadoCuenta.AlDia);

            uni += a4;
            Alumno a5 = new Alumno(5, "Carlos", "Gonzalez", "12236456", EntidadesAbstractas.Persona.ENacionalidad.Argentino, Universidad.EClases.Programacion, Alumno.EEstadoCuenta.AlDia);

            uni += a5;
            Alumno a6 = new Alumno(6, "Juan", "Perez", "12234656", EntidadesAbstractas.Persona.ENacionalidad.Argentino, Universidad.EClases.Laboratorio, Alumno.EEstadoCuenta.Deudor);

            uni += a6;
            Alumno a7 = new Alumno(7, "Joaquin", "Suarez", "91122456", EntidadesAbstractas.Persona.ENacionalidad.Extranjero, Universidad.EClases.Laboratorio, Alumno.EEstadoCuenta.AlDia);

            uni += a7;
            Alumno a8 = new Alumno(8, "Rodrigo", "Smith", "22236456", EntidadesAbstractas.Persona.ENacionalidad.Argentino, Universidad.EClases.Legislacion, Alumno.EEstadoCuenta.AlDia);

            uni += a8;
            Profesor i1 = new Profesor(1, "Juan", "Lopez", "12234456", EntidadesAbstractas.Persona.ENacionalidad.Argentino);

            uni += i1;
            Profesor i2 = new Profesor(2, "Roberto", "Juarez", "32234456", EntidadesAbstractas.Persona.ENacionalidad.Argentino);

            uni += i2;
            try
            {
                uni += Universidad.EClases.Programacion;
            }
            catch (SinProfesorException e)
            {
                Console.WriteLine(e.Message);
            }
            try
            {
                uni += Universidad.EClases.Laboratorio;
            }
            catch (SinProfesorException e)
            {
                Console.WriteLine(e.Message);
            }
            try
            {
                uni += Universidad.EClases.Legislacion;
            }
            catch (SinProfesorException e)
            {
                Console.WriteLine(e.Message);
            }
            try
            {
                uni += Universidad.EClases.SPD;
            }
            catch (SinProfesorException e)
            {
                Console.WriteLine(e.Message);
            }
            Console.WriteLine(uni.ToString());
            Console.ReadKey();
            Console.Clear();
            try
            {
                //aca guarda el XML universidad lo hace bien
                Universidad.Guardar(uni);
                Console.WriteLine("Archivo de Universidad guardado.");
            }
            catch (ArchivosException e)
            {
                //no entra aca
                Console.WriteLine(e.Message);
            }
            try
            {
                int jornada = 0;
                //aca guarda con un indexador ANDA
                Jornada.Guardar(uni[jornada]);
                Console.WriteLine("Archivo de Jornada {0} guardado.", jornada);
                //Console.WriteLine(Jornada.Leer());
            }
            catch (ArchivosException e)
            {
                Console.WriteLine(e.Message);
            }
            Console.ReadKey();
        }
        public static void Initialize(ContextFacultate context)
        {
            context.Database.EnsureCreated();

            if (context.Studenti.Any())
            {
                return; // BD a fost creata anterior
            }

            var profesori = new Profesor[]
            {
                new Profesor {
                    Nume = "Anton", Prenume = "Vasile", Email = "*****@*****.**"
                },
                new Profesor {
                    Nume = "Popa", Prenume = "Ana", Email = "*****@*****.**"
                },
                new Profesor {
                    Nume = "Marin", Prenume = "Angel", Email = "*****@*****.**"
                },
                new Profesor {
                    Nume = "Vamanu", Prenume = "Dana", Email = "*****@*****.**"
                },
                new Profesor {
                    Nume = "Morariu", Prenume = "Anamaria", Email = "*****@*****.**"
                },
                new Profesor {
                    Nume = "Popa", Prenume = "Andrei", Email = "*****@*****.**"
                },
            };

            foreach (Profesor p in profesori)
            {
                context.Profesori.Add(p);
            }
            context.SaveChanges();

            var cursuri = new Curs[]
            { new Curs {
                  ID = 1, Denumire = "Informatica Economica", Credite = 5, ProfesorID = 1
              },
              new Curs {
                  ID = 2, Denumire = "Economie", Credite = 4, ProfesorID = 2
              },
              new Curs {
                  ID = 3, Denumire = "Matematica", Credite = 5, ProfesorID = 3
              },
              new Curs {
                  ID = 4, Denumire = "Statistica", Credite = 3, ProfesorID = 4
              },
              new Curs {
                  ID = 5, Denumire = "Management", Credite = 4, ProfesorID = 5
              },
              new Curs {
                  ID = 6, Denumire = "Finante", Credite = 5, ProfesorID = 6
              } };

            foreach (Curs c in cursuri)
            {
                context.Cursuri.Add(c);
            }
            context.SaveChanges();

            var studenti = new Student[]
            {
                new Student {
                    Nume = "Moculescu", Prenume = "Flaviu", DataNasterii = DateTime.Parse("1997-07-08"), An = 2
                },
                new Student {
                    Nume = "Nita", Prenume = "Adi", DataNasterii = DateTime.Parse("1997-03-03"), An = 1
                },
                new Student {
                    Nume = "Stanescu", Prenume = "Stela", DataNasterii = DateTime.Parse("1998-08-08"), An = 2
                },
                new Student {
                    Nume = "Vlaicu", Prenume = "Corina", DataNasterii = DateTime.Parse("1997-07-23"), An = 3
                },
                new Student {
                    Nume = "Stefan", Prenume = "Horatiu", DataNasterii = DateTime.Parse("1997-07-08"), An = 2
                },
                new Student {
                    Nume = "Mironescu", Prenume = "Victor", DataNasterii = DateTime.Parse("1998-09-03"), An = 1
                },
                new Student {
                    Nume = "Prunea", Prenume = "Delia", DataNasterii = DateTime.Parse("1997-07-08"), An = 1
                },
                new Student {
                    Nume = "Apostu", Prenume = "Isabella", DataNasterii = DateTime.Parse("1996-04-03"), An = 3
                },
                new Student {
                    Nume = "Stefanescu", Prenume = "Sorin", DataNasterii = DateTime.Parse("1997-07-08"), An = 2
                },
                new Student {
                    Nume = "Bogza", Prenume = "Mihai", DataNasterii = DateTime.Parse("1997-06-05"), An = 3
                },
            };

            foreach (Student st in studenti)
            {
                context.Studenti.Add(st);
            }
            context.SaveChanges();

            var carti = new Carte[]
            {
                new Carte {
                    Titlu = "Programare in C", DataPublicare = DateTime.Parse("1997-03-03"), ProfesorID = 1
                },
                new Carte {
                    Titlu = "Economie", DataPublicare = DateTime.Parse("1995-02-02"), ProfesorID = 2
                },
                new Carte {
                    Titlu = "Economie aplicata", DataPublicare = DateTime.Parse("1995-07-02"), ProfesorID = 2
                },
                new Carte {
                    Titlu = "Finante", DataPublicare = DateTime.Parse("1997-09-09"), ProfesorID = 6
                },
            };

            foreach (Carte b in carti)
            {
                context.Carti.Add(b);
            }
            context.SaveChanges();

            var participari = new Participare[]
            { new Participare {
                  CursID = 1, StudentID = 1, Nota = Decimal.Parse("7.2")
              },
              new Participare {
                  CursID = 2, StudentID = 2, Nota = Decimal.Parse("8")
              },
              new Participare {
                  CursID = 3, StudentID = 2, Nota = Decimal.Parse("5.5")
              },
              new Participare {
                  CursID = 5, StudentID = 1, Nota = Decimal.Parse("9")
              },
              new Participare {
                  CursID = 2, StudentID = 2, Nota = Decimal.Parse("10")
              },
              new Participare {
                  CursID = 3, StudentID = 3, Nota = Decimal.Parse("8.5")
              },
              new Participare {
                  CursID = 4, StudentID = 3, Nota = Decimal.Parse("6.7")
              },
              new Participare {
                  CursID = 2, StudentID = 4, Nota = Decimal.Parse("9.4")
              },
              new Participare {
                  CursID = 5, StudentID = 2, Nota = Decimal.Parse("4")
              },
              new Participare {
                  CursID = 1, StudentID = 6, Nota = Decimal.Parse("3.4")
              },
              new Participare {
                  CursID = 5, StudentID = 5, Nota = Decimal.Parse("4.6")
              },
              new Participare {
                  CursID = 1, StudentID = 5, Nota = Decimal.Parse("7")
              } };

            foreach (Participare p in participari)
            {
                context.Participari.Add(p);
            }
            context.SaveChanges();
        }
Example #12
0
 public CrearReunion(Alumno a, Profesor p)
 {
     this.alumno   = a;
     this.profesor = p;
     InitializeComponent();
 }
Example #13
0
        static void Main(string[] args)
        {
            Console.WriteLine("Gestion de Estructura");
            Persona[] lista = new Persona[3];

            lista[0] = new Alumno("Ivan", "Cardozo")
            {
                Id       = 1,
                Edad     = 36,
                Telefono = "311111",
                Email    = "*****@*****.**"
            };

            lista[1] = new Profesor()
            {
                Id       = 2,
                Nombre   = " Axel ",
                Apellido = "Ruiz",
                Edad     = 28,
                Telefono = "2142",
                Catedra  = "Programacion"
            };

            lista[2] = new Profesor()
            {
                Id       = 3,
                Nombre   = " William ",
                Apellido = "Torballs",
                Edad     = 25,
                Telefono = "911",
                Catedra  = "Algebra"
            };

            Console.WriteLine(Persona.ContadorPersonas);
            Console.WriteLine("Resumenes");

            foreach (Persona p in lista)
            {
                Console.WriteLine($"Tipo {p.GetType()}");
                Console.WriteLine(p.ConstruirResumen());

                IEnteInstituto ente = p;

                ente.ConstruirLlaveSecreta("Argumento cualquiera");
            }
            Console.WriteLine("S T R U C  T S");

            CursoStruct c = new CursoStruct(70);

            c.Curso = "101-B";

            var newC = new CursoStruct();

            newC.Curso = "564-A";


            var cursoFreak = c;

            cursoFreak.Curso = "666-G";

            Console.WriteLine($"Curso c = {c.Curso}");
            Console.WriteLine($"Curso Freak = {cursoFreak.Curso}");



            Console.WriteLine("C L A S E S ");

            CursoClass c_class = new CursoClass(70);

            c_class.Curso = "102-B";

            var newCc_class = new CursoStruct();

            newCc_class.Curso = "563-A";


            var cursoFreakc_class = c_class;

            cursoFreak.Curso = "662-G";

            Console.WriteLine($"Curso c = {c_class.Curso}");
            Console.WriteLine($"Curso Freak = {cursoFreakc_class.Curso}");



            Console.WriteLine("E N U M E R A C I O N E S");

            var alumnoEst = new Alumno(" William ", "Torballs")
            {
                Id       = 3,
                Edad     = 25,
                Telefono = "911",
                Estado   = EstadosAlumno.Activo
            };

            Persona personaX = alumnoEst;

            Console.WriteLine("Este es el estado del alumno:  " + alumnoEst.Estado);

            Console.WriteLine($"Tipo:       { typeof(EstadosAlumno) }");
            Console.WriteLine($"Tipo:       { typeof(Alumno) }");
            Console.WriteLine($"Tipo:       { alumnoEst.GetType()  }");
            Console.WriteLine($"Nombresito: { personaX.GetType()  }");
            Console.WriteLine($"Tipo:       { nameof(Alumno) }");
            Console.WriteLine($"Tamaño:     { sizeof(int) }");

            Console.ReadLine();
        }
Example #14
0
 public CrearReunion(Alumno a, Profesor p)
 {
     this.alumno = a;
     this.profesor = p;
     InitializeComponent();
 }
Example #15
0
        public void Rutina1()
        {
            WriteLine("GESTION DE INSTITUCION");

            //Persona obj = new Persona();

            Persona[] lista = new Persona[3];

            lista[0] = new Alumno("Juan Carlos", "Ruiz")
            {
                Id       = 1,
                Edad     = 36,
                Telefono = "944954119",
                Email    = "*****@*****.**"
            };

            lista[1] = new Profesor()
            {
                Id       = 2,
                Nombre   = "Freddy",
                Apellido = "Vega",
                Edad     = 86,
                Telefono = "944954119",
                Catedra  = "Programación"
            };

            lista[2] = new Profesor()
            {
                Id       = 3,
                Nombre   = "William",
                Apellido = "Torvalds",
                Edad     = 86,
                Telefono = "944954119",
                Catedra  = "Algebra"
            };

            WriteLine(Persona.ContadorPersonas);
            Console.WriteLine("Resumenes");

            foreach (Persona persona in lista)
            {
                Console.WriteLine($"Tipo: {persona.GetType()}");
                Console.WriteLine(persona.ConstruirResumen());

                IEnteInstituto ente = persona;
                ente.ConstruirLlaveSecreta("Hola");
            }

            Console.WriteLine("S T R U C T S");
            CursoStruct c = new CursoStruct(70);

            c.Curso = "101-B";

            CursoStruct newC = new CursoStruct();

            newC.Curso = "564-A";

            var cursoFreak = c;

            cursoFreak.Curso = "666-G";

            Console.WriteLine($"Curso c = {c.Curso}");
            Console.WriteLine($"Curso Freak = {cursoFreak.Curso}");
            Console.WriteLine("");

            Console.WriteLine("C L A S E S");
            CursoClass c_class = new CursoClass(70);

            c_class.Curso = "101-B";

            //CursoClass newC_class = new CursoClass();
            //newC_class.Curso = "564-A";

            var cursoFreak_class = c_class;

            cursoFreak_class.Curso = "666-G";

            Console.WriteLine($"Curso c = {c_class.Curso}");
            Console.WriteLine($"Curso Freak = {cursoFreak_class.Curso}");

            Console.WriteLine("");
            Console.WriteLine("E N U M E R A C I O N E S");

            var alumnoEstado = new Alumno("Freddy", "Vega")
            {
                Id       = 22,
                Edad     = 86,
                Telefono = "944954119",
                Estado   = EstadosAlumno.Activo
            };
            Persona        personax = alumnoEstado;
            IEnteInstituto iei      = alumnoEstado;

            Console.WriteLine("Estado de Alumno" + alumnoEstado.Estado);
            Console.WriteLine($"Tipo: {typeof(EstadosAlumno)}");
            Console.WriteLine($"Tipo: {typeof(Alumno)}");
            Console.WriteLine($"Tipo: {iei.GetType()}");
            Console.WriteLine($"Tipo: {alumnoEstado.GetType()}");
            Console.WriteLine($"Tipo: {personax.GetType()}");
            Console.WriteLine($"Nombre: {nameof(Alumno)}");
            Console.WriteLine($"Tamaño: {sizeof(int)}");
        }
Example #16
0
        static void Main(string[] args)
        {
            Console.Title = "UTN - TSP - TP03 2C 2020 - CLAUDIA JARA";
            Universidad uni = new Universidad();
            Alumno      a1  = new Alumno(1, "Juan", "Lopez", "12234456",
                                         EntidadesAbstractas.Persona.ENacionalidad.Argentino, Universidad.EClases.Programacion,
                                         Alumno.EEstadoCuenta.Becado);

            uni += a1;
            try
            {
                Alumno a2 = new Alumno(2, "Juana", "Martinez", "12234458",
                                       EntidadesAbstractas.Persona.ENacionalidad.Extranjero, Universidad.EClases.Laboratorio,
                                       Alumno.EEstadoCuenta.Deudor);
                uni += a2;
            }

            catch (NacionalidadInvalidaException e)
            {
                Console.WriteLine(e.Message);
            }
            try
            {
                Alumno a3 = new Alumno(3, "José", "Gutierrez", "12234456",
                                       EntidadesAbstractas.Persona.ENacionalidad.Argentino, Universidad.EClases.Programacion,
                                       Alumno.EEstadoCuenta.Becado);
                uni += a3;
            }
            catch (AlumnoRepetidoException e)
            {
                Console.WriteLine(e.Message);
            }
            Alumno a4 = new Alumno(4, "Miguel", "Hernandez", "92264456",
                                   EntidadesAbstractas.Persona.ENacionalidad.Extranjero, Universidad.EClases.Legislacion,
                                   Alumno.EEstadoCuenta.AlDia);

            uni += a4;
            Alumno a5 = new Alumno(5, "Carlos", "Gonzalez", "12236456",
                                   EntidadesAbstractas.Persona.ENacionalidad.Argentino, Universidad.EClases.Programacion,
                                   Alumno.EEstadoCuenta.AlDia);

            uni += a5;
            Alumno a6 = new Alumno(6, "Juan", "Perez", "12234656",
                                   EntidadesAbstractas.Persona.ENacionalidad.Argentino, Universidad.EClases.Laboratorio,
                                   Alumno.EEstadoCuenta.Deudor);

            uni += a6;
            Alumno a7 = new Alumno(7, "Joaquin", "Suarez", "91122456",
                                   EntidadesAbstractas.Persona.ENacionalidad.Extranjero, Universidad.EClases.Laboratorio,
                                   Alumno.EEstadoCuenta.AlDia);

            uni += a7;
            Alumno a8 = new Alumno(8, "Rodrigo", "Smith", "22236456",
                                   EntidadesAbstractas.Persona.ENacionalidad.Argentino, Universidad.EClases.Legislacion,
                                   Alumno.EEstadoCuenta.AlDia);

            uni += a8;
            Profesor i1 = new Profesor(1, "Juan", "Lopez", "12224458",
                                       EntidadesAbstractas.Persona.ENacionalidad.Argentino);

            uni += i1;
            Profesor i2 = new Profesor(2, "Roberto", "Juarez", "32234456",
                                       EntidadesAbstractas.Persona.ENacionalidad.Argentino);

            uni += i2;
            try
            {
                uni += Universidad.EClases.Programacion;
            }
            catch (SinProfesorException e)
            {
                Console.WriteLine(e.Message);
            }
            try
            {
                uni += Universidad.EClases.Laboratorio;
            }
            catch (SinProfesorException e)
            {
                Console.WriteLine(e.Message);
            }
            try
            {
                uni += Universidad.EClases.Legislacion;
            }
            catch (SinProfesorException e)
            {
                Console.WriteLine(e.Message);
            }
            try
            {
                uni += Universidad.EClases.SPD;
            }
            catch (SinProfesorException e)
            {
                Console.WriteLine(e.Message);
            }
            Console.WriteLine(uni.ToString());
            Console.ReadKey();
            Console.Clear();
            try
            {
                Universidad.Guardar(uni);
                Console.WriteLine("Archivo de Universidad guardado.");
            }
            catch (ArchivosException e)
            {
                Console.WriteLine(e.Message);
            }
            try
            {
                int jornada = 0;
                Jornada.Guardar(uni[jornada]);
                Console.WriteLine("Archivo de Jornada {0} guardado.", jornada);
                //Console.WriteLine(Jornada.Leer());
            }
            catch (ArchivosException e)
            {
                Console.WriteLine(e.Message);
            }
            Console.ReadKey();
        }
Example #17
0
 public void AddProfesor(Profesor profesor)
 {
     data.Insertar(profesor);
     LoadTable();
 }
Example #18
0
 public void EditProfesor(Profesor profesor)
 {
     data.Actualizar(profesor);
     LoadTable();
 }
Example #19
0
        public void rutina1()
        {
            Console.WriteLine("Gestion de Institucion");
            var alumno1 = new Alumno("joel", "suarez")
            {
                Id = 1, Edad = 36, NickName = "JOEKS", Telefono = "22333222", Email = "*****@*****.**"
            };
            //alumno1.Nombre = "joel suarez";

            //var persona1 = new Persona() { Id = 1, Nombre = "Joel Suarez", Apellido = "suarez", Edad = 36, Telefono = "22333222" };
            var profesor = new Profesor()
            {
                Id = 1, Nombre = "Joel Suarez", Apellido = "suarez", Edad = 36, Telefono = "22333222", Catedra = "Matematicas"
            };

            Console.WriteLine("Virtual override");
            Console.WriteLine(profesor.ImprimirEdad);


            Persona a = profesor;
            Persona b = alumno1;

            Console.WriteLine("Foreach");
            Persona[] lista = new Persona[3];
            lista[0] = new Alumno("carlos", "ruiz")
            {
                Id = 1, Edad = 36, NickName = "JOEKS", Telefono = "22333222", Email = "*****@*****.**"
            };
            lista[1] = new Profesor()
            {
                Id = 2, Nombre = "miguel", Apellido = "suarez", Edad = 36, Telefono = "22333222", Catedra = "Matematicas"
            };
            lista[2] = new Profesor()
            {
                Id = 3, Nombre = "juvencio", Apellido = "sanchez", Edad = 36, Telefono = "22333222", Catedra = "Fisica"
            };

            foreach (Persona p in lista)
            {
                Console.WriteLine($"Tipo {p.GetType()}");
                Console.WriteLine(p.ConstruirResumen());

                institute ente = p;
                ente.ContruirLLaveSecreta("Hola");
            }

            a = b;
            Console.WriteLine(alumno1.Nombre);
            Console.WriteLine(Persona.ContadorPersona);

            Console.WriteLine("Resumenes");
            Console.WriteLine(alumno1.ConstruirResumen());
            Console.WriteLine(profesor.ConstruirResumen());

            Console.WriteLine("retornando valores por referencia");
            var anum = 15;

            Console.WriteLine(alumno1.RetornarVal(ref anum));
            Console.WriteLine(anum);

            Console.WriteLine("retornando valores sin referencia");
            Console.WriteLine(alumno1.RetornarValWReference(anum));
            Console.WriteLine(anum);
        }
Example #20
0
 public void ExtranjeroInvalido()
 {
     Profesor profesor = new Profesor(4, "Lionel", "Messi", "23456980", Persona.ENacionalidad.Extranjero);
 }
Example #21
0
        static void Main(string[] args)
        {
            var profe = new Profesor()
            {
                Id = 4, Nombre = "oscar", Apellido = "perez", CodigoInterno = "Profe_smart"
            };

            var trasmitter = new TransmisorDeDatos();

            //asigancion de eventos
            // multicast delegate

            trasmitter.InformationSend += Trasmitter_InformationSend;
            trasmitter.InformationSend += (obj, evtargs) => { Console.WriteLine("segundo evento casteado"); };
            //trasmitter.FormatearYEnviar(profe, formatter,"Alex");
            //trasmitter.FormatearYEnviar(profe, formatter2, "Alex");

            // lambda functions
            trasmitter.FormatearYEnviar(profe, (s) => new string(s.Reverse().ToArray <char>()), "Alex");
            trasmitter.FormatearYEnviar(profe, formatter2, "Alex");

            // quitando eventos
            trasmitter.InformationSend -= Trasmitter_InformationSend;
            trasmitter.FormatearYEnviar(profe, formatter, "Alex");

            Console.WriteLine("Manipulacion de documentos");

            var listaProfesores = new List <Profesor>();

            string[] lineas = File.ReadAllLines("./Files/Profesores.txt");

            int localId = 0;

            foreach (var line in lineas)
            {
                listaProfesores.Add(new Profesor()
                {
                    Nombre = line, Id = localId++
                });
            }

            foreach (var prof in listaProfesores)
            {
                Console.WriteLine(prof.Nombre);
            }

            //binary files
            var archivo = File.Open("profesBinarios.bin", FileMode.OpenOrCreate);

            var binaryFile = new BinaryWriter(archivo);

            foreach (var prof in listaProfesores)
            {
                //var bytesNombre = Encoding.UTF8.GetBytes(prof.Nombre);
                //archivo.Write(bytesNombre, 0, bytesNombre.Length);

                binaryFile.Write(profe.Nombre);
                binaryFile.Write(profe.Id);
            }

            //liberar memoria
            binaryFile.Close();
            archivo.Close();


            Console.WriteLine("Conexion a base de Datos con Entity Frameworks");

            var db = new InstitucionDB();

            db.Profesores.AddRange(listaProfesores);
            db.SaveChanges();


            Console.ReadLine();
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,GeneroId,Nombre,Apellidos,Imagen")] Profesor profesor,
                                               List <int> formaciones, List <int> idiomas, List <int> materias)
        {
            if (id != profesor.Id)
            {
                return(NotFound());
            }

            List <ProfesorFormacion> profesorFormaciones = await _context.ProfesorFormacion
                                                           .Where(pf => pf.ProfesorId == profesor.Id)
                                                           .ToListAsync();

            foreach (ProfesorFormacion formacion in profesorFormaciones)
            {
                _context.Remove(formacion);
            }

            List <ProfesorIdioma> profesorIdiomas = await _context.ProfesorIdioma
                                                    .Where(pi => pi.ProfesorId == profesor.Id)
                                                    .ToListAsync();

            foreach (ProfesorIdioma idioma in profesorIdiomas)
            {
                _context.Remove(idioma);
            }

            Usuario usuario = await _userManager.GetUserAsync(User);

            profesor.UsuarioId = usuario.Id;

            profesor.ProfesoresFormaciones = new List <ProfesorFormacion>();

            profesor.ProfesoresIdiomas = new List <ProfesorIdioma>();


            foreach (int idIdioma in idiomas)
            {
                ProfesorIdioma profesorIdioma = new ProfesorIdioma
                {
                    ProfesorId = profesor.Id,
                    IdiomaId   = idIdioma
                };
                profesor.ProfesoresIdiomas.Add(profesorIdioma);
            }

            foreach (int idFormacion in formaciones)
            {
                ProfesorFormacion profesorFormacion = new ProfesorFormacion
                {
                    ProfesorId  = profesor.Id,
                    FormacionId = idFormacion
                };
                profesor.ProfesoresFormaciones.Add(profesorFormacion);
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(profesor);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProfesorExists(profesor.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ProfesoresMateriasId"]    = new SelectList(_context.Set <Materia>(), "Id", "Nombre", profesor.ProfesoresMaterias);
            ViewData["ProfesoresIdiomasId"]     = new SelectList(_context.Set <Idioma>(), "Id", "Nombre", profesor.ProfesoresIdiomas);
            ViewData["ProfesoresFormacionesId"] = new SelectList(_context.Set <Formacion>(), "Id", "Nombre", profesor.ProfesoresFormaciones);
            ViewData["GeneroId"] = new SelectList(_context.Set <Genero>(), "Id", "Nombre", profesor.GeneroId);
            return(View(profesor));
        }
Example #23
0
        public void SinProfesor_Exception()
        {
            Universidad u = new Universidad();

            Profesor profe = (u == Universidad.EClases.Programacion);
        }
Example #24
0
 public void TestMethod3SinProfesorException()
 {
     Universidad universidad = new Universidad();
     Profesor    profesor    = universidad == Universidad.EClases.SPD;
 }
 public frmPrivacy(Profesor profesor)  : this()
 {
     _professor = profesor;
 }
Example #26
0
 public bool RemoveProfesor(Profesor prof)
 {
     if (FindProfesor(prof))
     {
         profesor.Remove(prof);
         return true;
     }
     else
         return false;
 }
        internal static bool SacuvajKurs(TextBox txtDatumDo, TextBox txtDatumOd, TextBox txtNaziv, RadioButton rbDA, RadioButton rbNE, object nivo, ComboBox cmbNivo, ComboBox cmbProfesor)
        {
            bool pom = true;

            try
            {
                DateTime.ParseExact(txtDatumDo.Text, "dd.MM.yyyy", null);
            }
            catch (Exception)
            {
                txtDatumDo.BackColor = Color.LightCoral;
                pom = false;
                MessageBox.Show("Nije dobar datum do!");
            }
            try
            {
                DateTime.ParseExact(txtDatumOd.Text, "dd.MM.yyyy", null);
                if (DateTime.ParseExact(txtDatumDo.Text, "dd.MM.yyyy", null) != DateTime.MaxValue && DateTime.ParseExact(txtDatumOd.Text, "dd.MM.yyyy", null) != DateTime.MinValue)
                {
                    if (DateTime.ParseExact(txtDatumOd.Text, "dd.MM.yyyy", null) < DateTime.ParseExact(txtDatumDo.Text, "dd.MM.yyyy", null))
                    {
                        txtDatumDo.BackColor = Color.White;
                        txtDatumOd.BackColor = Color.White;
                    }
                    else
                    {
                        txtDatumDo.BackColor = Color.LightCoral;
                        txtDatumOd.BackColor = Color.LightCoral;
                        pom = false;
                        MessageBox.Show("Datum od ne sme biti veci od datuma do!");
                    }
                }
            }
            catch (Exception)
            {
                txtDatumOd.BackColor = Color.LightCoral;
                pom = false;
                MessageBox.Show("Nije dobar datum od!");
            }



            if (string.IsNullOrEmpty(txtNaziv.Text))
            {
                txtNaziv.BackColor = Color.LightCoral;
                pom = false;
                MessageBox.Show("Niste uneli naziv!");
            }
            else
            {
                txtNaziv.BackColor = Color.White;
            }

            if (nivo == null)
            {
                MessageBox.Show("Niste izabrali nivo!");
                cmbNivo.BackColor = Color.LightCoral;
                pom = false;
            }
            else
            {
                cmbNivo.BackColor = Color.White;
            }
            if (kurs.Termini.Count == 0)
            {
                pom = false;
                MessageBox.Show("Niste uneli nijedan termin");
            }
            if (!pom)
            {
                return(false);
            }

            kurs.Naziv   = txtNaziv.Text;
            kurs.DatumDO = DateTime.ParseExact(txtDatumDo.Text, "dd.MM.yyyy", null);
            kurs.DatumOd = DateTime.ParseExact(txtDatumOd.Text, "dd.MM.yyyy", null);
            kurs.Nivo    = nivo as Nivo;
            if (rbDA.Checked)
            {
                kurs.Aktivan = 1;
            }
            else
            {
                kurs.Aktivan = 0;
            }

            Profesor   prof = cmbProfesor.SelectedItem as Profesor;
            Sertifikat sert = new Sertifikat();

            sert.USLOV = "IDProfesor = " + prof.Id;
            Sertifikat s = komunikacija.VratiSertifikatZaProfesora(sert) as Sertifikat;

            if (s.Jezik.IDJezik != kurs.Nivo.Jezik.IDJezik)
            {
                MessageBox.Show("Izabrani profesor ne predaje na izabranom nivou!");
                return(false);
            }
            kurs.Profesor = prof;
            kurs.IZMENA   = " Naziv = '" + kurs.Naziv + "', DatumOd = '" + kurs.DatumOd.ToString("yyyy-MM-dd") + "', DatumDo= '" + kurs.DatumDO.ToString("yyyy-MM-dd") + "', Aktivan = " + kurs.Aktivan + ", IDNivo = " + kurs.Nivo.IDNivo + ", IDProfesor = " + kurs.Profesor.Id + "";
            object rez = komunikacija.ZapamtiKurs(kurs);

            if (rez == null)
            {
                MessageBox.Show("Sistem ne moze da zapamti kurs!");
                return(false);
            }
            else
            {
                MessageBox.Show("Sistem je zapamtio kurs!");
                return(true);
            }
        }
Example #28
0
 public bool FindProfesor(Profesor prof)
 {
     foreach (var p in profesor)
     {
         if (p.Equals(prof))
         {
             return true;
         }
     }
     return false;
 }
Example #29
0
        public int CrearEmpleado(string nombre, string apellido, DateTime fechaNacimiento, int documento, string descripcion, DateTime fechaInicio, EnumTipoEmpleado tipoEmpleado)
        {
            Empleado buscado = bdEmpleado.BuscarPorClavesUnicas(documento);

            if (buscado != null && buscado.EstadoEmpleado == EnumEstadoEmpleado.Baja)
            {
                buscado.EstadoEmpleado          = EnumEstadoEmpleado.Activo;
                buscado.Persona.Nombre          = nombre;
                buscado.Persona.Apellido        = apellido;
                buscado.Persona.FechaNacimiento = fechaNacimiento;
                buscado.DescripcionTarea        = descripcion;
                buscado.TipoEmpleado            = tipoEmpleado;
                buscado.FechaInicio             = fechaInicio;

                bdEmpleado.Actualizar(buscado);
                return(-1);
            }
            else if (buscado != null)
            {
                return(-2);
            }

            Persona pers = controladorPersona.BuscarPersonaPorClavesUnicas(documento);

            if (pers == null)
            {
                pers = new Persona
                {
                    Nombre          = nombre,
                    Apellido        = apellido,
                    FechaNacimiento = fechaNacimiento,
                    DNI             = documento
                };
                pers.Foto = CargarFotoPorDefecto();
                new BDPersona().Crear(pers);
            }

            Empleado unEmpleado = null;

            switch (tipoEmpleado)
            {
            case EnumTipoEmpleado.Secretaria:
                unEmpleado = new Secretaria();
                break;

            case EnumTipoEmpleado.Profesor:
                unEmpleado = new Profesor();
                break;

            default:
                unEmpleado = new Empleado();
                break;
            }

            unEmpleado.FechaInicio      = fechaInicio;
            unEmpleado.DescripcionTarea = descripcion;
            unEmpleado.TipoEmpleado     = tipoEmpleado;
            unEmpleado.EstadoEmpleado   = EnumEstadoEmpleado.Activo;



            unEmpleado.Persona = pers;
            return(bdEmpleado.Crear(unEmpleado));
        }
Example #30
0
        public ActionResult createReportAll(string tipo)
        {
            LocalReport lr   = new LocalReport();
            string      path = Path.Combine(Server.MapPath("~/Reportes"), "ReporteProyectos.rdlc");

            if (System.IO.File.Exists(path))
            {
                lr.ReportPath = path;
            }
            else
            {
                return(View("Index"));
            }

            string        cnnString = System.Configuration.ConfigurationManager.ConnectionStrings["con"].ConnectionString;
            SqlConnection cnn       = new SqlConnection(cnnString);

            SqlCommand cmdProy  = new SqlCommand();
            SqlCommand cmdProf  = new SqlCommand();
            SqlCommand cmdEmpr  = new SqlCommand();
            SqlCommand cmdCurso = new SqlCommand();

            cmdProy.Connection  = cnn;
            cmdProf.Connection  = cnn;
            cmdEmpr.Connection  = cnn;
            cmdCurso.Connection = cnn;

            cmdProy.CommandType  = System.Data.CommandType.StoredProcedure;
            cmdProf.CommandType  = System.Data.CommandType.StoredProcedure;
            cmdEmpr.CommandType  = System.Data.CommandType.StoredProcedure;
            cmdCurso.CommandType = System.Data.CommandType.StoredProcedure;

            cmdProy.CommandText  = "selectProyectoTodo";
            cmdProf.CommandText  = "selectProfesorTodo";
            cmdEmpr.CommandText  = "selectEmpresaTodo";
            cmdCurso.CommandText = "selectCursoTodo";

            List <Proyecto> proyect   = new List <Proyecto>();
            List <Profesor> professor = new List <Profesor>();
            List <Empresa>  company   = new List <Empresa>();
            List <Curso>    subject   = new List <Curso>();

            cnn.Open();
            using (SqlDataReader dr = cmdProy.ExecuteReader())
            {
                while (dr.Read())
                {
                    Proyecto newItem = new Proyecto();
                    newItem.idProyecto     = dr.GetInt32(0);
                    newItem.nombreProyecto = dr.GetString(1);
                    newItem.estadoProyecto = dr.GetString(2);
                    newItem.tecnologia     = dr.GetString(3);
                    newItem.fechaInicio    = dr.GetDateTime(4);
                    newItem.idContacto     = dr.GetInt32(5);
                    newItem.idCurso        = dr.GetInt32(6);
                    newItem.idProfesor     = dr.GetInt32(7);
                    proyect.Add(newItem);
                }
            }
            cnn.Close();

            cnn.Open();
            using (SqlDataReader dr = cmdEmpr.ExecuteReader())
            {
                while (dr.Read())
                {
                    Empresa newItem = new Empresa();
                    newItem.idContacto     = dr.GetInt32(0);
                    newItem.nombreEmpresa  = dr.GetString(1);
                    newItem.nombreContacto = dr.GetString(2);
                    newItem.email          = dr.GetString(3);
                    newItem.telefono       = dr.GetInt32(4);
                    newItem.tipoEmpresa    = dr.GetString(5);
                    company.Add(newItem);
                }
            }
            cnn.Close();

            cnn.Open();
            using (SqlDataReader dr = cmdProf.ExecuteReader())
            {
                while (dr.Read())
                {
                    Profesor newItem = new Profesor();
                    newItem.idProfesor       = dr.GetInt32(0);
                    newItem.nombreProfesor   = dr.GetString(1);
                    newItem.apellidoProfesor = dr.GetString(2);
                    newItem.nombreUsuario    = dr.GetString(3);
                    newItem.emailProfesor    = dr.GetString(4);
                    professor.Add(newItem);
                }
            }
            cnn.Close();

            cnn.Open();
            using (SqlDataReader dr = cmdCurso.ExecuteReader())
            {
                while (dr.Read())
                {
                    Curso newItem = new Curso();
                    newItem.idCurso     = dr.GetInt32(0);
                    newItem.nombreCurso = dr.GetString(1);
                    subject.Add(newItem);
                }
            }
            cnn.Close();


            ReportDataSource rdProy = new ReportDataSource("DataSetProyecto", proyect);
            ReportDataSource rdProf = new ReportDataSource("DataSetProfesor", professor);
            ReportDataSource rdEmpr = new ReportDataSource("DataSetEmpresa", company);
            ReportDataSource rdSubj = new ReportDataSource("DataSetCurso", subject);

            lr.DataSources.Add(rdProy);
            lr.DataSources.Add(rdProf);
            lr.DataSources.Add(rdEmpr);
            lr.DataSources.Add(rdSubj);

            string reportType = tipo;
            string mimeType;
            string encoding;
            string fileNameExtension;

            string deviceInfo =

                "<DeviceInfo>" +
                "  <OutputFormat>" + tipo + "</OutputFormat>" +
                "  <PageWidth>8.5in</PageWidth>" +
                "  <PageHeight>11in</PageHeight>" +
                "  <MarginTop>0.5in</MarginTop>" +
                "  <MarginLeft>1in</MarginLeft>" +
                "  <MarginRight>1in</MarginRight>" +
                "  <MarginBottom>0.5in</MarginBottom>" +
                "</DeviceInfo>";

            Warning[] warnings;
            string[]  streams;
            byte[]    renderedBytes;

            renderedBytes = lr.Render(
                reportType,
                deviceInfo,
                out mimeType,
                out encoding,
                out fileNameExtension,
                out streams,
                out warnings);

            return(File(renderedBytes, mimeType));
        }
Example #31
0
        public List <Empleado> MigrarEmpleados(Object[,] migraciones)
        {
            List <Empleado> listaEmpleados  = new List <Empleado>();
            List <int>      listadocumentos = new List <int>();

            ////string nombre,string apellido, DateTime fechaNacimiento, int documento, string descripcion, DateTime fechaInicio, EnumTipoEmpleado tipoEmpleado
            for (int i = 0; i < migraciones.GetLength(0); i++)
            {
                listadocumentos.Add((int)migraciones[i, 3]);
            }
            if (!EmpleadosConDocumentosUnicos(listadocumentos))
            {
                return(null);
            }
            for (int i = 0; i < migraciones.GetLength(0); i++)
            {
                string           nombre          = (string)migraciones[i, 0];
                string           apellido        = (string)migraciones[i, 1];
                DateTime         fechaNacimiento = (DateTime)migraciones[i, 2];
                int              nroDocumento    = (int)migraciones[i, 3];
                string           descripcion     = (string)migraciones[i, 4];
                DateTime         fechaInicio     = (DateTime)migraciones[i, 5];
                EnumTipoEmpleado tipoEmpleado    = (EnumTipoEmpleado)migraciones[i, 6];
                Persona          pers            = new Persona
                {
                    Nombre          = nombre,
                    Apellido        = apellido,
                    FechaNacimiento = fechaNacimiento,
                    DNI             = nroDocumento
                };
                pers.Foto = CargarFotoPorDefecto();
                new BDPersona().Crear(pers);


                Empleado unEmpleado = null;
                switch (tipoEmpleado)
                {
                case EnumTipoEmpleado.Secretaria:
                    unEmpleado = new Secretaria();
                    break;

                case EnumTipoEmpleado.Profesor:
                    unEmpleado = new Profesor();
                    break;

                default:
                    unEmpleado = new Empleado();
                    break;
                }

                unEmpleado.FechaInicio      = fechaInicio;
                unEmpleado.DescripcionTarea = descripcion;
                unEmpleado.TipoEmpleado     = tipoEmpleado;
                unEmpleado.EstadoEmpleado   = EnumEstadoEmpleado.Activo;



                unEmpleado.Persona = pers;
                listaEmpleados.Add(unEmpleado);
            }
            bdEmpleado.Migrar(listaEmpleados);
            return(listaEmpleados);
        }
Example #32
0
        public void CreateDataBase()
        {
            Data  initialData = new Data();
            Curso curso       = new Curso()
            {
                CursoCode = "A10", Nombre = "Primero Basico", Descripcion = "Conocimiento de sí mismo e ingreso al mundo de la lectura y escritura"
            };

            _db.Cursos.Add(curso);
            for (int i = 0; i < initialData.NombresAlum.Length; i++)
            {
                Alumno alum = new Alumno()
                {
                    Rut = initialData.RutAlum[i], Nombre = initialData.NombresAlum[i], Apellido = initialData.ApellidosAlum[i], Curso = curso
                };
                _db.Alumnos.Add(alum);
                _db.SaveChanges();
            }
            Perfil perfil = new Perfil()
            {
                Nombre = "Administrador"
            };

            _db.Perfiles.Add(perfil);
            for (int i = 0; i < initialData.privilegios.Length; i++)
            {
                Privilegio privilegio = new Privilegio()
                {
                    Nombre = initialData.privilegios[i]
                };
                _db.Privilegios.Add(privilegio);
                _db.SaveChanges();
                _db.PerfilesPrivilegios.Add(new PerfilPrivilegio()
                {
                    PrivilegioId = i + 1, PerfilId = 1
                });
            }
            for (int i = 0; i < initialData.ProfesoresNombre.Length; i++)
            {
                Profesor profe = new Profesor()
                {
                    Rut = initialData.RutProfesor[i], Nombre = initialData.ProfesoresNombre[i], Apellido =
                        initialData.ProfesoresApellido[i]
                };
                _db.Profesores.Add(profe);
                _db.SaveChanges();
            }
            for (int i = 0; i < initialData.asignaturas.Length; i++)
            {
                Asignatura asig = new Asignatura()
                {
                    AsignaturaCode = i.ToString(), Nombre = initialData.asignaturas[i]
                };
                _db.Asignaturas.Add(asig);
                _db.SaveChanges();
            }
            _db.Usuarios.Add(new Usuario()
            {
                Nombre = "JMOLINA", Clave = "1234", Estado = 1, Perfiles = perfil
            });
            _db.SaveChanges();
        }
Example #33
0
 public void TestDniMenor()
 {
     Profesor profesor = new Profesor(5, "Marcelo", "Gallardo", "-4", Persona.ENacionalidad.Argentino);
 }
Example #34
0
 public void TestNacionalidadInvalidaException()
 {
     Profesor alumno = new Profesor(5, "joaquin", "rojas", "99999999", Persona.ENacionalidad.Argentino);
 }
Example #35
0
 public void TestDniLetras()
 {
     Profesor profesor = new Profesor(5, "Marcelo", "Gallardo", "sarasa", Persona.ENacionalidad.Argentino);
 }
Example #36
0
        private void ListaProfesores_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Profesor profesor = (Profesor)ListaProfesores.SelectedItem;

            inputNombre.Text = profesor.Nombre;
        }
Example #37
0
        static void Main(string[] args)
        {
            string[] name = new string[16];
            string[] family = new string[16];
            int[] years = new int[16];

            for (int i = 0; i < 16; i++)
            {
                Console.Write("Enter fisrt name: ");
                name[i] = Console.ReadLine();
                Console.Write("Enter family name: ");
                family[i] = Console.ReadLine();
                Console.Write("Enter years of working experience: ");
                years[i] = int.Parse(Console.ReadLine());
                Console.WriteLine();

                if (years[i] < 0)
                {
                    Massage();
                    break;
                }
            }

            string[] college = new string[] { "Telecommunications College", "Economics College", "Business College" };
            string[] university = new string[] { "Technical University", "Sofia University", "New Bulgarian University" };
            string[] title = new string[] { "Doctor", "Docent" };
            string[] subject = new string[] { "English", "Literature", "History" };
            string exercise1 = "Physics";
            string exercise2 = "Chemistry";
            string exercise3 = "Mathematics";

            for (int i = 0; i < 16; i++)
            {
                if (years[i] < 0)
                {
                    Massage();
                    break;
                }
                if (i >= 0 && i <= 2)
                {
                    Teacher teacher = new Teacher(name[i], family[i], years[i], subject[i]);
                    teacher.FirstName = name[i];
                    teacher.FamilyName = family[i];
                    teacher.WorkingExperience = years[i];
                    teacher.TeachingSubject = subject[i];
                    Console.WriteLine("{0} {1} has {2} years of working experience and teaches {3}.", teacher.FirstName, teacher.FamilyName, teacher.WorkingExperience, teacher.TeachingSubject);
                    teacher.SayHello();
                    teacher.SayGoodbye();
                    teacher.CheckHomeworks();
                    Console.WriteLine();
                }
                else if (i >= 3 && i <= 5)
                {
                    SchoolTeacher schoolTeacher = new SchoolTeacher();
                    schoolTeacher.FirstName = name[i];
                    schoolTeacher.FamilyName = family[i];
                    schoolTeacher.WorkingExperience = years[i];
                    schoolTeacher.TeachingSubject = subject[i - 3];
                    Console.WriteLine("{0} {1} has {2} years of working experience and teaches {3}.", schoolTeacher.FirstName, schoolTeacher.FamilyName, schoolTeacher.WorkingExperience, schoolTeacher.TeachingSubject);
                    schoolTeacher.SayHello();
                    schoolTeacher.SayGoodbye();
                    schoolTeacher.CheckHomeworks();
                    schoolTeacher.EntertainKids();
                    schoolTeacher.TeachingClasses();
                    Console.WriteLine();
                }
                else if (i >= 6 && i <= 8)
                {
                    CollegeTeacher collegeTeacher = new CollegeTeacher(name[i], family[i], years[i], subject[i - 6], college[i - 6]);
                    collegeTeacher.FirstName = name[i];
                    collegeTeacher.FamilyName = family[i];
                    collegeTeacher.WorkingExperience = years[i];
                    collegeTeacher.TeachingSubject = subject[i - 6];
                    collegeTeacher.TeachingCollege = college[i - 6];
                    Console.WriteLine("{0} {1} has {2} years of working experience and teaches {3} in {4}.", collegeTeacher.FirstName, collegeTeacher.FamilyName, collegeTeacher.WorkingExperience, collegeTeacher.TeachingSubject, collegeTeacher.TeachingCollege);
                    collegeTeacher.SayHello();
                    collegeTeacher.SayGoodbye();
                    collegeTeacher.CheckHomeworks();
                    Console.WriteLine();
                }
                else if (i >= 9 && i <= 11)
                {
                    Lecturer lecturer = new Lecturer(name[i], family[i], years[i], university[i - 9]);
                    lecturer.FirstName = name[i];
                    lecturer.FamilyName = family[i];
                    lecturer.WorkingExperience = years[i];
                    lecturer.TeachingUniversity = university[i - 9];
                    Console.WriteLine("{0} {1} has {2} years of working experience in {3}.", lecturer.FirstName, lecturer.FamilyName, lecturer.WorkingExperience, lecturer.TeachingUniversity);
                    lecturer.SayHello();
                    lecturer.CheckHomeworks();
                    if (i == 9)
                    { lecturer.WageExercise(exercise1); }
                    if (i == 10)
                    { lecturer.WageExercise(exercise1, exercise2); }
                    if (i == 11)
                    { lecturer.WageExercise(exercise1, exercise2, exercise3); }
                    Console.WriteLine("This lecturer can't wage more than {0} lectures per week!", Lecturer.maximumLecturesPerWeek);
                    Console.WriteLine();
                }
                else if (i >= 12 && i <= 13)
                {
                    Profesor professor = new Profesor(name[i], family[i], years[i], university[i - 12], title[i - 12]);
                    professor.FirstName = name[i];
                    professor.FamilyName = family[i];
                    professor.WorkingExperience = years[i];
                    professor.TeachingUniversity = university[i - 12];
                    professor.Title = title[i - 12];
                    Console.WriteLine("Professor {0} {1} is teaching at {2}.", professor.FirstName, professor.FamilyName, professor.TeachingUniversity);
                    professor.Say(professor.Title, professor.WorkingExperience);
                    professor.CheckHomeworks();
                    Console.WriteLine("This professor can't wage more than {0} lectures per week!", Profesor.maximumLecturesPerWeek);
                    professor.WageExams();
                    Console.WriteLine();
                }
                else if (i >= 14 && i <= 15)
                {
                    bool chiefAssistant = true;

                    if (years[i] < 10)
                    { chiefAssistant = false; }

                    Assistant assistant = new Assistant(name[i], family[i], years[i], university[i - 14], chiefAssistant);
                    assistant.FirstName = name[i];
                    assistant.FamilyName = family[i];
                    assistant.WorkingExperience = years[i];
                    assistant.TeachingUniversity = university[i - 14];
                    assistant.ChiefAssistant = chiefAssistant;
                    Console.WriteLine("{0} {1} has {2} years of working experience in {3}.", assistant.FirstName, assistant.FamilyName, assistant.WorkingExperience, assistant.TeachingUniversity);
                    assistant.CheckAssistant(assistant.FirstName, assistant.FamilyName, assistant.ChiefAssistant);
                    assistant.CheckHomeworks();
                    Console.WriteLine("This assistant can't assit in more than {0} lectures per week!", Assistant.maximumLecturesPerWeek);
                    assistant.CheckExams();
                    assistant.WriteScientificArticles();
                    Console.WriteLine();
                }
            }

            Console.WriteLine("TOTAL PERSONS EMPLOYED: " + Person.GetPersonCount());
            Console.WriteLine();
        }