示例#1
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            string account = Frm_main.account;
            string oldPwd  = txtOldPwd.Text.Trim();
            string newPwd  = txtNewPwd.Text.Trim();
            string newPwd2 = txtNewPwd2.Text.Trim();

            DLLAdmin dll = new DLLAdmin();


            if (oldPwd == dll.GetPassword(account))
            {
                if (newPwd != newPwd2)
                {
                    MessageBox.Show("两次密码不一致!");
                    txtNewPwd.Focus();
                    return;
                }
                dll.ChangePassword(account, newPwd);
                MessageBox.Show("修改密码成功!");
                this.Dispose();
            }
            else
            {
                MessageBox.Show("原密码错误!");
                txtNewPwd.Focus();
            }
        }
示例#2
0
        private void BindGridView()
        {
            DLLAdmin dll = new DLLAdmin();
            DataSet  ds  = dll.ListAdmin();

            gridControl1.DataSource = ds.Tables[0];
        }
示例#3
0
 private void  除ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.gridView1.RowCount > 0)
         {
             if (this.gridView1.GetSelectedRows()[0] < 0)
             {
                 MessageBox.Show("没有选中信息,请选择!", "提示", MessageBoxButtons.OK);
                 return;
             }
             if (MessageBox.Show("确认删除账号信息", "确认信息", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.OK)
             {
                 DLLAdmin dao      = new DLLAdmin();
                 string   ADMIN_ID = this.gridView1.GetRowCellValue(this.gridView1.FocusedRowHandle, this.gridView1.Columns[0]).ToString();
                 if (dao.delete(ADMIN_ID))
                 {
                     BindGridView();
                 }
             }
         }
     }
     catch
     {
         MessageBox.Show("删除失败,这个车型在被使用!\n");
         return;
     }
 }
示例#4
0
文件: Frm_main.cs 项目: 16201320/-
        private void Frm_main_FormClosed(object sender, FormClosedEventArgs e)
        {
            frmLogin.Dispose();
            DLLAdmin dll = new DLLAdmin();

            dll.QuitLogin(account);
        }
示例#5
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string account  = txtAccount.Text.Trim();
            string password = txtPassword.Text.Trim();

            DLLAdmin dll = new DLLAdmin();

            if (dll.Login(account, password))
            {
                Frm_main frm = new Frm_main(this, getAdminName(account));
                frm.Show();
                Frm_main.admin   = account;
                txtAccount.Text  = "";
                txtPassword.Text = "";
                this.Hide();
            }
            else
            {
                MessageBox.Show("用户名或密码不正确,请重试!");
            }
        }
示例#6
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();
        }
示例#7
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;
            }
        }