public InvoiceUIForm(OutputInvoice invoice)
     : base(null)
 {
     InitializeComponent();
     _entity = invoice.Clone();
     _entity.BeginEdit();
     SetFormData();
 }
        /// <summary>
        /// Guarda en la bd el objeto actual
        /// </summary>
        protected override bool SaveObject()
        {
            this.Datos.RaiseListChangedEvents = false;

            // do the save
            try
            {
                if (_entity.AlbaranContado)
                {
                    PgMng.Message = Resources.Messages.COMPACTANDO_ALBARANES;
                }

                OutputInvoice temp = _entity.Clone();
                temp.ApplyEdit();
                _entity = temp.Save();
                _entity.ApplyEdit();

                return(true);
            }
            finally
            {
                this.Datos.RaiseListChangedEvents = true;
            }
        }