예제 #1
0
        static void Main(string[] args)
        {
            Entidades.Profesor objEntidadProfesor = new Entidades.Profesor();
            Console.Write("Ingrese su apellido: ");
            objEntidadProfesor.Apellido = Console.ReadLine();
            Console.Write("Ingrese su nombre: ");
            objEntidadProfesor.Nombre = Console.ReadLine();
            Console.Write("Ingrese su mail: ");
            objEntidadProfesor.Mail = Console.ReadLine();

            Logica.Profesor objLogicaProfesor = new Logica.Profesor();
            objLogicaProfesor.Agregar(objEntidadProfesor);
            Console.WriteLine("¡Profesor agregado!");
            Console.ReadKey();
        }
예제 #2
0
        public void Corregido(Entidades.Profesor p_objEntProfesor, int p_IdMateria, int p_IdCurso, int p_IdSede)
        {
            Conexion.conn.Open();

            MySqlCommand sql = new MySqlCommand("Corrigido", Conexion.conn);

            sql.CommandType = CommandType.StoredProcedure;
            sql.Parameters.AddWithValue("@IdPersona", p_objEntProfesor.ID);
            sql.Parameters.AddWithValue("@IdMateria", p_IdMateria);
            sql.Parameters.AddWithValue("@IdCurso", p_IdCurso);
            sql.Parameters.AddWithValue("@IdSede", p_IdSede);
            sql.ExecuteNonQuery();



            Conexion.conn.Close();
        }
예제 #3
0
        public void Agregar(Entidades.Profesor profesor)
        {
            string        strConnection = @"Server=CPX-DRG65AZ7G7H\TRAINING;database=tecno;Integrated Security=true";
            string        strSQL        = "insert into Profesores(Apellido,Nombre,Mail) values(@apellido,@nombre,@mail)";
            SqlConnection objConnection = new SqlConnection();

            objConnection.ConnectionString = strConnection;
            SqlCommand objCommand = new SqlCommand();

            objCommand.CommandText = strSQL;
            objCommand.Connection  = objConnection;

            objCommand.Parameters.AddWithValue("@apellido", profesor.Apellido);
            objCommand.Parameters.AddWithValue("@nombre", profesor.Nombre);
            objCommand.Parameters.AddWithValue("@mail", profesor.Mail);

            objConnection.Open();
            objCommand.ExecuteNonQuery();
            objConnection.Close();
        }
예제 #4
0
파일: Program.cs 프로젝트: FlorGRP/Solucion
        static void Main(string[] args)
        {
            Entidades.Profesor objEntidadProfesor = new Entidades.Profesor();

            Console.Write("Ingrese Apellido: ");
            objEntidadProfesor.Apellido = Console.ReadLine();

            Console.Write("Ingrese Nombre: ");
            objEntidadProfesor.Nombre = Console.ReadLine();

            Console.Write("Ingrese Email: ");
            objEntidadProfesor.Email = Console.ReadLine();

            Logica.Profesor objLogicaProfesor = new Logica.Profesor();
            objLogicaProfesor.Agregar(objEntidadProfesor);

            Console.WriteLine("Profesor agregado exitosamente");

            Console.ReadKey();
        }
예제 #5
0
        public void Agregar(Entidades.Profesor profesor)
        {
            string strSQL = @"insert into Profesores (Nombre,Apellido,FechaContratacion,Titulo,IdActividad) 
                            values (@Nombre,@Apellido,@FechaContratacion,@Titulo,@IdActividad)";

            SqlConnection objConexion = new SqlConnection(Conexion.strConexion);
            SqlCommand    objCom      = new SqlCommand(strSQL, objConexion);

            //PARAMETROS
            objCom.Parameters.AddWithValue("@Nombre", profesor.Nombre);
            objCom.Parameters.AddWithValue("@Apellido", profesor.Apellido);
            objCom.Parameters.AddWithValue("@FechaContratacion", profesor.FechaContratacion);
            objCom.Parameters.AddWithValue("@Titulo", profesor.Titulo);
            objCom.Parameters.AddWithValue("@IdActividad", profesor.actividad.IdActividad);


            objConexion.Open();
            objCom.ExecuteNonQuery();
            objConexion.Close();
        }
