protected override void EditLineAction()
        {
            if (Lines_BS.Current == null)
            {
                return;
            }

            OutputDeliveryLine cf = (OutputDeliveryLine)Lines_BS.Current;

            _cliente = Client_BS.Current as ClienteInfo;

            if (cf.OidPartida == 0)
            {
                DeliveryLineEditForm form = new DeliveryLineEditForm(ETipoProducto.Libres, _entity, _serie, _cliente, cf, this);

                if (form.ShowDialog(this) == DialogResult.OK)
                {
                    _entity.CalculateTotal();
                }
            }
            else
            {
                DeliveryLineEditForm form = new DeliveryLineEditForm(ETipoProducto.Almacen, _entity, _serie, _cliente, cf, this);

                if (form.ShowDialog(this) == DialogResult.OK)
                {
                    _entity.CalculateTotal();
                }
            }
        }
Ejemplo n.º 2
0
        internal void Update(OutputInvoice parent)
        {
            // if we're not dirty then don't update the database
            if (!this.IsDirty)
            {
                return;
            }

            this.OidFactura = parent.Oid;

            ValidationRules.CheckRules();

            if (!IsValid)
            {
                throw new iQValidationException(Library.Resources.Messages.GENERIC_VALIDATION_ERROR);
            }

            SessionCode = parent.SessionCode;
            OutputInvoiceLineRecord obj = Session().Get <OutputInvoiceLineRecord>(Oid);

            obj.CopyValues(Base.Record);
            Session().Update(obj);

            if (OidPartida == 0)
            {
                OutputDeliveries albaranes = OutputDeliveries.GetList(parent.GetAlbaranes(), true, true, parent.SessionCode);

                OutputDeliveryLine concepto = null;
                OutputDelivery     albaran  = null;

                foreach (OutputDelivery item in albaranes)
                {
                    albaran = item;

                    foreach (OutputDeliveryLine ca in item.Conceptos)
                    {
                        if (ca.Oid == OidConceptoAlbaran)
                        {
                            concepto = ca;
                            break;
                        }
                    }

                    if (concepto != null)
                    {
                        break;
                    }
                }

                if (concepto != null)
                {
                    concepto.CopyFrom(this);
                    albaran.CalculateTotal();
                }
            }

            MarkOld();
        }