private void add_click(object sender, RoutedEventArgs e)
        {
            try
            {
                ProgramOffered    program = new ProgramOffered();
                ProgramsOfferedBL bL      = new ProgramsOfferedBL();

                // if(string.IsNullOrWhiteSpace(pname_txt.Text))

                if (pname_txt.Text.Length == 0)
                {
                    throw new UniversityException("Program Name Field Can not be Empty");
                }
                if (Desc_txt.Text.Length == 0)
                {
                    throw new UniversityException("Description Field Can not be Empty");
                }
                if (elg_txt.Text.Length == 0)
                {
                    throw new UniversityException("Application Eligibility Field Can not be Empty");
                }
                if (dur_txt.Text.Length == 0)
                {
                    throw new UniversityException("Duration Field Can not be Empty");
                }
                if (deg_txt.Text.Length == 0)
                {
                    throw new UniversityException("Degree Certificate Field Can not be Empty");
                }
                program.ProgramName            = pname_txt.Text;
                program.Description            = Desc_txt.Text;
                program.ApllicationEligibility = elg_txt.Text;
                program.Duration = Convert.ToInt32(dur_txt.Text);
                program.DegreeCertificationOffered = deg_txt.Text;

                bool added = bL.Add(program);
                if (added)
                {
                    MessageBox.Show("Added Succesfully");
                }
            }
            catch (UniversityException ex)
            {
                MessageBox.Show(ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
예제 #2
0
        static void AddProg()
        {
            ProgramOffered program = new ProgramOffered()
            {
                ProgramName = "Btech Cs", Description = "computer study", ApllicationEligibility = "12th Pass", Duration = 3, DegreeCertificationOffered = "BCA Pass"
            };

            ProgramsOfferedBL programBl = new ProgramsOfferedBL();
            bool progadded = programBl.Add(program);

            if (progadded)
            {
                Console.WriteLine("added succesfully");
            }
            else
            {
                Console.WriteLine("not added succesfully");
            }
        }