Ejemplo n.º 1
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            //Set AJAX timeout to 1 hr for large sites
            AJAX.GetScriptManager(Page).AsyncPostBackTimeout = timeout;

            _PortalDefault = PortalSettings.DefaultLanguage;
            defaultLanguageLabel.Language = PortalSettings.DefaultLanguage;
            defaultLanguageLabel.Visible  = true;

            if (!IsPostBack)
            {
                //Do not display SelectedFilesCount progress indicator.
                pageCreationProgressArea.ProgressIndicators &= ~ProgressIndicators.SelectedFilesCount;
            }
            pageCreationProgressArea.ProgressIndicators &= ~ProgressIndicators.TimeEstimated;
            pageCreationProgressArea.ProgressIndicators &= ~ProgressIndicators.TransferSpeed;

            pageCreationProgressArea.Localization.Total           = Localization.GetString("TotalLanguages", LocalResourceFile);
            pageCreationProgressArea.Localization.TotalFiles      = Localization.GetString("TotalPages", LocalResourceFile);
            pageCreationProgressArea.Localization.Uploaded        = Localization.GetString("TotalProgress", LocalResourceFile);
            pageCreationProgressArea.Localization.UploadedFiles   = Localization.GetString("Progress", LocalResourceFile);
            pageCreationProgressArea.Localization.CurrentFileName = Localization.GetString("Processing", LocalResourceFile);


            var pageList = GetTabsToLocalize(PortalId, Locale);

            PagesToLocalize.Text = pageList.Count.ToString(CultureInfo.InvariantCulture);
            if (pageList.Count == 0)
            {
                updateButton.Enabled = false;
            }
        }
