Exemplo n.º 1
0
 public override int buscarRegistros()
 {
     CamadaDados.Compra.TList_TpRequisicao lista =
         CamadaNegocio.Compra.TCN_TpRequisicao.Buscar(id_tprequisicao.Text,
                                                      ds_tprequisicao.Text,
                                                      tp_requisicao.SelectedValue != null ? tp_requisicao.SelectedValue.ToString() : string.Empty,
                                                      null);
     bsTpRequisicao_PositionChanged(this, new EventArgs());
     if (lista != null)
     {
         if (lista.Count > 0)
         {
             this.Lista = lista;
             bsTpRequisicao.DataSource = Lista;
         }
         else
         if ((vTP_Modo == Utils.TTpModo.tm_Standby) || (vTP_Modo == Utils.TTpModo.tm_busca))
         {
             bsTpRequisicao.Clear();
         }
         return(lista.Count);
     }
     else
     {
         return(0);
     }
 }
Exemplo n.º 2
0
        private void gTpRequisicao_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (gTpRequisicao.Columns[e.ColumnIndex].SortMode == DataGridViewColumnSortMode.NotSortable)
            {
                return;
            }
            if (bsTpRequisicao.Count < 1)
            {
                return;
            }
            PropertyDescriptorCollection lP = TypeDescriptor.GetProperties(new CamadaDados.Compra.TRegistro_TpRequisicao());

            CamadaDados.Compra.TList_TpRequisicao lComparer;
            SortOrder direcao = SortOrder.None;

            if ((gTpRequisicao.Columns[e.ColumnIndex].HeaderCell.SortGlyphDirection == SortOrder.None) ||
                (gTpRequisicao.Columns[e.ColumnIndex].HeaderCell.SortGlyphDirection == SortOrder.Descending))
            {
                lComparer = new CamadaDados.Compra.TList_TpRequisicao(lP.Find(gTpRequisicao.Columns[e.ColumnIndex].DataPropertyName, true), SortOrder.Ascending);
                foreach (DataGridViewColumn c in gTpRequisicao.Columns)
                {
                    c.HeaderCell.SortGlyphDirection = SortOrder.None;
                }
                direcao = SortOrder.Ascending;
            }
            else
            {
                lComparer = new CamadaDados.Compra.TList_TpRequisicao(lP.Find(gTpRequisicao.Columns[e.ColumnIndex].DataPropertyName, true), SortOrder.Descending);
                foreach (DataGridViewColumn c in gTpRequisicao.Columns)
                {
                    c.HeaderCell.SortGlyphDirection = SortOrder.None;
                }
                direcao = SortOrder.Descending;
            }
            (bsTpRequisicao.List as CamadaDados.Compra.TList_TpRequisicao).Sort(lComparer);
            bsTpRequisicao.ResetBindings(false);
            gTpRequisicao.Columns[e.ColumnIndex].HeaderCell.SortGlyphDirection = direcao;
        }