// Action Method(s)
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                MultiEntryDisallow = false;
                QuaintSessionManager session = new QuaintSessionManager();
                UserInfo    = Convert.ToString(session.ActiveUserInformation);
                StationInfo = Convert.ToString(session.ActiveStationInformation);
                LoadLocation();

                if (Request.QueryString["Id"] != null)
                {
                    this.ModelId = Convert.ToInt32(QuaintSecurityManager.DecryptUrl(Convert.ToString(Request.QueryString["Id"])));
                    Edit(this.ModelId);
                    lblTitleStatus.Text        = "Update";
                    btnSave.Text               = "Update";
                    btnSaveAndContinue.Text    = "Update & Continue";
                    btnSaveAndContinue.Visible = false;
                }
                else
                {
                    GenerateCode();
                }
            }
        }
        private void SetUserInfoAndStationInfoInSession()
        {
            QuaintSessionManager session = new QuaintSessionManager();
            QuaintLibraryManager lib     = new QuaintLibraryManager();

            session.ActiveStationInformation = lib.IpAddress
                                               + ", " + lib.MacAddress
                                               + ", " + lib.MachineName
                                               + ", " + lib.ProcessorId
                                               + ", " + lib.OsInfo
                                               + ", " + lib.BrowserInfo
                                               + ", " + lib.CountryCodeAlpha2
                                               + ", " + lib.CountryName
                                               + ", " + lib.Latitude
                                               + ", " + lib.Longitude;

            //Dictionary<string, string> terminal = lib.GetTerminal();
            //session.ActiveStationInformation = terminal["IpAddress"]
            //    + ", " + terminal["MacAddress"]
            //    + ", " + terminal["MachineName"]
            //    + ", " + terminal["ProcessorId"]
            //    + ", " + terminal["OsInfo"]
            //    + ", " + terminal["BrowserInfo"]
            //    + ", " + terminal["CountryCodeAlpha2"]
            //    + ", " + terminal["CountryName"]
            //    + ", " + terminal["Latitude"]
            //    + ", " + terminal["Longitude"];

            session.ActiveUserInformation = session.ActiveUserRoleId
                                            + ", " + session.ActiveUserRoleName
                                            + ", " + session.ActiveUserId
                                            + ", " + session.ActiveUserName;
        }
Ejemplo n.º 3
0
 // Action Method(s)
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         QuaintSessionManager session = new QuaintSessionManager();
         UserInfo    = Convert.ToString(session.ActiveUserInformation);
         StationInfo = Convert.ToString(session.ActiveStationInformation);
         GenerateCode();
     }
 }
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txtUsername.Text))
                {
                    Alert(AlertType.Warning, "Enter username.");
                    txtUsername.Focus();
                }
                else if (string.IsNullOrEmpty(txtPassword.Text))
                {
                    Alert(AlertType.Warning, "Enter password.");
                    txtPassword.Focus();
                }
                else
                {
                    Users user = new Users();
                    user.UserName = Convert.ToString(txtUsername.Text);
                    user.Password = Convert.ToString(txtPassword.Text);

                    if (IsUsernameExist(user))
                    {
                        if (IsPasswordExist(user))
                        {
                            UsersModel           usrModel = AccountLogin(user);
                            QuaintSessionManager session  = new QuaintSessionManager();
                            session.ActiveUserName     = usrModel.FullName;
                            session.ActiveUserRoleName = usrModel.UserType;
                            session.ActiveUserId       = usrModel.UserId;

                            if (string.IsNullOrEmpty(this.RedirectUrl))
                            {
                                Response.Redirect("~/Default.aspx", false);
                            }
                            else
                            {
                                Response.Redirect(this.RedirectUrl, false);
                            }
                        }
                        else
                        {
                            Alert(AlertType.Error, "Username and password does not match.");
                        }
                    }
                    else
                    {
                        Alert(AlertType.Error, "User is not exist.");
                    }
                }
            }
            catch (Exception ex)
            {
                Alert(AlertType.Error, "Failed to login.");
            }
        }
 // Action Method(s)
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         QuaintSessionManager session = new QuaintSessionManager();
         this.UserInfo    = Convert.ToString(session.ActiveUserInformation);
         this.StationInfo = Convert.ToString(session.ActiveStationInformation);
         this.ModelId     = Convert.ToInt32(session.ActiveUserId);
         txtPassword.Focus();
     }
 }
        private void AccountLogout()
        {
            QuaintSessionManager session = new QuaintSessionManager();

            session.RemoveAll();
            session.ClearAll();
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.Cache.SetExpires(DateTime.UtcNow.AddHours(-1));
            Response.Cache.SetNoStore();
            Session.Abandon();
            Session.Clear();
            System.Web.Security.FormsAuthentication.SignOut();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            QuaintSessionManager session = new QuaintSessionManager();

            if (!session.HasSession)
            {
                Response.Redirect("~/Login.aspx");
            }
            else
            {
                SetUserInfoAndStationInfoInSession();
            }
        }
