private void SaveProtal()
 {
     if (Int32.Parse(hdnPortalID.Value) > 0)
     {
         PortalController.UpdatePortal(Int32.Parse(hdnPortalID.Value), txtPortalName.Text, false, GetUsername);
     }
     else
     {
         if (HttpRuntime.Cache["AspxStoreSetting" + GetPortalID.ToString() + GetStoreID.ToString()] != null)
         {
             string portalUrl;
             string portalName = txtPortalName.Text.Trim().Replace(" ", "_");
             if (IsUseFriendlyUrls)
             {
                 portalUrl = Request.ServerVariables["SERVER_NAME"] + "/portal/" + portalName + "/" + "home" + SageFrameSettingKeys.PageExtension;
             }
             else
             {
                 portalUrl = Request.ServerVariables["SERVER_NAME"] + "/portal/" + "home";
             }
             string newPortalname = SaveTemplate();
             PortalMgrController.AddStoreSubscriber(portalName, false, GetUsername,
                                                    newPortalname);
         }
         else
         {
             string newPortalname = SaveTemplate();
             PortalMgrController.AddPortal(txtPortalName.Text, false, GetUsername, newPortalname);
         }
     }
 }
Exemplo n.º 2
0
        private void SaveProtal()
        {
            if (Int32.Parse(hdnPortalID.Value) > 0)
            {
                bool   IsParent  = ddlAvailablePortal.SelectedIndex == 0 ? true : false;
                int    ParentID  = ddlAvailablePortal.SelectedIndex == 0 ? 0 : int.Parse(ddlAvailablePortal.SelectedValue);
                string PortalURL = ddlAvailablePortal.SelectedIndex == 0 ? txtUrl.Text : txtPortalName.Text;


                PortalController.UpdatePortal(Int32.Parse(hdnPortalID.Value), txtPortalName.Text, IsParent, GetUsername, PortalURL, ParentID);
            }
            else
            {
                if (HttpRuntime.Cache["AspxStoreSetting" + GetPortalID.ToString() + GetStoreID.ToString()] != null)
                {
                    string newPortalname = SaveTemplate();
                    int    ParentPortal  = int.Parse(ddlAvailablePortal.SelectedValue);
                    // string PSEOName = txtUrl.Text == string.Empty ? ddlAvailablePortal.SelectedItem.ToString() : txtUrl.Text;
                    string PSEOName = string.Empty;
                    if (txtUrl.Text != string.Empty)
                    {
                        PSEOName = txtUrl.Text.Contains("http://") || txtUrl.Text.Contains("https://") ? txtUrl.Text : "http://" + txtUrl.Text;
                    }
                    else
                    {
                        PSEOName = txtPortalName.Text;
                    }
                    bool IsParent = false;
                    //PortalMgrController.AddPortal(txtPortalName.Text, false, GetUsername, newPortalname);
                    if (ddlAvailablePortal.SelectedIndex == 0)
                    {
                        IsParent = true;
                    }
                    PortalMgrController.AddStoreSubscriber(txtPortalName.Text, IsParent, GetUsername,
                                                           newPortalname, ParentPortal, PSEOName);
                }
                else
                {
                    string newPortalname = SaveTemplate();
                    int    ParentPortal  = int.Parse(ddlAvailablePortal.SelectedValue);
                    // string PSEOName = txtUrl.Text == string.Empty ? ddlAvailablePortal.SelectedItem.ToString() : txtUrl.Text;
                    string PSEOName = string.Empty;
                    if (txtUrl.Text != string.Empty)
                    {
                        PSEOName = txtUrl.Text.Contains("http://") || txtUrl.Text.Contains("https://") ? txtUrl.Text : "http://" + txtUrl.Text;
                    }
                    else
                    {
                        PSEOName = txtPortalName.Text;
                    }
                    bool IsParent = false;
                    //PortalMgrController.AddPortal(txtPortalName.Text, false, GetUsername, newPortalname);
                    if (ddlAvailablePortal.SelectedIndex == 0)
                    {
                        IsParent = true;
                    }
                    PortalMgrController.AddPortal(txtPortalName.Text, IsParent, GetUsername, newPortalname, ParentPortal, PSEOName);
                }
            }
        }
 private void SaveProtal()
 {
     if (Int32.Parse(hdnPortalID.Value) > 0)
     {
         bool   IsParent  = ddlAvailablePortal.SelectedIndex == 0 ? true : false;
         int    ParentID  = ddlAvailablePortal.SelectedIndex == 0 ? 0 : int.Parse(ddlAvailablePortal.SelectedValue);
         string PortalURL = ddlAvailablePortal.SelectedIndex == 0 ? txtUrl.Text : txtPortalName.Text;
         PortalController.UpdatePortal(Int32.Parse(hdnPortalID.Value), txtPortalName.Text, IsParent, GetUsername, PortalURL, ParentID);
     }
     else
     {
         if (HttpRuntime.Cache["AspxStoreSetting" + GetPortalID.ToString() + GetStoreID.ToString()] != null)
         {
             string newpassword    = GetRandomPassword(6);
             int    passowrdformat = 2;
             string password;
             int?   customerID = 0;
             string passwordsalt, portalUrl;
             string portalName = txtPortalName.Text.Trim().Replace(" ", "_");
             portalUrl = Request.ServerVariables["SERVER_NAME"] + "/portal/" + portalName + "/" + "home" + SageFrameSettingKeys.PageExtension;
             PasswordHelper.EnforcePasswordSecurity(passowrdformat, newpassword, out password,
                                                    out passwordsalt);
             string email = txtEmail.Text.Trim();
             SaveTemplate();
             customerID = PortalMgrController.AddStoreSubscriber(portalName, "", "", email, null, false, false,
                                                                 "superuser",
                                                                 password, passwordsalt, passowrdformat, false);
             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);
             }
         }
         else
         {
             string newPortalname = SaveTemplate();
             int    ParentPortal  = int.Parse(ddlAvailablePortal.SelectedValue);
             // string PSEOName = txtUrl.Text == string.Empty ? ddlAvailablePortal.SelectedItem.ToString() : txtUrl.Text;
             string PSEOName = string.Empty;
             if (txtUrl.Text != string.Empty)
             {
                 PSEOName = txtUrl.Text.Contains("http://") || txtUrl.Text.Contains("https://") ? txtUrl.Text : "http://" + txtUrl.Text;
             }
             else
             {
                 PSEOName = txtPortalName.Text;
             }
             bool IsParent = false;
             //PortalMgrController.AddPortal(txtPortalName.Text, false, GetUsername, newPortalname);
             if (ddlAvailablePortal.SelectedIndex == 0)
             {
                 IsParent = true;
             }
             PortalMgrController.AddPortal(txtPortalName.Text, IsParent, GetUsername, newPortalname, ParentPortal, PSEOName);
             ShowMessage(SageMessageTitle.Information.ToString(),
                         GetSageMessage("PortalSettings", "PortalSaveSuccessfully"), "",
                         SageMessageType.Success);
         }
     }
 }