/// <summary>
    /// Currently we are going through the legacy slxweb.dll and populating an iframe.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void Page_Load(object sender, EventArgs e)
    {
        if (this.Visible)
        {
            string         UserId         = "";
            SLXUserService slxUserService = Sage.Platform.Application.ApplicationContext.Current.Services.Get <Sage.Platform.Security.IUserService>() as SLXUserService;
            if (slxUserService != null)
            {
                UserId = slxUserService.GetUser().Id.ToString().Trim();
            }

            LegacySupportCommon.LegacyLogin(UserId, Page);
            string EntityId = (Request.QueryString["entityId"] == null) ? "" : Request.QueryString["entityId"];

            if ((sParams.Length > 0) && (sParams[0] != '&'))
            {
                sParams = "&" + sParams;
            }
            string sUrl = String.Format("/scripts/slxweb.dll/view?name={0}{1}", sTemplate, sParams);
            if (sUrl.ToLower().IndexOf("id=") == -1)
            {
                sUrl = sUrl + "&id=" + EntityId;
            }
            LegacyTabContent.Attributes.Add("src", sUrl);
            LegacyTabContent.Attributes.Add("width", sWidth);
            LegacyTabContent.Attributes.Add("height", sHeight);
            LegacyTabContent.Attributes.Add("border", sBorder);
        }
    }
Beispiel #2
0
    /// <summary>
    /// Handles the Load event of the Page 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>
    protected void Page_Load(object sender, EventArgs e)
    {
        string         UserId         = "ADMIN";
        SLXUserService slxUserService = Sage.Platform.Application.ApplicationContext.Current.Services.Get <Sage.Platform.Security.IUserService>() as SLXUserService;

        if (slxUserService != null)
        {
            UserId = slxUserService.GetUser().Id.ToString().Trim();
        }

        LegacySupportCommon.LegacyLogin(UserId, Page);
        HtmlContainerControl div = (HtmlContainerControl)FindControl("prefscookiediv");

        var conn = LegacySupportCommon.GetOpenConnection();
        var cmd  = conn.CreateCommand();

        cmd.Connection = conn;
        string vSQL = String.Format("SELECT USERPREFERENCES FROM SLXWEBUSERINFO WHERE USERID LIKE '{0}%'", UserId);

        try
        {
            cmd.CommandText = vSQL;
            object res     = cmd.ExecuteScalar();
            string cookstr = (res == null) ? "" : res.ToString();
            if (cookstr == "")
            {
                vSQL            = "SELECT PATH FROM SLXWEBALIAS WHERE NAME = 'defprefs' AND ISACTIVE = 'T'";
                cmd.CommandText = vSQL;
                res             = cmd.ExecuteScalar();
                cookstr         = (res == null) ? "" : res.ToString();
            }
            cookstr = cookstr.Replace("<#SYS name=theuserid>", UserId);
            if (cookstr.IndexOf("caldefuser") < 0)
            {
                cookstr += "&caldefuser=" + UserId;
            }
            div.InnerText = cookstr;
        }
        finally
        {
            cmd.Dispose();
            conn.Close();
            conn.Dispose();
        }
    }