示例#1
0
        private void AddOrEdit(int id)
        {
            switch (FormType)
            {
            case STUDENTS:
                StudentEditForm form1 = new StudentEditForm(id);
                form1.ShowDialog();
                break;

            case TRAINERS:
                TrainerEditForm form2 = new TrainerEditForm(id);
                form2.ShowDialog();
                break;

            case SCHEDULE:
                ScheduleEditForm form3 = new ScheduleEditForm(id);
                form3.ShowDialog();
                break;

            case GROUPS:
                GroupsEditForm form4 = new GroupsEditForm(id);
                form4.ShowDialog();
                break;
            }
            RefreshResults(false);
        }
示例#2
0
 public StudentEditPresenter(StudentEditForm form, StudentTicketBLL student)
 {
     this.form           = form;
     this.currentStudent = student;
     validator           = new FormValidator();
     serviceFactory      = new ServiceFactory(new PGRepositoryFactory());
     service             = serviceFactory.getUserService();
 }
示例#3
0
        public void openUpdateStudentForm()
        {
            StudentEditForm edit = new StudentEditForm(getStudentFromTextBoxes());

            edit.ShowDialog();
            getListOfStudents();
            reloadStudGrid();
        }
示例#4
0
 public void openEditForm()
 {
     if (currentUser is StudentTicketBLL)
     {
         StudentEditForm form = new StudentEditForm(currentUser as StudentTicketBLL);
         form.Show();
     }
     else if (currentUser is WorkerTicketBLL)
     {
         WorkerEditForm form = new WorkerEditForm(currentUser as WorkerTicketBLL);
         form.ShowDialog();
     }
     loadInfo();
 }
        public ActionResult Edit(StudentEditForm form)
        {
            if (form == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }

            var updatee = UoW.Students.GetById(form.Id);

            var updated = TryUpdateModel(updatee, "", new string[] 
            {
                "LastName",
                "FirstMidName",
                "EnrollmentDate"
            });

            if (updated)
            {
                try
                {
                    UoW.Commit();

                    return RedirectToAction<StudentController>(c => c.Index(null, null, null, null))
                        .WithSuccess("Instructor Updated Successfully!");
                }
                catch (RetryLimitExceededException /* dex */)
                {
                    //Log the error (uncomment dex variable name and add a line here to write a log.
                    ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists, see your system administrator.");
                }
            }

            return View(updatee).WithError("Error occured! Look at the info below.");
        }