示例#1
0
        internal void Update(Expedient parent)
        {
            this.RaiseListChangedEvents = false;

            parent.UpdateTotalesProductos(this, true);

            // update (thus deleting) any deleted child objects
            foreach (Batch obj in DeletedList)
            {
                obj.DeleteSelf(parent);
            }

            // now that they are deleted, remove them from memory too
            DeletedList.Clear();

            // add/update any current child objects
            foreach (Batch obj in this)
            {
                if (obj.IsNew)
                {
                    obj.Insert(parent);
                }
                else
                {
                    obj.Update(parent);
                }
            }

            this.RaiseListChangedEvents = true;
        }
示例#2
0
        public void Remove(Expedient expediente, Batch item)
        {
            base.Remove(item);
            if (expediente != null)
            {
                expediente.UpdateTotalesProductos(this, true);
            }

            //El stock inicial asociado se borra en el Delete
        }
示例#3
0
        /// <summary>
        /// Implementa Save_button_Click
        /// </summary>
        protected override void SubmitAction()
        {
            if (CurrentProducto == null)
            {
                _action_result = DialogResult.OK;
                return;
            }

            _entity.CopyFrom(_maquina, CurrentProducto, _expedient, true);
            _expedient.UpdateTotalesProductos(_expedient.Partidas, true);

            _action_result = DialogResult.OK;
        }
示例#4
0
        /// <summary>
        /// Implementa Save_button_Click
        /// </summary>
        protected override void SubmitAction()
        {
            if (Datos_ProductoProveedor.Current == null)
            {
                MessageBox.Show("Debe elegir un producto.",
                                Face.Resources.Labels.ADVISE_TITLE,
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Information);

                _action_result = DialogResult.Ignore;
                return;
            }

            if (_entity.KilosIniciales == 0 || _entity.BultosIniciales == 0)
            {
                MessageBox.Show("Es necesario poner el número de kilos y de bultos.",
                                Face.Resources.Labels.ADVISE_TITLE,
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Information);

                _action_result = DialogResult.Ignore;
                return;
            }

            _entity.CopyFrom(CurrentProductoProveedor, _expediente, true);

            if (_expediente.Partidas.Count == 1)
            {
                if (_expediente.TipoMercancia == string.Empty)
                {
                    _expediente.TipoMercancia = CurrentProductoProveedor.Producto;
                }
                else
                {
                    _expediente.TipoMercancia += "\n" + CurrentProductoProveedor.Producto;
                }
            }

            _expediente.UpdateTotalesProductos(_expediente.Partidas, true);

            _action_result = DialogResult.OK;
        }