public PlanAnualSelectForm(Form parent, PlanAnualList lista)
     : base(true, parent, lista)
 {
     InitializeComponent();
     _view_mode   = molView.Select;
     DialogResult = DialogResult.Cancel;
 }
        protected new SortedBindingList <PlanAnualInfo> Localize(object value, string column_name)
        {
            SortedBindingList <PlanAnualInfo> list = null;
            PlanAnualList sourceList = null;

            switch (FilterType)
            {
            case IFilterType.None:
                if (List == null)
                {
                    MessageBox.Show(moleQule.Face.Resources.Messages.NO_RESULTS);
                    return(null);
                }
                sourceList = List;
                break;

            case IFilterType.Filter:
                if (FilteredList == null)
                {
                    MessageBox.Show(moleQule.Face.Resources.Messages.NO_RESULTS);
                    return(null);
                }
                sourceList = FilteredList;
                break;
            }

            FCriteria criteria = null;
            string    related  = "none";

            switch (column_name)
            {
            default:
            {
                criteria = GetCriteria(column_name, value, _operation);
            } break;
            }

            switch (related)
            {
            case "none":
            {
                list = sourceList.GetSortedSubList(criteria);
            } break;
            }

            if (list.Count == 0)
            {
                MessageBox.Show(moleQule.Face.Resources.Messages.NO_RESULTS);
                return(sourceList.GetSortedList());
            }

            DatosSearch.DataSource = list;
            DatosSearch.MoveFirst();

            AddFilterLabel(column_name, value);

            Tabla.Focus();

            return(list);
        }
        /// <summary>
        /// Toma la lista de bancos de la base de datos y rellena la tabla.
        /// </summary>
        protected override void RefreshMainData()
        {
            _lista = PlanAnualList.GetList(false);
            Bar.Grow("PlanAnuales");

            Datos_Planes.DataSource = PlanAnualList.SortList(_lista,
                                                             "Codigo",
                                                             this.GetGridSortDirection(Tabla));
            Bar.FillUp("Ordenar Lista");
        }
Exemplo n.º 4
0
        public PlanAnualMngForm(bool isModal, Form parent, PlanAnualList list)
            : base(isModal, parent, list)
        {
            InitializeComponent();
            SetView(molView.Normal);
            // Parche para poder abrir el formulario en modo diseño y no perder la configuracion de columnas
            DatosLocal_BS    = Datos;
            Tabla.DataSource = DatosLocal_BS;
            SetMainDataGridView(Tabla);
            Datos.DataSource = PlanAnualList.NewList().GetSortedList();

            base.SortProperty = Codigo.DataPropertyName;
        }
Exemplo n.º 5
0
        protected new SortedBindingList <PlanAnualInfo> Localize(FilterItem item)
        {
            SortedBindingList <PlanAnualInfo> list = null;
            PlanAnualList sourceList = null;

            switch (FilterType)
            {
            case IFilterType.None:
                if (List == null)
                {
                    MessageBox.Show(Face.Resources.Messages.NO_RESULTS);
                    return(null);
                }
                sourceList = List;
                break;

            case IFilterType.Filter:
                if (FilteredList == null)
                {
                    MessageBox.Show(Face.Resources.Messages.NO_RESULTS);
                    return(null);
                }
                sourceList = FilteredList;
                break;
            }

            if (item.FilterProperty == IFilterProperty.All)
            {
                FCriteria criteria = GetCriteria(string.Empty, item.Value, null, item.Operation);
                list = sourceList.GetSortedSubList(criteria, _properties_list);
            }
            else
            {
                FCriteria criteria = GetCriteria(item.Column, item.Value, null, item.Operation);
                list = sourceList.GetSortedSubList(criteria, _properties_list);
            }

            if (list.Count == 0)
            {
                MessageBox.Show(Face.Resources.Messages.NO_RESULTS);
                return(sourceList.GetSortedList());
            }

            DatosSearch.DataSource = list;
            DatosSearch.MoveFirst();

            AddFilterLabel(item);

            return(list);
        }
