/// <summary>
        /// 获取菜单列表
        /// </summary>
        /// <param name="user">用户对象</param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public IEnumerable <Roles> GetList(string where, string orderBy, int pageIndex, int pageSize)
        {
            RolesBLL bll         = new RolesBLL();
            string   decodeWhere = Common.Base64ToString(where);
            string   newWhere    = Common.Where2Query <Roles>(decodeWhere);
            var      list        = bll.GetList(newWhere, orderBy, pageIndex, pageSize);

            return(list);
        }
示例#2
0
        private void BuscarButton_Click(object sender, EventArgs e)
        {
            var listado = new List <Roles>();

            if (!string.IsNullOrEmpty(InformacionTextBox.Text))
            {
                switch (FiltroComboBox.SelectedIndex)
                {
                case 0:
                    listado = RolesBLL.GetList(r => r.RolId == Utilitarios.ToInt(InformacionTextBox.Text));
                    break;

                case 1:
                    listado = RolesBLL.GetList(r => r.Nombre.Contains(InformacionTextBox.Text));
                    break;

                case 3:
                    listado = RolesBLL.GetList(r => r.Descripcion.Contains(InformacionTextBox.Text));
                    break;
                }
            }
            else
            {
                listado = RolesBLL.GetList(c => true);
            }

            if (FiltroCheckBox.Checked == true)
            {
                listado = RolesBLL.GetList(e => e.FechaCreacion.Date >= FechaDesdeDateTimePicker.Value.Date && e.FechaCreacion.Date <= FechaHastaDateTimePicker.Value.Date);
            }

            if (ActivoRadioButton.Checked == true)
            {
                listado = RolesBLL.GetList(e => e.esActivo == true);
            }

            if (InactivoRadioButton.Checked == true)
            {
                listado = RolesBLL.GetList(e => e.esActivo == false);
            }

            RolesDataGridView.DataSource = null;
            RolesDataGridView.DataSource = listado;
        }
        private void BuscarButton_Click(object sender, EventArgs e)
        {
            var lista = new List <Roles>();

            if (!string.IsNullOrWhiteSpace(FiltrarTextBox.Text))
            {
                switch (FiltrocomboBox.SelectedIndex)
                {
                case 0:     //RolId
                    lista = RolesBLL.GetList(r => r.RolId == Conversiones.ToInt(FiltrarTextBox.Text));
                    break;

                case 1:     //Descripcion
                    lista = RolesBLL.GetList(r => r.Descripcion.Contains(FiltrarTextBox.Text));
                    break;

                default:
                    break;
                }
            }
            else
            {
                lista = RolesBLL.GetList(r => true);
            }

            if (FiltroFechacheckBox.Checked == true)
            {
                lista = lista.Where(r => r.FechaCreacion.Date >= FechaDesdedateTimePicker.Value.Date && r.FechaCreacion.Date <= FechaHastadateTimePicker.Value.Date).ToList();
            }

            if (ActivosRadioButton.Checked == true)
            {
                lista = lista.Where(r => r.EsActivo == true).ToList();
            }

            if (InactivosRadioButton.Checked == true)
            {
                lista = lista.Where(r => r.EsActivo == false).ToList();
            }

            ConsultasDataGridView.DataSource = null;
            ConsultasDataGridView.DataSource = lista;
        }
        private void BuscarButton_Click(object sender, EventArgs e)
        {
            var listado = new List <Roles>();

            if (!string.IsNullOrEmpty(CriterioTextBox.Text))
            {
                switch (FiltroComboBox.SelectedIndex)
                {
                case 0:
                    listado = RolesBLL.GetList(e => e.RolID == int.Parse(CriterioTextBox.Text));
                    break;

                case 1:
                    listado = RolesBLL.GetList(e => e.DescripcionRol.Contains(CriterioTextBox.Text));
                    break;
                }
            }
            else
            {
                listado = RolesBLL.GetList(c => true);
            }

            if (UsarFechaCheckBox.Checked == true)
            {
                listado = RolesBLL.GetList(e => e.FechaCreacion.Date >= FechaDesdeDateTimePicker.Value.Date && e.FechaCreacion.Date <= FechaHastaDateTimePicker.Value.Date);
            }

            if (ActivoRadioButton.Checked == true)
            {
                listado = RolesBLL.GetList(e => e.esActivo == true);
            }

            if (InactivoRadioButton.Checked == true)
            {
                listado = RolesBLL.GetList(e => e.esActivo == false);
            }

            DatosDataGrid.DataSource = null;
            DatosDataGrid.DataSource = listado;
        }
