Beispiel #1
0
        protected void bt_adminUpadate_Click(object sender, EventArgs e)
        {
            Client client = new Client();
            string phone  = tb_Phone.Text.Trim();
            string name   = tb_name.Text.Trim();

            string pwd = tb_pwd.Text.Trim();

            //Response.Write(phone + "..." + name + "..."+pwd+"..."+ rbl_sex.SelectedItem.Value);
            client.Phone = phone;
            client.Name  = name;
            client.Pwd   = pwd;
            if (string.IsNullOrEmpty(phone))
            {
                Response.Write("<script>alert('手机号不能为空!')</script>");
            }
            else if (phone != phone2 && clientBll.SelectPhoneCount(phone))//判断如果管理员修改了用户账号时,该账号是否已经存在
            {
                Response.Write("<script>alert('该账号已经存在!')</script>");
            }
            else if (string.IsNullOrEmpty(pwd))
            {
                Response.Write("<script>alert('密码不能为空!')</script>");
            }

            else if (string.IsNullOrEmpty(name))
            {
                Response.Write("<script>alert('昵称不能为空')</script>");
            }
            else
            {
                client.Sex = rbl_sex.SelectedItem.Value;
                int age;

                client.Age = Int32.TryParse(tb_age.Text.Trim(), out age) ? (byte?)age : null;;
                if (clientBll.adminUpdate(client, showId) && feedBackBll.adminUpdate(client, phone2) && replyBll.adminUpdate(client, phone2))//同时更新三个表
                {
                    Response.Write("<script>alert('修改成功')</script>");
                    //Response.Redirect("adminClient.aspx");
                }
                else
                {
                    Response.Write("<script>alert('修改失败')</script>");
                }
                //Response.Write(phone2);
            }
        }