private void withdrawButtonClick(object sender, RoutedEventArgs e)
        {
            try
            {
                var selecteditem = new List <SearchStudentInfoAllByIdResult>();

                foreach (SearchStudentInfoAllByIdResult item in StudentSearchGrid.ItemsSource)
                {
                    if (((CheckBox)SelectedStudent.GetCellContent(item)).IsChecked == true)
                    {
                        int withdrawNumber = item.AdmissionNumber;
                        context.RemoveOrRestore(admissionNumber: withdrawNumber, active: "False", date: DateTime.Now.Date);
                    }
                }
                withdrawButton.IsEnabled = false;
                onLoad();
                this.ShowMessageAsync("Done", "Process completed");
            }
            catch (System.InvalidCastException err)
            {
                this.ShowMessageAsync("Selection Error!", "You didn't select any item or the search result doesn't belong to your query / Withdraw is only on ID");
                Debug.WriteLine(err.ToString());
            }
            clearAll(stdId);
            onLoad();
        }
예제 #2
0
        private void createButtonClick(object sender, RoutedEventArgs e)
        {
            createFamily();
            currentIndex();

            if (sNameRadioButton.IsChecked == true && sName.Text != "")
            {
                var SelectedItem = new List <SearchStudentInfoAllByNameResult>();

                foreach (SearchStudentInfoAllByNameResult item in StudentSearchGrid.ItemsSource)
                {
                    if (((CheckBox)SelectedStudent.GetCellContent(item)).IsChecked == true)
                    {
                        var re = context.AddMembersToFamily(admissionNumber: item.AdmissionNumber, familyID: currentIndex(), date: DateTime.Now.Date);
                    }
                }
                this.ShowMessageAsync("Successful", "New Family Created and Member are added to the family");
            }
            if (fNameRadioButton.IsChecked == true && fName.Text != "")
            {
                var SelectedItem = new List <SearchStudentInfoAllByFatherNameResult>();

                foreach (SearchStudentInfoAllByFatherNameResult item in StudentSearchGrid.ItemsSource)
                {
                    if (((CheckBox)SelectedStudent.GetCellContent(item)).IsChecked == true)
                    {
                        var re = context.AddMembersToFamily(admissionNumber: item.AdmissionNumber, familyID: currentIndex(), date: DateTime.Now.Date);
                    }
                }
                this.ShowMessageAsync("Successful", "New Family Created and Member are added to the family");
            }
        }
예제 #3
0
        private void ClassDeleteFeeButtonClick(object sender, RoutedEventArgs e)
        {
            try
            {
                string grade = ((ComboBoxItem)Grade.SelectedItem).Tag.ToString();

                var selectedItem = new List <SearchStudentInfoByGradeResult>();

                foreach (SearchStudentInfoByGradeResult item in StudentSearchGrid.ItemsSource)
                {
                    if (((CheckBox)SelectedStudent.GetCellContent(item)).IsChecked == true)
                    {
                        context.ClassDeleteFee
                        (
                            feeID: selectedID,
                            feeMonth: ClassGetDate(),
                            admissionNumber: item.AdmissionNumber
                        );
                    }
                }
                this.ShowMessageAsync("Are you sure!?",
                                      "This action auto deletes the Fee of selected name, month and year. Which can't be retrived after. If the fee is being paid it will be erased from invoice and accounts");
                Grade.SelectedIndex = 0;
            }
            catch (NullReferenceException)
            {
                this.ShowMessageAsync("No selection made", "The grade is not selected");
                Grade.Focus();
            }
        }
예제 #4
0
        public bool Remove(BaseEntity entity)
        {
            bool result = false;

            if (entity == null)
            {
                ShowFeedback("No valid group selected. Canceling.", FeedbackType.Error);
                return(false);
            }
            try
            {
                ClearFeedback();
                string msg = "";
                int    gId = entity.Id;
                result = SelectedStudent.RemoveGroup((Group)entity, UnitOfWork, ref msg);
                if (result)
                {
                    RefreshAvailableGroups(SelectedStudent);
                    ShowFeedback($"Removed Student {SelectedStudent.Id} from Group {gId}.", FeedbackType.Success);
                    result = true;
                }
                else
                {
                    ShowFeedback(msg, FeedbackType.Error);
                }

                return(result);
            }
            catch (Exception ex)
            {
                ShowFeedback(ex.Message, FeedbackType.Error);
                return(false);
            }
        }
