コード例 #1
0
 // FOR SUBMIT BUTTON
 public void checkEmptyAndSave()
 {
     if (StudentNameText.Text.Length <= 2)
     {
         this.ShowMessageAsync("Empty", "Student Name Box is empty!");
         StudentNameText.Focus();
     }
     else if (DOBText.Text.Length < 8)
     {
         this.ShowMessageAsync("Empty or Missing", "DOB is empty!");
         DOBText.Focus();
     }
     else if (FatherCNICText.Text.Length <= 2)
     {
         this.ShowMessageAsync("Empty", "Father CNIC Box is empty!");
         FatherCNICText.Focus();
     }
     //else if (HomeAddressText.Text.Length <= 2)
     //{
     //    this.ShowMessageAsync("Empty", "Address Box is empty!");
     //    HomeAddressText.Focus();
     //}
     else if (EmergencyText.Text.Length <= 2)
     {
         this.ShowMessageAsync("Empty", "Mobile Number Box is empty!");
         EmergencyText.Focus();
     }
     else
     {
         saveNewStudent();
     }
 }
コード例 #2
0
 // FOR UPDATE BUTTON
 public void emptyBoxes()
 {
     if (StudentNameText.Text.Length <= 2)
     {
         this.ShowMessageAsync("Empty", "Student Name Box is empty!");
         StudentNameText.Focus();
     }
     else if (DOBText.Text.Length < 8)
     {
         this.ShowMessageAsync("Empty or Missing", "DOB is empty!");
         DOBText.Focus();
     }
     else if (FatherCNICText.Text.Length <= 2)
     {
         this.ShowMessageAsync("Empty", "Father CNIC Box is empty!");
         FatherCNICText.Focus();
     }
     //else if (HomeAddressText.Text.Length <= 2)
     //{
     //    this.ShowMessageAsync("Empty", "Address Box is empty!");
     //    HomeAddressText.Focus();
     //}
     else if (EmergencyText.Text.Length <= 2)
     {
         this.ShowMessageAsync("Empty", "Mobile Number Box is empty!");
         EmergencyText.Focus();
     }
     else
     {
         try
         {
             //3. Mark entity as modified
             context.Entry(search).State = System.Data.Entity.EntityState.Modified;
             context.SaveChanges();
             this.ShowMessageAsync("Student Updated", "Student updated successfully");
             clearAll();
             nextAdmission();
             UpdateButton.Visibility = Visibility.Hidden;
             SubmitButton.Visibility = Visibility.Visible;
             Grade.SelectedIndex     = 0;
             onLoad();
         }
         catch (DbEntityValidationException err)
         {
             foreach (var eve in err.EntityValidationErrors)
             {
                 Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                                   eve.Entry.Entity.GetType().Name, eve.Entry.State);
                 foreach (var ve in eve.ValidationErrors)
                 {
                     Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"",
                                       ve.PropertyName, ve.ErrorMessage);
                 }
             }
         }
     }
 }
コード例 #3
0
        public void onLoad()
        {
            PINextButton.Content = Fa.Arrow_right;
            FIBackButton.Content = Fa.Arrow_left;
            FInextButton.Content = Fa.Arrow_right;
            RBackButton.Content  = Fa.Arrow_left;

            StudentNameText.Focus();
            DateDisplay.Content = DateTime.Now.ToString("dd-MM-yyyy");
            //DOBText.Text = "DD/MM/YYYY";
            string format      = "yy";
            var    CurrentYear = DateTime.Now.ToString(format);
            var    NextYear    = DateTime.Now.AddYears(1);

            AcademicYearDisplay.Text = CurrentYear + "-" + NextYear.ToString(format);
            nextAdmission();
        }
コード例 #4
0
 private void ResetOnLostFocus(object sender, RoutedEventArgs e)
 {
     if (AdmissionNumberDisplay.Text == "")
     {
         nextAdmission();
         clearAll();
         UpdateButton.Visibility = Visibility.Hidden;
         SubmitButton.Visibility = Visibility.Visible;
         StudentNameText.Focus();
     }
     else if (AdmissionNumberDisplay.Text != "")
     {
         UpdateButton.Visibility = Visibility.Visible;
         SubmitButton.Visibility = Visibility.Collapsed;
         int entered;
         Int32.TryParse(AdmissionNumberDisplay.Text.ToString(), out entered);
         forUpdate(entered);
         StudentNameText.Focus();
     }
 }