Example #1
0
        public string Eliminar(DInstruItems Instru_Item)
        {
            string        rpta   = "";
            SqlConnection SlqCon = new SqlConnection();

            try
            {
                string sp = "SpInstru_ItemEliminar";

                SlqCon.ConnectionString = Conexion.Cn;
                SqlCommand SqlCmd = new SqlCommand(sp, SlqCon);
                SqlCmd.CommandType = CommandType.StoredProcedure;

                SlqCon.Open();

                SqlCmd.Parameters.Add(new SqlParameter("@Instru", Instru_Item.Id_Instrumento));

                rpta = SqlCmd.ExecuteNonQuery() == 1 ? "OK" : "NO se Elimino el Registro";

                return(rpta);
            }
            catch (Exception ex)
            {
                rpta = ex.Message;
            }
            finally
            {
                if (SlqCon.State == ConnectionState.Open)
                {
                    SlqCon.Close();
                }
            }

            return(rpta);
        }
Example #2
0
        public DataTable ListarAsignados(DInstruItems Instru_Item)
        {
            DataTable     DtResultado = new DataTable();
            SqlConnection SlqCon      = new SqlConnection();

            try
            {
                string sp = "SpInstru_ItemListarAsociados";
                SlqCon.ConnectionString = Conexion.Cn;
                SqlCommand SqlCmd = new SqlCommand(sp, SlqCon);

                SlqCon.Open();
                SqlCmd.CommandType = CommandType.StoredProcedure;

                SqlDataAdapter SqlDat = new SqlDataAdapter(SqlCmd);
                SqlDat.SelectCommand.Parameters.Add(new SqlParameter("@Instru", Instru_Item.Id_Instrumento));

                SqlDat.Fill(DtResultado);
            }
            catch
            {
                DtResultado = null;
            }
            finally
            {
                if (SlqCon.State == ConnectionState.Open)
                {
                    SlqCon.Close();
                }
            }
            return(DtResultado);
        }
Example #3
0
        public string Insertar(DInstruItems Instru_Item)
        {
            string        rpta   = "";
            SqlConnection SlqCon = new SqlConnection();

            try
            {
                string sp = "SpInstru_ItemInsertar";
                SlqCon.ConnectionString = Conexion.Cn;
                SqlCommand SqlCmd = new SqlCommand(sp, SlqCon);
                SqlCmd.CommandType = CommandType.StoredProcedure;

                SlqCon.Open();

                //[Instanciando parĂ¡metro de Salida.]
                //SqlCmd.Parameters.Add(new SqlParameter("@id", 0));
                SqlCmd.Parameters.Add(new SqlParameter("@id", SqlDbType.Int, 8, Convert.ToString(ParameterDirection.Output))).Value = DBNull.Value;
                SqlCmd.Parameters.Add(new SqlParameter("@id_Instrumento", Instru_Item.Id_Instrumento));
                SqlCmd.Parameters.Add(new SqlParameter("@id_Item_Comp", Instru_Item.Id_Item_Comp));
                SqlCmd.Parameters.Add(new SqlParameter("@METODO", Instru_Item.Metodo));
                SqlCmd.Parameters.Add(new SqlParameter("@UNIDAD", Instru_Item.Unidad));
                SqlCmd.Parameters.Add(new SqlParameter("@RANGO", Instru_Item.Rango));
                SqlCmd.Parameters.Add(new SqlParameter("@RESOLUCION", Instru_Item.Resolucion));
                SqlCmd.Parameters.Add(new SqlParameter("@CRITERIO", Instru_Item.Criterio));

                rpta = SqlCmd.ExecuteNonQuery() == 1 ? "OK" : "NO se Ingreso el Registro";
            }
            catch (Exception ex)
            {
                rpta = ex.Message;
            }
            finally
            {
                if (SlqCon.State == ConnectionState.Open)
                {
                    SlqCon.Close();
                }
            }

            return(rpta);
        }