protected void rptrTemplates_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     if (e.CommandName.Equals("Activate"))
     {
         int TemplateID = int.Parse(e.CommandArgument.ToString());
         Label lbl = (Label)e.Item.FindControl("lblTemplateTitle");
         SettingProvider sageSP = new SettingProvider();
         sageSP.SaveSageSetting(SettingType.SiteAdmin.ToString(), SageFrameSettingKeys.PortalCssTemplate, lbl.Text, GetUsername, GetPortalID.ToString());
         SageFrameConfig sfConfig = new SageFrameConfig();
         sfConfig.ResetSettingKeys(GetPortalID);
         BindTemplate();
     }
     else if (e.CommandName.Equals("DeleteTemplate"))
     {
         string[] args = e.CommandArgument.ToString().Split('_');
         string templateName = args[0];
         if (templateName.ToLower() == "default")
         {
             ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("TemplateManagement", "TemplateCannotDeleted"), "", SageMessageType.Alert);
         }
         else
         {
             if (DeleteTemplate(Int32.Parse(args[1].ToString())))
             {
                 string templateFolderPath = HttpContext.Current.Server.MapPath("~/") + "Templates\\" + args[0];
                 DeleteDirectory(templateFolderPath);
                 BindTemplate();
                 PanelVisibility(false, true);
             }
         }
     }
 }
        private void SaveProtal()
        {
            try
            {
                string newpassword = GetRandomPassword(6);
                int passowrdformat = 2;
                string password;

                int? customerID = 0;
                string passwordsalt, portalUrl;
                string portalName = txtPortalName.Text.Trim().Replace(" ", "_");
                if (IsUseFriendlyUrls)
                {
                    portalUrl = Request.ServerVariables["SERVER_NAME"] + "/portal/" + portalName + "/" + "home.aspx";
                }
                else
                {
                    portalUrl = Request.ServerVariables["SERVER_NAME"] + "/portal/" + "home";
                }

                if (!(string.IsNullOrEmpty(txtPortalName.Text.Trim())))
                {
                    if (Int32.Parse(hdnPortalID.Value) > 0)
                    {
                        dbPortal.sp_PortalUpdate(Int32.Parse(hdnPortalID.Value), txtPortalName.Text.Trim(), false,
                                                 GetUsername);
                        ShowMessage(SageMessageTitle.Information.ToString(),
                                    GetSageMessage("PortalSettings", "PortalSaveSuccessfully"), "",
                                    SageMessageType.Success);

                    }
                    else
                    {
                        PasswordHelper.EnforcePasswordSecurity(passowrdformat, newpassword, out password,
                                                               out passwordsalt);
                        string email = txtEmail.Text.Trim();
                        dbPortal.usp_Aspx_AddStoreSubscriber(portalName, "", "", email, null, false, false, "superuser",
                                                             password, passwordsalt, passowrdformat, false,
                                                             ref customerID);
                        try
                        {
                            sendEmail(customerID, newpassword, portalName, txtEmail.Text.Trim(), "superuser", "",
                                      portalUrl);
                            ShowMessage(SageMessageTitle.Information.ToString(),
                                        GetSageMessage("PortalSettings", "PortalSavedAndEmailSendSuccessfully"), "",
                                        SageMessageType.Success);
                        }
                        catch
                        {
                            ShowMessage(SageMessageTitle.Notification.ToString(),
                                        GetSageMessage("PortalSettings", "PortalAddEmailSendProblem"), "",
                                        SageMessageType.Alert);
                        }
                    }
                    BindPortalSetting();
                    HttpContext.Current.Cache.Remove("Portals");
                    BindPortal();
                    PanelVisibility(false, true);
                    HttpContext.Current.Cache.Remove("SageSetting");
                    SageFrameConfig sf = new SageFrameConfig();
                    sf.ResetSettingKeys(int.Parse(this.hdnPortalID.Value.ToString()));
                }
            }
            catch (Exception)
            {
                ShowMessage(SageMessageTitle.Notification.ToString(),
                            GetSageMessage("PortalSettings", "PortalAlreadyExist"), "", SageMessageType.Alert);
            }
        }
Ejemplo n.º 3
0
        protected void imgSave_Click(object sender, ImageClickEventArgs e)
        {

            try
            {
                if (Int32.Parse(hdnPortalID.Value) > 0)
                {
                    if (txtPortalName.Text.Trim() != "")
                    {
                        SaveProtal();
                        BindPortalSetting();
                        HttpContext.Current.Cache.Remove("Portals");
                        BindPortal();
                        PanelVisibility(false, true);
                        HttpContext.Current.Cache.Remove("SageSetting");
                        SageFrameConfig sf = new SageFrameConfig();
                        sf.ResetSettingKeys(int.Parse(this.hdnPortalID.Value.ToString()));
                    }
                    else
                    {
                        lblPortalNameError.Visible = true;
                    }
                }
                else
                {
                    if (txtEmail.Text.Trim() != "")
                    {
                        if (txtPortalName.Text.Trim() != "")
                        {
                            SaveProtal();
                            BindPortalSetting();
                            HttpContext.Current.Cache.Remove("Portals");
                            BindPortal();
                            PanelVisibility(false, true);
                            HttpContext.Current.Cache.Remove("SageSetting");
                            SageFrameConfig sf = new SageFrameConfig();
                            sf.ResetSettingKeys(int.Parse(this.hdnPortalID.Value.ToString()));

                        }
                        else
                        {
                            lblPortalNameError.Visible = true;
                        }
                    }
                    else
                    {
                        lblStoreEmailError.Visible = true;
                    }
                }
            }
            catch (Exception ex)
            {
                ProcessException(ex);
            }
        }
 protected void imgSave_Click(object sender, EventArgs e)
 {
     try
     {
         bool status = false;
         foreach (GridViewRow row in gdvPortal.Rows)
         {
             LinkButton lnkPortal = row.FindControl("lnkUsername") as LinkButton;
             if (gdvPortal.DataKeys[row.RowIndex]["PortalID"].ToString() != hdnPortalIndex.Value)
             {
                 if (lnkPortal.Text.ToLower().Equals(txtPortalName.Text.ToLower()))
                 {
                     status = true;
                 }
             }
         }
         if (!(string.IsNullOrEmpty(txtPortalName.Text)))
         {
             if (!status)
             {
                 SaveProtal();
                 BindPortalSetting();
                 HttpRuntime.Cache.Remove(CacheKeys.Portals);
                 SageFrameConfig sf = new SageFrameConfig();
                 sf.ResetSettingKeys(int.Parse(this.hdnPortalID.Value.ToString()));
                 HttpContext.Current.Session.Remove(SessionKeys.SageFrame_PortalSEOName);
                 AppErazer.ClearSysCache();
                 BindPortal();
                 // BindSitePortal();
                 PanelVisibility(false, true);
                 //Redirect(GetPortalID);
             }
             else
             {
                 ShowMessage("", GetSageMessage("PortalSettings", "PortalAlreadyExists"), "", SageMessageType.Alert);
             }
         }
     }
     catch (Exception ex)
     {
         ProcessException(ex);
     }
 }