public SingleEmpleadoHuella(EmpleadoHuella reg)
        {
            InitializeComponent();
            empleadoHuella = reg;
            this.DataContext = empleadoHuella;

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

            CreateDAC objDAC = new CreateDAC();
            if (objDAC.CreateRecord(obj) == true)
                return "Registro almacenado con éxito.";
            else
                return "No se pudo almacenar el regitro.";
        }
Beispiel #3
0
        public string Update(EmpleadoHuella obj, int idEmpleadoHuella)
        {

            UpdateDAC objDAC = new UpdateDAC();
            if (objDAC.UpdateRecord(obj, idEmpleadoHuella) == true)
                return "Registro almacenado con éxito.";
            else
                return "No se pudo almacenar el regitro.";
        }
Beispiel #4
0
        public bool UpdateRecord(EmpleadoHuella obj, int idEmpleadoHuella)
        {
            SqlConnection con = new SqlConnection(Info.sqlSet());
            SqlCommand cmd = new SqlCommand("SP_EmpleadoHuella_Update", con);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@IdEmpleadoHuella", idEmpleadoHuella);
            cmd.Parameters.AddWithValue("@IdEmpleado", obj.IdEmpleado);
            cmd.Parameters.AddWithValue("@IdTipoHuella", obj.IdTipoHuella);
            cmd.Parameters.AddWithValue("@Huella", obj.Huella);
            con.Open();

            if (cmd.ExecuteNonQuery() > 0)
            {
                con.Close();
                return true;
            }
            else
            {
                con.Close();
                return false;
            }
        }
Beispiel #5
0
        public List<EmpleadoHuella> readEmpleadoHuella()
        {
            List<EmpleadoHuella> empleadoHuellaList = new List<EmpleadoHuella>();

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

                con.Open();

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

                        tmp.IdEmpleadoHuella = (reader.GetValue(0) != DBNull.Value) ? Convert.ToInt32(reader.GetValue(0)) : tmp.IdEmpleadoHuella;
                        tmp.IdEmpleado = (reader.GetValue(1) != DBNull.Value) ? Convert.ToInt32(reader.GetValue(1)) : tmp.IdEmpleado;
                        tmp.IdTipoHuella = (reader.GetValue(2) != DBNull.Value) ? Convert.ToInt32(reader.GetValue(2)) : tmp.IdTipoHuella;
                        tmp.Huella = (reader.GetValue(3) != DBNull.Value) ? Convert.ToString(reader.GetValue(3)) : tmp.Huella;

                        empleadoHuellaList.Add(tmp);
                    }
                }

                con.Close();
            }

            return empleadoHuellaList;
        }
Beispiel #6
0
        public EmpleadoHuella readOneEmpleadoHuella(int idEmpleadoHuella)
        {
            EmpleadoHuella empleadoHuella = new EmpleadoHuella();

            using (SqlConnection con = new SqlConnection(Info.sqlSet()))
            {
                SqlCommand cmd = new SqlCommand("SP_EmpleadoHuella_SelectRow", con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@IdEmpleadoHuella", idEmpleadoHuella);

                con.Open();

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

                        tmp.IdEmpleadoHuella = (reader.GetValue(0) != DBNull.Value) ? Convert.ToInt32(reader.GetValue(0)) : tmp.IdEmpleadoHuella;
                        tmp.IdEmpleado = (reader.GetValue(1) != DBNull.Value) ? Convert.ToInt32(reader.GetValue(1)) : tmp.IdEmpleado;
                        tmp.IdTipoHuella = (reader.GetValue(2) != DBNull.Value) ? Convert.ToInt32(reader.GetValue(2)) : tmp.IdTipoHuella;
                        tmp.Huella = (reader.GetValue(3) != DBNull.Value) ? Convert.ToString(reader.GetValue(3)) : tmp.Huella;

                        empleadoHuella = tmp;
                    }
                }

                con.Close();
            }

            return empleadoHuella;
        }