예제 #5
0
 public void UpdateStudent()
 {
     if (SelectedStudent != null)
     {
         var output_chair = Student.ValidateChairNumber(ChairNumber);
         if (!output_chair.IsSuccess)
         {
             MessageBox.Show(output_chair.AllErrors, "Warning!", MessageBoxButton.OK, MessageBoxImage.Error);
         }
         else
         {
             SelectedStudent.Name        = Name;
             SelectedStudent.ChairNumber = output_chair.ValidatedResult;
             SelectedStudent.Dni         = Dni;
             var res_save = SelectedStudent.Save();
             if (!res_save.IsSuccess)
             {
                 MessageBox.Show(res_save.AllErrors, "Warning!", MessageBoxButton.OK, MessageBoxImage.Error);
             }
             else
             {
                 GetStudents();
                 ClearStudent();
             }
         }
     }
 }
        private void DeleteCurrent(object sender, RoutedEventArgs e)
        {
            if (SelectedItem.GetType().Name == SelectedFaculty.GetType().Name)
            {
                SelectedFaculty = (FacultyViewModel)SelectedItem;
                Collection.Remove(SelectedFaculty.Key, true);
                CollectionView.Remove(SelectedFaculty);
            }

            if (SelectedItem.GetType().Name == SelectedGroup.GetType().Name)
            {
                SelectedGroup = (GroupViewModel)SelectedItem;
                Faculty <int, Group <int, Student> > faculty;
                Collection.TryGetValue(SelectedGroup.Parent.Key, out faculty, true);
                faculty.Remove(SelectedGroup.Key, true);
                SelectedGroup.Parent.Groups.Remove(SelectedGroup);
            }

            if (SelectedItem.GetType().Name == SelectedStudent.GetType().Name)
            {
                SelectedStudent = (StudentViewModel)SelectedItem;
                Faculty <int, Group <int, Student> > faculty;
                Collection.TryGetValue(SelectedStudent.Parent.Parent.Key, out faculty, true);
                Group <int, Student> group;
                faculty.TryGetValue(SelectedStudent.Parent.Key, out group, true);
                group.Remove(SelectedStudent.Key, true);
                SelectedStudent.Parent.Students.Remove(SelectedStudent);
            }

            TreeViewAll.ItemsSource = null;
            TreeViewAll.ItemsSource = CollectionView;
        }
예제 #7
0
 public void DeleteStudent()
 {
     if (SelectedStudent != null)
     {
         SelectedStudent.Delete();
         GetStudents();
     }
 }
예제 #8
0
 private void CancelStudentExecute()
 {
     if (SelectedStudent != null)
     {
         SelectedStudent.CopyTo(TempSelectedStudent);
     }
     else
     {
         SelectedStudent = StudentList[0];
     }
 }
예제 #9
0
 private void enter_edit_mode()
 {
     EditMode      = true;
     NewMode       = false;
     _edit_student = SelectedStudent.Clone();
     messenger_send_set_student(_edit_student);
     // Keep a pointer to the current item on list
     _last_selected_student = SelectedStudent;
     // Set the selected item to the edit copy
     SelectedStudent = _edit_student;
 }
예제 #10
0
        private void ClasssAssignFeeButtonClick(object sender, RoutedEventArgs e)
        {
            try
            {
                string grade = ((ComboBoxItem)Grade.SelectedItem).Tag.ToString();

                DateTime DueDate;
                if (DueDateText.Text.Contains("/"))
                {
                    DueDate = DateTime.ParseExact(ClassDueDate.Text.ToString(), "dd/MM/yyyy", CultureInfo.InvariantCulture);
                }
                else
                {
                    DueDate = DateTime.ParseExact(ClassDueDate.Text.ToString(), "dd-MM-yyyy", CultureInfo.InvariantCulture);
                }
                DateTime AppliedDate = DateTime.Now.Date;

                var selectedItem = new List <SearchStudentInfoByGradeResult>();

                //Console.WriteLine(ClassSelectedID.ToString(), "feeID");
                //Console.WriteLine(ClassGetFeeAmount().ToString(), "ClassGetFeeAmount");
                //Console.WriteLine(ClassgetFineAmount().ToString(), "ClassgetFineAmount");
                //Console.WriteLine(DueDate.ToString(), "DueDate");
                //Console.WriteLine(DueDate.ToString(), "DueDate");
                //Console.WriteLine(AppliedDate.ToString(), "appliedON");
                //Console.WriteLine(ClassGetDate().ToString(), "feeMonth");

                foreach (SearchStudentInfoByGradeResult item in StudentSearchGrid.ItemsSource)
                {
                    //if (((CheckBox)SelectedStudent.GetCellContent(item)).IsChecked == true)
                    if (((CheckBox)SelectedStudent.GetCellContent(item)).IsChecked == true)
                    {
                        Console.WriteLine(ClassSelectedID.ToString() + " feeID");
                        Console.WriteLine(ClassGetFeeAmount().ToString() + " ClassGetFeeAmount");
                        Console.WriteLine(ClassgetFineAmount().ToString() + " ClassgetFineAmount");
                        Console.WriteLine(DueDate.ToString() + " DueDate");
                        Console.WriteLine(item.AdmissionNumber.ToString() + " item.AdmissionNumber");
                        Console.WriteLine(AppliedDate.ToString() + " appliedON");
                        Console.WriteLine(ClassGetDate().ToString() + " feeMonth");
                    }
                }

                this.ShowMessageAsync("Done", "Process completed");
            }
            catch (System.InvalidCastException err)
            {
                this.ShowMessageAsync("Selection Error!", "You didn't select any item or the search result doesn't belong to your query / Withdraw is only on ID");
                Debug.WriteLine(err.ToString());
            }
        }
예제 #11
0
        public bool Save()
        {
            ClearFeedback();
            bool result;

            try
            {
                if (FormContext == FormContext.Create)
                {
                    //Create New
                    result = Lecturer.AddNewStudent(SelectedStudent, UnitOfWork);
                    if (result)
                    {
                        UpdateMyStudentsList(studentRowsToReturn);
                        ShowFeedback($"Created Student: {SelectedStudent.Id}.", FeedbackType.Success);
                    }
                    else
                    {
                        ShowFeedback($"Failed to create student.", FeedbackType.Error);
                    }
                }
                else
                {
                    //Update
                    result = SelectedStudent.Validate();
                    if (result)
                    {
                        result = (UnitOfWork.Complete() > 0) ? true : false;
                        if (result)
                        {
                            ShowFeedback($"Updated Student: {SelectedStudent.Id}.", FeedbackType.Success);
                        }
                        else
                        {
                            ShowFeedback($"Student not updated: {SelectedStudent.Id}.", FeedbackType.Error);
                            result = false;
                        }
                    }
                }
                return(result);
            }
            catch (Exception ex)
            {
                ShowFeedback(ex.GetBaseException().Message, FeedbackType.Error);
                return(false);
            }
        }
        private void FillFields()
        {
            windowAddStudent.NameTextbox.Text      = SelectedStudent.FirstName;
            windowAddStudent.LastNameTextBox.Text  = SelectedStudent.LastName;
            windowAddStudent.dateTimePicker1.Value = SelectedStudent.DateOfBirth;
            windowAddStudent.EmailTextBox.Text     = SelectedStudent.Email;
            windowAddStudent.addStudentGenderComboBox.SelectedItem = SelectedStudent.Gender;
            windowAddStudent.StreetTextBox.Text      = SelectedStudent.Address;
            windowAddStudent.PostalcodeTextBox.Text  = SelectedStudent.Postalcode;
            windowAddStudent.DialogAddResidence.Text = SelectedStudent.Residence;
            windowAddStudent.DialogAddLevel.Text     = SelectedStudent.Niveau.ToString();
            Console.WriteLine(SelectedStudent.ParentID.ToString());

            //Als geselecteerde user een eigenaar is zal deze zijn level niet kunnen aanpassen
            if (SelectedStudent.IsOwner)
            {
                windowAddStudent.DialogAddLevel.Enabled = false;
            }

            //Als de geselecteerde leerling een ouderheeft zal deze informatie ook zichtbaar worden
            if (SelectedStudent.ParentID != null)
            {
                using (DatabaseContext db = new DatabaseContext())
                {
                    var parent = db.Parents.Select(x => x).Where(x => x.ParentID == SelectedStudent.ParentID).SingleOrDefault();
                    windowAddStudent.AddParentFirstName.Text      = parent.FirstName;
                    windowAddStudent.AddParentLastName.Text       = parent.LastName;
                    windowAddStudent.AddParentStreet.Text         = parent.Address;
                    windowAddStudent.AddParentPostalcode.Text     = parent.Postalcode;
                    windowAddStudent.AddParentResidence.Text      = parent.Residence;
                    windowAddStudent.AddParentEmail.Text          = parent.Residence;
                    windowAddStudent.AddParentGender.SelectedItem = parent.Gender;
                }
            }
            else if (SelectedStudent.CalculateAge() < 18)
            {
                windowAddStudent.groupBox2.Enabled = true;
            }
            else
            {
                windowAddStudent.groupBox2.Enabled = false;
            }
        }
