/// <summary>
        /// The method will be invoked when detail panel is loaded.
        /// The implementation can resolve current visiting Page from the conversation as (HttpContext.Current.Handler as Page).
        /// </summary>
        /// <param name="sender">The web page which contains the detail panel.</param>
        /// <param name="e">Callback event argument.</param>
        public override void OnLoad(IRequestHandler sender, DetailPanelPageEventArgs e)
        {
            if (this.UserExtensionDataForm != null)
            {
                Guid extensionDataTypeId = this.ResolveUserExtensionDataTypeId();
                this.UserExtensionDataForm.CreateDataInputForm(extensionDataTypeId);
            }

            if (this.OrganizationSelector != null)
            {
                this.RegisterClientAssociationBetweenOrganizationAndRole();

                this.OrganizationSelector.Domain = this.Domain;
                if (this.OrganizationSelector.SelectedOrganization != null)
                {
                    OrganizationObject organizationObject = this.OrganizationSelector.SelectedOrganization;
                    this.CreateRoleCheckBoxes(organizationObject);

                    IEnumerable<Guid> selectedRoleIds = this.ResolveSelectedRoleCheckBox(organizationObject);
                    this.SetRoleCheckBoxSelection(selectedRoleIds);
                }
            }
        }
        /// <summary>
        /// The method will be invoked when detail panel is loaded.
        /// The implementation can resolve current visiting Page from the conversation as (HttpContext.Current.Handler as Page).
        /// </summary>
        /// <param name="sender">The web page which contains the detail panel.</param>
        /// <param name="e">Callback event argument.</param>
        public override void OnLoad(IRequestHandler sender, DetailPanelPageEventArgs e)
        {
            if (this.ExtensionDataForm != null)
            {
                Guid extensionDataTypeId = this.ResolveExtensionDataTypeId();
                if (extensionDataTypeId == Guid.Empty)
                    this.ExtensionDataForm = null;
                else
                    this.ExtensionDataForm.CreateDataInputForm(extensionDataTypeId);
            }

            if (!sender.IsPostBack)
                this.BindParentHierarchyData();
        }
 /// <summary>
 /// The method will be invoked when the aggregate panel is initialized.
 /// </summary>
 /// <param name="sender">The sender which invokes the callback. It's a web page in web environment.</param>
 /// <param name="e">Callback event argument.</param>
 public virtual void OnInit(IRequestHandler sender, DetailPanelPageEventArgs e)
 {
 }
 /// <summary>
 /// The method will be invoked when detail panel is loaded.
 /// The implementation can resolve current visiting Page from the conversation as (HttpContext.Current.Handler as Page).
 /// </summary>
 /// <param name="sender">The web page which contains the detail panel.</param>
 /// <param name="e">Callback event argument.</param>
 public override void OnLoad(IRequestHandler sender, DetailPanelPageEventArgs e)
 {
     if (!sender.IsPostBack && this.DropDownListDomain != null)
     {
         this.DropDownListDomain.Items.Clear();
         this.DropDownListDomain.Items.Add(new WebControls.ListItem("", ""));
         IPlatformConfiguration platformConfiguration = SpringContext.Current.GetObject<IPlatformConfiguration>();
         foreach (OrganizationDomain domain in platformConfiguration.Domains)
             this.DropDownListDomain.Items.Add(new WebControls.ListItem(domain.Text, domain.Value));
     }
 }
        /// <summary>
        /// The method will be invoked when detail panel is loaded.
        /// The implementation can resolve current visiting Page from the conversation as (HttpContext.Current.Handler as Page).
        /// </summary>
        /// <param name="sender">The web page which contains the detail panel.</param>
        /// <param name="e">Callback event argument.</param>
        public override void OnLoad(IRequestHandler sender, DetailPanelPageEventArgs e)
        {
            if (!string.IsNullOrEmpty(this.DropDownListFieldMetadataType.SelectedValue))
            {
                FieldType fieldType = (FieldType)Enum.Parse(typeof(FieldType), this.DropDownListFieldMetadataType.SelectedValue);
                this.BuildFieldMetadataControl(fieldType);
            }

            ClientScripts.RegisterHeaderScriptInclude("~/resources/javascript/SelectionFieldMetadataControl.js");
        }
        /// <summary>
        /// Load organization types when the web page loaded
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public override void OnLoad(IRequestHandler sender, DetailPanelPageEventArgs e)
        {
            if (this.AssociatedAreaSelector != null)
                this.AssociatedAreaSelector.SetHierarchyType(platformConfiguration.AreaHierarchyTypeValue);

            if (!sender.IsPostBack && this.DropDownListOrganizationType != null)
            {
                IEnumerable<OrganizationTypeObject> organizationTypes = organizationApi.FindOrganizationTypes(new[] { authenticationContext.TempVariables["Domain.Value"] as string });
                this.DropDownListOrganizationType.Items.Clear();
                this.DropDownListOrganizationType.Items.Add("");

                foreach (OrganizationTypeObject organizationType in organizationTypes)
                    this.DropDownListOrganizationType.Items.Add(new ListItem(organizationType.Name, organizationType.OrganizationTypeId.ToString()));
            }

            if (this.ParentOrganizationSelector != null)
                this.ParentOrganizationSelector.Domain = authenticationContext.TempVariables["Domain.Value"] as string;

            if (this.OrganizationExtensionDataForm != null)
            {
                Guid extensionDataTypeId = this.ResolveOrganizationExtensionDataTypeId();
                this.OrganizationExtensionDataForm.CreateDataInputForm(extensionDataTypeId);
            }
        }
        /// <summary>
        /// When User call Create method in IDetailPanelPage,
        /// This method will be invoked, and help user do the pre-required conditions, setup parameters
        /// </summary>
        /// <returns></returns>
        public string Create()
        {
            Validate();
            setupArgs = new SetupApplicationContextVariablesEventArgs();
            detailPanelArgs = new DetailPanelPageEventArgs("", DetailPanelPageRenderModes.New);
            sender = new RequestHandlerMock();
            sender.isPostBack = true;
            IDetailPanelPage actualPanel = actual as IDetailPanelPage;
            actualPanel.SetupContextTempVariables(sender, setupArgs);
            actualPanel.OnInit(sender, detailPanelArgs);
            actualPanel.OnLoad(sender, detailPanelArgs);

            return actualPanel.Create();
        }
        /// <summary>
        /// When User call Update method in IDetailPanelPage,
        /// This method will be invoked, and help user do the pre-required conditions, setup parameters
        /// </summary>
        /// <param name="entityId"></param>
        public void Update(string entityId)
        {
            Validate();
            setupArgs = new SetupApplicationContextVariablesEventArgs();
            detailPanelArgs = new DetailPanelPageEventArgs(entityId, DetailPanelPageRenderModes.Update);
            sender = new RequestHandlerMock();
            sender.isPostBack = true;
            IDetailPanelPage actualPanel = actual as IDetailPanelPage;

            actualPanel.SetupContextTempVariables(sender, setupArgs);
            actualPanel.OnInit(sender, detailPanelArgs);
            actualPanel.OnLoad(sender, detailPanelArgs);

            actualPanel.Update(entityId);
        }
 /// <summary>
 /// When User call OnPreRender method in IDetailPanelPage,
 /// This method will be invoked, and help user do the pre-required conditions, setup parameters
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public void OnPreRender(IRequestHandler sender, DetailPanelPageEventArgs e)
 {
 }