Example #1
0
    ///// <summary>
    ///// 用户查询
    ///// </summary>
    ///// <param name="sender"></param>
    ///// <param name="e"></param>
    //protected void SearchButton_Click(object sender, EventArgs e)
    //{

    //    string strName = "";
    //    int strUserType =0;
    //    string strSubClass ="";
    //    Response.Redirect(string.Format("SysUserSearch.aspx?UserName={0}&UserTypeID={1}&SubClassID={2}", strName, strUserType, strSubClass));

    //}

    protected void Add_Submit_Click(object sender, EventArgs e)
    {
        string strName  = UserName.Text.ToString();
        string strPwd   = PassWord.Text.ToString();
        string strRname = RealName.Text.ToString();
        int    typeid   = int.Parse(TypeID.SelectedValue.ToString());

        string subClass = SubClassID.SelectedValue.ToString();

        if (subClass.Equals("-1"))
        {
            Jscript.AjaxAlert(this, "请 选择用户类型");
            return;
        }
        int    groupid   = int.Parse(GroupID1.Value.ToString());
        string strDept   = Dept.Text.ToString();
        string strQQ     = QQ.Text.ToString();
        string strTaobao = WangWang.Text.ToString();
        string strTel    = Tel.Text.ToString();
        string strEmail  = Email.Text.ToString();
        string strDesc   = Description.Text.ToString();
        string strState  = State.SelectedValue.ToString();
        string strSex    = Sex.SelectedValue.ToString();

        Leyp.Model.User u = new Leyp.Model.User();

        u.UserName    = strName;
        u.Password    = StrHelper.EncryptPassword(strPwd, StrHelper.PasswordType.MD5);//MD5加密
        u.Description = strDesc;
        u.Email       = strEmail;
        u.GroupID     = groupid;
        u.TypeID      = typeid;
        u.QQ          = strQQ;
        u.RealName    = strRname;
        u.Sex         = strSex;
        u.State       = strState;
        u.WangWang    = strTaobao;
        u.Tel         = strTel;
        u.Dept        = strDept;
        u.BankAccount = BankAccount.Text.ToString();
        u.Bankname    = Bankname.Text.ToString();
        u.Character   = Character.Text.ToString();
        u.CompanyInfo = CompanyInfo.Text.ToString();
        u.CompanyName = CompanyName.Text.ToString();
        u.Address     = Address.Text.ToString();
        u.SubClassID  = int.Parse(SubClassID.SelectedValue.ToString());
        u.LatelyLogin = "";

        if (Leyp.SQLServerDAL.Factory.getUserDAL().insertNewUser(u))
        {
            Panel1.Visible     = false;
            HyperLink1.Visible = true;
        }
        else
        {
            Panel1.Visible     = false;
            HyperLink1.Text    = "添加失败!可能用户名已经存在!请重新注册";
            HyperLink1.Visible = true;
        }
    }
Example #2
0
    protected void submit_Click(object sender, EventArgs e)
    {
        string pwd0 = StrHelper.EncryptPassword(oldpwd.Text.ToString(), StrHelper.PasswordType.MD5);
        string pwd1 = StrHelper.EncryptPassword(newpwd.Text.ToString(), StrHelper.PasswordType.MD5);

        string userName = getUserName();

        if (Leyp.SQLServerDAL.Factory.getUserDAL().resetPassWord(pwd0, pwd1, userName))
        {
            Panel1.Visible = false;
            Label1.Visible = true;
        }
        else
        {
            Panel1.Visible = false;
            Label1.Text    = "操作失败!";
            Label1.Visible = true;
        }
    }