示例#5
0
        private void BuscarButton_Click(object sender, EventArgs e)
        {
            var lista = new List <Roles>();


            if (FiltroActivoCheckBox.Checked)
            {
                if (TodosRadioButton.Checked)
                {
                    if (!String.IsNullOrWhiteSpace(CriterioTextBox.Text))
                    {
                        switch (FiltroComboBox.SelectedIndex)
                        {
                        case 0:     //para RolId
                            lista = RolesBLL.GetList(r => r.RolId == Utilidades.ToInt(CriterioTextBox.Text));
                            break;

                        case 1:     //para Descripcion
                            lista = RolesBLL.GetList(r => r.Descripcion.Contains(CriterioTextBox.Text));
                            break;

                        default:
                            break;
                        }
                    }
                    else
                    {
                        lista = RolesBLL.GetList(r => true);
                    }
                }

                else if (ActivosRadioButton.Checked)
                {
                    if (!String.IsNullOrWhiteSpace(CriterioTextBox.Text))
                    {
                        switch (FiltroComboBox.SelectedIndex)
                        {
                        case 0:     //para RolId
                            lista = RolesBLL.GetList(r => r.RolId == Utilidades.ToInt(CriterioTextBox.Text) && r.esActivo);
                            break;

                        case 1:     //para Descripcion
                            lista = RolesBLL.GetList(r => r.Descripcion.Contains(CriterioTextBox.Text.ToUpper()) && r.esActivo || r.Descripcion.Contains(CriterioTextBox.Text.ToLower()) && r.esActivo);
                            break;

                        default:
                            break;
                        }
                    }
                    else
                    {
                        lista = RolesBLL.GetList(r => r.esActivo);
                    }
                }

                else if (InactivosRadioButton.Checked)
                {
                    if (!String.IsNullOrWhiteSpace(CriterioTextBox.Text))
                    {
                        switch (FiltroComboBox.SelectedIndex)
                        {
                        case 0:     //para RolId
                            lista = RolesBLL.GetList(r => r.RolId == Utilidades.ToInt(CriterioTextBox.Text) && !r.esActivo);
                            break;

                        case 1:     //para Descripcion
                            lista = RolesBLL.GetList(r => r.Descripcion.Contains(CriterioTextBox.Text.ToUpper()) && !r.esActivo || r.Descripcion.Contains(CriterioTextBox.Text.ToLower()) && !r.esActivo);
                            break;

                        default:
                            break;
                        }
                    }
                    else
                    {
                        lista = RolesBLL.GetList(r => !r.esActivo);
                    }
                }
            }
            else
            {
                if (!String.IsNullOrWhiteSpace(CriterioTextBox.Text))
                {
                    switch (FiltroComboBox.SelectedIndex)
                    {
                    case 0:     //para RolId
                        lista = RolesBLL.GetList(r => r.RolId == Utilidades.ToInt(CriterioTextBox.Text));
                        break;

                    case 1:     //para Descripcion
                        lista = RolesBLL.GetList(r => r.Descripcion.Contains(CriterioTextBox.Text));
                        break;

                    default:
                        break;
                    }
                }
                else
                {
                    lista = RolesBLL.GetList(r => true);
                }
            }


            if (FiltroFechaCheckBox.Checked)
            {
                lista = RolesBLL.GetList(l => l.FechaCreacion >= DesdeDateTimePicker.Value && l.FechaCreacion <= HastaDateTimePicker.Value);
            }

            RolesConsultaDataGridView.DataSource = null;
            RolesConsultaDataGridView.DataSource = lista;
        }
