コード例 #1
0
        private void modifyButton_Click(object sender, EventArgs e)
        {
            // Better make sure it isn't the empty string or all blanks
            string newProjectName = modifyTextbox.Text.Trim();

            if (newProjectName == "")
            {
                MessageBox.Show("Feature name cannot be empty or blank", "Attention");
                return;
            }
            FakeFeatureRepository fake2 = new FakeFeatureRepository();

            if (fake2.isDuplicate(newProjectName))
            {
                MessageBox.Show("Feature title already exists.", "Attention");
                return;
            }
            Feature feat = new Feature
            {
                ID    = _selectId,
                Title = modifyTextbox.Text.Trim()
            };

            string result = fake2.Modify(feat);

            if (result != FakeFeatureRepository.NO_ERROR)
            {
                MessageBox.Show("Error modifying title. Error: " + result);
            }
            else
            {
                MessageBox.Show("Title modification successful.", "Information");
                this.Close();
            }
        }
コード例 #2
0
        private void createButton_Click(object sender, EventArgs e)
        {
            FakeFeatureRepository feat = new FakeFeatureRepository();
            Feature f = new Feature();

            f.ID        = feat.GetNextFeatureID(_selectProj);
            f.ProjectID = _selectProj;

            if (feat.isDuplicate(featTextBox.Text.Trim()) == true)
            {
                MessageBox.Show("Title Must Be Unique", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (featTextBox.Text.Trim() == "")
            {
                MessageBox.Show("Title Must Have a Value", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                f.Title = featTextBox.Text.Trim();
                feat.Add(f);
            }
            this.Close();
        }