コード例 #1
0
ファイル: Emprendimiento.cs プロジェクト: castorms/Proyecto1
        protected static Emprendimiento CargarDatosDesdeReader2(IDataRecord fila)
        {
            Emprendimiento o = null;

            if (fila != null)
            {
                o = new Emprendimiento
                {
                    Identificador = fila.IsDBNull(fila.GetOrdinal("Emp_id")) ? "" : fila.GetString(fila.GetOrdinal("Emp_id")),
                };
            }
            return(o);
        }
コード例 #2
0
ファイル: Emprendimiento.cs プロジェクト: castorms/Proyecto1
        public static List <Emprendimiento> BuscarPorEvaluador(string cedula, string email)
        {
            List <Emprendimiento> empEv = Emprendimiento.FindAll();
            List <Evaluacion>     eva   = Evaluacion.FindAll();

            foreach (Evaluacion e in eva)
            {
                if (cedula == e.Cedula && email == e.Email && e.Estado == false)
                {
                    Emprendimiento emp = FindByIdentificador(e.Identificador);
                    empEv.Add(emp);
                }
            }
            return(empEv);
        }
コード例 #3
0
ファイル: Evaluacion.cs プロジェクト: castorms/Proyecto1
        public bool Disponible()
        {
            Emprendimiento emp     = Emprendimiento.FindByIdentificador(this.identificador);
            bool           bandera = true;

            if (emp != null)
            {
                if (emp.Evaluaciones.Count < 3)
                {
                    foreach (Evaluacion e in emp.Evaluaciones)
                    {
                        if (e.Cedula == this.cedula)
                        {
                            bandera = false;
                        }
                    }
                }
                else
                {
                    bandera = false;
                }
            }


            if (bandera)
            {
                Evaluacion ev = new Evaluacion
                {
                    Puntaje          = 0,
                    Justificacion    = "",
                    FechaRealizacion = DateTime.Now,
                    Identificador    = this.identificador,
                    Cedula           = this.cedula,
                    Email            = this.email,
                };
                emp.Evaluaciones.Add(ev);
            }

            return(bandera);
        }
コード例 #4
0
ファイル: Emprendimiento.cs プロジェクト: castorms/Proyecto1
        public static List <Emprendimiento> FindAll()
        {
            SqlConnection cn  = Conexion.CrearConexion();
            SqlCommand    cmd = new SqlCommand();

            cmd.CommandText = @"SELECT * FROM EMPRENDIMIENTO";

            cmd.Connection = cn;
            List <Emprendimiento> listaEmprendimiento = null;

            try
            {
                Conexion.AbrirConexion(cn);

                SqlDataReader dr = cmd.ExecuteReader();
                if (dr.HasRows)
                {
                    listaEmprendimiento = new List <Emprendimiento>();
                    while (dr.Read())
                    {
                        Emprendimiento e = CargarDatosDesdeReader(dr);
                        listaEmprendimiento.Add(e);
                    }
                }
                return(listaEmprendimiento);
            }
            catch (SqlException ex)
            {
                //
                System.Diagnostics.Debug.Assert(false, ex.Message);
                return(null);
            }
            finally
            {
                Conexion.CerrarConexion(cn);
            }
        }
コード例 #5
0
ファイル: Emprendimiento.cs プロジェクト: castorms/Proyecto1
        public static Emprendimiento FindByIdentificador(string identificador)
        {
            SqlConnection cn  = Conexion.CrearConexion();
            SqlCommand    cmd = new SqlCommand();

            cmd.CommandText = @"SELECT * FROM EMPRENDIMIENTO 
                                         WHERE Emp_id=@IDENTIFICADOR";
            cmd.Parameters.AddWithValue("@IDENTIFICADOR", identificador);
            cmd.Connection = cn;
            Emprendimiento Empre = null;

            try
            {
                Conexion.AbrirConexion(cn);

                SqlDataReader dr = cmd.ExecuteReader();
                if (dr.HasRows)
                {
                    Empre = new Emprendimiento();
                    while (dr.Read())
                    {
                        Emprendimiento m = CargarDatosDesdeReader2(dr);
                    }
                }
                return(Empre);
            }
            catch (SqlException ex)
            {
                System.Diagnostics.Debug.Assert(false, ex.Message);
                return(null);
            }
            finally
            {
                Conexion.CerrarConexion(cn);
            }
        }
コード例 #6
0
ファイル: Emprendimiento.cs プロジェクト: castorms/Proyecto1
        private static void MostrarTodosLosEmprendimiento()
        {
            Console.WriteLine("Lista de todas las personas:");

            MostrarEmprendimiento(Emprendimiento.FindAll());
        }