コード例 #1
0
        public override void DeleteObject(long oid)
        {
            ExpedientInfo exp = ExpedientInfo.Get(oid, false);

            exp.LoadChilds(typeof(Batch), false, true);
            if (exp.Partidas.Count > 0)
            {
                MessageBox.Show("El expediente tiene productos asociados",
                                moleQule.Face.Resources.Labels.ADVISE_TITLE,
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);

                _action_result = DialogResult.Ignore;
                return;
            }

            exp.LoadChilds(typeof(Maquinaria), false, true);
            if (exp.Maquinarias != null && exp.Maquinarias.Count > 0)
            {
                MessageBox.Show("El expediente tiene maquinas asociadas",
                                moleQule.Face.Resources.Labels.ADVISE_TITLE,
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);

                _action_result = DialogResult.Ignore;
                return;
            }

            Expedient.Delete(oid);
            _action_result = DialogResult.OK;

            ExpedienteList cache = Cache.Instance.Get(typeof(ExpedienteList)) as ExpedienteList;

            if (cache != null)
            {
                cache.RemoveItem(oid);
            }

            //Se eliminan todos los formularios de ese objeto
            foreach (EntityDriverForm form in _list_active_form)
            {
                if (form is ItemMngBaseForm)
                {
                    if (((ItemMngBaseForm)form).Oid == oid)
                    {
                        form.Dispose();
                        break;
                    }
                }
            }
        }
コード例 #2
0
        public override void UpdateList()
        {
            switch (_current_action)
            {
            case molAction.Add:
            case molAction.Copy:
                if (_entity == null)
                {
                    return;
                }
                List.AddItem(_entity.GetInfo(false));
                if (FilterType == IFilterType.Filter)
                {
                    ExpedienteList listA = ExpedienteList.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)
                {
                    ExpedienteList listD = ExpedienteList.GetList(_filter_results);
                    listD.RemoveItem(ActiveOID);
                    _filter_results = listD.GetSortedList();
                }
                break;
            }

            RefreshSources();
            if (_entity != null)
            {
                Select(_entity.Oid);
            }
            _entity = null;
        }