Beispiel #1
0
        private void agregar_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(nombre.Text))
                {
                    throw new Exception("Nombre vacio");
                }
                if (string.IsNullOrEmpty(cantidadhora.Text))
                {
                    throw new Exception("Cantidad horas vacio");
                }

                Proyecto value = locales.Checked ? value = new Local() : new Internacional();

                value.Nombre        = nombre.Text;
                value.CantidadHoras = Convert.ToInt32(cantidadhora.Text);
                value.Desarrollador = (Desarrollador)desarrolladorBindingSource.Current;

                value.CalcularCosto();

                _empresa.AgregarProyecto(value);
                CargarProyectos();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #2
0
        private void CargarDatos()
        {
            var desarrollador = new Desarrollador
            {
                Nombre    = "Developer 1",
                Email     = "*****@*****.**",
                Documento = "50112589",
                CostoHora = 300
            };

            _empresa.AgregarDesarrollador(desarrollador);

            var desarrollador2 = new Desarrollador
            {
                Nombre    = "Developer 2",
                Email     = "*****@*****.**",
                Documento = "50112588",
                CostoHora = 250
            };

            _empresa.AgregarDesarrollador(desarrollador2);

            var proyecto = new Local
            {
                CantidadHoras = 10,
                Nombre        = "Proyecto Local Nuevo",
                Desarrollador = desarrollador
            };

            proyecto.CalcularCosto();
            _empresa.AgregarProyecto(proyecto);

            var _proyecto = new Internacional
            {
                CantidadHoras = 10,
                Nombre        = "Proyecto Int. Nuevo",
                Desarrollador = desarrollador2
            };

            _proyecto.CalcularCosto();
            _empresa.AgregarProyecto(_proyecto);
        }