Exemplo n.º 6
0
        public override void UpdateList()
        {
            switch (_current_action)
            {
            case molAction.Add:
                if (_entity == null)
                {
                    return;
                }
                List.AddItem(_entity.GetInfo(false));
                if (FilterType == IFilterType.Filter)
                {
                    PlanAnualList listA = PlanAnualList.GetList(_filter_results);
                    listA.AddItem(_entity.GetInfo(false));
                    _filter_results = listA.GetSortedList();
                }
                break;

            case molAction.Edit:
            case molAction.Lock:
            case molAction.Unlock:
                if (_entity == null)
                {
                    return;
                }
                ActiveItem.CopyFrom(_entity);
                break;

            case molAction.Delete:
                if (ActiveItem == null)
                {
                    return;
                }
                List.RemoveItem(ActiveOID);
                if (FilterType == IFilterType.Filter)
                {
                    PlanAnualList listD = PlanAnualList.GetList(_filter_results);
                    listD.RemoveItem(ActiveOID);
                    _filter_results = listD.GetSortedList();
                }
                break;
            }

            _entity = null;
            RefreshSources();
        }
        /// <summary>
        /// Toma la lista de bancos de la base de datos y rellena la tabla.
        /// </summary>
        protected override void RefreshMainData()
        {
            Bar.Grow(string.Empty, "PlanAnual");

            _selected_oid = ActiveOID;

            switch (DataType)
            {
            case EntityMngFormTypeData.Default:
                List = PlanAnualList.GetList(false);
                break;

            case EntityMngFormTypeData.ByParameter:
                _sorted_list = List.GetSortedList();
                break;
            }
            Bar.Grow(string.Empty, "Lista de Productos");
        }
        /// <summary>
        /// Filtra la tabla
        /// </summary>
        /// <param name="oid">Identificar del elemento</param>
        protected override void Filter(object filtro)
        {
            _lista_filtrada = ((PlanAnualList)filtro).Clone();

            if (Filtros.SelectedTab != Filtros.TabPages["Advanced_TP"])
            {
                Filtros.SelectedTab = Filtros.TabPages["Advanced_TP"];
            }
            else
            {
                try
                {
                    Datos.DataSource =
                        PlanAnualList.SortList(_lista_filtrada, "Codigo", ListSortDirection.Ascending);
                }
                catch (Exception)
                {
                    Datos.DataSource = _lista;
                }
            }
        }
        /// <summary>
        /// Aplica el filtro correspondiente según la pestaña
        /// </summary>
        protected override void ApplyFilter()
        {
            switch (Filtros.SelectedTab.Name)
            {
            case "Todos_TP":
            {
                RefreshMainData();
            } break;

            case "Advanced_TP":
            {
                try
                {
                    Datos_Planes.DataSource =
                        PlanAnualList.SortList(_lista_filtrada, "Codigo", ListSortDirection.Ascending);
                }
                catch (Exception)
                {
                    Datos_Planes.DataSource = _lista;
                }
            } break;

            case "Nombre_TP":
            {
                try
                {
                    CriteriaEx criteria = PlanAnual.GetCriteria(PlanAnual.OpenSession());
                    criteria.AddStartsWith("Nombre", ActiveItem.Nombre[0].ToString());
                    _lista = PlanAnualList.GetList(criteria);
                    Datos_Planes.DataSource = PlanAnualList.SortList(_lista,
                                                                     "Codigo",
                                                                     ListSortDirection.Ascending);
                }
                catch (Exception)
                {
                    _lista = null;
                }
            } break;
            }
        }
        public override void RefreshSecondaryData()
        {
            if (EntityInfo != null)
            {
                _planes = PlanAnualList.GetList();
                Library.Quality.HComboBoxSourceList _combo_planes = new Library.Quality.HComboBoxSourceList(_planes);
                Datos_Planes.DataSource = _combo_planes;
                Bar.Grow();

                Library.Instruction.InstructorList empleados = Library.Instruction.InstructorList.GetList(false);

                Library.Instruction.InstructorList      responsables        = empleados.GetResponsablesList();
                Library.Instruction.HComboBoxSourceList _combo_responsables = new Library.Instruction.HComboBoxSourceList(responsables);
                Datos_Responsables.DataSource = _combo_responsables;
                Bar.Grow();

                Library.Instruction.InstructorList      auditores        = empleados.GetAuditoresList();
                Library.Instruction.HComboBoxSourceList _combo_auditores = new Library.Instruction.HComboBoxSourceList(auditores);
                Datos_Auditores.DataSource = _combo_auditores;
                Bar.Grow();

                UserList usuarios = UserList.GetList();
                Library.Application.HComboBoxSourceList _combo_usuarios = new Library.Application.HComboBoxSourceList(usuarios);
                Datos_Usuarios_Auditores.DataSource    = _combo_usuarios;
                Datos_Usuarios_Responsables.DataSource = _combo_usuarios;
                Bar.Grow();

                DepartamentoList departamentos = DepartamentoList.GetList();
                Library.Quality.HComboBoxSourceList _combo_departamentos = new Library.Quality.HComboBoxSourceList(departamentos);
                Datos_Departamentos_Auditores.DataSource    = _combo_departamentos;
                Datos_Departamentos_Responsables.DataSource = _combo_departamentos;
                Bar.Grow();

                _tipos_auditorias = TipoAuditoriaList.GetList();
                Bar.Grow();
            }
        }
        ///// <summary>Imprime la lista del objetos
        ///// <returns>void</returns>
        ///// </summary>
        //public override void PrintList()
        //{
        //    ClienteReportMng reportMng = new ClienteReportMng(AppContext.ActiveSchema);

        //    PlanAnualListRpt report = reportMng.GetPlanAnualListReport(PlanAnualList.GetList((IList<PlanAnualInfo>)Datos.List));

        //    if (report != null)
        //    {
        //        ReportViewer.SetReport(report);
        //        ReportViewer.ShowDialog();
        //    }
        //    else
        //    {
        //        MessageBox.Show(Resources.Messages.NO_DATA_REPORTS,
        //                        Labels.EMPTY_REPORT,
        //                        MessageBoxButtons.OK,
        //                        MessageBoxIcon.Exclamation);
        //    }
        //}

        #endregion

        #region Events

        private void PlanAnualMngForm_KeyPress(object sender, KeyPressEventArgs e)
        {
            DataGridViewColumn col;

            if (Tabla.CurrentCell == null)
            {
                if (Tabla.SortedColumn != null)
                {
                    col = Tabla.SortedColumn;
                }
                else
                {
                    col = Tabla.Columns[0];
                }
            }
            else
            {
                col = Tabla.Columns[Tabla.CurrentCell.ColumnIndex];
            }

            if (col.ValueType != null)
            {
                if (col.ValueType.Name == "Int32")
                {
                    return;
                }
                if (col.ValueType.Name == "Int64")
                {
                    return;
                }
                if (col.ValueType.Name == "Single")
                {
                    return;
                }
                if (col.ValueType.Name == "Double")
                {
                    return;
                }

                string     car      = e.KeyChar.ToString();
                CriteriaEx criteria = PlanAnual.GetCriteria(PlanAnual.OpenSession());

                criteria.AddStartsWith(col.DataPropertyName, car);

                // Buscamos las palabras que empiecen por el caracter
                PlanAnualList lista = PlanAnualList.GetList(criteria);
                SortedBindingList <PlanAnualInfo> list =
                    PlanAnualList.GetSortedList(lista, col.DataPropertyName, ListSortDirection.Ascending);

                int foundIndex;

                // Nos situamos en la primera aparicion de esa lista en la
                // que se muestra. Esto se hace pq se ha consultado la bd y no la lista actual
                // lo que puede dar lugar a inconsistencias si otro usuario a cambiado la bd
                foreach (PlanAnualInfo cli in list)
                {
                    foundIndex = Datos.IndexOf(cli);
                    if (foundIndex != -1)
                    {
                        Datos.Position = foundIndex;
                        break;
                    }
                }
            }
        }
        /// <summary>
        /// Selecciona un elemento de la tabla
        /// </summary>
        /// <param name="oid">Identificar del elemento</param>
        protected override void Select(long oid)
        {
            int foundIndex = Datos.IndexOf(PlanAnualList.GetList(false).GetItem(oid));

            Datos.Position = foundIndex;
        }