예제 #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.IsPostBack)
     {
         LocalPropertiesContext.Initialize(this.Session);
     }
 }
 private void UpdateProfile()
 {
     this.CurrentProfile.LocalProperties.Clear();
     if (OptionsRadioButtonList.SelectedIndex == 0)
     {                   // Default [nothing]
     }
     else if (OptionsRadioButtonList.SelectedIndex == 1)
     {                   // Host file [blank]
         foreach (LocalPropertyLookup item in LocalPropertiesContext.Load())
         {
             item.DatacentreSuffix = string.Empty;
             this.CurrentProfile.LocalProperties.Add(item);
         }
     }
     else if (OptionsRadioButtonList.SelectedIndex == 2)
     {                   // Manual DNS [copy]
         foreach (LocalPropertyLookup item in LocalPropertiesContext.Get(this.Session))
         {
             this.CurrentProfile.LocalProperties.Add(item);
         }
     }
     else
     {
         throw new NotImplementedException();
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.CurrentProfile == null)
            {
                Navigator.RedirectToDefaultPage(this.Response);
            }

            if (!this.IsPostBack)
            {
                // Init Controls
                ITICLabel.Text               = this.CurrentProfile.ITICCode.Code;
                InfrastructureLabel.Text     = this.CurrentProfile.ITICCode.Infrastructure.Name;
                CapabilityLabel.Text         = this.CurrentProfile.ITICCode.Capability.Name;
                LogicalSystemGroupLabel.Text = this.CurrentProfile.ITICCode.LogicalSystemGroup.Name;
                FilenameLabel.Text           = this.CurrentProfile.Context.Name;

                // Check CheckBoxes
                if (this.CurrentProfile.LocalProperties.Count == 0)
                {
                    OptionsRadioButtonList.SelectedIndex = 0;
                    LocalPropertiesContext.Initialize(this.Session);
                }
                else if (this.CurrentProfile.LocalProperties.Count > 0 && this.CurrentProfile.LocalProperties.All((lp) => String.IsNullOrWhiteSpace(lp.DatacentreSuffix)))
                {
                    OptionsRadioButtonList.SelectedIndex = 1;
                    LocalPropertiesContext.Initialize(this.Session);
                }
                else
                {
                    OptionsRadioButtonList.SelectedIndex = 2;
                    if (this.CurrentProfile.LocalProperties.Count == 0)
                    {
                        this.CurrentProfile.LocalProperties = LocalPropertiesContext.Load();
                    }
                    LocalPropertiesContext.Initialize(this.Session, this.CurrentProfile.LocalProperties);
                }
                SetState();

                // Set initial State
                UIHelper.SetMessage(MessageImage, MessageLabel, MessageType.None, null);
            }
        }