Beispiel #1
0
        public List <C_Status> listarStatus()
        {
            List <C_Status> status = new List <C_Status>();

            if (con == null)
            {
                con = new conexion();
            }
            con.conectar();
            SqlCommand cmd = new SqlCommand("_sp_listarStatus", con.cnxn);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@idStatusPrincipal", id_statusPrincipal);
            SqlDataReader dr = cmd.ExecuteReader();

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    C_Status sts = new C_Status();
                    sts.id_status   = dr.GetInt32(0);
                    sts.descripcion = dr.GetString(1).Trim(new char[] { ' ' });

                    //sts.observacion = dr.GetString(2).Trim(new char[] { ' ' });
                    sts.id_statusPrincipal = dr.GetInt32(3);
                    status.Add(sts);
                }
            }
            con.desconectar();
            return(status);
        }
Beispiel #2
0
 private void cmbStatusPrincipal_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     Clases.C_Status sts = new Clases.C_Status();
     sts.id_statusPrincipal      = (int)cmbStatusPrincipal.SelectedValue;
     cmbStatus.ItemsSource       = sts.listarStatus();
     cmbStatus.DisplayMemberPath = "descripcion";
     cmbStatus.SelectedValuePath = "id_status";
 }