Exemplo n.º 1
0
        private void LogInUser(string email, Guid identifier)
        {
            try
            {
                GlobalUsersBLL globalUsersBLL    = new GlobalUsersBLL();
                var            globalUserDetails = globalUsersBLL.AuthenticateUserByOpenID(email, identifier);
                if (globalUserDetails != null)
                {
                    int appUserID = globalUsersBLL.GetApplicationUserByUser(globalUserDetails.UserID, ABCLogisticsApp.TMS);

                    if (appUserID > 0)
                    {
                        Session["GlobalUserID"] = globalUserDetails.UserID.ToString();
                        Session["UserName"]     = globalUserDetails.FirstName + " " + globalUserDetails.LastName;
                        Session["FirstName"]    = globalUserDetails.FirstName;
                        Session["LastName"]     = globalUserDetails.LastName;
                        Session["RoleID"]       = globalUserDetails.RoleID.ToString();
                        Session["UserEmail"]    = globalUserDetails.Email;
                        Session["Password"]     = globalUserDetails.Password;
                        Session["AppUserID"]    = appUserID.ToString();
                        Session["GoogleID"]     = identifier;

                        if (cbRememberMe.Checked == true)
                        {
                            RememberUser(txtUserID.Text.Trim());
                        }
                        Response.Redirect("~/home", true);
                    }
                    else
                    {
                        lblErrMessage.Text = CommonMessages.ERROR_GLOBAL_NO_APPLICATION_ACCESS;
                    }
                }
                else
                {
                    lblErrMessage.Text = CommonMessages.ERROR_GLOBAL_ACCOUNT_NOT_FOUND;
                    txtUserID.Focus();
                }
            }
            catch (Exception ex)
            {
                lblErrMessage.Text = (new GlobalErrorLogsBLL()).LogGlobalError(ex, "TMS - LogIn - LogInUser");
            }
        }
Exemplo n.º 2
0
        private void LogInUser(string email, Guid identifier)
        {
            try
            {
                GlobalUsersBLL globalUsersBLL    = new GlobalUsersBLL();
                var            globalUserDetails = globalUsersBLL.AuthenticateUserByOpenID(email, identifier);
                if (globalUserDetails != null)
                {
                    int appUserID = globalUsersBLL.GetApplicationUserByUser(globalUserDetails.UserID, ABCLogisticsApp.TMS);

                    if (appUserID > 0)
                    {
                        Session["GlobalUserID"] = globalUserDetails.UserID.ToString();
                        Session["UserName"]     = globalUserDetails.FirstName + " " + globalUserDetails.LastName;
                        Session["FirstName"]    = globalUserDetails.FirstName;
                        Session["LastName"]     = globalUserDetails.LastName;
                        Session["RoleID"]       = globalUserDetails.RoleID.ToString();
                        Session["UserEmail"]    = globalUserDetails.Email;
                        Session["Password"]     = globalUserDetails.Password;
                        Session["AppUserID"]    = appUserID.ToString();
                        Session["GoogleID"]     = identifier;

                        ScriptManager.RegisterClientScriptBlock(this, GetType(), "AuthReturn", "AuthReturn();", true);
                    }
                    else
                    {
                        lblMsg.Text = CommonMessages.ERROR_GLOBAL_NO_APPLICATION_ACCESS;
                    }
                }
                else
                {
                    lblMsg.Text = CommonMessages.ERROR_GLOBAL_ACCOUNT_NOT_FOUND;
                }
            }
            catch (Exception ex)
            {
                lblMsg.Text = (new GlobalErrorLogsBLL()).LogGlobalError(ex, "TMS - GoogleAuth - LogInUser");
            }
        }