Esempio n. 1
0
        //添加登陆用户
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            DLLAdmin dao  = new DLLAdmin();
            string   name = ACCOUNT.Text.Trim();

            //控制参数格式
            if (name == "")
            {
                MessageBox.Show("信息不能为空!");
                return;
            }
            string sql1 = "select * from ADMIN_INFO where ACCOUNT = '" + name + "'";

            if (common.SqlHelper.ExcuteSql(sql1) > 0)
            {
                MessageBox.Show("该账号已经被使用!", "信息提示", MessageBoxButtons.OK);
                return;
            }
            dao.add(this.ACCOUNT.Text.Trim(), this.ACCOUNT_TYPE.Text.Trim(), this.NAME.Text.Trim(), this.PASSWORD.Text.Trim());
            BindGridView();
        }
Esempio n. 2
0
        //保存账号信息
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            DLLAdmin dao  = new DLLAdmin();
            string   name = ACCOUNT.Text.Trim();

            //控制参数格式
            if (name == "")
            {
                MessageBox.Show("信息不能为空!");
                return;
            }
            switch (strOperationFlag)
            {
            case "add":
                string sql1 = "select * from ADMIN_INFO where ACCOUNT = '" + name + "'";
                if (common.SqlHelper.ExcuteSql(sql1) > 0)
                {
                    MessageBox.Show("该账号已经被使用!", "信息提示", MessageBoxButtons.OK);
                    return;
                }
                dao.add(this.ACCOUNT.Text.Trim(), this.ACCOUNT_TYPE.Text.Trim(), this.NAME.Text.Trim(), this.PASSWORD.Text.Trim());
                this.DialogResult = DialogResult.OK;
                this.Close();
                break;

            case "modify":
                string sql2 = "select count(*) from ADMIN_INFO where ACCOUNT = '" + name + "' and ADMIN_ID <> '" + ADMIN_ID + "'";
                if (common.SqlHelper.ExcuteSql(sql2) > 0)
                {
                    MessageBox.Show("该账号已经被使用!", "信息提示", MessageBoxButtons.OK);
                    this.ACCOUNT.Focus();
                    return;
                }
                dao.Modify(this.ADMIN_ID, ACCOUNT.Text.Trim(), this.ACCOUNT_TYPE.Text.Trim(), this.NAME.Text.Trim(), this.PASSWORD.Text.Trim());
                this.DialogResult = DialogResult.OK;
                this.Close();
                break;
            }
        }