Beispiel #1
0
        /// -----------------------------------------------------------------------------
        ///         ''' <summary>
        ///         ''' cmdUpdate_Click runs when the update button is clicked
        ///         ''' </summary>
        ///         ''' <remarks>
        ///         ''' </remarks>
        ///         ''' <history>
        ///         '''     [cnurse]	9/23/2004	Updated to reflect design changes for Help, 508 support
        ///         '''                       and localisation
        ///         ''' </history>
        ///         ''' -----------------------------------------------------------------------------
        public void cmdUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                if (Page.IsValid == true & ctlURL.Url != "")
                {
                    Link objLink = new Link();

                    // bind text values to object
                    objLink.ItemId        = itemId;
                    objLink.ModuleId      = ModuleId;
                    objLink.CreatedByUser = UserInfo.UserID;
                    objLink.CreatedDate   = DateTime.Now;
                    objLink.Title         = txtTitle.Text;
                    objLink.Url           = ctlURL.Url;

                    int refreshInterval = 0;

                    if (ctlURL.UrlType == "U")
                    {
                        refreshInterval = System.Convert.ToInt32(ddlGetContentInterval.SelectedValue);
                    }

                    objLink.RefreshInterval = refreshInterval;

                    if ((ddlViewOrderLinks.Items.Count > 0))
                    {
                        switch (ddlViewOrder.SelectedValue)
                        {
                        case "B":
                        {
                            objLink.ViewOrder = Convert.ToInt32(ddlViewOrderLinks.SelectedValue) - 1;
                            LinkController.UpdateViewOrder(objLink, -1, this.ModuleId);
                            break;
                        }

                        case "A":
                        {
                            objLink.ViewOrder = Convert.ToInt32(ddlViewOrderLinks.SelectedValue) + 1;
                            LinkController.UpdateViewOrder(objLink, 1, this.ModuleId);
                            break;
                        }

                        default:
                        {
                            objLink.ViewOrder = Null.NullInteger;
                            break;
                        }
                        }
                    }
                    else
                    {
                        objLink.ViewOrder = Null.NullInteger;
                    }

                    objLink.Description = txtDescription.Text;
                    objLink.GrantRoles  = ";";

                    foreach (ListItem cb in cblGrantRoles.Items)
                    {
                        if (cb.Selected)
                        {
                            objLink.GrantRoles += cb.Value + ";";
                        }
                    }

                    if (objLink.GrantRoles.Equals(";"))
                    {
                        objLink.GrantRoles += "0;";
                    }

                    // Create an instance of the Link DB component

                    if (Common.Utilities.Null.IsNull(itemId))
                    {
                        LinkController.AddLink(objLink);
                    }
                    else
                    {
                        LinkController.UpdateLink(objLink);
                    }

                    ModuleController.SynchronizeModule(ModuleId);

                    // url tracking
                    UrlController objUrls = new UrlController();
                    objUrls.UpdateUrl(PortalId, ctlURL.Url, ctlURL.UrlType, ctlURL.Log, ctlURL.Track, ModuleId, ctlURL.NewWindow);

                    // Redirect back to the portal home page
                    Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(), true);
                }
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }