Example #1
0
        public void Update(int UserID, string AccountName, string UserPassword, string UserName, int?RoleID, string Email, string PhoneNumber, string CertNumber)
        {
            DDUser item = new DDUser();

            item.MarkOld();
            item.IsLoaded = true;

            item.UserID = UserID;

            item.AccountName = AccountName;

            item.UserPassword = UserPassword;

            item.UserName = UserName;

            item.RoleID = RoleID;

            item.Email = Email;

            item.PhoneNumber = PhoneNumber;

            item.CertNumber = CertNumber;

            item.Save(UserName);
        }
Example #2
0
 private void btnUpdate_Click(object sender, EventArgs e)
 {
     try
     {
         DDUser newUser = new DDUser("AccountName", MainForm.AccountName);
         newUser.UserName    = this.tbxUserName.Text;
         newUser.PhoneNumber = this.tbxPhoneNumber.Text;
         newUser.Email       = this.tbxEmail.Text;
         newUser.CertNumber  = this.tbxCertNumber.Text;
         newUser.Save();
         MessageBox.Show(this, "信息修改成功!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     catch
     {
         MessageBox.Show(this, "信息修改失败,请检查数据库连接是否正确!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Example #3
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (CheckAllDate() != DialogResult.OK)
            {
                return;
            }
            else
            {
                Query query = new Query(DDUser.Schema);
                query.AddWhere("AccountName", this.tbxAccountName.Text);
                DataTable dt = query.ExecuteDataSet().Tables[0];
                if (dt.Rows.Count > 0)
                {
                    MessageBox.Show(this, "该帐户已存在,请重新输入!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.tbxAccountName.Focus();
                    return;
                }

                try
                {
                    this.dataGridView1.Rows.Add(1);
                    dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells["AccountName"].Value  = this.tbxAccountName.Text;
                    dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells["UserPassword"].Value = this.tbxPassword.Text;
                    dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells["UserName"].Value     = this.tbxUserName.Text;
                    dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells["PhoneNumber"].Value  = this.tbxPhoneNumber.Text;
                    dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells["Email"].Value        = this.tbxEmail.Text;
                    dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells["CertNumber"].Value   = this.tbxCertNumber.Text;
                    dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells["RoleID"].Value       = this.cbxRoleID.SelectedValue;

                    DDUser newUser = new DDUser();
                    newUser.AccountName  = this.tbxAccountName.Text;
                    newUser.UserPassword = this.tbxPassword.Text;
                    newUser.UserName     = this.tbxUserName.Text;
                    newUser.PhoneNumber  = this.tbxPhoneNumber.Text;
                    newUser.Email        = this.tbxEmail.Text;
                    newUser.CertNumber   = this.tbxCertNumber.Text;
                    newUser.RoleID       = Convert.ToInt32(this.cbxRoleID.SelectedValue);
                    newUser.Save();
                }
                catch
                {
                    MessageBox.Show(this, "数据添加失败,请检查数据库是否连接正确?", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
Example #4
0
        private void btnEditPwd_Click(object sender, EventArgs e)
        {
            if (this.tbxOldPassword.Text.Trim().Length == 0)
            {
                MessageBox.Show(this, "请输入原密码!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.tbxOldPassword.Focus();
                return;
            }
            if (this.tbxNewPassword.Text.Trim().Length == 0)
            {
                MessageBox.Show(this, "请输入新密码!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.tbxNewPassword.Focus();
                return;
            }
            if (this.tbxRepeatedPassword.Text.Trim().Length == 0)
            {
                MessageBox.Show(this, "请重复输入新密码!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.tbxRepeatedPassword.Focus();
                return;
            }
            if (this.tbxNewPassword.Text.Trim() != this.tbxRepeatedPassword.Text.Trim())
            {
                MessageBox.Show(this, "两次输入的密码不一致!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.tbxRepeatedPassword.Focus();
                return;
            }
            DDUser newUser = new DDUser("AccountName", MainForm.AccountName);

            if (this.tbxOldPassword.Text.Trim() != newUser.UserPassword)
            {
                MessageBox.Show(this, "原密码输入错误!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.tbxOldPassword.Focus();
                return;
            }
            else
            {
                newUser.UserPassword = this.tbxNewPassword.Text.Trim();
                newUser.Save();
                MessageBox.Show(this, "密码修改成功!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Example #5
0
        public void Insert(string AccountName, string UserPassword, string UserName, int?RoleID, string Email, string PhoneNumber, string CertNumber)
        {
            DDUser item = new DDUser();

            item.AccountName = AccountName;

            item.UserPassword = UserPassword;

            item.UserName = UserName;

            item.RoleID = RoleID;

            item.Email = Email;

            item.PhoneNumber = PhoneNumber;

            item.CertNumber = CertNumber;


            item.Save(UserName);
        }
Example #6
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (CheckAllDate() != DialogResult.OK)
            {
                return;
            }
            else
            {
                try
                {
                    DataGridViewRow dgr = dataGridView1.CurrentRow;
                    dgr.Cells["AccountName"].Value  = this.tbxAccountName.Text;
                    dgr.Cells["UserPassword"].Value = this.tbxPassword.Text;
                    dgr.Cells["UserName"].Value     = this.tbxUserName.Text;
                    dgr.Cells["PhoneNumber"].Value  = this.tbxPhoneNumber.Text;
                    dgr.Cells["Email"].Value        = this.tbxEmail.Text;
                    dgr.Cells["CertNumber"].Value   = this.tbxCertNumber.Text;
                    dgr.Cells["RoleID"].Value       = this.cbxRoleID.SelectedValue;

                    DDUser newUser = new DDUser("UserID", Convert.ToInt32(dgr.Cells["UserID"].Value));
                    newUser.AccountName  = this.tbxAccountName.Text;
                    newUser.UserPassword = this.tbxPassword.Text;
                    newUser.UserName     = this.tbxUserName.Text;
                    newUser.PhoneNumber  = this.tbxPhoneNumber.Text;
                    newUser.Email        = this.tbxEmail.Text;
                    newUser.CertNumber   = this.tbxCertNumber.Text;
                    newUser.RoleID       = Convert.ToInt32(this.cbxRoleID.SelectedValue);
                    newUser.Save();

                    MessageBox.Show("数据修改成功!", "修改数据");
                }
                catch
                {
                    MessageBox.Show(this, "数据修改失败,请检查数据库是否连接正确!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }