Beispiel #1
0
        protected void btnSignIn_Click(object sender, EventArgs e)
        {
            if (!this.IsValid)
            {
                return;
            }

            //Hash the password and compare credentials with the DB
            string passwordHash = Utils.HashPassword(txtPassword.Text);

            StageBitz.Data.User user = AuthenticateUser(txtUsername.Text, passwordHash);

            if (user == null)
            {
                divInvalidLogin.Visible = true;
                txtPassword.Text        = string.Empty;
                txtUsername.Focus();
            }
            else
            {
                Support.SetUserSessionData(user);

                //Store the user id as the username inside asp.net auth cookie (if remember me is checked)
                FormsAuthentication.RedirectFromLoginPage(user.UserId.ToString(), chkRememberMe.Checked);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Handles the ItemDataBound event of the gvContacts control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="Telerik.Web.UI.GridItemEventArgs"/> instance containing the event data.</param>
        protected void gvContacts_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                GridDataItem        dataItem = (GridDataItem)e.Item;
                StageBitz.Data.User user     = ((dynamic)e.Item.DataItem).User;

                #region Fulle Name

                HyperLink lnkUser      = (HyperLink)e.Item.FindControl("lnkUser");
                string    userFullName = (user.FirstName + " " + user.LastName).Trim();
                lnkUser.Text = Support.TruncateString(userFullName, 25);
                if (userFullName.Length > 25)
                {
                    lnkUser.ToolTip = userFullName;
                }
                lnkUser.NavigateUrl = "~/Personal/UserDetails.aspx?userId=" + user.UserId;

                #endregion Fulle Name

                #region Position

                if (!string.IsNullOrEmpty(user.Position))
                {
                    dataItem["Position"].Text = Support.TruncateString(user.Position, 20);
                    if (user.Position.Length > 20)
                    {
                        dataItem["Position"].ToolTip = user.Position;
                    }
                }

                #endregion Position

                #region Primary Email

                HyperLink lnkEmail = (HyperLink)e.Item.FindControl("lnkEmail");
                if (user.IsEmailVisible)
                {
                    lnkEmail.Text        = Support.TruncateString(user.Email1, 20);
                    lnkEmail.NavigateUrl = "mailto:" + user.Email1;
                    if (user.Email1.Length > 20)
                    {
                        lnkEmail.ToolTip = user.Email1;
                    }
                }
                else
                {
                    lnkEmail.Visible = false;
                }

                #endregion Primary Email
            }
        }
Beispiel #3
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="EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                StageBitz.Data.User user = DataContext.Users.Where(u => u.UserId == UserID).FirstOrDefault();
                UserEmail = user.Email1;

                ltrlName.Text  = Support.TruncateString((user.FirstName + " " + user.LastName).Trim(), 100);
                ltrlEmail.Text = Support.TruncateString(user.Email1, 50);

                LoadBreadCrumbs();
            }
        }