示例#6
0
        private void BuscarButton_Click(object sender, EventArgs e)
        {
            var listado = new List <Roles>();

            if (!string.IsNullOrEmpty(CriterioTextBox.Text))
            {
                switch (FiltroComboBox.SelectedIndex)
                {
                case 0:
                    listado = RolesBLL.GetList(e => e.RolID == Conversiones.AEntero(CriterioTextBox.Text));
                    break;

                case 1:
                    listado = RolesBLL.GetList(e => e.DescripcionRol.Contains(CriterioTextBox.Text));
                    break;
                }
            }
            else
            {
                listado = RolesBLL.GetList(c => true);
            }

            if (UsarFechaCheckBox.Checked == true)
            {
                listado = RolesBLL.GetList(e => e.FechaCreacion.Date >= FechaDesdeDateTimePicker.Value.Date && e.FechaCreacion.Date <= FechaHastaDateTimePicker.Value.Date);
            }

            if (ActivoRadioButton.Checked == true)
            {
                listado = RolesBLL.GetList(e => e.esActivo == true);
            }

            if (InactivoRadioButton.Checked == true)
            {
                listado = RolesBLL.GetList(e => e.esActivo == false);
            }

            /*//ninguno seleccionado
             * if (UsarFechaCheckBox.Checked == false && CriterioTextBox.Text == string.Empty && TodosRadioButton.Checked == false && ActivoRadioButton.Checked == false && InactivoRadioButton.Checked == false)
             * {
             *  listado = RolesBLL.GetList(e => true);
             * }
             *
             * //De uno en uno
             * if (UsarFechaCheckBox.Checked != false && CriterioTextBox.Text == string.Empty && TodosRadioButton.Checked == false && ActivoRadioButton.Checked == false && InactivoRadioButton.Checked == false)
             * {
             *  listado = RolesBLL.GetList(e => e.FechaCreacion.Date >= FechaDesdeDateTimePicker.Value.Date && e.FechaCreacion.Date <= FechaHastaDateTimePicker.Value.Date);
             * }
             * if (UsarFechaCheckBox.Checked == false && CriterioTextBox.Text != string.Empty && TodosRadioButton.Checked == false && ActivoRadioButton.Checked == false && InactivoRadioButton.Checked == false)
             * {
             *  if (!string.IsNullOrEmpty(CriterioTextBox.Text))
             *  {
             *      switch (FiltroComboBox.SelectedIndex)
             *      {
             *          case 0:
             *              listado = RolesBLL.GetList(e => e.RolID == int.Parse(CriterioTextBox.Text));
             *              break;
             *
             *          case 1:
             *              listado = RolesBLL.GetList(e => e.DescripcionRol.Contains(CriterioTextBox.Text));
             *              break;
             *
             *      }
             *  }
             *  else
             *  {
             *      listado = RolesBLL.GetList(c => true);
             *  }
             * }
             * if (UsarFechaCheckBox.Checked == false && CriterioTextBox.Text == string.Empty && TodosRadioButton.Checked != false && ActivoRadioButton.Checked == false && InactivoRadioButton.Checked == false)
             * {
             *  listado = RolesBLL.GetList(e => e.esActivo == true || e.esActivo == false);
             * }
             * if (UsarFechaCheckBox.Checked == false && CriterioTextBox.Text == string.Empty && TodosRadioButton.Checked == false && ActivoRadioButton.Checked != false && InactivoRadioButton.Checked == false)
             * {
             *  listado = RolesBLL.GetList(e => e.esActivo == true);
             * }
             * if (UsarFechaCheckBox.Checked == false && CriterioTextBox.Text == string.Empty && TodosRadioButton.Checked == false && ActivoRadioButton.Checked == false && InactivoRadioButton.Checked != false)
             * {
             *  listado = RolesBLL.GetList(e => e.esActivo == false);
             * }
             *
             * //De dos en dos
             * //Empezando con Las fechas
             * if (UsarFechaCheckBox.Checked != false && CriterioTextBox.Text != string.Empty && TodosRadioButton.Checked == false && ActivoRadioButton.Checked == false && InactivoRadioButton.Checked == false)
             * {
             *  if (!string.IsNullOrEmpty(CriterioTextBox.Text))
             *  {
             *      switch (FiltroComboBox.SelectedIndex)
             *      {
             *          case 0:
             *              listado = RolesBLL.GetList(e => e.RolID == int.Parse(CriterioTextBox.Text) && e.FechaCreacion.Date >= FechaDesdeDateTimePicker.Value.Date && e.FechaCreacion.Date <= FechaHastaDateTimePicker.Value.Date);
             *              break;
             *
             *          case 1:
             *              listado = RolesBLL.GetList(e => e.DescripcionRol.Contains(CriterioTextBox.Text) && e.FechaCreacion.Date >= FechaDesdeDateTimePicker.Value.Date && e.FechaCreacion.Date <= FechaHastaDateTimePicker.Value.Date);
             *              break;
             *
             *      }
             *  }
             *  else
             *  {
             *      listado = RolesBLL.GetList(c => c.FechaCreacion.Date >= FechaDesdeDateTimePicker.Value.Date && c.FechaCreacion.Date <= FechaHastaDateTimePicker.Value.Date);
             *  }
             * }
             * if (UsarFechaCheckBox.Checked != false && CriterioTextBox.Text == string.Empty && TodosRadioButton.Checked != false && ActivoRadioButton.Checked == false && InactivoRadioButton.Checked == false)
             * {
             *  listado = RolesBLL.GetList(e => e.FechaCreacion.Date >= FechaDesdeDateTimePicker.Value.Date && e.FechaCreacion.Date <= FechaHastaDateTimePicker.Value.Date && e.esActivo == true || e.esActivo == false);
             * }
             * if (UsarFechaCheckBox.Checked != false && CriterioTextBox.Text == string.Empty && TodosRadioButton.Checked == false && ActivoRadioButton.Checked != false && InactivoRadioButton.Checked == false)
             * {
             *  listado = RolesBLL.GetList(e => e.FechaCreacion.Date >= FechaDesdeDateTimePicker.Value.Date && e.FechaCreacion.Date <= FechaHastaDateTimePicker.Value.Date && e.esActivo == true);
             * }
             * if (UsarFechaCheckBox.Checked != false && CriterioTextBox.Text == string.Empty && TodosRadioButton.Checked == false && ActivoRadioButton.Checked == false && InactivoRadioButton.Checked != false)
             * {
             *  listado = RolesBLL.GetList(e => e.FechaCreacion.Date >= FechaDesdeDateTimePicker.Value.Date && e.FechaCreacion.Date <= FechaHastaDateTimePicker.Value.Date || e.esActivo == false);
             * }
             *
             * //De dos en dos
             * //Con el criterio
             * if (UsarFechaCheckBox.Checked == false && CriterioTextBox.Text != string.Empty && TodosRadioButton.Checked != false && ActivoRadioButton.Checked == false && InactivoRadioButton.Checked == false)
             * {
             *  if (!string.IsNullOrEmpty(CriterioTextBox.Text) && TodosRadioButton.Checked == true)
             *  {
             *      switch (FiltroComboBox.SelectedIndex)
             *      {
             *          case 0:
             *              listado = RolesBLL.GetList(e => e.RolID == int.Parse(CriterioTextBox.Text) && e.esActivo == true || e.esActivo == false);
             *              break;
             *
             *          case 1:
             *              listado = RolesBLL.GetList(e => e.DescripcionRol.Contains(CriterioTextBox.Text) && e.esActivo == true || e.esActivo == false);
             *              break;
             *
             *      }
             *  }
             *
             *  else
             *  {
             *      listado = RolesBLL.GetList(c => c.esActivo == true || c.esActivo == false);
             *  }
             *
             * }
             *
             * if (UsarFechaCheckBox.Checked == false && CriterioTextBox.Text != string.Empty && TodosRadioButton.Checked == false && ActivoRadioButton.Checked != false && InactivoRadioButton.Checked == false)
             * {
             *  if (!string.IsNullOrEmpty(CriterioTextBox.Text) && ActivoRadioButton.Checked == true)
             *  {
             *      switch (FiltroComboBox.SelectedIndex)
             *      {
             *          case 0:
             *              listado = RolesBLL.GetList(e => e.RolID == int.Parse(CriterioTextBox.Text) && e.esActivo == true);
             *              break;
             *
             *          case 1:
             *              listado = RolesBLL.GetList(e => e.DescripcionRol.Contains(CriterioTextBox.Text) && e.esActivo == true);
             *              break;
             *
             *      }
             *  }
             *  else
             *  {
             *      listado = RolesBLL.GetList(c => c.esActivo == true);
             *  }
             * }
             *
             * if (UsarFechaCheckBox.Checked == false && CriterioTextBox.Text != string.Empty && TodosRadioButton.Checked == false && ActivoRadioButton.Checked == false && InactivoRadioButton.Checked != false)
             * {
             *  if (!string.IsNullOrEmpty(CriterioTextBox.Text) && InactivoRadioButton.Checked == true)
             *  {
             *      switch (FiltroComboBox.SelectedIndex)
             *      {
             *          case 0:
             *              listado = RolesBLL.GetList(e => e.RolID == int.Parse(CriterioTextBox.Text) && e.esActivo == false);
             *              break;
             *
             *          case 1:
             *              listado = RolesBLL.GetList(e => e.DescripcionRol.Contains(CriterioTextBox.Text) && e.esActivo == false);
             *              break;
             *
             *      }
             *  }
             *  else
             *  {
             *      listado = RolesBLL.GetList(c => c.esActivo == false);
             *  }
             * }
             *
             * //De tres en tres
             * //Con usar fechas y criterio
             * if (UsarFechaCheckBox.Checked != false && CriterioTextBox.Text != string.Empty && TodosRadioButton.Checked != false && ActivoRadioButton.Checked == false && InactivoRadioButton.Checked == false)
             * {
             *  if (!string.IsNullOrEmpty(CriterioTextBox.Text) && TodosRadioButton.Checked == true)
             *  {
             *      switch (FiltroComboBox.SelectedIndex)
             *      {
             *          case 0:
             *              listado = RolesBLL.GetList(e => e.RolID == int.Parse(CriterioTextBox.Text) && e.esActivo == true || e.esActivo == false && e.FechaCreacion.Date >= FechaDesdeDateTimePicker.Value.Date && e.FechaCreacion.Date <= FechaHastaDateTimePicker.Value.Date);
             *              break;
             *
             *          case 1:
             *              listado = RolesBLL.GetList(e => e.DescripcionRol.Contains(CriterioTextBox.Text) && e.esActivo == true || e.esActivo == false && e.FechaCreacion.Date >= FechaDesdeDateTimePicker.Value.Date && e.FechaCreacion.Date <= FechaHastaDateTimePicker.Value.Date);
             *              break;
             *
             *      }
             *  }
             *
             *  else
             *  {
             *      listado = RolesBLL.GetList(c => c.esActivo == true || c.esActivo == false && c.FechaCreacion.Date >= FechaDesdeDateTimePicker.Value.Date && c.FechaCreacion.Date <= FechaHastaDateTimePicker.Value.Date);
             *  }
             * }
             * if (UsarFechaCheckBox.Checked != false && CriterioTextBox.Text != string.Empty && TodosRadioButton.Checked == false && ActivoRadioButton.Checked != false && InactivoRadioButton.Checked == false)
             * {
             *  if (!string.IsNullOrEmpty(CriterioTextBox.Text) && ActivoRadioButton.Checked == true)
             *  {
             *      switch (FiltroComboBox.SelectedIndex)
             *      {
             *          case 0:
             *              listado = RolesBLL.GetList(e => e.RolID == int.Parse(CriterioTextBox.Text) && e.esActivo == true && e.FechaCreacion.Date >= FechaDesdeDateTimePicker.Value.Date && e.FechaCreacion.Date <= FechaHastaDateTimePicker.Value.Date);
             *              break;
             *
             *          case 1:
             *              listado = RolesBLL.GetList(e => e.DescripcionRol.Contains(CriterioTextBox.Text) && e.esActivo == true && e.FechaCreacion.Date >= FechaDesdeDateTimePicker.Value.Date && e.FechaCreacion.Date <= FechaHastaDateTimePicker.Value.Date);
             *              break;
             *
             *      }
             *  }
             *  else
             *  {
             *      listado = RolesBLL.GetList(c => c.esActivo == true && c.FechaCreacion.Date >= FechaDesdeDateTimePicker.Value.Date && c.FechaCreacion.Date <= FechaHastaDateTimePicker.Value.Date);
             *  }
             * }
             * if (UsarFechaCheckBox.Checked != false && CriterioTextBox.Text != string.Empty || CriterioTextBox.Text == string.Empty && FiltroComboBox.Text != string.Empty && TodosRadioButton.Checked == false && ActivoRadioButton.Checked == false && InactivoRadioButton.Checked != false)
             * {
             *  if (!string.IsNullOrEmpty(CriterioTextBox.Text) && InactivoRadioButton.Checked == true)
             *  {
             *      switch (FiltroComboBox.SelectedIndex)
             *      {
             *          case 0:
             *              listado = RolesBLL.GetList(e => e.RolID == int.Parse(CriterioTextBox.Text) && e.esActivo == false && e.FechaCreacion.Date >= FechaDesdeDateTimePicker.Value.Date && e.FechaCreacion.Date <= FechaHastaDateTimePicker.Value.Date);
             *              break;
             *
             *          case 1:
             *              listado = RolesBLL.GetList(e => e.DescripcionRol.Contains(CriterioTextBox.Text) && e.esActivo == false && e.FechaCreacion.Date >= FechaDesdeDateTimePicker.Value.Date && e.FechaCreacion.Date <= FechaHastaDateTimePicker.Value.Date);
             *              break;
             *
             *      }
             *  }
             *  else
             *  {
             *      MessageBox.Show("Pase por aqui lo ultimio.", "Pasando");
             *      listado = RolesBLL.GetList(c => c.esActivo == false && c.FechaCreacion.Date >= FechaDesdeDateTimePicker.Value.Date && c.FechaCreacion.Date <= FechaHastaDateTimePicker.Value.Date);
             *  }
             * }*/

            DatosDataGrid.DataSource = null;
            DatosDataGrid.DataSource = listado;
        }
        private void BuscarButton_Click(object sender, EventArgs e)
        {
            var lista = new List <Roles>();


            if (!string.IsNullOrWhiteSpace(CriterioTextBox.Text))
            {
                switch (FiltroComboBox.SelectedIndex)
                {
                case 0:    //todos
                    if (ActivosRadioButton.Checked == true)
                    {
                        lista = RolesBLL.GetList(r => r.esActivo == true);
                    }
                    else if (InactivosRadioButton.Checked == true)
                    {
                        lista = RolesBLL.GetList(r => r.esActivo == false);
                    }
                    else
                    {
                        lista = RolesBLL.GetList(lista => true);
                    }
                    break;

                case 1:     //RolesId

                    if (ActivosRadioButton.Checked == true)
                    {
                        lista = RolesBLL.GetList(r => r.RolId == Utilitarios.ToInt(CriterioTextBox.Text) && r.esActivo == true);
                    }
                    else if (InactivosRadioButton.Checked == true)
                    {
                        lista = RolesBLL.GetList(r => r.RolId == Utilitarios.ToInt(CriterioTextBox.Text) && r.esActivo == false);
                    }
                    else
                    {
                        lista = RolesBLL.GetList(r => r.RolId == Utilitarios.ToInt(CriterioTextBox.Text));
                    }
                    break;

                case 2:    //Descripcion
                    if (ActivosRadioButton.Checked == true)
                    {
                        lista = RolesBLL.GetList(r => r.Descripcion.Contains(CriterioTextBox.Text) && r.esActivo == true);
                    }
                    else if (InactivosRadioButton.Checked == true)
                    {
                        lista = RolesBLL.GetList(r => r.Descripcion.Contains(CriterioTextBox.Text) && r.esActivo == false);
                    }
                    else
                    {
                        lista = RolesBLL.GetList(r => r.Descripcion.Contains(CriterioTextBox.Text));
                    }
                    break;
                }
            }
            else
            {
                if (ActivosRadioButton.Checked == true)
                {
                    lista = RolesBLL.GetList(r => r.esActivo == true);
                }
                else if (InactivosRadioButton.Checked == true)
                {
                    lista = RolesBLL.GetList(r => r.esActivo == false);
                }
                else
                {
                    lista = RolesBLL.GetList(lista => true);
                }
            }

            if (UsarFiltroFechascheckBox.Checked == true)
            {
                lista = lista.Where(c => c.FechaCreacion.Date >= DesdeDateTimePicker.Value.Date && c.FechaCreacion.Date <= HastaFechaDateTimePicker.Value.Date).ToList();
            }

            ConsultaRolesDataGridView.DataSource = null;
            ConsultaRolesDataGridView.DataSource = lista;
        }