public Institucions ObtenerPorRazonsocial(string razonSocial)
        {
            Institucions institucionencontrada = null;
            string       sql = "SELECT * FROM institucion WHERE Nombre=@razon";

            if (con == null)
            {
                con = new MySqlConnection(ConexionUtil.Cadena);
            }
            using (con)
            {
                con.Open();
                using (MySqlCommand com = new MySqlCommand(sql, con))
                {
                    com.Parameters.Add(new MySqlParameter("@razon", razonSocial));
                    using (MySqlDataReader resultado = com.ExecuteReader())
                    {
                        if (resultado.Read())
                        {
                            institucionencontrada = new Institucions()
                            {
                                Codigo = int.Parse(resultado["codigo"].ToString()),
                                RUC    = resultado["RUC"].ToString(),
                                Nombre = resultado["Nombre"].ToString(),
                            };
                        }
                    }
                }
            }
            return(institucionencontrada);
        }
Esempio n. 2
0
        public Institucions ObtenerInstitucionRUC(string ruc)
        {
            Institucions institucionRUC = null;

            institucionRUC = dao.ObtenerPorRuc(ruc);
            if (institucionRUC != null)
            {
                return(institucionRUC);
            }
            else
            {
                throw new FaultException <DataException>(new DataException()
                {
                    DataError = "La institucion con el RUC ingresado no existe"
                }, new FaultReason("Validation Failed"));
            }
        }
Esempio n. 3
0
        public Institucions ObtenerInstitucionRazon(string razon)
        {
            Institucions institucionRazon = null;

            institucionRazon = dao.ObtenerPorRazonsocial(razon);

            if (institucionRazon != null)
            {
                return(institucionRazon);
            }
            else
            {
                throw new FaultException <DataException>(new DataException()
                {
                    DataError = "La institucion con la Razon Social ingresad no existe"
                }, new FaultReason("Validation Failed"));
            }
        }