Exemplo n.º 1
0
        protected void btnAdd_Click(object sender, System.EventArgs e)
        {
            string username=this.lblName.Text.Trim();
            AccountsPrincipal user=new AccountsPrincipal(username);
            User currentUser=new JiaJiao.Bus.User(user);

            currentUser.UserName=username;
            currentUser.TrueName=txtTrueName.Text.Trim();
            if (txtPassword.Text.Trim() != "")
            {
                currentUser.Password = AccountsPrincipal.EncryptPassword(txtPassword.Text.Trim());
            }
            if(RadioButton1.Checked)
                currentUser.Sex="男";
            else
                currentUser.Sex="女";
            currentUser.Phone=this.txtPhone.Text.Trim();
            currentUser.Email=txtEmail.Text.Trim();
            //currentUser.EmployeeID=0;
            //currentUser.DepartmentID=this.Dropdepart.SelectedValue;
            int style=int.Parse(this.dropStyle.SelectedValue);
            currentUser.Style=style;
            if (!currentUser.Update())
            {
                this.lblMsg.ForeColor=Color.Red;
                this.lblMsg.Text = "更新用户信息发生错误!";
            }
            else
            {
                Response.Redirect("Admin/useradmin.aspx");
            }
        }
Exemplo n.º 2
0
        protected void btnAdd_Click(object sender, System.EventArgs e)
        {
            if (Page.IsValid)
            {
                string username=this.lblName.Text.Trim();
                AccountsPrincipal user=new AccountsPrincipal(username);
                User currentUser=new JiaJiao.Bus.User(user);
                currentUser.UserName=username;
                currentUser.TrueName=txtTrueName.Text.Trim();
                if(RadioButton1.Checked)
                    currentUser.Sex="男";
                else
                    currentUser.Sex="女";
                currentUser.Phone=this.txtPhone.Text.Trim();
                currentUser.Email=txtEmail.Text.Trim();
                //currentUser.UserType = dropUserType.SelectedValue;
                int style=int.Parse(this.dropStyle.SelectedValue);
                currentUser.Style=style;
                if (!currentUser.Update())
                {
                    this.lblMsg.ForeColor=Color.Red;
                    this.lblMsg.Text = "更新用户信息发生错误!";
                }
                else
                {
                    this.lblMsg.ForeColor=Color.Blue;
                    this.lblMsg.Text = "用户信息更新成功!";
                }
                string virtualPath=ConfigurationManager.AppSettings.Get("VirtualPath");
                Session["Style"]=style;
                Response.Clear();
                Response.Write("<SCRIPT LANGUAGE=\"JavaScript\">\n");
                Response.Write("<!--\n");
                Response.Write("parent.topFrame.location=\""+virtualPath+"/Admin/top.aspx\";\n");
                Response.Write("parent.leftFrame.location=\""+virtualPath+"/Admin/left.aspx\";\n");
                Response.Write("parent.spliterFrame.location=\""+virtualPath+"/Admin/spliter.aspx\";\n");
                Response.Write("parent.mainFrame.location=\"userinfo.aspx\";\n");
            //				Response.Write("parent.mainFrame.location=\"userinfo.aspx?id="+userName+"\";\n");
                Response.Write("//-->\n");
                Response.Write("</SCRIPT>");
                Response.End();

            }
        }
Exemplo n.º 3
0
        protected void btnAdd_Click(object sender, System.EventArgs e)
        {
            if (Page.IsValid)
            {
                SiteIdentity SID=new SiteIdentity(User.Identity.Name);
                if(SID.TestPassword(txtOldPassword.Text)==0)
                {
                    this.lblMsg.ForeColor=Color.Red;
                    this.lblMsg.Text = "原密码输入错误!";
                }
                else
                    if(this.txtPassword.Text.Trim()!=this.txtPassword1.Text.Trim())
                {
                    this.lblMsg.ForeColor=Color.Red;
                    this.lblMsg.Text="密码输入的不一致!请重试!";
                }
                else
                {
                    AccountsPrincipal user=new AccountsPrincipal(Context.User.Identity.Name);
                    User currentUser=new JiaJiao.Bus.User(user);

                    currentUser.Password=AccountsPrincipal.EncryptPassword(txtPassword.Text);

                    if (!currentUser.Update())
                    {
                        this.lblMsg.ForeColor=Color.Red;
                        this.lblMsg.Text = "更新用户信息发生错误!";
                        //日志
                        //UserLog.AddLog(currentUser.UserName, currentUser.UserType, Request.UserHostAddress, Request.Url.AbsoluteUri, "用户密码更新失败");
                    }
                    else
                    {
                        this.lblMsg.ForeColor=Color.Blue;
                        this.lblMsg.Text = "用户信息更新成功!";
                        //日志
                        //UserLog.AddLog(currentUser.UserName, currentUser.UserType, Request.UserHostAddress, Request.Url.AbsoluteUri, "用户密码更新成功");
                    }

                }
            }
        }