Esempio n. 1
0
 public override int buscarRegistros()
 {
     CamadaDados.Fazenda.Cadastros.TList_Equipamento lista =
         CamadaNegocio.Fazenda.Cadastros.TCN_Equipamento.Buscar(cd_equipamento.Text,
                                                                cd_fazenda.Text,
                                                                tp_equipamento.SelectedValue != null ? tp_equipamento.SelectedValue.ToString() : string.Empty,
                                                                tp_conservacao.SelectedValue != null ? tp_conservacao.SelectedValue.ToString() : string.Empty,
                                                                null);
     if (lista != null)
     {
         if (lista.Count > 0)
         {
             this.Lista = lista;
             bsEquipamento.DataSource = lista;
         }
         else
         if ((vTP_Modo == Utils.TTpModo.tm_Standby) || (vTP_Modo == Utils.TTpModo.tm_busca))
         {
             bsEquipamento.Clear();
         }
         return(lista.Count);
     }
     else
     {
         return(0);
     }
 }
Esempio n. 2
0
        private void gEquipamento_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (gEquipamento.Columns[e.ColumnIndex].SortMode == DataGridViewColumnSortMode.NotSortable)
            {
                return;
            }
            if (bsEquipamento.Count < 1)
            {
                return;
            }
            PropertyDescriptorCollection lP = TypeDescriptor.GetProperties(new CamadaDados.Fazenda.Cadastros.TRegistro_Equipamento());

            CamadaDados.Fazenda.Cadastros.TList_Equipamento lComparer;
            SortOrder direcao = SortOrder.None;

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