コード例 #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            ISpecialityService specialityService = new SpecialityService();
            String             description       = txtSpeciality.Text.ToString().Trim();
            speciality         objSpeciality     = new speciality();

            objSpeciality.description = description;
            if (description.Length == 0)
            {
                MessageBox.Show("Type an speciality");
            }
            else if (specialityService.GetSpecialityByDescription(description) != null)
            {
                MessageBox.Show("This speciality is already saved. Try another");
            }
            else
            {
                specialityService.CreateSpeciality(objSpeciality);
                MessageBox.Show("Speciality saved");
            }

            this.specialityTableAdapter.Fill(this.finalAppWebDataSet.speciality);
        }