예제 #13
0
        private void EditSelectedStudent(object parameter)
        {
            if (SelectedStudent == null)
            {
                return;
            }

            var selectedStudentClone = (StudentDTO)SelectedStudent.Clone();
            var editResult           = studentService.Edit(selectedStudentClone);

            if (editResult)
            {
                SelectedStudent.FirstName = selectedStudentClone.FirstName;
                SelectedStudent.LastName  = selectedStudentClone.LastName;
                SelectedStudent.Age       = selectedStudentClone.Age;
                SelectedStudent.Gender    = selectedStudentClone.Gender;

                var student = MappingUtil.MapToInstance <StudentDTO, Student>(selectedStudent);
                studentRepository.Update(student);
            }
        }
예제 #14
0
        public bool GenerateNewPasswordHash(string optionalNewPassword)
        {
            ClearFeedback();
            bool result = false;

            try
            {
                //Confirmation Check
                Mediator.NotifyColleagues(MediatorChannels.StudentsPageGeneratePasswordCheck.ToString(), null);
                if (IsConfirmed)
                {
                    //randomly generate
                    result = SelectedStudent.GenerateNewPasswordHash(ref optionalNewPassword, null);
                    OnPropertyChanged(nameof(SelectedStudent));
                    if (result)
                    {
                        ShowFeedback("Password hash generated: \nRemember to save changes.", FeedbackType.Info);
                    }
                    else
                    {
                        ShowFeedback("Failed to generate new password hash.", FeedbackType.Error);
                    }
                    //Temporary display new password
                    Mediator.NotifyColleagues(MediatorChannels.StudentsPageNewPasswordDisplay.ToString(), optionalNewPassword);
                    return(true);
                }
                else
                {
                    ShowFeedback("Generation of new password Canceled.", FeedbackType.Error);
                    return(false);
                }
            }
            catch (Exception ex)
            {
                ShowFeedback(ex.Message, FeedbackType.Error);
                return(false);
            }
        }
