コード例 #1
0
ファイル: AccountOperation.cs プロジェクト: windygu/ERP-1
        private void button1_Click(object sender, EventArgs e)
        {
            //check the integry

            if (String.IsNullOrWhiteSpace(textBox1.Text.Trim()))
            {
                MessageBox.Show("Please input the name");
                textBox1.Focus();
                return;
            }
            if (String.IsNullOrWhiteSpace(maskedTextBox1.Text.Trim()))
            {
                MessageBox.Show("Please input the password");
                maskedTextBox1.Focus();
                return;
            }

            if (accountMgr.IsNameExist(textBox1.Text.Trim()))
            {
                MessageBox.Show(string.Format("The name:{0} already exists!"), textBox1.Text.Trim());
                textBox1.Focus();
                return;
            }


            //Check password is same
            if (maskedTextBox1.Text.Trim() != maskedTextBox2.Text.Trim())
            {
                MessageBox.Show("The Passwords do not match!");
                maskedTextBox1.Focus();
                return;
            }


            if (GetJobIdFromJobName(comboBox1.Text) == (int)JobDescription.Admin)
            {
                MessageBox.Show("You can not add an Admin.");
                comboBox1.Focus();
                return;
            }

            Save();
            this.Close();
        }