public SingleTipoHuella(TipoHuella reg)
        {
            InitializeComponent();
            tipoHuella = reg;
            this.DataContext = tipoHuella;

            btnActualizar.Visibility = Visibility.Visible;
            btnGuardar.Visibility = Visibility.Collapsed;
        }
Example #2
0
        public string Create(TipoHuella obj)
        {

            CreateDAC objDAC = new CreateDAC();
            if (objDAC.CreateRecord(obj) == true)
                return "Registro almacenado con éxito.";
            else
                return "No se pudo almacenar el regitro.";
        }
Example #3
0
        public bool UpdateRecord(TipoHuella obj, int idTipoHuella)
        {
            SqlConnection con = new SqlConnection(Info.sqlSet());
            SqlCommand cmd = new SqlCommand("SP_TipoHuella_Update", con);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@IdTipoHuella", idTipoHuella);
            cmd.Parameters.AddWithValue("@Clave", obj.Clave);
            cmd.Parameters.AddWithValue("@Descripcion", obj.Descripcion);
            con.Open();

            if (cmd.ExecuteNonQuery() > 0)
            {
                con.Close();
                return true;
            }
            else
            {
                con.Close();
                return false;
            }
        }
Example #4
0
        public List<TipoHuella> readTipoHuella()
        {
            List<TipoHuella> tipoHuellaList = new List<TipoHuella>();

            using (SqlConnection con = new SqlConnection(Info.sqlSet()))
            {
                SqlCommand cmd = new SqlCommand("SP_TipoHuella_SelectAll", con);
                cmd.CommandType = CommandType.StoredProcedure;

                con.Open();

                using (SqlDataReader reader = cmd.ExecuteReader())
                {
                    // Loop through each record.
                    while (reader.Read())
                    {
                        TipoHuella tmp = new TipoHuella();

                        tmp.IdTipoHuella = (reader.GetValue(0) != DBNull.Value) ? Convert.ToInt32(reader.GetValue(0)) : tmp.IdTipoHuella;
                        tmp.Clave = (reader.GetValue(1) != DBNull.Value) ? Convert.ToString(reader.GetValue(1)) : tmp.Clave;
                        tmp.Descripcion = (reader.GetValue(2) != DBNull.Value) ? Convert.ToString(reader.GetValue(2)) : tmp.Descripcion;

                        tipoHuellaList.Add(tmp);
                    }
                }

                con.Close();
            }

            return tipoHuellaList;
        }
Example #5
0
        public TipoHuella readOneTipoHuella(int idTipoHuella)
        {
            TipoHuella tipoHuella = new TipoHuella();

            using (SqlConnection con = new SqlConnection(Info.sqlSet()))
            {
                SqlCommand cmd = new SqlCommand("SP_TipoHuella_SelectRow", con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@IdTipoHuella", idTipoHuella);

                con.Open();

                using (SqlDataReader reader = cmd.ExecuteReader())
                {
                    // Loop through each record.
                    while (reader.Read())
                    {
                        TipoHuella tmp = new TipoHuella();

                        tmp.IdTipoHuella = (reader.GetValue(0) != DBNull.Value) ? Convert.ToInt32(reader.GetValue(0)) : tmp.IdTipoHuella;
                        tmp.Clave = (reader.GetValue(1) != DBNull.Value) ? Convert.ToString(reader.GetValue(1)) : tmp.Clave;
                        tmp.Descripcion = (reader.GetValue(2) != DBNull.Value) ? Convert.ToString(reader.GetValue(2)) : tmp.Descripcion;

                        tipoHuella = tmp;
                    }
                }

                con.Close();
            }

            return tipoHuella;
        }
Example #6
0
        public string Update(TipoHuella obj, int idTipoHuella)
        {

            UpdateDAC objDAC = new UpdateDAC();
            if (objDAC.UpdateRecord(obj, idTipoHuella) == true)
                return "Registro almacenado con éxito.";
            else
                return "No se pudo almacenar el regitro.";
        }