Ejemplo n.º 8
0
        // Action Method(s)
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //MultiEntryDisallow = false;
                QuaintSessionManager session = new QuaintSessionManager();
                UserInfo    = Convert.ToString(session.ActiveUserInformation);
                StationInfo = Convert.ToString(session.ActiveStationInformation);
                GenerateCode();

                if (Request.QueryString["Id"] != null)
                {
                    this.ModelId = Convert.ToInt32(QuaintSecurityManager.DecryptUrl(Convert.ToString(Request.QueryString["Id"])));
                }
            }
        }
Ejemplo n.º 9
0
        // Action Method(s)
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request.QueryString["Ref"] != null)
                {
                    if (Convert.ToString(Request.QueryString["Ref"]).ToString().ToLower() == "success")
                    {
                        Alert(AlertType.Success, "Saved successfully.");
                    }
                }

                QuaintSessionManager session = new QuaintSessionManager();
                UserInfo    = Convert.ToString(session.ActiveUserInformation);
                StationInfo = Convert.ToString(session.ActiveStationInformation);
                GenerateCode();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            QuaintSessionManager session = new QuaintSessionManager();

            if (!session.HasSession)
            {
                Response.Redirect("~/Login.aspx?Ref=admin");
            }
            else
            {
                if (session.ActiveUserRoleName.ToLower() == "admin")
                {
                    SetUserInfoAndStationInfoInSession();
                }
                else
                {
                    Response.Redirect("~/Default.aspx");
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                QuaintSessionManager session = new QuaintSessionManager();
                if (session.HasSession)
                {
                    areaAccess.Visible   = false;
                    areaUserInfo.Visible = true;
                    lblUserName.Text     = session.ActiveUserName;

                    string currentUrl  = HttpContext.Current.Request.Url.AbsoluteUri;
                    string redirectUrl = "~/Login.aspx?Ref=logout&Redirect=" + QuaintSecurityManager.EncryptUrl(currentUrl);
                    btnLogout.HRef = redirectUrl;
                }
                else
                {
                    areaAccess.Visible   = true;
                    areaUserInfo.Visible = false;
                    lblUserName.Text     = string.Empty;
                }
            }
        }
Ejemplo n.º 12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                LoadBlogPostCategories();

                if (Request.QueryString["Slug"] != null)
                {
                    string slug = Convert.ToString(Request.QueryString["Slug"]);
                    LoadData(slug);

                    QuaintSessionManager session = new QuaintSessionManager();
                    if (session.HasSession)
                    {
                        attachmentDownload.Visible = true;
                        attachmentView.Visible     = false;
                    }
                }
                else
                {
                    Response.Redirect("~/Pages/Blog.aspx");
                }
            }
        }
Ejemplo n.º 13
0
        // Action
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txtUsername.Text))
                {
                    Alert(AlertType.Warning, "Enter username.");
                    txtUsername.Focus();
                }
                else if (string.IsNullOrEmpty(txtPassword.Text))
                {
                    Alert(AlertType.Warning, "Enter password.");
                    txtPassword.Focus();
                }
                else
                {
                    Users user = new Users();
                    user.UserName = Convert.ToString(txtUsername.Text);
                    user.Password = Convert.ToString(txtPassword.Text);

                    if (!string.IsNullOrEmpty(this.ModelReference))
                    {
                        if (this.ModelReference == "admin")
                        {
                            //User
                            if (IsUsernameExist(user))
                            {
                                if (IsPasswordExist(user))
                                {
                                    UsersModel           usrModel = AccountLogin(user);
                                    QuaintSessionManager session  = new QuaintSessionManager();
                                    session.ActiveUserId   = usrModel.UserId;
                                    session.ActiveUserName = usrModel.UserName;
                                    session.Add("UserType", "admin");
                                    session.Add("ActiveUser", usrModel);
                                    Response.Redirect("~/Account/Dashboard.aspx");
                                }
                                else
                                {
                                    Alert(AlertType.Error, "Username and password does not match.");
                                }
                            }
                            else
                            {
                                Alert(AlertType.Error, "User is not exist.");
                            }
                        }
                        else if (this.ModelReference == "member")
                        {
                            // Member
                            if (IsUsernameExist(user))
                            {
                                if (IsPasswordExist(user))
                                {
                                    UsersModel           usrModel = AccountLogin(user);
                                    QuaintSessionManager session  = new QuaintSessionManager();
                                    session.ActiveUserId   = usrModel.UserId;
                                    session.ActiveUserName = usrModel.FullName;
                                    session.Add("UserType", "member");
                                    session.Add("ActiveUser", usrModel);
                                    Response.Redirect("~/MemberPanel/Dashboard.aspx");
                                }
                                else
                                {
                                    Alert(AlertType.Error, "Username and password does not match.");
                                }
                            }
                            else
                            {
                                Alert(AlertType.Error, "Member is not exist.");
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
                Alert(AlertType.Error, "Failed to login.");
            }
        }