示例#1
0
        public virtual void CopyValues(ClientProductRecord source)
        {
            if (source == null)
            {
                return;
            }

            Oid                = source.Oid;
            _oid_producto      = source.OidProducto;
            _oid_cliente       = source.OidCliente;
            _precio            = source.Precio;
            _facturacion_bulto = source.FacturacionBulto;
            _p_descuento       = source.PDescuento;
            _tipo_descuento    = source.TipoDescuento;
            _precio_compra     = source.PrecioCompra;
            _facturar          = source.Facturar;
            _fecha_validez     = source.FechaValidez;
        }
        internal void UpdateHistoria(Cliente parent)
        {
            foreach (ProductoCliente item in this)
            {
                if (item.IsNew)
                {
                    parent.Historia += Environment.NewLine +
                                       DateTime.Now.ToString() + " - " +
                                       String.Format(Resources.Messages.NUEVO_PRODUCTO_ASOCIADO,
                                                     item.Producto,
                                                     item.Precio.ToString("C5"),
                                                     AppContext.Principal.Identity.Name);
                }
                else if (item.IsDirty)
                {
                    ClientProductRecord obj = Session().Get <ClientProductRecord>(item.Oid);
                    if (item.Precio != obj.Precio)
                    {
                        parent.Historia += Environment.NewLine +
                                           DateTime.Now.ToString() + " - " +
                                           String.Format(Resources.Messages.EDITADO_PRODUCTO_ASOCIADO,
                                                         item.Producto,
                                                         item.Precio.ToString("C5"),
                                                         AppContext.Principal.Identity.Name);
                    }
                }
            }

            foreach (ProductoCliente item in DeletedList)
            {
                parent.Historia += Environment.NewLine +
                                   DateTime.Now.ToString() + " - " +
                                   String.Format(Resources.Messages.BORRADO_PRODUCTO_ASOCIADO,
                                                 item.Producto,
                                                 item.Precio.ToString("C5"),
                                                 AppContext.Principal.Identity.Name);
            }
        }
示例#3
0
        internal void Update(Product parent)
        {
            // if we're not dirty then don't update the database
            if (!this.IsDirty)
            {
                return;
            }

            OidProducto = parent.Oid;

            try
            {
                SessionCode = parent.SessionCode;
                ClientProductRecord obj = Session().Get <ClientProductRecord>(Oid);
                obj.CopyValues(Base.Record);
                Session().Update(obj);
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }

            MarkOld();
        }