Beispiel #1
0
        /// <summary>
        /// cmdUpdate_Click runs when the Update Button is clicked
        /// </summary>
        /// <history>
        ///     [cnurse]	9/28/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        protected void cmdUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                if (Page.IsValid)
                {
                    DesktopModuleInfo objDesktopModule = new DesktopModuleInfo();

                    objDesktopModule.DesktopModuleID = DesktopModuleId;
                    objDesktopModule.ModuleName      = txtModuleName.Text;
                    objDesktopModule.FolderName      = txtFolderName.Text;
                    objDesktopModule.FriendlyName    = txtFriendlyName.Text;
                    if (objDesktopModule.FolderName == "")
                    {
                        objDesktopModule.FolderName = objDesktopModule.ModuleName;
                    }
                    objDesktopModule.Description = txtDescription.Text;
                    objDesktopModule.IsPremium   = chkPremium.Checked;
                    objDesktopModule.IsAdmin     = false;

                    if (!String.IsNullOrEmpty(txtVersion.Text))
                    {
                        objDesktopModule.Version = txtVersion.Text;
                    }
                    else
                    {
                        objDesktopModule.Version = Null.NullString;
                    }

                    if (!String.IsNullOrEmpty(txtBusinessClass.Text))
                    {
                        objDesktopModule.BusinessControllerClass = txtBusinessClass.Text;
                    }
                    else
                    {
                        objDesktopModule.BusinessControllerClass = Null.NullString;
                    }

                    if (!String.IsNullOrEmpty(txtCompatibleVersions.Text))
                    {
                        objDesktopModule.CompatibleVersions = txtCompatibleVersions.Text;
                    }
                    else
                    {
                        objDesktopModule.CompatibleVersions = Null.NullString;
                    }


                    DesktopModuleController objDesktopModules = new DesktopModuleController();

                    if (Null.IsNull(DesktopModuleId))
                    {
                        try
                        {
                            objDesktopModule.DesktopModuleID = objDesktopModules.AddDesktopModule(objDesktopModule);
                        }
                        catch
                        {
                            UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("AddModule.ErrorMessage", this.LocalResourceFile), ModuleMessageType.RedError);
                            return;
                        }
                    }
                    else
                    {
                        objDesktopModules.UpdateDesktopModule(objDesktopModule);
                    }

                    // delete old portal module assignments
                    objDesktopModules.DeletePortalDesktopModules(Null.NullInteger, objDesktopModule.DesktopModuleID);
                    // add new portal module assignments
                    if (objDesktopModule.IsPremium)
                    {
                        foreach (ListItem objListItem in ctlPortals.Assigned)
                        {
                            objDesktopModules.AddPortalDesktopModule(int.Parse(objListItem.Value), objDesktopModule.DesktopModuleID);
                        }
                    }
                    // update interfaces
                    UpdateModuleInterfaces(objDesktopModule.BusinessControllerClass);

                    Response.Redirect(EditUrl("desktopmoduleid", objDesktopModule.DesktopModuleID.ToString()), true);
                }
            }
            catch (Exception exc)  //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Beispiel #2
