Ejemplo n.º 1
0
        /// <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)
        {
            Debug.ArgumentNotNull(e, "e");

            base.OnPreRender(e);

            IOrderDetailsView view = this.Page.Items["OrderDetailsView"] as IOrderDetailsView;

            Assert.IsNotNull(view, "Unable to render Order Field Editor. View cannot be null.");

            bool needsDataBind = false;

            foreach (DataField field in this.fieldEditorLeft.Fields.Concat(this.fieldEditorRight.Fields))
            {
                if (!field.ReadOnly && view.IsReadOnly)
                {
                    needsDataBind  = true;
                    field.ReadOnly = true;
                }

                if (field.Name == "State")
                {
                    needsDataBind  = true;
                    field.ReadOnly = field.ReadOnly && !view.CanReopenOrder;
                }
            }

            if (needsDataBind)
            {
                OrderStateList orderStateList           = this.fieldEditorLeft.Controls.Flatten <OrderStateList>().Concat(this.fieldEditorRight.Controls.Flatten <OrderStateList>()).SingleOrDefault();
                string         persistedValue           = null;
                bool           disableSubstateAnimation = false;

                if (orderStateList != null)
                {
                    persistedValue           = orderStateList.GetValue();
                    disableSubstateAnimation = orderStateList.DisableSubstateAnimation;
                }

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

                orderStateList = this.fieldEditorLeft.Controls.Flatten <OrderStateList>().Concat(this.fieldEditorRight.Controls.Flatten <OrderStateList>()).SingleOrDefault();

                if (orderStateList != null)
                {
                    orderStateList.SetValue(persistedValue);
                    orderStateList.DisableSubstateAnimation = disableSubstateAnimation;
                }
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SubstateListItemTemplate"/> class.
 /// </summary>
 /// <param name="owner">The owner.</param>
 public SubstateListItemTemplate(OrderStateList owner)
 {
     this.owner = owner;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ControlContainerContentTemplate"/> class.
 /// </summary>
 /// <param name="owner">The owner.</param>
 public ControlContainerContentTemplate(OrderStateList owner)
 {
     this.owner = owner;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ControlContainerContentTemplate"/> class.
 /// </summary>
 /// <param name="owner">The owner.</param>
 public ControlContainerContentTemplate(OrderStateList owner)
 {
     this.owner = owner;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SubstateListItemTemplate"/> class.
 /// </summary>
 /// <param name="owner">The owner.</param>
 public SubstateListItemTemplate(OrderStateList owner)
 {
     this.owner = owner;
 }