protected void btnEvaluar_Click(object sender, EventArgs e)
        {
            int            CodId         = Convert.ToInt32(ddlEmp.SelectedValue);
            int            idEvaluador   = Convert.ToInt32(Session["IdEvaluador"].ToString());
            int            puntaje       = Convert.ToInt32(txtPuntaje.Text);
            string         justificacion = txtJust.Text;
            DateTime       fecha         = DateTime.Today;
            Emprendimiento emp           = new Emprendimiento();

            if (CodId > 0 && idEvaluador > 0 && puntaje >= 0 && puntaje <= 4 && justificacion.Length >= 100 && justificacion.Length <= 500 && emp.buscar(CodId))
            {
                Evaluacion ev = new Evaluacion()
                {
                    Emprendimiento = emp,
                    Puntaje        = puntaje,
                    Justicacion    = justificacion,
                    Fecha          = fecha,
                    Estado         = true,
                };

                if (ev.actualizar(idEvaluador))
                {
                    lblMensaje.Text    = "Se Ingreso la evaluacion correctamente";
                    btnEvaluar.Visible = false;
                }
            }
            else
            {
                lblMensaje.Text = "Ingresar datos de evaluacion correctamente";
            }
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Rol"] != null)
            {
                if (Session["Rol"].ToString() != "Administrador")
                {
                    Response.Redirect("Login.aspx");
                }
            }
            else
            {
                Response.Redirect("Login.aspx");
            }

            if (!IsPostBack)
            {
                ddlEmp.DataSource     = Emprendimiento.busarEmpAagregarEval();
                ddlEmp.DataTextField  = "Titulo";
                ddlEmp.DataValueField = "CodId";
                ddlEmp.DataBind();

                ddlEv.DataSource     = Evaluador.buscarTodos();
                ddlEv.DataTextField  = "Nombre";
                ddlEv.DataValueField = "IdEvaluador";
                ddlEv.DataBind();
            }
        }
Example #3
0
        public ActionResult Financiar(int id)
        {
            if (Session["Email"] == null)
            {
                return(RedirectToAction("Index"));
            }

            string             email = Session["Email"].ToString();
            List <Financiador> f     = Financiador.buscarPorFinaciador(email);
            Emprendimiento     empre = db.Emprendimientos.Find(id);

            if (empre != null)
            {
                foreach (Financiador j in f)
                {
                    double saldo = 0;
                    saldo = Convert.ToDouble(j.Monto);

                    if (saldo > empre.Costo)
                    {
                        j.Financiados = new List <Emprendimiento>();
                        j.Financiados.Add(empre);
                        db.SaveChanges();
                    }
                }
            }
            return(View());
        }
Example #4
0
        static void Main(string[] args)
        {
            Console.WriteLine("Ingrese Titulo:");
            string TituloNuevo = Console.ReadLine();

            Console.WriteLine("Ingrese Costo:");
            double CostoNuevo = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("Ingrese Duracion en dias:");
            int DuracionNuevo = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("Ingrese Puntaje del 0 al 4:");
            int PuntajeNuevo = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("Ingrese Descripcion (Incluir Evaluadores e Integrantes):");
            string DescripcionNuevo = Console.ReadLine();

            Console.ReadKey();

            Emprendimiento e = new Emprendimiento {
                Titulo = TituloNuevo, Costo = CostoNuevo, Duracion = DuracionNuevo, Puntaje = PuntajeNuevo, Descripcion = DescripcionNuevo
            };

            using (FinanciacionConText db = new FinanciacionConText()) {
                db.Emprendimientos.Add(e);
                db.SaveChanges();
            }
        }
Example #5
0
        public ActionResult cargarArchivo()
        {
            string       line;
            StreamReader file = new StreamReader(@"\solucionFinanciacion\EntidadDeNegocio\archivostexto\PRO3TEXTOEMPRENDIMIENTOS.txt");

            while ((line = file.ReadLine()) != null)
            {
                Char     delimiter  = '#';
                String[] substrings = line.Split(delimiter);

                double numero = 0;
                double.TryParse(substrings[1], out numero);

                int numero1 = 0;
                int.TryParse(substrings[2], out numero1);

                int numero2 = 0;
                int.TryParse(substrings[3], out numero2);

                Emprendimiento empre = new Emprendimiento
                {
                    Titulo      = substrings[0],
                    Costo       = numero,
                    Duracion    = numero1,
                    Puntaje     = numero2,
                    Descripcion = substrings[4]
                };
                db.Emprendimientos.Add(empre);
            }
            file.Close();
            db.SaveChanges();
            List <Emprendimiento> emp = Emprendimiento.buscarEmprenidmientos();

            return(View(emp.ToList()));
        }
