Beispiel #1
0
        protected void btn_reg_Click(object sender, EventArgs e)
        {
            if (txt_username.Text.Trim() != "")
            {
                RedGlovePermission.BLL.Users bll = new RedGlovePermission.BLL.Users();
                RedGlovePermission.Model.Users model = new RedGlovePermission.Model.Users();
                model.UserName = txt_username.Text.Trim();
                model.Password = RedGlovePermission.Lib.SecurityEncryption.MD5(txt_password2.Text.Trim(), 32);
                model.Question = txt_question.Text.Trim();
                model.Answer = txt_answer.Text.Trim();
                if (RGP_Value.IsVerifyUser)
                {
                    model.UserGroup = RGP_Value.initGroupID;
                    model.RoleID = RGP_Value.InitRoleID;
                }
                model.IsLimit = false;

                switch (bll.CreateUser(model))
                {
                    case 1:
                        ScriptManager.RegisterClientScriptBlock(CustomPanel1, this.GetType(), "MsgBox", "alert('" + ResourceManager.GetString("Pub_Msg_add_true") + "')", true);
                        break;
                    case 2:
                        ScriptManager.RegisterClientScriptBlock(CustomPanel1, this.GetType(), "MsgBox", "alert('" + ResourceManager.GetString("Pub_Msg_IsUser") + "')", true);
                        break;
                    default:
                        ScriptManager.RegisterClientScriptBlock(CustomPanel1, this.GetType(), "MsgBox", "alert('" + ResourceManager.GetString("Pub_Msg_add_false") + "')", true);
                        break;
                }
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(CustomPanel1, this.GetType(), "MsgBox", "alert('" + ResourceManager.GetString("Pub_Msg_V_1") + "')", true);
            }
        }
Beispiel #2
0
        protected void btn_reg_Click(object sender, EventArgs e)
        {
            RedGlovePermission.BLL.Users   bll   = new RedGlovePermission.BLL.Users();
            RedGlovePermission.Model.Users model = new RedGlovePermission.Model.Users();
            model.UserName = txt_username.Text.Trim();
            model.Password = RedGlovePermission.Lib.SecurityEncryption.MD5(txt_password2.Text.Trim(), 32);
            model.Question = txt_question.Text.Trim();
            model.Answer   = txt_answer.Text.Trim();
            if (RGP_Value.IsVerifyUser)
            {
                model.UserGroup = RGP_Value.initGroupID;
                model.RoleID    = RGP_Value.InitRoleID;
            }
            model.IsLimit = false;

            switch (bll.CreateUser(model))
            {
            case 1:
                ScriptManager.RegisterClientScriptBlock(CustomPanel1, this.GetType(), "MsgBox", "alert('注册成功!')", true);
                break;

            case 2:
                ScriptManager.RegisterClientScriptBlock(CustomPanel1, this.GetType(), "MsgBox", "alert('用户已经存在,请更换后重试!')", true);
                break;

            default:
                ScriptManager.RegisterClientScriptBlock(CustomPanel1, this.GetType(), "MsgBox", "alert('注册失败!')", true);
                break;
            }
        }
Beispiel #3
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");
 }
 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");
 }
 protected void btn_save_Click(object sender, EventArgs e)
 {
     if (OldPassword.Text != "" && NewPassword.Text != "" && RePassword.Text != "" && (NewPassword.Text == RePassword.Text))
     {
         RedGlovePermission.BLL.Users bll = new RedGlovePermission.BLL.Users();
         int id = SessionBox.GetUserSession().LoginId;
         if (bll.VerifyPassword(id,RedGlovePermission.Lib.SecurityEncryption.MD5(OldPassword.Text.Trim(), 32)))
         {
             if (bll.ChangePassword(id, RedGlovePermission.Lib.SecurityEncryption.MD5(RePassword.Text.Trim(), 32)))
             {
                 ScriptManager.RegisterClientScriptBlock(CustomPanel1, this.GetType(), "", "alert('" + ResourceManager.GetString("Pub_Msg_update_true") + "');", true);
             }
             else
             {
                 ScriptManager.RegisterClientScriptBlock(CustomPanel1, this.GetType(), "", "alert('" + ResourceManager.GetString("Pub_Msg_update_false") + "');", true);
             }
         }
         else
         {
             ScriptManager.RegisterClientScriptBlock(CustomPanel1, this.GetType(), "", "alert('" + ResourceManager.GetString("ChangePassword_Msg_1") + "');", true);
         }
     }
 }
Beispiel #6
0
 protected void btn_save_Click(object sender, EventArgs e)
 {
     if (OldPassword.Text != "" && NewPassword.Text != "" && RePassword.Text != "" && (NewPassword.Text == RePassword.Text))
     {
         RedGlovePermission.BLL.Users bll = new RedGlovePermission.BLL.Users();
         int id = SessionBox.GetUserSession().LoginId;
         if (bll.VerifyPassword(id, RedGlovePermission.Lib.SecurityEncryption.MD5(OldPassword.Text.Trim(), 32)))
         {
             if (bll.ChangePassword(id, RedGlovePermission.Lib.SecurityEncryption.MD5(RePassword.Text.Trim(), 32)))
             {
                 ScriptManager.RegisterClientScriptBlock(CustomPanel1, this.GetType(), "", "alert('" + ResourceManager.GetString("Pub_Msg_update_true") + "');", true);
             }
             else
             {
                 ScriptManager.RegisterClientScriptBlock(CustomPanel1, this.GetType(), "", "alert('" + ResourceManager.GetString("Pub_Msg_update_false") + "');", true);
             }
         }
         else
         {
             ScriptManager.RegisterClientScriptBlock(CustomPanel1, this.GetType(), "", "alert('" + ResourceManager.GetString("ChangePassword_Msg_1") + "');", true);
         }
     }
 }
Beispiel #7
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);
                }
            }
        }
Beispiel #8
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);
                }
            }
        }