예제 #6
0
        public void Modificar(Entidades.Profesor profesor)
        {
            string strSQL = "@ update profesores set Nombre=@Nombre, Apellido=@Apellido, FechaContratacion=@FechaContratacion, titulo=@Titulo," +
                            "IdActividad=@IdActividad, HorasTrabajadas=@HorasTrabajadas where id=@id";
            SqlConnection objConexion = new SqlConnection(Conexion.strConexion);
            SqlCommand    objCom      = new SqlCommand(strSQL, objConexion);

            //PARAMETROS

            objCom.Parameters.Add("@Nombre", System.Data.SqlDbType.VarChar).Value             = profesor.Nombre;
            objCom.Parameters.Add("@Apellido", System.Data.SqlDbType.VarChar).Value           = profesor.Apellido;
            objCom.Parameters.Add("@FechaContratacion", System.Data.SqlDbType.VarChar).Value  = profesor.FechaContratacion;
            objCom.Parameters.Add("@Titulo", System.Data.SqlDbType.VarChar).Value             = profesor.Titulo;
            objCom.Parameters.Add("@ActividadPrincipal", System.Data.SqlDbType.VarChar).Value = profesor.actividad.NombreActividad;
            objCom.Parameters.Add("@HorasTrabajadas", System.Data.SqlDbType.VarChar).Value    = profesor.HorasTrabajadas;


            objConexion.Open();
            objCom.ExecuteNonQuery();
            objConexion.Close();
        }
        protected void btnConfirmar_Click(object sender, EventArgs e)
        {
            Entidades.Profesor objEntidades = new Entidades.Profesor();

            objEntidades.Apellido          = txtApellido.Text;
            objEntidades.Nombre            = txtNombre.Text;
            objEntidades.FechaContratacion = FechaContratacion.SelectedDate;
            objEntidades.Titulo            = txtTitulo.Text;
            Entidades.Actividad objEntidadesActividad = new Entidades.Actividad();
            objEntidadesActividad.IdActividad = Convert.ToInt32(ddlActividad.SelectedValue);
            objEntidades.actividad            = objEntidadesActividad;



            objLogica.Agregar(objEntidades);
            lblMensaje.Text = "Profesor agregado";


            txtApellido.Text = "";
            txtNombre.Text   = "";
            txtTitulo.Text   = "";
        }
예제 #8
0
        //Metodo Agregar
        public void Agregar(Entidades.Profesor pProfesor)
        {
            string strConexion = @"Server=CPX-O6PQ19GS3AD\TRAINING; database=Techno;Integrated Security=true";
            string strSQL      = @"insert Profesores(id,apellido,nombre,email) values(@id,@apellido,@nombre,@email)";

            SqlConnection objConexion = new SqlConnection();

            objConexion.ConnectionString = strConexion;

            SqlCommand objCommand = new SqlCommand();

            objCommand.CommandText = strSQL;

            //Paramentros:Los parametros son propiedades
            objCommand.Parameters.AddWithValue("@id", pProfesor.ID);
            objCommand.Parameters.AddWithValue("@apellido", pProfesor.Apellido);
            objCommand.Parameters.AddWithValue("@nombre", pProfesor.Nombre);
            objCommand.Parameters.AddWithValue("@email", pProfesor.Email);

            //Abro la conexion
            objConexion.Open();
            objCommand.ExecuteNonQuery();
            objConexion.Close();
        }