Example #6
0
        public ActionResult DeleteConfirmed(int id)
        {
            Emprendimiento emprendimiento = db.Emprendimientos.Find(id);

            db.Emprendimientos.Remove(emprendimiento);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #7
0
 public ActionResult Edit([Bind(Include = "CodigoEmp_id,Titulo,Costo,Duracion,Puntaje,Descripcion")] Emprendimiento emprendimiento)
 {
     if (ModelState.IsValid)
     {
         db.Entry(emprendimiento).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(emprendimiento));
 }
Example #8
0
        public NuevoEmprendimiento GetEmprendimiento(string identificador)
        {
            SqlDataReader       dr = Emprendimiento.select_byId(identificador);
            NuevoEmprendimiento p  = null;

            if (dr != null && dr.Read())
            {
                p = cargarEmprendimiento(dr);
            }
            return(p);
        }
Example #9
0
        public ActionResult Create([Bind(Include = "CodigoEmp_id,Titulo,Costo,Duracion,Puntaje,Descripcion")] Emprendimiento emprendimiento)
        {
            if (ModelState.IsValid)
            {
                db.Emprendimientos.Add(emprendimiento);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(emprendimiento));
        }
Example #10
0
        public ActionResult empMontoDuracion(double monto1, double monto2, int duracion)
        {
            List <Emprendimiento> emp = new List <Emprendimiento>();

            if (monto1 >= 0 && monto2 >= 0 && duracion >= 0)
            {
                emp = Emprendimiento.buscarEmprendimientosFiltrados(monto1, monto2, duracion);
                return(View("ListarVista", emp));
            }
            return(View());
        }
        protected void btnSeleccionar_Click(object sender, EventArgs e)
        {
            int            CodId = Convert.ToInt32(ddlEmp.SelectedValue);
            Emprendimiento emp   = new Emprendimiento();

            if (emp.buscar(CodId))
            {
                grillaEmp.DataSource = Emprendimiento.mostrarEmprendimiento(emp);
                grillaEmp.DataBind();
                plcEvaluar.Visible = true;
            }
        }
Example #12
0
        public List <NuevoEmprendimiento> GetAll()
        {
            List <NuevoEmprendimiento> lst = new List <NuevoEmprendimiento>();
            SqlDataReader dr = Emprendimiento.select_All();

            while (dr.Read())
            {
                lst.Add(cargarEmprendimiento(dr));
            }

            return(lst);
        }
Example #13
0
        // GET: Emprendimientos/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Emprendimiento emprendimiento = db.Emprendimientos.Find(id);

            if (emprendimiento == null)
            {
                return(HttpNotFound());
            }
            return(View(emprendimiento));
        }
        protected void btnDarAlta_Click(object sender, EventArgs e)
        {
            string mensaje    = "No se pudo dar de alta.";
            string email      = txtEmail.Text;
            string contrasena = txtContrasena.Text;
            string rol        = "Postulante";
            string cedula     = txtCedula.Text;
            string nombre     = txtNombre.Text;

            if (email != "" && contrasena.Length >= 8 && cedula != "" && nombre != "")
            {
                if (Integrante.verificarIntegrante(cedula))
                {
                    Integrante inte = new Integrante()
                    {
                        Email      = email,
                        Contrasena = contrasena,
                        Rol        = rol,
                        Cedula     = cedula,
                        Nombre     = nombre,
                    };


                    string titulo      = txtTitulo.Text;
                    string descripcion = txtDescripcion.Text;
                    double costo       = -1;
                    if (txtCosto.Text != "")
                    {
                        costo = Convert.ToDouble(txtCosto.Text);
                    }
                    int tiempoEjec = -1;
                    if (txtTiempoEjec.Text != "")
                    {
                        tiempoEjec = Convert.ToInt32(txtTiempoEjec.Text);
                    }

                    if (titulo != "" && descripcion != "" && costo >= 0 && tiempoEjec > 0)
                    {
                        if (Emprendimiento.verificarEmprendimiento(titulo))
                        {
                            Emprendimiento em = new Emprendimiento()
                            {
                                Titulo          = titulo,
                                Descripcion     = descripcion,
                                Costo           = costo,
                                TiempoEjecucion = tiempoEjec,
                                Integrantes     = new List <Integrante>(),
                                Financiado      = false,
                            };

                            if (em != null && inte != null)
                            {
                                if (em.agregarIntegrante(inte))
                                {
                                    if (em.insertar())
                                    {
                                        Session["email"]       = email;
                                        Session["rol"]         = rol;
                                        Session["CodEm"]       = Integrante.buscarCodEm(email);
                                        mensaje                = "Se dio de alta correctamente.";
                                        btnDarAlta.Visible     = false;
                                        btnAgregarPost.Visible = true;
                                    }
                                }
                            }
                        }
                        else
                        {
                            mensaje += "\n El emprendimiento ya existe";
                        }
                    }
                    else
                    {
                        mensaje += "\n Ingrese datos del emprendimiento correctamente.";
                    }
                }
                else
                {
                    mensaje += "\n El integrante ya existe en un emprendimiento.";;
                }
            }
            else
            {
                mensaje += "\n Ingrese datos del postulante correctametne.";
            }


            lblMensaje.Text = mensaje;
        }
Example #15
0
        public ActionResult ListadoPorcentaje()
        {
            List <Emprendimiento> emp = Emprendimiento.buscarEmprenidmientos();

            return(View(emp.ToList()));
        }