예제 #1
0
        /// <summary>
        /// Guarda en la bd el objeto actual
        /// </summary>
        protected override bool SaveObject()
        {
            this.Datos.RaiseListChangedEvents = false;

            InventarioAlmacen temp = _entity.Clone();

            temp.ApplyEdit();

            // do the save
            try
            {
                _entity = temp.Save();
                _entity.ApplyEdit();


                //Decomentar si se va a mantener en memoria
                //_entity.BeginEdit();
                return(true);
            }
            catch (Exception ex)
            {
                PgMng.ShowInfoException(ex);
                return(false);
            }
            finally
            {
                this.Datos.RaiseListChangedEvents = true;
            }
        }
        public override void OpenEditForm()
        {
            InventarioAlmacenEditForm form = new InventarioAlmacenEditForm(ActiveOID, this);

            AddForm(form);
            _entity = form.Entity;
        }
 public override void DeleteObject(long oid)
 {
     if (ProgressInfoMng.ShowQuestion(moleQule.Face.Resources.Messages.DELETE_CONFIRM) == DialogResult.Yes)
     {
         InventarioAlmacen.Delete(oid);
         _action_result = DialogResult.OK;
     }
 }
예제 #4
0
 public InventarioAlmacenAddForm(InventarioAlmacen source, Form parent)
     : base(-1, parent)
 {
     InitializeComponent();
     _entity = source.Clone();
     _entity.BeginEdit();
     SetFormData();
     _mf_type = ManagerFormType.MFAdd;
 }
        public override void OpenAddForm()
        {
            InventarioAlmacenAddForm form = new InventarioAlmacenAddForm(this);

            AddForm(form);
            if (form.ActionResult == DialogResult.OK)
            {
                _entity = form.Entity;
            }
        }
        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)
                {
                    InventarioAlmacenList listA = InventarioAlmacenList.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)
                {
                    InventarioAlmacenList listD = InventarioAlmacenList.GetList(_filter_results);
                    listD.RemoveItem(ActiveOID);
                    _filter_results = listD.GetSortedList();
                }
                break;
            }

            RefreshSources();
            if (_entity != null)
            {
                Select(_entity.Oid);
            }
            _entity = null;
        }
예제 #7
0
 protected override void GetFormSourceData(long oid)
 {
     _entity = InventarioAlmacen.Get(oid);
     _entity.BeginEdit();
 }
예제 #8
0
 protected override void GetFormSourceData()
 {
     _entity = InventarioAlmacen.New();
     _entity.BeginEdit();
 }