Ejemplo n.º 2
0
 protected override void OnPreRender(EventArgs e)
 {
     //base.OnPreRender(e);
     //pHelp.Visible = false;
     pInit.Visible = false;
     GenerateAndRenderDemoData();
     if (_renderinfo.Template != null && !string.IsNullOrEmpty(_renderinfo.OutputString))
     {
         //Rendering was succesful.
         var lit = new LiteralControl(Server.HtmlDecode(_renderinfo.OutputString));
         Controls.Add(lit);
         var  mst = _renderinfo.Template.Manifest;
         bool editWitoutPostback = mst != null && mst.EditWitoutPostback;
         if (ModuleContext.PortalSettings.EnablePopUps && ModuleContext.IsEditable && editWitoutPostback)
         {
             AJAX.WrapUpdatePanelControl(lit, true);
         }
         _engine.IncludeMeta(Page);
     }
     if (LogContext.IsLogActive && !Debugger.IsAttached)
     {
         ClientResourceManager.RegisterScript(Page, Page.ResolveUrl("~/DesktopModules/OpenContent/js/opencontent.js"), FileOrder.Js.DefaultPriority);
         var json = JsonConvert.SerializeObject(LogContext.Current.ModuleLogs(ModuleContext.ModuleId));
         json = json.Replace("<script>", "*script*");
         json = json.Replace("</script>", "*/script*");
         StringBuilder logScript = new StringBuilder();
         //logScript.AppendLine("<script type=\"text/javascript\"> ");
         logScript.AppendLine("$(document).ready(function () { ");
         logScript.AppendLine("var logs = " + json + "; ");
         logScript.AppendLine("$.fn.openContent.printLogs(\"Module " + ModuleContext.ModuleId + " - " + ModuleContext.Configuration.ModuleTitle + "\", logs);");
         logScript.AppendLine("});");
         //logScript.AppendLine("</script>");
         Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "logScript" + ModuleContext.ModuleId, /*DotNetNuke.UI.Utilities.ClientAPI.EscapeForJavascript*/ (logScript.ToString()), true);
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Loads the possible settings, and selects the current values.
        /// </summary>
        public override void LoadSettings()
        {
            try
            {
                base.LoadSettings();

                ((ScriptManager)AJAX.ScriptManagerControl(this.Page)).Scripts.Add(new ScriptReference("Engage.Dnn.Events.JavaScript.EngageEvents.TemplatedDisplayOptions.combined.js", Assembly.GetExecutingAssembly().FullName));

                this.LoadBoundSettings(
                    this.DateRangeFromSettings.Start,
                    this.RangeStartDropDownList,
                    this.StartSpecificDatePicker,
                    this.StartWindowAmountTextBox,
                    this.StartWindowIntervalDropDownList);

                this.LoadBoundSettings(
                    this.DateRangeFromSettings.End,
                    this.RangeEndDropDownList,
                    this.EndSpecificDatePicker,
                    this.EndWindowAmountTextBox,
                    this.EndWindowIntervalDropDownList);

                this.RecordsPerPageTextBox.Value = this.RecordsPerPage;

                this.Load += (_, __) => this.DataBind();
                this.DateRangeValidator.ServerValidate += this.DateRangeValidator_ServerValidate;
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Ejemplo n.º 4
0
        private void LoadUpdatePanel()
        {
            AJAX.RegisterScriptManager();
            ScriptManager scriptManager = AJAX.GetScriptManager(this.Page);

            if (scriptManager != null)
            {
                scriptManager.EnablePartialRendering = true;
            }
            UpdatePanel updatePanel = new UpdatePanel();

            updatePanel.UpdateMode = UpdatePanelUpdateMode.Conditional;
            updatePanel.ID         = _Control.ID + "_UP";
            Control objContentTemplateContainer = updatePanel.ContentTemplateContainer;

            InjectMessageControl(objContentTemplateContainer);
            objContentTemplateContainer.Controls.Add(_Control);
            InjectModuleContent(updatePanel);
            System.Web.UI.WebControls.Image objImage = new System.Web.UI.WebControls.Image();
            objImage.ImageUrl      = "~/images/progressbar.gif";
            objImage.AlternateText = "ProgressBar";

            UpdateProgress updateProgress = new UpdateProgress();

            updateProgress.AssociatedUpdatePanelID = updatePanel.ID;
            updateProgress.ID = updatePanel.ID + "_Prog";
            updateProgress.ProgressTemplate = new UI.WebControls.LiteralTemplate(objImage);
            this.Controls.Add(updateProgress);
        }
        /// <summary>
        /// Handles the <see cref="RadGrid.ItemCreated"/> event of the <see cref="JobsGrid"/> control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="GridItemEventArgs"/> instance containing the event data.</param>
        private void JobsGrid_ItemCreated(object sender, GridItemEventArgs e)
        {
            var commandItem = e.Item as GridCommandItem;

            if (commandItem != null)
            {
                // control information from http://www.telerik.com/help/aspnet-ajax/grddefaultbehavior.html
                commandItem.FindControl("AddNewRecordButton").Visible = false;
                commandItem.FindControl("InitInsertButton").Visible   = false;
                commandItem.FindControl("RefreshButton").Visible      = false;
                commandItem.FindControl("RebindGridButton").Visible   = false;

                var tableHeaderResourceKey = commandItem.OwnerTableView == this.JobsGrid.MasterTableView
                    ? "JobsTableHeader"
                    : "ApplicationsTableHeader";

                var leftColumn = commandItem.FindControl("AddNewRecordButton").Parent;
                leftColumn.Controls.Add(new LiteralControl(this.Localize(tableHeaderResourceKey)));

                // from http://www.telerik.com/help/aspnet-ajax/grdexportwithajax.html
                AJAX.RegisterPostBackControl(commandItem.FindControl("ExportToExcelButton"));
                AJAX.RegisterPostBackControl(commandItem.FindControl("ExportToCsvButton"));
            }
            else
            {
                // control information from http://www.telerik.com/help/aspnet-ajax/grdaccessingdefaultpagerbuttons.html
                var pagerItem = e.Item as GridPagerItem;
                if (pagerItem != null)
                {
                    ((Label)pagerItem.FindControl("ChangePageSizeLabel")).Text = this.Localize("Change Page Size Label.Text");
                }
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.Init"/> event.
        /// </summary>
        /// <param name="e">An <see cref="T:System.EventArgs"/> object that contains the event data.</param>
        protected override void OnInit(EventArgs e)
        {
            if (!this.PermissionsService.CanManageEvents)
            {
                this.DenyAccess();
                return;
            }

            base.OnInit(e);
            AJAX.RegisterPostBackControl(this.SaveEventButton);
            AJAX.RegisterPostBackControl(this.SaveAndCreateNewEventButton);

            this.Load += this.Page_Load;
            this.SaveEventButton.Click             += this.SaveEventButton_Click;
            this.SaveAndCreateNewEventButton.Click += this.SaveAndCreateNewEventButton_Click;
            this.CancelButton.Click                        += this.CancelButtonClick;
            this.CancelGoHomeButton.Click                  += this.CancelGoHomeButton_Click;
            this.DeleteAction.Delete                       += this.DeleteAction_Delete;
            this.CreateAnotherEventLink.Click              += this.CreateAnotherEventLink_Click;
            this.RecurringCheckBox.CheckedChanged          += this.RecurringCheckbox_CheckedChanged;
            this.AllowRegistrationsCheckBox.CheckedChanged += this.AllowRegistrationsCheckBox_CheckedChanged;
            this.LimitRegistrationsCheckBox.CheckedChanged += this.LimitRegistrationsCheckBox_CheckedChanged;
            this.CapacityMetMessageRadioButtonList.SelectedIndexChanged += this.CapacityMetMessageRadioButtonList_SelectedIndexChanged;
            this.RecurrenceEditorValidator.ServerValidate   += this.RecurrenceEditorValidator_ServerValidate;
            this.UniqueCategoryNameValidator.ServerValidate += this.UniqueCategoryNameValidator_ServerValidate;
        }
Ejemplo n.º 7
0
        protected override void OnInit(EventArgs e)
        {
            this.Load += this.Page_Load;

            // LoadControlType();
            base.OnInit(e);

            // System.InvalidOperationException: The EnableScriptGlobalization property cannot be changed during async postbacks or after the Init event.
            if (!this.IsPostBack && AJAX.IsInstalled())
            {
                AJAX.RegisterScriptManager();
                var scriptManager = AJAX.GetScriptManager(this.Page);
                scriptManager.EnableScriptGlobalization = true;
                scriptManager.EnableScriptLocalization  = true;
            }

            this.teDescription.Width  = this.ItemEditDescriptionWidth;
            this.teDescription.Height = this.ItemEditDescriptionHeight;

            if (Engage.Utility.HasValue(this.VersionInfoObject.Url))
            {
                this.ctlUrlSelection.Url     = this.VersionInfoObject.Url;
                this.chkNewWindow.Checked    = this.VersionInfoObject.NewWindow;
                this.pnlUrlSelection.Visible = true;
                this.chkUrlSelection.Checked = true;
                this.UseUrls = true;
            }

            // TODO: should we allow NewWindow to work even if the URL option isn't chosen
        }
        protected override void OnInit(EventArgs e)
        {
            this.Load += this.Page_Load;

            AJAX.RegisterPostBackControl(btnUploadThumbnail);
            base.OnInit(e);
        }
Ejemplo n.º 9
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Page_Load runs when the control is loaded.
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [cnurse]	5/10/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        /// -----------------------------------------------------------------------------
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            try
            {
                //ensure portal signup is allowed
                if ((!IsHostMenu || UserInfo.IsSuperUser == false) && !Host.DemoSignup)
                {
                    Response.Redirect(Globals.NavigateURL("Access Denied"), true);
                }
                valEmail2.ValidationExpression = Globals.glbEmailRegEx;

                if (!Page.IsPostBack)
                {
                    //set the async timeout same with script time out
                    AJAX.GetScriptManager(Page).AsyncPostBackTimeout = 900;
                    BindTemplates();

                    if (UserInfo.IsSuperUser)
                    {
                        rowType.Visible         = true;
                        useCurrentPanel.Visible = true;
                        useCurrent.Checked      = true;
                        adminUserPanel.Visible  = false;

                        optType.SelectedValue = "P";
                    }
                    else
                    {
                        useCurrentPanel.Visible = false;
                        useCurrent.Checked      = false;
                        adminUserPanel.Visible  = true;

                        optType.SelectedValue = "C";

                        txtPortalAlias.Text = Globals.GetDomainName(Request) + @"/";
                        rowType.Visible     = false;
                        string strMessage = string.Format(Localization.GetString("DemoMessage", LocalResourceFile),
                                                          Host.DemoPeriod != Null.NullInteger ? " for " + Host.DemoPeriod + " days" : "",
                                                          Globals.GetDomainName(Request));
                        lblInstructions.Text        = strMessage;
                        lblInstructions.Visible     = true;
                        btnCustomizeHomeDir.Visible = false;
                    }

                    txtHomeDirectory.Text    = @"Portals/[PortalID]";
                    txtHomeDirectory.Enabled = false;
                    if (MembershipProviderConfig.RequiresQuestionAndAnswer)
                    {
                        questionRow.Visible = true;
                        answerRow.Visible   = true;
                    }
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            //Set AJAX timeout to 1 hr for large sites
            AJAX.GetScriptManager(Page).AsyncPostBackTimeout = timeout;

            _PortalDefault = PortalSettings.DefaultLanguage;
            defaultLanguageLabel.Language = PortalSettings.DefaultLanguage;
            defaultLanguageLabel.Visible  = true;

            if (!IsPostBack)
            {
                //Do not display SelectedFilesCount progress indicator.
                pageCreationProgressArea.ProgressIndicators &= ~ProgressIndicators.SelectedFilesCount;
            }

            pageCreationProgressArea.ProgressIndicators &= ~ProgressIndicators.TimeEstimated;
            pageCreationProgressArea.ProgressIndicators &= ~ProgressIndicators.TransferSpeed;

            pageCreationProgressArea.Localization.Total           = Localization.GetString("TotalLanguages", LocalResourceFile);
            pageCreationProgressArea.Localization.TotalFiles      = Localization.GetString("TotalPages", LocalResourceFile);
            pageCreationProgressArea.Localization.Uploaded        = Localization.GetString("TotalProgress", LocalResourceFile);
            pageCreationProgressArea.Localization.UploadedFiles   = Localization.GetString("Progress", LocalResourceFile);
            pageCreationProgressArea.Localization.CurrentFileName = Localization.GetString("Processing", LocalResourceFile);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Handles the loading of the module setting for this control
        /// </summary>
        public override void LoadSettings()
        {
            try {
                if (AJAX.IsInstalled())
                {
                    AJAX.RegisterScriptManager();
                }

                if (!IsPostBack)
                {
                    if (!Null.IsNull(Settings.EmployeeID))
                    {
                        comboEmployees.SelectByValue(Settings.EmployeeID);
                    }
                    else
                    {
                        comboEmployees.SelectedIndex = 0;
                    }

                    checkAutoTitle.Checked       = Settings.AutoTitle;
                    checkShowCurrentUser.Checked = Settings.ShowCurrentUser;
                    textPhotoWidth.Text          = Settings.PhotoWidth.ToString();
                }
            }
            catch (Exception ex) {
                Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
Ejemplo n.º 12
0
 protected override void OnInit(EventArgs e)
 {
     JavaScript.RequestRegistration(CommonJs.DnnPlugins);
     _cookie = string.Format("_Module_{0}_Survey_{1}_", ModuleId, ResultsVersion);
     AddActionHandler(SurveyActions_Click);
     AJAX.RegisterPostBackControl(SubmitSurveyButton);
     AJAX.RegisterPostBackControl(ExportToCsvButton);
     base.OnInit(e);
 }
Ejemplo n.º 13
0
        protected new void Page_Init(object sender, EventArgs e)
        {
            base.Page_Init(sender, e);

            if (AJAX.IsInstalled())
            {
                AJAX.RegisterPostBackControl(btnUpload);
            }
        }
        /// <summary>
        /// Raises the <see cref="Control.Init"/> event.
        /// </summary>
        /// <param name="e">An <see cref="EventArgs"/> object that contains the event data.</param>
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            this.Load += this.Page_Load;
            this.AddToCalendarButton.Click += this.AddToCalendarButton_Click;

            AJAX.RegisterPostBackControl(this.AddToCalendarButton);
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.Init"/> event.
        /// </summary>
        /// <param name="e">An <see cref="T:System.EventArgs"/> object that contains the event data.</param>
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            this.RegisterScripts();
            if (AJAX.IsInstalled())
            {
                AJAX.RegisterScriptManager();
            }
        }
Ejemplo n.º 16
0
 /// <summary>
 ///   ShowButton configures and displays a button
 /// </summary>
 /// <param name = "button">The button to configure</param>
 /// <param name = "command">The command name (amd key) of the button</param>
 private void ShowButton(LinkButton button, string command)
 {
     button.Visible = true;
     if (!string.IsNullOrEmpty(command))
     {
         button.Text = Utilities.GetLocalizedString(command);
     }
     AJAX.RegisterPostBackControl(button);
     _pnlButtons.Visible = true;
 }
Ejemplo n.º 17
0
 protected override void OnPreRender(EventArgs e)
 {
     //base.OnPreRender(e);
     //pHelp.Visible = false;
     try
     {
         engine.Render(Page);
     }
     catch (TemplateException ex)
     {
         RenderTemplateException(ex);
     }
     catch (InvalidJsonFileException ex)
     {
         RenderJsonException(ex);
     }
     catch (Exception ex)
     {
         LoggingUtils.ProcessModuleLoadException(this, ex);
     }
     GenerateAndRenderDemoData();
     if (_renderinfo.Template != null && !string.IsNullOrEmpty(_renderinfo.OutputString))
     {
         //Rendering was succesful.
         var lit = new LiteralControl(Server.HtmlDecode(_renderinfo.OutputString));
         Controls.Add(lit);
         var  mst = _renderinfo.Template.Manifest;
         bool editWitoutPostback = mst != null && mst.EditWitoutPostback;
         if (ModuleContext.PortalSettings.EnablePopUps && ModuleContext.IsEditable && editWitoutPostback)
         {
             AJAX.WrapUpdatePanelControl(lit, true);
         }
         try
         {
             engine.IncludeResourses(Page, this);
         }
         catch (Exception ex)
         {
             DotNetNuke.UI.Skins.Skin.AddModuleMessage(this, ex.Message, DotNetNuke.UI.Skins.Controls.ModuleMessage.ModuleMessageType.RedError);
         }
         //if (DemoData) pDemo.Visible = true;
     }
     if (LogContext.IsLogActive && !Debugger.IsAttached)
     {
         ClientResourceManager.RegisterScript(Page, Page.ResolveUrl("~/DesktopModules/OpenContent/js/opencontent.js"), FileOrder.Js.DefaultPriority);
         StringBuilder logScript = new StringBuilder();
         logScript.AppendLine("<script type=\"text/javascript\"> ");
         logScript.AppendLine("$(document).ready(function () { ");
         logScript.AppendLine("var logs = " + JsonConvert.SerializeObject(LogContext.Current.ModuleLogs(ModuleContext.ModuleId)) + "; ");
         logScript.AppendLine("$.fn.openContent.printLogs('Module " + ModuleContext.ModuleId + " - " + ModuleContext.Configuration.ModuleTitle + "', logs);");
         logScript.AppendLine("});");
         logScript.AppendLine("</script>");
         Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "logScript" + ModuleContext.ModuleId, logScript.ToString());
     }
 }
Ejemplo n.º 18
0
        protected override void OnInit(EventArgs e)
        {
            JavaScript.RequestRegistration(CommonJs.DnnPlugins);
            ClientAPI.RegisterClientReference(Page, ClientAPI.ClientNamespaceReferences.dnn);

            if (AJAX.IsEnabled())
            {
                ScriptManager.GetCurrent(Page).RegisterPostBackControl(UpdateParameterButton);
                ScriptManager.GetCurrent(Page).RegisterPostBackControl(UpdateButton);
            }
        }
Ejemplo n.º 19
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            cancelButton.Click += cancelButton_Click;
            updateButton.Click += updateButton_Click;

            LocalResourceFile = Localization.GetResourceFile(this, "LocalizePages.ascx");

            //Set AJAX timeout to 1 hr for large sites
            AJAX.GetScriptManager(Page).AsyncPostBackTimeout = timeout;
        }
        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.Init"/> event.
        /// </summary>
        /// <param name="e">An <see cref="T:System.EventArgs"/> object that contains the event data.</param>
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            Load += Page_Load;
            btnConfigure.Click += BtnConfigureClick;
            ddlChooseDisplayType.SelectedIndexChanged += DdlChooseDisplayTypeSelectedIndexChanged;

            if (AJAX.IsInstalled())
            {
                AJAX.RegisterScriptManager();
            }
        }
        /// <summary>
        /// Handles the <see cref="Control.Load"/> event of this control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void Page_Load(object sender, EventArgs e)
        {
            ((ScriptManager)AJAX.ScriptManagerControl(this.Page)).RegisterPostBackControl(this.ExportButton);

            if (!this.IsPostBack)
            {
                this.StartDatePicker.SelectedDate = DateTime.Today;
                this.EndDatePicker.SelectedDate   = DateTime.Today.AddDays(15);
            }

            this.StartDatePicker.Skin = this.EndDatePicker.Skin = ModuleSettings.CalendarSkin.GetValueAsStringFor(this);
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Handles the Page_Load event.
        /// </summary>
        /// <param name="e">Event arguments.</param>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (EnableAjax && AJAX.IsInstalled())
            {
                AJAX.RegisterScriptManager();
            }

            try
            {
                if (!IsPostBack)
                {
                    // load the data into the control the first time we hit this page

                    // check we have an item to lookup
                    if (ItemId != null)
                    {
                        // load the item
                        var item = GetItemWithDependencies(ItemId.Value);

                        if (item != null && CanEditItem(item))
                        {
                            ButtonDelete.Visible = CanDeleteItem(item);
                            LoadItem(item);
                        }
                        else
                        {
                            Response.Redirect(Globals.NavigateURL(), true);
                        }
                    }
                    else
                    {
                        ButtonDelete.Visible = false;
                        if (ModuleAuditControl != null)
                        {
                            ModuleAuditControl.Visible = false;
                        }

                        LoadNewItem();
                    }
                }
                else
                {
                    PostBack();
                }
            }
            catch (Exception ex)
            {
                Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
Ejemplo n.º 23
0
        /// <summary>Saves the passed Customer through the API</summary>
        /// <exception cref="Exception">Thrown when the call is not successful.</exception>
        /// <param name="customerToSave">The Customer to save.</param>
        /// <returns>True if it succeeds, false if it fails.</returns>
        public bool Save(Customer customerToSave)
        {
            string json = JsonConvert.SerializeObject(customerToSave);

            CallResults results = AJAX.CallAPI(CUSTOMER_API_URL, Constants.enumRESTVerb.PUT, json);

            if (!results.Success)
            {
                throw new Exception($"Error {System.Reflection.MethodBase.GetCurrentMethod().Name} - the error is {results.ErrorMessage}");
            }

            return(results.Success);
        }
Ejemplo n.º 24
0
        public static void RegisterScripts(Page page, Control ctl)
        {
            const string scriptKey = "initTriState";

            if (!ClientAPI.IsClientScriptBlockRegistered(page, scriptKey))
            {
                AJAX.RegisterScriptManager();
                JavaScript.RequestRegistration(CommonJs.jQuery);
                ClientAPI.RegisterClientScriptBlock(page, "dnn.permissiontristate.js");

                ClientAPI.RegisterStartUpScript(page, scriptKey, "<script type='text/javascript'>" + GetInitScript(ctl) + "</script>");
            }
        }
Ejemplo n.º 25
0
        /// <summary>Gets a customer order based on passed order id.</summary>
        /// <exception cref="Exception">Thrown when the call is not successful.</exception>
        /// <param name="orderId">Id of the order to get.</param>
        /// <returns>The CustomerOrder.</returns>
        public CustomerOrder GetByOrderId(int orderId)
        {
            CallResults results = AJAX.CallAPI($"{CUSTOMERORDER_API_URL}{orderId}", Constants.enumRESTVerb.GET);

            if (!results.Success)
            {
                throw new Exception($"Error {MethodBase.GetCurrentMethod().Name} - the error is {results.ErrorMessage}");
            }

            CustomerOrder order = JsonConvert.DeserializeObject <CustomerOrder>(results.Json);

            return(order);
        }
Ejemplo n.º 26
0
        /// <summary>Creates a new CustomerOrder through the API</summary>
        /// <exception cref="Exception">Thrown when the call is not successful.</exception>
        /// <param name="newOrder">NewCustomerOrder instance to create order from.</param>
        /// <returns>The uid of the newly created CustomerOrder.</returns>
        public int Create(NewCustomerOrder newOrder)
        {
            string json = JsonConvert.SerializeObject(newOrder);

            CallResults results = AJAX.CallAPI(CUSTOMERORDER_API_URL, Constants.enumRESTVerb.POST, json);

            if (!results.Success || !int.TryParse(results.Json, out int orderId))
            {
                throw new Exception($"Error {MethodBase.GetCurrentMethod().Name} - the error is {results.ErrorMessage}");
            }

            return(orderId);
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.Init"/> event.
        /// </summary>
        /// <param name="e">An <see cref="T:System.EventArgs"/> object that contains the event data.</param>
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            this.PreRender += this.Page_PreRender;
            this.AddToCalendarButton.Click += this.AddToCalendarButton_Click;
            this.EditButton.Click          += this.EditButton_Click;

            this.RegisterButton.CurrentEvent        = this.currentEvent;
            this.RegisterButton.ModuleConfiguration = this.ModuleConfiguration;
            this.RegisterButton.LocalResourceFile   = this.LocalResourceFile;

            AJAX.RegisterPostBackControl(this.AddToCalendarButton);
        }
        /// <summary>Gets all of the Stores for the group.</summary>
        /// <exception cref="Exception">Thrown when the call is not successful.</exception>
        /// <returns>A collection of all Stores for the group.</returns>
        public List <Store> GetAll()
        {
            CallResults results = AJAX.CallAPI(STORES_API_URL, Constants.enumRESTVerb.GET);

            if (!results.Success)
            {
                throw new Exception($"Error {System.Reflection.MethodBase.GetCurrentMethod().Name} - the error is {results.ErrorMessage}");
            }

            List <Store> stores = JsonConvert.DeserializeObject <List <Store> >(results.Json);

            return(stores);
        }
Ejemplo n.º 29
0
        /// <summary>Gets all headers.Gets all of the orders but does not include line items.</summary>
        /// <exception cref="Exception">Thrown when the call is not successful.</exception>
        /// <returns>List of Customer Orders.</returns>
        public List <CustomerOrder> GetAllHeaders()
        {
            CallResults results = AJAX.CallAPI(CUSTOMERORDER_API_URL, Constants.enumRESTVerb.GET);

            if (!results.Success)
            {
                throw new Exception($"Error {MethodBase.GetCurrentMethod().Name} - the error is {results.ErrorMessage}");
            }

            List <CustomerOrder> customerOrders = JsonConvert.DeserializeObject <List <CustomerOrder> >(results.Json);

            return(customerOrders);
        }
Ejemplo n.º 30
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            this.Load += this.ItemDisplayOptionsLoad;

            var moduleCssUrl = this.ResolveUrl("Module.css");

            PageBase.RegisterStyleSheet(this.Page, moduleCssUrl, true);

            if (AJAX.IsInstalled())
            {
                AJAX.RegisterScriptManager();
            }
        }