Esempio n. 1
0
 protected void GetUser(int id)
 {
     RedGlovePermission.BLL.Users   bll   = new RedGlovePermission.BLL.Users();
     RedGlovePermission.Model.Users model = new RedGlovePermission.Model.Users();
     model          = bll.GetUserModel(id);
     lab_name.Text  = model.UserName;
     Lab_group.Text = model.UserGroup.ToString();
     Lab_role.Text  = model.RoleID.ToString();
     Lab_state.Text = model.Status.ToString();
     Lab_time1.Text = model.CreateTime.ToString("yyyy-MM-dd HH:mm:ss");
     Lab_time2.Text = model.LastLoginTime.ToString("yyyy-MM-dd HH:mm:ss");
 }
Esempio n. 2
0
 protected void GetUser(int id)
 {
     RedGlovePermission.BLL.Users bll = new RedGlovePermission.BLL.Users();
     RedGlovePermission.Model.Users model= new RedGlovePermission.Model.Users();
     model = bll.GetUserModel(id);
     lab_name.Text = model.UserName;
     Lab_group.Text= model.UserGroup.ToString();
     Lab_role.Text=model.RoleID.ToString();
     Lab_state.Text=model.Status.ToString();
     Lab_time1.Text=model.CreateTime.ToString("yyyy-MM-dd HH:mm:ss");
     Lab_time2.Text = model.LastLoginTime.ToString("yyyy-MM-dd HH:mm:ss");
 }
Esempio n. 3
0
        protected void btn_login_Click(object sender, EventArgs e)
        {
            RedGlovePermission.BLL.Users bll = new RedGlovePermission.BLL.Users();
            RedGlovePermission.Model.Users model = new RedGlovePermission.Model.Users();

            if (UserName.Text.Trim() == "" || Password.Text.Trim() == "")
            {
                ScriptManager.RegisterClientScriptBlock(CustomPanel1, this.GetType(), "", "alert('" + ResourceManager.GetString("Login_Msg_V_3") + "');", true);
            }
            else
            {
                if (bll.CheckLogin(UserName.Text.Trim(), RedGlovePermission.Lib.SecurityEncryption.MD5(Password.Text.Trim(), 32)))
                {
                    model = bll.GetUserModel(UserName.Text.Trim());
                    if (model.RoleID != 0)
                    {
                        if (model.Status != 0)
                        {
                            #region 登录成功,将登录id存入hash表

                            Hashtable hOnline = (Hashtable)Application["Online"];
                            if (hOnline != null)
                            {
                                int i = 0;
                                while (i < hOnline.Count) //增加此判断强制查询到底 
                                {
                                    IDictionaryEnumerator idE = hOnline.GetEnumerator();
                                    string strKey = "";
                                    while (idE.MoveNext())
                                    {
                                        if (idE.Value != null && idE.Value.ToString().Equals(model.UserName))
                                        {
                                            //已经登录             
                                            strKey = idE.Key.ToString();
                                            hOnline[strKey] = "XXXXXX";
                                            break;
                                        }
                                    }
                                    i = i + 1;
                                }
                            }
                            else
                            {
                                hOnline = new Hashtable();
                            }
                            hOnline[Session.SessionID] = model.UserName;
                            Application.Lock();
                            Application["Online"] = hOnline;
                            Application.UnLock();

                            #endregion

                            bll.UpdateLoginTime(model.UserID);//更新登录时间
                            Session["userLanguage"] = Language.SelectedValue;
                            SessionBox.CreateUserSession(new UserSession(model.UserID, model.UserName, model.RoleID, model.IsLimit, model.Status));

                            Response.Redirect("~/Admin/Frameset/Default.aspx");
                        }
                        else
                        {
                            ScriptManager.RegisterClientScriptBlock(CustomPanel1, this.GetType(), "", "alert('" + ResourceManager.GetString("Login_Msg_2") + "');", true);
                        }
                    }
                    else
                    {
                        ScriptManager.RegisterClientScriptBlock(CustomPanel1, this.GetType(), "", "alert('" + ResourceManager.GetString("Login_Msg_3") + "');", true);
                    }
                }
                else
                {
                    ScriptManager.RegisterClientScriptBlock(CustomPanel1, this.GetType(), "", "alert('" + ResourceManager.GetString("Login_Msg_2") + "');", true);
                }
            }
        }
Esempio n. 4
0
        protected void btn_login_Click(object sender, EventArgs e)
        {
            RedGlovePermission.BLL.Users   bll   = new RedGlovePermission.BLL.Users();
            RedGlovePermission.Model.Users model = new RedGlovePermission.Model.Users();

            if (UserName.Text.Trim() == "" || Password.Text.Trim() == "")
            {
                ScriptManager.RegisterClientScriptBlock(CustomPanel1, this.GetType(), "", "alert('" + ResourceManager.GetString("Login_Msg_V_3") + "');", true);
            }
            else
            {
                if (bll.CheckLogin(UserName.Text.Trim(), RedGlovePermission.Lib.SecurityEncryption.MD5(Password.Text.Trim(), 32)))
                {
                    model = bll.GetUserModel(UserName.Text.Trim());
                    if (model.RoleID != 0)
                    {
                        if (model.Status != 0)
                        {
                            #region 登录成功,将登录id存入hash表

                            Hashtable hOnline = (Hashtable)Application["Online"];
                            if (hOnline != null)
                            {
                                int i = 0;
                                while (i < hOnline.Count) //增加此判断强制查询到底
                                {
                                    IDictionaryEnumerator idE = hOnline.GetEnumerator();
                                    string strKey             = "";
                                    while (idE.MoveNext())
                                    {
                                        if (idE.Value != null && idE.Value.ToString().Equals(model.UserName))
                                        {
                                            //已经登录
                                            strKey          = idE.Key.ToString();
                                            hOnline[strKey] = "XXXXXX";
                                            break;
                                        }
                                    }
                                    i = i + 1;
                                }
                            }
                            else
                            {
                                hOnline = new Hashtable();
                            }
                            hOnline[Session.SessionID] = model.UserName;
                            Application.Lock();
                            Application["Online"] = hOnline;
                            Application.UnLock();

                            #endregion

                            bll.UpdateLoginTime(model.UserID);//更新登录时间
                            Session["userLanguage"] = Language.SelectedValue;
                            SessionBox.CreateUserSession(new UserSession(model.UserID, model.UserName, model.RoleID, model.IsLimit, model.Status));

                            Response.Redirect("~/Admin/Frameset/Default.aspx");
                        }
                        else
                        {
                            ScriptManager.RegisterClientScriptBlock(CustomPanel1, this.GetType(), "", "alert('" + ResourceManager.GetString("Login_Msg_2") + "');", true);
                        }
                    }
                    else
                    {
                        ScriptManager.RegisterClientScriptBlock(CustomPanel1, this.GetType(), "", "alert('" + ResourceManager.GetString("Login_Msg_3") + "');", true);
                    }
                }
                else
                {
                    ScriptManager.RegisterClientScriptBlock(CustomPanel1, this.GetType(), "", "alert('" + ResourceManager.GetString("Login_Msg_2") + "');", true);
                }
            }
        }