예제 #9
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            Negocio.Profesores oProfesores = new Negocio.Profesores();

            if (this.esValido())
            {
                try
                {
                    Entidades.Profesor oProfesor = new Entidades.Profesor();
                    if (tipoOperacion != General.TipoOperacion.Alta)
                    {
                        oProfesor.Legajo = Convert.ToInt32(this.txtLegajo.Text) - 90000;
                    }
                    oProfesor.Activo = chbActivo.Checked;
                    oProfesor.Apellido = txtApellido.Text;
                    oProfesor.Direccion = txtDireccion.Text;
                    oProfesor.Email = txtEmail.Text;
                    oProfesor.FechaInicio = Convert.ToDateTime(txtFechaInicio.Text.ToString());
                    oProfesor.FechaNacimiento = Convert.ToDateTime(txtNacimiento.Text.ToString());
                    oProfesor.Nombre = txtNombre.Text;
                    oProfesor.NroDoc = int.Parse(txtNroDoc.Text);
                    oProfesor.TelefonoCelular = txtCelular.Text;
                    oProfesor.TelefonoFijo = txtTelefono.Text;
                    oProfesor.TipoDoc = cbxTipoDoc.SelectedItem.ToString();
                    oProfesor.Titulo = txtTitulo.Text;
                    oProfesor.usuario = new Entidades.Usuario();
                    oProfesor.usuario.NombreUsuario = txtUsuario.Text;
                    oProfesor.usuario.Password = txtContrasenia.Text;
                    oProfesor.usuario.Rol = Entidades.Usuario.RolUsuario.Usuario;
                    if (this.tipoOperacion == General.TipoOperacion.Modificacion)
                    {
                        oProfesores.Modificar(oProfesor);
                        if (txtContrasenia.Text != "")
                        {
                            oProfesores.ModificarUsuario(oProfesor);
                        }
                        MessageBox.Show("Profesor modificado correctamente", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        int id = oProfesores.Agregar(oProfesor);
                        MessageBox.Show("Profesor agregado correctamente.\nLegajo Nº: " + id.ToString(), "Información",
                                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }

                finally
                {
                    oProfesores = null;
                    borrarCampos();
                }

            }
        }
예제 #10
0
        //Metodos

        public void Agregar(Entidades.Profesor pProfesor)
        {
            Datos.Profesor objProfesor = new Datos.Profesor();
            objProfesor.Agregar(pProfesor);
        }
예제 #11
0
 public void Modificar(Entidades.Profesor profesor)
 {
     objDatos.Modificar(profesor);
 }
예제 #12
0
 public void Agregar(Entidades.Profesor profesor)
 {
     objDatos.Agregar(profesor);
 }
예제 #13
0
        public Entidades.Profesores RecuperarUno(int id)
        {
            MySqlConnection oConn = Datos.General.CreateConnection();
            using (oConn)
            {
                oConn.Open();

                MySqlCommand oCmd = new MySqlCommand();
                using (oCmd)
                {
                    oCmd.Connection = oConn;
                    oCmd.CommandType = CommandType.StoredProcedure;
                    oCmd.CommandText = "ProfesoresRecuperarUno";
                    oCmd.Parameters.AddWithValue("@Legajo", id);

                    Entidades.Profesores oProfesores = new Entidades.Profesores();
                    try
                    {
                        MySqlDataReader oReader = oCmd.ExecuteReader();
                        using (oReader)
                        {
                            while (oReader.Read())
                            {
                                Entidades.Profesor oProfesor = new Entidades.Profesor();
                                oProfesor.Apellido = Convert.ToString(oReader["Apellido"]);
                                oProfesor.Nombre = Convert.ToString(oReader["Nombre"]);
                                oProfesor.TipoDoc = Convert.ToString(oReader["TipoDoc"]);
                                oProfesor.NroDoc = Convert.ToInt32(oReader["NroDoc"]);
                                oProfesor.FechaNacimiento = Convert.ToDateTime(oReader["FechaNacimiento"]);
                                oProfesor.Direccion = Convert.ToString(oReader["Direccion"]);
                                oProfesor.TelefonoFijo = Convert.ToString(oReader["TelefonoFijo"]);
                                oProfesor.TelefonoCelular = Convert.ToString(oReader["TelefonoCelular"]);
                                oProfesor.Email = Convert.ToString(oReader["Email"]);
                                oProfesor.Legajo = Convert.ToInt32(oReader["Legajo"]);
                                oProfesor.Activo = Convert.ToBoolean(oReader["Activo"]);
                                oProfesor.FechaInicio = Convert.ToDateTime(oReader["FechaInicio"]);
                                oProfesor.Titulo = Convert.ToString(oReader["Titulo"]);
                                oProfesor.usuario = new Entidades.Usuario();
                                oProfesor.usuario.NombreUsuario = Convert.ToString(oReader["NombreUsuario"]);
                                oProfesores.Add(oProfesor);
                                oProfesor = null;
                            }

                            return oProfesores;
                        }

                    }

                    finally
                    {
                        oProfesores = null;
                    }
                }
            }
        }