예제 #15
0
        private void TreeViewSelected(object sender, RoutedEventArgs e)
        {
            TreeViewItem tvi = e.OriginalSource as TreeViewItem;

            if (tvi != null)
            {
                if (tvi.DataContext.GetType().Name == SelectedFaculty.GetType().Name)
                {
                    Add_Info_Button.Content = "_Add group...";
                    Delete_Button.Content   = "_Delete faculty";
                    Modify_Button.Content   = "_Modify faculty...";
                    Delete_Button.IsEnabled = true;
                    Delete_Button.Opacity   = 1;
                    Modify_Button.Opacity   = 1;
                    Modify_Button.IsEnabled = true;

                    SelectedItem    = (FacultyViewModel)tvi.DataContext;
                    SelectedFaculty = (FacultyViewModel)tvi.DataContext;
                    bool hasstuds = false;
                    foreach (var group in SelectedFaculty.Groups)
                    {
                        if (group.Students.Count != 0)
                        {
                            hasstuds = true;
                        }
                    }
                    AM_TB.Content = (hasstuds) ? "Faculty average mark: " + SelectedFaculty.AM
                        : "";
                }
                if (tvi.DataContext.GetType().Name == SelectedGroup.GetType().Name)
                {
                    Add_Info_Button.Content = "_Add student...";
                    Delete_Button.Content   = "_Delete group";
                    Modify_Button.Content   = "_Modify group...";
                    Delete_Button.IsEnabled = true;
                    Delete_Button.Opacity   = 1;
                    Modify_Button.Opacity   = 1;
                    Modify_Button.IsEnabled = true;
                    SSListButton.IsEnabled  = true;
                    SSListButton.Opacity    = 1;

                    SelectedItem  = (GroupViewModel)tvi.DataContext;
                    SelectedGroup = (GroupViewModel)tvi.DataContext;
                    AM_TB.Content = (SelectedGroup.Students.Count != 0) ? "Group average mark: " + SelectedGroup.AM : "";
                }
                if (tvi.DataContext.GetType().Name == SelectedStudent.GetType().Name)
                {
                    Add_Info_Button.Content = "_More info...";
                    Delete_Button.Content   = "_Delete student";
                    Modify_Button.Content   = "_Modify student...";
                    Delete_Button.IsEnabled = true;
                    Delete_Button.Opacity   = 1;
                    Modify_Button.Opacity   = 1;
                    Modify_Button.IsEnabled = true;


                    SelectedItem    = (StudentViewModel)tvi.DataContext;
                    SelectedStudent = (StudentViewModel)tvi.DataContext;
                    AM_TB.Content   = "Student average mark: " + SelectedStudent.AM;
                }
            }
        }
예제 #16
0
        private void ModifyCurrent(object sender, RoutedEventArgs e)
        {
            if (SelectedItem.GetType().Name == SelectedFaculty.GetType().Name)
            {
                InputPage ip = new InputPage((FacultyViewModel)SelectedItem, "Modify");
                ip.Owner = this;
                ip.Resources["BorderColor"]    = Resources["BorderColor"];
                ip.Resources["ButtonColor"]    = Resources["ButtonColor"];
                ip.Resources["BGColor"]        = Resources["BGColor"];
                ip.Resources["TextColor"]      = Resources["TextColor"];
                ip.Resources["FontStyle"]      = Resources["FontStyle"];
                ip.Resources["FontFamily"]     = Resources["FontFamily"];
                ip.Resources["FontSizeSmall"]  = Resources["FontSizeSmall"];
                ip.Resources["FontSizeMedium"] = Resources["FontSizeMedium"];
                ip.Resources["FontSizeLarge"]  = Resources["FontSizeLarge"];

                ip.Show();

                TreeViewAll.ItemsSource = null;
                TreeViewAll.ItemsSource = CollectionView;
            }

            if (SelectedItem.GetType().Name == SelectedGroup.GetType().Name)
            {
                InputPage ip = new InputPage((GroupViewModel)SelectedItem, "Modify");
                ip.Owner = this;
                ip.Resources["BorderColor"]    = Resources["BorderColor"];
                ip.Resources["ButtonColor"]    = Resources["ButtonColor"];
                ip.Resources["BGColor"]        = Resources["BGColor"];
                ip.Resources["TextColor"]      = Resources["TextColor"];
                ip.Resources["FontStyle"]      = Resources["FontStyle"];
                ip.Resources["FontFamily"]     = Resources["FontFamily"];
                ip.Resources["FontSizeSmall"]  = Resources["FontSizeSmall"];
                ip.Resources["FontSizeMedium"] = Resources["FontSizeMedium"];
                ip.Resources["FontSizeLarge"]  = Resources["FontSizeLarge"];

                ip.Show();

                TreeViewAll.ItemsSource = null;
                TreeViewAll.ItemsSource = CollectionView;
            }

            if (SelectedItem.GetType().Name == SelectedStudent.GetType().Name)
            {
                SelectedStudent = (StudentViewModel)SelectedItem;
                StudentInput si = new StudentInput((StudentViewModel)SelectedItem);
                si.Owner = this;
                si.Resources["BorderColor"]    = Resources["BorderColor"];
                si.Resources["ButtonColor"]    = Resources["ButtonColor"];
                si.Resources["BGColor"]        = Resources["BGColor"];
                si.Resources["TextColor"]      = Resources["TextColor"];
                si.Resources["FontStyle"]      = Resources["FontStyle"];
                si.Resources["FontFamily"]     = Resources["FontFamily"];
                si.Resources["FontSizeSmall"]  = Resources["FontSizeSmall"];
                si.Resources["FontSizeMedium"] = Resources["FontSizeMedium"];
                si.Resources["FontSizeLarge"]  = Resources["FontSizeLarge"];

                si.Show();

                TreeViewAll.ItemsSource = null;
                TreeViewAll.ItemsSource = CollectionView;
            }
        }
 void _AddAssignment()
 {
     SelectedStudent.AddAssignment("New", 0, 100);
 }
예제 #18
0
        private void Add(object sender, RoutedEventArgs e)
        {
            if (SelectedItem == null)
            {
                InputPage ip = new InputPage(new FacultyViewModel(), "Add");
                ip.Owner = this;

                ip.Resources["BorderColor"]    = Resources["BorderColor"];
                ip.Resources["ButtonColor"]    = Resources["ButtonColor"];
                ip.Resources["BGColor"]        = Resources["BGColor"];
                ip.Resources["TextColor"]      = Resources["TextColor"];
                ip.Resources["FontStyle"]      = Resources["FontStyle"];
                ip.Resources["FontFamily"]     = Resources["FontFamily"];
                ip.Resources["FontSizeSmall"]  = Resources["FontSizeSmall"];
                ip.Resources["FontSizeMedium"] = Resources["FontSizeMedium"];
                ip.Resources["FontSizeLarge"]  = Resources["FontSizeLarge"];

                ip.Show();

                TreeViewAll.ItemsSource     = null;
                TreeViewAll.ItemsSource     = CollectionView;
                Delete_All_Button.IsEnabled = true;
                Delete_All_Button.Opacity   = 1;
                return;
            }

            if (SelectedItem.GetType().Name == SelectedFaculty.GetType().Name)
            {
                SelectedFaculty = (FacultyViewModel)SelectedItem;
                InputPage ip = new InputPage(new GroupViewModel()
                {
                    Parent = SelectedFaculty
                }, "Add");
                ip.Owner = this;

                ip.Resources["BorderColor"]    = Resources["BorderColor"];
                ip.Resources["ButtonColor"]    = Resources["ButtonColor"];
                ip.Resources["BGColor"]        = Resources["BGColor"];
                ip.Resources["TextColor"]      = Resources["TextColor"];
                ip.Resources["FontStyle"]      = Resources["FontStyle"];
                ip.Resources["FontFamily"]     = Resources["FontFamily"];
                ip.Resources["FontSizeSmall"]  = Resources["FontSizeSmall"];
                ip.Resources["FontSizeMedium"] = Resources["FontSizeMedium"];
                ip.Resources["FontSizeLarge"]  = Resources["FontSizeLarge"];

                ip.Show();
                TreeViewAll.ItemsSource = null;
                TreeViewAll.ItemsSource = CollectionView;
                return;
            }

            if (SelectedItem.GetType().Name == SelectedGroup.GetType().Name)
            {
                SelectedGroup = (GroupViewModel)SelectedItem;
                StudentInput si = new StudentInput("Add new student to group \"" + SelectedGroup.Name + "\"");
                si.Owner = this;

                si.Resources["BorderColor"]    = Resources["BorderColor"];
                si.Resources["ButtonColor"]    = Resources["ButtonColor"];
                si.Resources["BGColor"]        = Resources["BGColor"];
                si.Resources["TextColor"]      = Resources["TextColor"];
                si.Resources["FontStyle"]      = Resources["FontStyle"];
                si.Resources["FontFamily"]     = Resources["FontFamily"];
                si.Resources["FontSizeSmall"]  = Resources["FontSizeSmall"];
                si.Resources["FontSizeMedium"] = Resources["FontSizeMedium"];
                si.Resources["FontSizeLarge"]  = Resources["FontSizeLarge"];

                si.Show();
                TreeViewAll.ItemsSource = null;
                TreeViewAll.ItemsSource = CollectionView;
                return;
            }

            if (SelectedItem.GetType().Name == SelectedStudent.GetType().Name)
            {
                SelectedStudent = (StudentViewModel)SelectedItem;
                Info si = new Info(SelectedStudent);
                si.Resources["BorderColor"]    = Resources["BorderColor"];
                si.Resources["ButtonColor"]    = Resources["ButtonColor"];
                si.Resources["BGColor"]        = Resources["BGColor"];
                si.Resources["TextColor"]      = Resources["TextColor"];
                si.Resources["FontStyle"]      = Resources["FontStyle"];
                si.Resources["FontFamily"]     = Resources["FontFamily"];
                si.Resources["FontSizeSmall"]  = Resources["FontSizeSmall"];
                si.Resources["FontSizeMedium"] = Resources["FontSizeMedium"];
                si.Resources["FontSizeLarge"]  = Resources["FontSizeLarge"];

                si.Show();
                return;
            }
        }
예제 #19
0
        public void ClassAutoAssign()
        {
            try
            {
                string grade = ((ComboBoxItem)Grade.SelectedItem).Tag.ToString();

                DateTime DueDate;
                if (DueDateText.Text.Contains("/"))
                {
                    DueDate = DateTime.ParseExact(ClassDueDate.Text.ToString(), "dd/MM/yyyy", CultureInfo.InvariantCulture);
                }
                else
                {
                    DueDate = DateTime.ParseExact(ClassDueDate.Text.ToString(), "dd-MM-yyyy", CultureInfo.InvariantCulture);
                }
                DateTime AppliedDate = DateTime.Now.Date;

                var selectedItem = new List <SearchStudentInfoByGradeResult>();

                //Console.WriteLine(ClassSelectedID.ToString(), "feeID");
                //Console.WriteLine(ClassGetFeeAmount().ToString(), "ClassGetFeeAmount");
                //Console.WriteLine(ClassgetFineAmount().ToString(), "ClassgetFineAmount");
                //Console.WriteLine(DueDate.ToString(), "DueDate");
                //Console.WriteLine(DueDate.ToString(), "DueDate");
                //Console.WriteLine(AppliedDate.ToString(), "appliedON");
                //Console.WriteLine(ClassGetDate().ToString(), "feeMonth");

                foreach (SearchStudentInfoByGradeResult item in StudentSearchGrid.ItemsSource)
                {
                    if (((CheckBox)SelectedStudent.GetCellContent(item)).IsChecked == true)
                    {
                        Console.WriteLine(ClassSelectedID.ToString() + " feeID");
                        Console.WriteLine(ClassGetFeeAmount().ToString() + " ClassGetFeeAmount");
                        Console.WriteLine(ClassgetFineAmount().ToString() + " ClassgetFineAmount");
                        Console.WriteLine(DueDate.ToString() + " DueDate");
                        Console.WriteLine(item.AdmissionNumber.ToString() + " item.AdmissionNumber");
                        Console.WriteLine(AppliedDate.ToString() + " appliedON");
                        Console.WriteLine(ClassGetDate().ToString() + " feeMonth");


                        context.ClassAssignFeeUpdate
                        (
                            feeID: ClassSelectedID,
                            feeAmount: ClassGetFeeAmount(),
                            fine: ClassgetFineAmount(),
                            dueDate: DueDate,
                            appliedON: AppliedDate,
                            feeMonth: ClassGetDate(),
                            admissionNumber: item.AdmissionNumber
                        );
                    }
                }

                this.ShowMessageAsync("Done", "Fee assigned successfully");
            }
            catch (Exception err)
            {
                this.ShowMessageAsync("Empty", "No grade selected");
                //this.ShowMessageAsync("Error", err.ToString());
            }
        }
        private void withdrawButtonClick(object sender, RoutedEventArgs e)
        {
            try
            {
                string promoteGrade = ((ComboBoxItem)PromoteGrade.SelectedItem).Tag.ToString();
                if (sId.IsChecked == true)
                {
                    var selecteditem = new List <SearchStudentInfoAllByIdResult>();

                    foreach (SearchStudentInfoAllByIdResult item in StudentSearchGrid.ItemsSource)
                    {
                        if (((CheckBox)SelectedStudent.GetCellContent(item)).IsChecked == true)
                        {
                            int promoteId = item.AdmissionNumber;
                            context.PromoteStudents(admissionNumber: promoteId, grade: promoteGrade);
                        }
                    }
                    this.ShowMessageAsync("Done", "Operation succeded");
                    onLoad();
                }
                else if (sName.IsChecked == true)
                {
                    var selecteditem = new List <SearchStudentInfoAllByNameResult>();

                    foreach (SearchStudentInfoAllByNameResult item in StudentSearchGrid.ItemsSource)
                    {
                        if (((CheckBox)SelectedStudent.GetCellContent(item)).IsChecked == true)
                        {
                            int promoteId = item.AdmissionNumber;
                            context.PromoteStudents(admissionNumber: promoteId, grade: promoteGrade);
                        }
                    }
                    this.ShowMessageAsync("Done", "Operation succeded");
                    onLoad();
                }
                else if (fName.IsChecked == true)
                {
                    var selecteditem = new List <SearchStudentInfoAllByFatherNameResult>();

                    foreach (SearchStudentInfoAllByFatherNameResult item in StudentSearchGrid.ItemsSource)
                    {
                        if (((CheckBox)SelectedStudent.GetCellContent(item)).IsChecked == true)
                        {
                            int promoteId = item.AdmissionNumber;
                            context.PromoteStudents(admissionNumber: promoteId, grade: promoteGrade);
                        }
                    }
                    this.ShowMessageAsync("Done", "Operation succeded");
                    onLoad();
                }
                else if (emergencyNumber.IsChecked == true)
                {
                    var selecteditem = new List <SearchStudentInfoAllByPrimaryResult>();

                    foreach (SearchStudentInfoAllByPrimaryResult item in StudentSearchGrid.ItemsSource)
                    {
                        if (((CheckBox)SelectedStudent.GetCellContent(item)).IsChecked == true)
                        {
                            int promoteId = item.AdmissionNumber;
                            context.PromoteStudents(admissionNumber: promoteId, grade: promoteGrade);
                        }
                    }
                    this.ShowMessageAsync("Done", "Operation succeded");
                    onLoad();
                }
                else if (gradeRadioButton.IsChecked == true)
                {
                    var selecteditem = new List <SearchStudentInfoByGradeResult>();

                    foreach (SearchStudentInfoByGradeResult item in StudentSearchGrid.ItemsSource)
                    {
                        if (((CheckBox)SelectedStudent.GetCellContent(item)).IsChecked == true)
                        {
                            int promoteId = item.AdmissionNumber;
                            context.PromoteStudents(admissionNumber: promoteId, grade: promoteGrade);
                        }
                    }

                    this.ShowMessageAsync("Done", "Operation succeded");
                    onLoad();
                }
                else if (emergencyNumber.IsChecked == false && fName.IsChecked == false && sId.IsChecked == false && sName.IsChecked == false && gradeRadioButton.IsChecked == true)
                {
                    var selecteditem = new List <SearchStudentInfoAllResult>();

                    foreach (SearchStudentInfoAllResult item in StudentSearchGrid.ItemsSource)
                    {
                        if (((CheckBox)SelectedStudent.GetCellContent(item)).IsChecked == true)
                        {
                            int promoteId = item.AdmissionNumber;
                            context.PromoteStudents(admissionNumber: promoteId, grade: promoteGrade);
                        }
                    }
                    this.ShowMessageAsync("Done", "Operation succeded");
                    onLoad();
                }
            }
            catch (Exception err)
            {
                MessageBox.Show(err.ToString());
            }
        }