示例#1
0
        public void agregarBus(Bus b)
        {
            Embus.Datos.DataBase bd = new Embus.Datos.DataBase();
            bd.connect();
            string sql = "agregarbusSP1";

            try
            {
                bd.CreateCommandSP(sql);

                bd.createParameter("@patente", System.Data.DbType.String, b.Patente);
                bd.createParameter("@id_marca_bus", System.Data.DbType.Int32, b.Id_marca_bus);
                bd.createParameter("@id_oficina", System.Data.DbType.Int32, b.Id_oficina);
                bd.createParameter("@apodo", System.Data.DbType.String, b.Apodo_bus);
                bd.createParameter("@capacidad", System.Data.DbType.Int32, b.Capacidad_bus);
                bd.createParameter("@estado", System.Data.DbType.Boolean, b.Estado_bus);
                DbDataReader dataReader = bd.Query();
                dataReader.Close();
                bd.Close();
            }
            catch (DataAccessException Ex)
            {
                throw new BusinessRulesException(Ex.Message);
            }
            catch (BusinessRulesException Ex)
            {
                throw new BusinessRulesException(Ex.Message);
            }
        }
示例#2
0
        public Contador GetNameCont(string rut_cont, string clave_cont)
        {
            Embus.Datos.DataBase bd = new Embus.Datos.DataBase();
            bd.connect();
            string sql = "SELECT NOM_CONT FROM CONTADOR WHERE RUT_CONT='" + rut_cont + "' AND CLAVE_CONT= '" + clave_cont + "'";

            bd.CreateCommand(sql);
            Contador     a;
            DbDataReader result = bd.Query();

            result.Read();
            a = new Contador(result.GetString(0));
            result.Close();
            bd.Close();
            return(a);
        }