0
        /// <summary>
        /// cmdUpdate_Click runs when the Update LinkButton is clicked.
        /// It saves the current Site Settings
        /// </summary>
        /// <history>
        ///     [cnurse]	9/9/2004	Modified
        /// </history>
        protected void cmdUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                string strLogo;
                string strBackground;

                strLogo       = ctlLogo.Url;
                strBackground = ctlBackground.Url;

                double dblHostFee = 0;
                if (!String.IsNullOrEmpty(txtHostFee.Text))
                {
                    dblHostFee = double.Parse(txtHostFee.Text);
                }

                double dblHostSpace = 0;
                if (!String.IsNullOrEmpty(txtHostSpace.Text))
                {
                    dblHostSpace = double.Parse(txtHostSpace.Text);
                }

                int intPageQuota = 0;
                if (txtPageQuota.Text != "")
                {
                    intPageQuota = int.Parse(txtPageQuota.Text);
                }

                double intUserQuota = 0;
                if (txtUserQuota.Text != "")
                {
                    intUserQuota = int.Parse(txtUserQuota.Text);
                }

                int intSiteLogHistory = -1;
                if (!String.IsNullOrEmpty(txtSiteLogHistory.Text))
                {
                    intSiteLogHistory = int.Parse(txtSiteLogHistory.Text);
                }

                DateTime datExpiryDate = Null.NullDate;
                if (!String.IsNullOrEmpty(txtExpiryDate.Text))
                {
                    datExpiryDate = Convert.ToDateTime(txtExpiryDate.Text);
                }

                int intSplashTabId = Null.NullInteger;
                if (cboSplashTabId.SelectedItem != null)
                {
                    intSplashTabId = int.Parse(cboSplashTabId.SelectedItem.Value);
                }

                int intHomeTabId = Null.NullInteger;
                if (cboHomeTabId.SelectedItem != null)
                {
                    intHomeTabId = int.Parse(cboHomeTabId.SelectedItem.Value);
                }

                int intLoginTabId = Null.NullInteger;
                if (cboLoginTabId.SelectedItem != null)
                {
                    intLoginTabId = int.Parse(cboLoginTabId.SelectedItem.Value);
                }

                int intUserTabId = Null.NullInteger;
                if (cboUserTabId.SelectedItem != null)
                {
                    intUserTabId = int.Parse(cboUserTabId.SelectedItem.Value);
                }

                if (txtPassword.Attributes["value"] != null)
                {
                    txtPassword.Attributes["value"] = txtPassword.Text;
                }

                // update Portal info in the database
                PortalController objPortalController = new PortalController();
                //check only relevant fields altered
                if (!UserInfo.IsSuperUser)
                {
                    PortalInfo objPortal   = objPortalController.GetPortal(intPortalId);
                    bool       HostChanged = false;
                    if (dblHostFee != objPortal.HostFee)
                    {
                        HostChanged = true;
                    }
                    if (dblHostSpace != objPortal.HostSpace)
                    {
                        HostChanged = true;
                    }
                    if (intPageQuota != objPortal.PageQuota)
                    {
                        HostChanged = true;
                    }
                    if (intUserQuota != objPortal.UserQuota)
                    {
                        HostChanged = true;
                    }
                    if (intSiteLogHistory != objPortal.SiteLogHistory)
                    {
                        HostChanged = true;
                    }
                    if (datExpiryDate != objPortal.ExpiryDate)
                    {
                        HostChanged = true;
                    }
                    if (HostChanged)
                    {
                        throw new Exception();
                    }
                }

                objPortalController.UpdatePortalInfo(intPortalId, txtPortalName.Text, strLogo, txtFooterText.Text, datExpiryDate, optUserRegistration.SelectedIndex, optBannerAdvertising.SelectedIndex, cboCurrency.SelectedItem.Value, Convert.ToInt32(cboAdministratorId.SelectedItem.Value), dblHostFee, dblHostSpace, intPageQuota, (int)intUserQuota, ((cboProcessor.SelectedValue == "") ? "" : cboProcessor.SelectedItem.Text).ToString(), txtUserId.Text, txtPassword.Text, txtDescription.Text, txtKeyWords.Text, strBackground, intSiteLogHistory, intSplashTabId, intHomeTabId, intLoginTabId, intUserTabId, cboDefaultLanguage.SelectedValue, Convert.ToInt32(cboTimeZone.SelectedValue), txtHomeDirectory.Text);
                bool blnAdminSkinChanged = SkinChanged(SkinInfo.RootSkin, PortalId, SkinType.Admin, ctlAdminSkin.SkinSrc) || SkinChanged(SkinInfo.RootContainer, PortalId, SkinType.Admin, ctlAdminContainer.SkinSrc);

                //Dim objSkins As New UI.Skins.SkinController
                SkinController.SetSkin(SkinInfo.RootSkin, PortalId, SkinType.Portal, ctlPortalSkin.SkinSrc);
                SkinController.SetSkin(SkinInfo.RootContainer, PortalId, SkinType.Portal, ctlPortalContainer.SkinSrc);
                SkinController.SetSkin(SkinInfo.RootSkin, PortalId, SkinType.Admin, ctlAdminSkin.SkinSrc);
                SkinController.SetSkin(SkinInfo.RootContainer, PortalId, SkinType.Admin, ctlAdminContainer.SkinSrc);

                if (UserInfo.IsSuperUser)
                {
                    // delete old portal module assignments
                    DesktopModuleController objDesktopModules = new DesktopModuleController();
                    objDesktopModules.DeletePortalDesktopModules(intPortalId, Null.NullInteger);
                    // add new portal module assignments
                    foreach (ListItem objListItem in ctlDesktopModules.Assigned)
                    {
                        objDesktopModules.AddPortalDesktopModule(intPortalId, int.Parse(objListItem.Value));
                    }
                }

                // Redirect to this site to refresh only if admin skin changed
                if (blnAdminSkinChanged)
                {
                    Response.Redirect(Request.RawUrl, true);
                }
            }
            catch (Exception exc)  //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }