Exemplo n.º 1
0
        private static void GetAllProg()
        {
            ProgramsOfferedBL     prog = new ProgramsOfferedBL();
            List <ProgramOffered> p    = new List <ProgramOffered>();

            try
            {
                p = prog.GetAll();
                foreach (ProgramOffered ps in p)
                {
                    Console.WriteLine($"{ps.ProgramName},{ps.Description},{ps.ApllicationEligibility},{ps.Duration},{ps.DegreeCertificationOffered}");
                }
                if (p.Count > 0)
                {
                    Console.WriteLine("Succes");
                }
                else
                {
                    Console.WriteLine("Not success");
                }
            }
            catch (UniversityException ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
        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);
            }
        }
Exemplo n.º 3
0
        private static void DeletProg()
        {
            ProgramOffered    program   = new ProgramOffered();
            ProgramsOfferedBL programBl = new ProgramsOfferedBL();

            bool progdeleted = programBl.Delete(program, "Btech Cs");

            if (progdeleted)
            {
                Console.WriteLine("Deleted Succesfully");
            }
            else
            {
                Console.WriteLine("not succesfully deleted");
            }
        }
Exemplo n.º 4
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");
            }
        }
        private void delete_click(object sender, RoutedEventArgs e)
        {
            try
            {
                ProgramsOfferedBL bL = new ProgramsOfferedBL();

                bool deleted = bL.Delete(pname_txt.Text);
                if (deleted)
                {
                    MessageBox.Show("Deleted Succesfully");
                }
            }
            catch (UniversityException ex)
            {
                MessageBox.Show(ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 6
0
 private static void UpdateProg()
 {
     try
     {
         ProgramOffered program = new ProgramOffered()
         {
             ProgramName = "Btech Cs", Description = "computer study", ApllicationEligibility = "10th Pass", Duration = 3, DegreeCertificationOffered = "BCA Pass"
         };
         ProgramsOfferedBL programBl = new ProgramsOfferedBL();
         bool progadded = programBl.Update("BCA", program);
         if (progadded)
         {
             Console.WriteLine("Updated succesfully");
         }
         else
         {
             Console.WriteLine("not Updated succesfully");
         }
     }
     catch (UniversityException ex)
     {
         Console.WriteLine(ex.Message);
     }
 }