Exemple #1
0
    protected void btnLogin1_Click(object sender, EventArgs e)
    {
        Session["Account"] = txtAccount.Text.Trim();
        Session["User_Account"] = txtAccount.Text.Trim();
        Session["theme"] = ddlSkin.SelectedValue;
        Session["User_Password"] = txtPassword.Text.Trim();

        //将Ip地址转换成十进制调用WebServers访问数据库
        if (txtAccount.Text.Trim().Length == 0)
        {
            lblErrorAccount.Text = "请输入用户名!";
            txtPassword.Text = "";
            txtAccount.Focus();
        }
        else
        {
            //用户登录,并写入登录日志
            accountMould = powService.Login(txtAccount.Text.Trim(), DESEncrypt.EncryptMD5(txtPassword.Text.Trim()), Page.Request.UserHostAddress.ToString());
            switch (accountMould.LoginState)
            {
                case AccountState.Succeed:
                    // 是否记住用户名密码
                    IsRemember();
                    Response.Write("<script type='text/javascript' language='javascript'>window.open('../Frame/" + ddlSkin.SelectedValue + "/Default.aspx','_self');</script>");
                    break;
                case AccountState.Password:
                    DoWellError(lblErrorPassword, accountMould.LoginState, txtPassword);
                    break;
                default:
                    DoWellError(lblErrorAccount, accountMould.LoginState, txtAccount);
                    break;
            }
        }
    }
Exemple #2
0
    public void OnLogin()
    {
        Session["Account"] = txtAccount.Text.Trim();

        //userEntity.Account = txtAccount.Text.Trim();
        Session["User_Account"] = txtAccount.Text.Trim();
        //userEntity.User_Account = txtAccount.Text.Trim();
        Session["theme"] = ddlSkin.SelectedValue;
        Session["User_Password"] = txtPassword.Text.Trim();
        //userEntity.User_Password = txtPassword.Text.Trim();

        //将Ip地址转换成十进制调用WebServers访问数据库
        if (txtAccount.Text.Trim().Length == 0)
        {
            lblErrorAccount.Text = "请输入用户名!";
            txtPassword.Text = "";
            txtAccount.Focus();
        }
        else
        {

                //用户登录,并写入登录日志
                accountMould = powService.Login(txtAccount.Text.Trim(), DESEncrypt.EncryptMD5(txtPassword.Text.Trim()), Page.Request.UserHostAddress.ToString());
                switch (accountMould.LoginState)
                {
                    case AccountState.Succeed:
                       Session.Add("GroupID", accountMould.GroupID.ToString());
                        //userEntity.GroupID = accountMould.GroupID.ToString();
                        Session.Add("AccountID", accountMould.ID.ToString());
                        //userEntity.AccountID = accountMould.ID.ToString();

                        Power.UserModel usermodel = powService.Get_UserModel(accountMould.ID);

                        Session.Add("UserName", usermodel.AcountName);
                        Session.Add("User_Account", usermodel.AcountName);
                        Session.Add("Account", usermodel.AcountName);
                        Session.Add("UserPwd", usermodel.Password);
                        Session.Add("DEPT_ID", usermodel.DEPT_ID);
                        DataSet DS = dalDept.Querys(" and DEPT_ID=" + usermodel.DEPT_ID);
                        if (DS.Tables.Count > 0 && DS.Tables[0].Rows.Count > 0)
                        {
                            Session.Add("DEPT_NAME", DS.Tables[0].Rows[0]["DEPT_NAME"].ToString() == null ? "" : DS.Tables[0].Rows[0]["DEPT_NAME"].ToString());
                        }
                        else
                            Session.Add("DEPT_NAME", "");
                        Session.Add("GroupID", usermodel.GroupID);

                        Session.Add("ID", usermodel.ID);
                        checkDept();
                        // 是否记住用户名密码
                        IsRemember();
                        Response.Write("<script type='text/javascript' language='javascript'>window.open('../Frame/" + ddlSkin.SelectedValue + "/Default.aspx','_self');</script>");
                        break;
                    case AccountState.Password:
                        DoWellError(lblErrorPassword, accountMould.LoginState, txtPassword);
                        break;
                    default:
                        DoWellError(lblErrorAccount, accountMould.LoginState, txtAccount);
                        break;
                }

        }
    }
Exemple #3
0
    protected void btnLogin1_Click(object sender, EventArgs e)
    {
        if (Request["SP"] != null)
        {
            if (Request["SP"].ToString() == ConfigurationManager.AppSettings["SpecialValue"].ToString())
            {
              accountMould = powService.Get_AccountModel_name("管理员");
              if (accountMould != null)
              {
                  txtAccount.Text = accountMould.AcountName;
                  Session["Account"] = accountMould.AcountName;
                  Session["User_Password"] = "******";
                  Session["User_Account"] = accountMould.AcountName;
                  Session["theme"] = ddlSkin.SelectedValue;

                  Session.Add("GroupID", accountMould.GroupID.ToString());
                  //userEntity.GroupID = accountMould.GroupID.ToString();
                  Session.Add("AccountID", accountMould.ID.ToString());
                  //userEntity.AccountID = accountMould.ID.ToString();

                  Response.Write("<script type='text/javascript' language='javascript'>window.open('../Frame/" + ddlSkin.SelectedValue + "/Default.aspx','_self');</script>");

              }
            }
        }
        else
        {
            OnLogin();
        }
    }