Beispiel #1
0
 public VoidedDocumentsLine()
 {
     TotalAmount             = new PayableAmount();
     BillingPayments         = new List <BillingPayment>();
     AllowanceCharge         = new AllowanceCharge();
     TaxTotals               = new List <TaxTotal>();
     AccountingCustomerParty = new AccountingSupplierParty();
     BillingReference        = new BillingReference();
 }
        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.PreRender"/> event.
        /// </summary>
        /// <param name="e">An <see cref="T:System.EventArgs"/> object that contains the event data.</param>
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            AllowanceCharge allowanceCharge = this.DataItem as AllowanceCharge;

            Assert.IsNotNull(allowanceCharge, "AllowanceCharge cannot be null.");
            Order order = this.ublEntityResolvingStrategy.GetEntity(allowanceCharge.Alias) as Order;

            if (order != null)
            {
                bool needsDataBind = false;
                bool enabled       = this.ublEntityResolvingStrategy.GetSecurityChecker()(order);

                foreach (Field field in this.fieldEditorLeft.Fields.Union(this.fieldEditorRight.Fields))
                {
                    needsDataBind  = needsDataBind || (field.ReadOnly ^ (!enabled));
                    field.ReadOnly = !enabled;
                }

                this.fieldEditorLeft.DataBind();
                this.fieldEditorRight.DataBind();
            }
        }