public void CopyValues(IDataReader source)
        {
            if (source == null)
            {
                return;
            }

            _record.CopyValues(source);

            _oid_store       = Format.DataReader.GetInt64(source, "OID_ALMACEN");
            _store           = Format.DataReader.GetString(source, "STORE");
            _store_id        = Format.DataReader.GetString(source, "STORE_ID");
            _cuenta_contable = Format.DataReader.GetString(source, "CUENTA_CONTABLE");
            _expedient       = Format.DataReader.GetString(source, "EXPEDIENTE");
            _n_factura       = Format.DataReader.GetString(source, "N_FACTURA");
            _fecha_factura   = Format.DataReader.GetDateTime(source, "FECHA_FACTURA");
            _acreedor        = Format.DataReader.GetString(source, "ACREEDOR");
            _id_batch        = Format.DataReader.GetString(source, "ID_BATCH");

            //Si no tiene expediente comprobamos si tiene el del gasto asociado
            _record.OidExpediente = (_record.OidExpediente == 0) ? Format.DataReader.GetInt64(source, "OID_EXPEDIENTE_GASTO") : _record.OidExpediente;
            _expedient            = (_expedient == string.Empty) ? Format.DataReader.GetString(source, "CODIGO_EXPEDIENTE_GASTO") : _expedient;
        }
        internal void Update(InputInvoice 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(moleQule.Resources.Messages.GENERIC_VALIDATION_ERROR);
            }

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

            long oid_exp_old = obj.OidExpediente;

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

            if ((OidExpediente != 0) && (parent.OidExpediente != OidExpediente))
            {
                Store.Expedient.Get(OidExpediente, false, true, parent.SessionCode);
            }

            if ((oid_exp_old != 0) && (OidExpediente != oid_exp_old))
            {
                Store.Expedient.Get(oid_exp_old, false, true, parent.SessionCode);

                InputDeliveryLineInfo ca = InputDeliveryLineInfo.Get(OidConceptoAlbaran, false);

                if (ca.OidExpediente != OidExpediente)
                {
                    InputDelivery albaran = InputDelivery.Get(ca.OidAlbaran, ETipoAcreedor.Todos, true, SessionCode);

                    albaran.Conceptos.GetItem(ca.Oid).OidExpediente = OidExpediente;

                    albaran.SaveAsChild();
                }
            }

            MarkOld();
        }