示例#1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrWhiteSpace(this.txtUsername.Text))
            {
                MessageBox.Show("Username is required!");
                return;
            }
            if (String.IsNullOrWhiteSpace(this.txtPassword.Text))
            {
                MessageBox.Show("Password is required!");
                return;
            }
            if (String.IsNullOrWhiteSpace(this.txtDBName.Text))
            {
                MessageBox.Show("Database name is required!");
                return;
            }

            if (String.IsNullOrWhiteSpace(this.txtServerName.Text) || this.cbDBType.Text == "Select the database type")
            {
                DialogResult selection = MessageBox.Show(this,
                                                         "Data system default will be Microsoft SQL Server.\nDo you want to continues?",
                                                         "Confirm default data system",
                                                         MessageBoxButtons.YesNo,
                                                         MessageBoxIcon.Question,
                                                         MessageBoxDefaultButton.Button1);

                if (selection == DialogResult.Yes)
                {
                    this.isEdited = true;
                    this.dataInfo = new DBInfo(
                        this.txtUsername.Text,
                        this.txtPassword.Text,
                        this.txtDBName.Text);
                    this.Close();
                }
                else
                {
                    return;
                }
            }
            else
            {
                this.isEdited = true;
                this.dataInfo = new DBInfo(
                    this.txtServerName.Text,
                    this.cbDBType.Text,
                    this.txtUsername.Text,
                    this.txtPassword.Text,
                    this.txtDBName.Text);
                this.Close();
            }
        }
示例#2
0
 private void btnReset_Click(object sender, EventArgs e)
 {
     this.isEdited = true;
     this.dataInfo = new DBInfo();
     this.Close();
 }