コード例 #1
0
        public DataTable Seguridad_SQL(string equipo, string hdd, string macseguridad)
        {
            SqlDataReader Resultado;
            DataTable     Tabla  = new DataTable();
            SqlConnection SqlCon = new SqlConnection();

            try
            {
                SqlCon = Conexion_SQLSeguridad.getInstancia().Conexion_SeguridadSQL();
                SqlCommand Comando = new SqlCommand("Seguridad.SQL_Equipo", SqlCon);
                Comando.CommandType = CommandType.StoredProcedure;

                Comando.Parameters.Add("@Equipo_SQL", SqlDbType.VarChar).Value       = equipo;
                Comando.Parameters.Add("@HDD_SQL", SqlDbType.VarChar).Value          = hdd;
                Comando.Parameters.Add("@MacSeguridad_SQL", SqlDbType.VarChar).Value = macseguridad;

                SqlCon.Open();
                Resultado = Comando.ExecuteReader();
                Tabla.Load(Resultado);
                return(Tabla);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (SqlCon.State == ConnectionState.Open)
                {
                    SqlCon.Close();
                }
            }
        }
コード例 #2
0
 public static Conexion_SQLSeguridad getInstancia()
 {
     if (Con == null)
     {
         Con = new Conexion_SQLSeguridad();
     }
     return(Con);
 }
コード例 #3
0
        public string Guardar_DatosBasicos(Entidad_Equipos Obj)
        {
            string        Rpta   = "";
            SqlConnection SqlCon = new SqlConnection();

            try
            {
                SqlCon = Conexion_SQLSeguridad.getInstancia().Conexion_SeguridadSQL();
                SqlCommand Comando = new SqlCommand("Seguridad.LI_Equipos", SqlCon);
                Comando.CommandType = CommandType.StoredProcedure;

                //Datos Auxiliares
                Comando.Parameters.Add("@Auto", SqlDbType.Int).Value = Obj.Auto;

                ////Panel Datos Basicos
                Comando.Parameters.Add("@Equipo", SqlDbType.VarChar).Value        = Obj.Equipo;
                Comando.Parameters.Add("@HDD", SqlDbType.VarChar).Value           = Obj.HDD;
                Comando.Parameters.Add("@Mac_Seguridad", SqlDbType.VarChar).Value = Obj.Mac_Seguridad;
                Comando.Parameters.Add("@Tipo", SqlDbType.VarChar).Value          = Obj.Tipo;

                SqlCon.Open();
                Rpta = Comando.ExecuteNonQuery() == 1 ? "OK" : "Error al Realizar el Registro";
            }
            catch (Exception ex)
            {
                Rpta = ex.Message;
            }
            finally
            {
                if (SqlCon.State == ConnectionState.Open)
                {
                    SqlCon.Close();
                }
            }
            return(Rpta);
        }