示例#1
0
        private void btn_confirm_Click(object sender, EventArgs e)
        {
            string aid   = tbox_id.Text.Trim();
            string aname = tbox_name.Text.Trim();
            string asex  = "男";
            string pwd   = tbox_pwd.Text.Trim();
            string atime = DateTime.Now.ToString();
            string sql   = "insert into admins(aid,aname,asex,atime) values('" + aid + "','" + aname + "','" + asex + "','" + atime + "')";

            if (string.Compare(pwd, "123456") != 0)
            {
                string sql1 = "update users set upasswd = '" + pwd + "' where uid = '" + aid + "'";
                if (Ad_UserManage.ExecuteSql(sql) != 0 && Ad_UserManage.ExecuteSql(sql1) != 0)//向源数据库传递并执行SQL语句
                {
                    MessageBox.Show("添加管理员信息成功!");
                }
            }
            else
            {
                if (Ad_UserManage.ExecuteSql(sql) != 0)//向源数据库传递并执行SQL语句
                {
                    MessageBox.Show("添加管理员信息成功!");
                }
            }
            this.pform.Show();
            this.Close();
        }
示例#2
0
 public Ad_UpdateAd(Ad_UserManage parent, string id)
 {
     InitializeComponent();
     pform = parent;
     aid   = id;
     this.info_ad.DataSource = Query("select aid,aname,asex from admins").Tables["admins"];
 }
        private void btn_confirm_Click(object sender, EventArgs e)
        {
            if (tbox_id.Text.Trim() == "")
            {
                MessageBox.Show("账号不能为空!");
            }
            else
            {
                string id = tbox_id.Text.Trim();
                string sql;
                if (radioButton1.Checked)
                {
                    sql = "update users set upasswd = '123456' where uid = '" + id + "' and ugroup = 3";
                }
                else
                {
                    sql = "update users set upasswd = '123456' where uid = '" + id + "' and ugroup = 2";
                }
                if (Ad_UserManage.ExecuteSql(sql) != 0)
                {
                    MessageBox.Show("密码已恢复默认值!");
                }
                else
                {
                    MessageBox.Show("账号不存在!");
                }

                this.pform.Show();
                this.Close();
            }
        }
        private void btn_user_Click(object sender, EventArgs e)
        {
            Ad_UserManage childrenForm = new Ad_UserManage(this, id);

            childrenForm.Owner = this;
            this.Hide();
            childrenForm.Show();
        }
示例#5
0
        private void btn_delete_Click(object sender, EventArgs e)
        {
            int    a     = info_ad.CurrentRow.Index;                         //获取当前选中行
            string aid_1 = info_ad.Rows[a].Cells[0].Value.ToString().Trim(); //获取该行第0列
            string sql   = "delete from admins where aid = '" + aid_1 + "'";

            if (Ad_UserManage.ExecuteSql(sql) > 0)
            {
                MessageBox.Show("删除成功!");
            }
        }
示例#6
0
        private void btn_confirm_Click(object sender, EventArgs e)
        {
            string newaid = tbox_aid.Text.Trim();
            string aname  = tbox_aname.Text.Trim();
            string asex   = cbox_asex.Text;
            string sql    = "update admins set aid = '" + newaid + "',aname = '" + aname + "',asex = '" + asex + "' where aid = '" + oldaid + "'";

            if (Ad_UserManage.ExecuteSql(sql) != 0)
            {
                MessageBox.Show("修改成功!");
            }
            this.pform.Show();
            this.Close();
        }
示例#7
0
 public Ad_AddAdmin(Ad_UserManage parent)
 {
     InitializeComponent();
     pform = parent;
 }
 public Ad_PwdReset(Ad_UserManage parent)
 {
     InitializeComponent();
     pform = parent;
     radioButton1.Checked = true;
 }