예제 #1
0
        protected void ProgramDataBind()
        {
            //the web page needs to access the BLL class method
            //   to obtain its data
            ProgramController sysmgr = new ProgramController();
            //get the actual data
            List <Program> info = sysmgr.Program_List();

            ProgramSelectionList.DataSource = info;
            ProgramSelectionList.DataBind();
        }
예제 #2
0
 protected void SearchProgram_Click(object sender, EventArgs e)
 {
     //if (ProgramList.SelectedIndex == 0)
     //{
     //    errormsgs.Add("Select a category to look up.");
     //    LoadMessageDisplay(errormsgs, "alert alert-info");
     //}
     //else
     //{
     try
     {
         //standard lookup
         ProgramController sysmgr = new ProgramController();
         //List<Program> info = sysmgr.Programs_FindByProgramName(info.ProgramName);
         List <Program> infoSchool = sysmgr.Programs_FindByProgramName(SearchPartialName.Text);
         ProgramSelectionList.DataSource = infoSchool;
         ProgramSelectionList.DataBind();
     }
     catch (DbUpdateException ex)
     {
         UpdateException updateException = (UpdateException)ex.InnerException;
         if (updateException.InnerException != null)
         {
             errormsgs.Add(updateException.InnerException.Message.ToString());
         }
         else
         {
             errormsgs.Add(updateException.Message);
         }
         LoadMessageDisplay(errormsgs, "alert alert-danger");
     }
     catch (DbEntityValidationException ex)
     {
         foreach (var entityValidationErrors in ex.EntityValidationErrors)
         {
             foreach (var validationError in entityValidationErrors.ValidationErrors)
             {
                 errormsgs.Add(validationError.ErrorMessage);
             }
         }
         LoadMessageDisplay(errormsgs, "alert alert-danger");
     }
     catch (Exception ex)
     {
         errormsgs.Add(GetInnerException(ex).ToString());
         LoadMessageDisplay(errormsgs, "alert alert-danger");
     }
 }