protected override void OnPreInit(EventArgs e)
        {
            try
            {
                LoadScriptManager();
                base.OnPreInit(e);
                if (!SecuredActionService.HasAccess("Entities/Opportunity/Add"))
                {
                    throw new RoleAccessDeniedException(Resources.SalesLogix.Error_NoAccess);
                }
                IDataService data = ApplicationContext.Current.Services.Get <IDataService>();
                if (data != null)
                {
                    VFSQuery.ConfigureVFS(data.GetConnectionString(), data.Server);
                }

                //Apply Page Properties
                PropertyConfigurationCollection pageProperties = new PropertyConfigurationCollection();
                pageProperties.Add("EntityTypeName", "Sage.Entity.Interfaces.IOpportunity, Sage.Entity.Interfaces", "");
                pageProperties.ApplyProperties(this);
                //Apply Template Properties
                PropertyConfigurationCollection templateProperties = new PropertyConfigurationCollection();
                templateProperties.Add("IncludeTaskPane", "False", "");
                templateProperties.ApplyProperties(this.Master);

                this.PageWorkItem.Services.AddNew <EntityFactoryContextService, IEntityContextService>();
                this.PageWorkItem.Services.Add <IWebDialogService>(new WebDialogService(this.PageWorkItem));
                this.PageWorkItem.Services.Add <IPageWorkItemLocator>(this.PageWorkItem);
                this.PageWorkItem.Services.AddNew <WebEntityBindingManager, IEntityBindingManager>();
                this.PageWorkItem.Services.AddNew <PanelRefreshService, IPanelRefreshService>();
            }
            catch (Exception ex)
            {
                HandleException(ex);
            }
        }
        protected override void OnPreInit(EventArgs e)
        {
            try
            {
                LoadScriptManager();
                base.OnPreInit(e);
                if (!SecuredActionService.HasAccess("Entities/Opportunity/Add"))
                {
                    throw new RoleAccessDeniedException(Resources.SalesLogix.Error_NoAccess);
                }
                IDataService data = ApplicationContext.Current.Services.Get<IDataService>();
                if(data != null)
                {
                    VFSQuery.ConfigureVFS(data.GetConnectionString(), data.Server);
                }

                //Apply Page Properties
                PropertyConfigurationCollection pageProperties = new PropertyConfigurationCollection();
                pageProperties.Add("EntityTypeName", "Sage.Entity.Interfaces.IOpportunity, Sage.Entity.Interfaces", "");
                pageProperties.ApplyProperties(this);
                //Apply Template Properties
                PropertyConfigurationCollection templateProperties = new PropertyConfigurationCollection();
                templateProperties.Add("IncludeTaskPane", "False", "");
                templateProperties.ApplyProperties(this.Master);

                this.PageWorkItem.Services.AddNew<EntityFactoryContextService, IEntityContextService>();
                this.PageWorkItem.Services.Add<IWebDialogService>(new WebDialogService(this.PageWorkItem));
                this.PageWorkItem.Services.Add<IPageWorkItemLocator>(this.PageWorkItem);
                this.PageWorkItem.Services.AddNew<WebEntityBindingManager, IEntityBindingManager>();
                this.PageWorkItem.Services.AddNew<PanelRefreshService, IPanelRefreshService>();

            }
            catch(Exception ex)
            {
                HandleException(ex);
            }
        }