private void update_click(object sender, RoutedEventArgs e)
 {
     try
     {
         ProgramOffered    program = new ProgramOffered();
         ProgramsOfferedBL bL      = new ProgramsOfferedBL();
         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 updated = bL.Update(program.ProgramName, program);
         if (updated)
         {
             MessageBox.Show("Updated Succesfully");
         }
     }
     catch (UniversityException ex)
     {
         MessageBox.Show(ex.Message);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Ejemplo n.º 2
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);
     }
 }