/// <summary>
    /// Handles the Load event of the Page control.
    /// </summary>
    /// <param name="sender">Source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/>Instance containing the event data.</param>
    /// <remarks>
    /// Sequence Diagram:<br/>
    ///     <img src="SequenceDiagrams/SD_WeblogOn.Page_Load.jpg"/>
    /// </remarks>
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            SetBrowserLanguage();
            string logOnUserSource = ConfigurationManager.AppSettings["LogOnUserSource"];

            string userSource = string.Empty;
            if (logOnUserSource == Constants.USER_SOURCE_DB)
            {
                userSource = Constants.USER_SOURCE_DB;
            }
            else
            {
                userSource = ApplicationSettings.ProvideSetting("Authentication Settings");
            }
            Session["UserSource"]       = userSource;
            HiddenFieldUserSource.Value = userSource;

            int adminCount = DataManager.Provider.Users.ProvideAdminCount(userSource);
            if (adminCount == 0)
            {
                //Response.Redirect("FirstLogOn.aspx");
            }
            Session["LogOnSource"] = userSource;
            string domainName = AppLibrary.ApplicationSettings.ProvideDomainName();
            if (!string.IsNullOrEmpty(domainName))
            {
                TextBoxDomainName.Text = domainName;
            }
            else
            {
                TextBoxDomainName.Text = AppController.ApplicationHelper.ProvideSystemDomain();
            }

            GetUserSource();
            DropDownListUserSource.SelectedIndex = DropDownListUserSource.Items.IndexOf(DropDownListUserSource.Items.FindByValue(userSource));
        }

        if (HiddenFieldUserSource.Value == Constants.USER_SOURCE_DB)
        {
            LinkButtonForgetPassword.Visible = true;
            displayDBControls();
        }
        else
        {
            LinkButtonForgetPassword.Visible = false;
            displayADControls();
        }

        TextBoxUserId.Focus();
        LocalizeThisPage();
        TextBoxUserId.Attributes.Add("onKeyPress", "return  isSpclChar()");
        Page.Title = Constants.APPLICATION_TITLE;
        LoginControlsCssClass();
    }
Beispiel #2
0
        private void Clear()
        {
            TextBoxUserId.Clear();
            TextBoxUserName.Clear();
            TextBoxPassword.Clear();
            TextBoxFunction.Clear();

            ComboBoxAvailable.SelectedIndex = 0;

            PanelLeft.Enabled = false;
            _mode             = -1;
        }
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">Source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/>Instance containing the event data.</param>
        /// <remarks>
        /// Sequence Diagram:<br/>
        ///     <img src="SequenceDiagrams/SD_PrintRoverWeb.Web.FirstLogOn.Page_Load.jpg"/>
        /// </remarks>
        protected void Page_Load(object sender, EventArgs e)
        {
            TextBoxUserId.Focus();
            //string browserLanguage = Request.ServerVariables["http_accept_language"].Split(",".ToCharArray())[0] as string;
            //AppController.ApplicationCulture.SetCulture(browserLanguage);
            string logOnUserSource = ConfigurationManager.AppSettings["LogOnUserSource"];

            Session["LogOnSource"] = logOnUserSource;
            if (logOnUserSource == Constants.USER_SOURCE_DB)
            {
                Session["UserSource"] = Constants.USER_SOURCE_DB;
            }
            else
            {
                Session["UserSource"] = ApplicationSettings.ProvideSetting("Authentication Settings");
            }
            userSource = Session["UserSource"] as string;
            HiddenFieldApplicationSettingValue.Value = userSource;
            switch (userSource)
            {
            case Constants.USER_SOURCE_DB:
                displayDBControls();
                break;

            default:
                displayADControls();
                break;
            }
            int AdminCount = DataManager.Provider.Users.ProvideAdminCount(userSource);

            if (AdminCount > 0)
            {
                Response.Redirect("LogOn.aspx");
            }
            LocalizeThisPage();
            AUDITORSOURCE          = Session["UserID"] as string;
            Session["LogOnSource"] = userSource;
            if (!IsPostBack)
            {
                GetUserSource();
                DropDownListUserSource.SelectedIndex = DropDownListUserSource.Items.IndexOf(DropDownListUserSource.Items.FindByValue(userSource));
            }
            TextBoxUserId.Attributes.Add("onKeyPress", "return  isSpclChar()");
        }