public BookManagement(Data.DBHandler DB, IOException.OutputProcessor outputProcessor)
 {
     this.student         = null;
     rentalManager        = null;
     this.outputProcessor = outputProcessor;
     this.DB = DB;
 }
 public BookManagement(Data.Student student, Data.DBHandler DB, IOException.OutputProcessor outputProcessor)
 {
     this.student         = student;
     this.outputProcessor = outputProcessor;
     this.DB       = DB;
     rentalManager = new RentalManagement(DB, student);
 }
        // 로그인 화면을 출력하고 로그인 정보를 입력 받는다
        public void Login()
        {
            // 유저 또는 관리자 로그인
            while (true)
            {
                Data.Student student = LoginProcess();
                if (student == null)
                {
                    Console.Clear();
                    return;
                }

                switch (student.status)
                {
                case ConstNumber.LOGIN_ADMIN:
                    Menu.AdminScreen(DB, outputProcessor);
                    break;

                case ConstNumber.LOGIN_USER:
                    new Library.BookManagement(student, DB, outputProcessor).UserRentalSystem();
                    break;

                case ConstNumber.LOGIN_FAIL:
                    outputProcessor.PressAnyKey("로그인 실패");
                    break;
                }
            }
        }
        private void Initialize(bool isToReloadBiometrics)
        {
            _student      = new Data.Student();
            _biometric    = new Biometric();
            _relBiometric = new RelBiometric();
            _attendance   = new Attendance();

            _IsFingerEnrolled = false;
            _Verificator      = new DPFP.Verification.Verification(); // Create a fingerprint template verificator

            if (isToReloadBiometrics)
            {
                _Biometrics = _biometricsRepository.GetBiometrics(); //Load all FingerPrintTemplate (fpt);
                Remarks     = (_Biometrics.Count == 0) ? "No fingerprint template available in our records." : "";
            }

            Student.ImageData = null;

            if (smsTimer == null)
            {
                smsTimer          = new Timer(1000 * 60 * 60);
                smsTimer.Elapsed += new ElapsedEventHandler(OnSMSTimerEvent);
                smsTimer.Start();
            }
        }
Example #5
0
        public async Task <ActionResult> Edit(Student std)
        {
            if (ModelState.IsValid)
            {
                var student = await _studentRepository.GetAsync(std.Id);

                if (student == null)
                {
                    var nStudent = new Data.Student
                    {
                        FirstName = std.FirstName,
                        LastName  = std.LastName,
                        Email     = std.Email,
                        Phone     = std.Phone
                    };
                    await _studentRepository.InsertAsync(nStudent);
                }
                else
                {
                    student.FirstName = std.FirstName;
                    student.LastName  = std.LastName;
                    student.Email     = std.Email;
                    student.Phone     = std.Phone;
                    await _studentRepository.UpdateAsync(student);
                }


                return(RedirectToAction("Index"));
            }
            else
            {
                return(View());
            }
        }
Example #6
0
        public async Task <ActionResult <StudentResponse> > Post(DTO.Student input, IFormFile file)
        {
            var studentExist = await _db.Students.Where(s => s.Username == input.Username).FirstOrDefaultAsync();

            if (studentExist != null)
            {
                return(Conflict(input));
            }

            var imageResponse = await _imageUploader.DataLoaderAsync(file, "userProfile");

            if (!imageResponse.IsSuccess)
            {
                return(BadRequest(imageResponse.Message));
            }

            var student = new Data.Student
            {
                Name            = input.Name,
                Bio             = input.Bio,
                ProfileImageUrl = imageResponse.Data,
                Username        = input.Username,
                EmailAddress    = input.EmailAddress,
            };

            _db.Students.Add(student);
            await _db.SaveChangesAsync();

            var result = student.MapStudentResponse();

            return(CreatedAtAction(nameof(GetStudent), new { username = result.Username }, result));
        }
        // 로그인 성공 시 입력 받은 로그인 정보를 전달한다.
        public Data.Student LoginProcess()
        {
            // 로그인 화면 출력
            Data.Student student = outputProcessor.LoginScreen();
            if (student == null)
            {
                return(null);
            }

            // 유저 로그인 확인
            if (CheckUserLogin(student))
            {
                outputProcessor.PressAnyKey(student.StudentNo + "님 환영합니다.");
                student.status = ConstNumber.LOGIN_USER;
                DB.LoadMemberInformation(student);
            }
            else
            {
                // 유저가 아니면 관리자 로그인인지 확인
                if (CheckAdminLogin(student))
                {
                    outputProcessor.PressAnyKey("관리자님 환영합니다.");
                    student.name   = "관리자";
                    student.status = ConstNumber.LOGIN_ADMIN;
                }
                // 둘 다 아니면 로그인 실패
                else
                {
                    student.status = ConstNumber.LOGIN_FAIL;
                }
            }

            return(student);
        }
        public StudentEntryPage(StudentListPage parent, Data.AttendanceDatabase database)
        {
            _parent   = parent;
            _database = database;
            Title     = "Enter Student Data";

            var entry  = new Entry();
            var entry2 = new Entry();

            var button = new Button {
                Text = "Add"
            };

            button.Clicked += async(object sender, EventArgs e) => {
                Data.Student student = new Data.Student();
                student.RollNumber = entry.Text;
                student.Name       = entry2.Text;

                _database.AddStudent(student);

                await Navigation.PopAsync();


                _parent.Refresh();
            };

            Content = new StackLayout {
                Spacing  = 20,
                Padding  = new Thickness(20),
                Children = { entry, entry2, button },
            };
        }
Example #9
0
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            if (IdBox.Text.Length == 0)
            {
                return;
            }

            DialogResult result = MessageBox.Show(
                "Delete " + NameBox.Text + "?", "Confirm",
                MessageBoxButtons.YesNo,
                MessageBoxIcon.Question,
                MessageBoxDefaultButton.Button2);

            if (result == DialogResult.Yes)
            {
                Data.Student student = Program.Entities.Students
                                       .Where(s => s.StudentId == IdBox.Text)
                                       .FirstOrDefault();

                Program.Entities.Students.Remove(student);
                Program.Entities.SaveChanges();

                Reset();
            }
        }
Example #10
0
        /// <summary>
        /// Obtiene todos los alumnos ordenados de mayor a menor.
        /// </summary>
        /// <returns>Retorna una lista ordenada de mayor a menor.</returns>
        public List <Entities.Student> GetAllStudents()
        {
            var dataStudent = new Data.Student();
            var students    = dataStudent.GetAllStudents();

            return(students);
        }
Example #11
0
        /// <summary>
        /// Llama a capa de data para guardar los datos en la DB.
        /// </summary>
        /// <param name="student">Contiene los datos que se quiere guardar.</param>
        /// <param name="idstudent">El identificador del alumno en la DB.</param>
        private void CreatePreferenceStudent(Entities.Student student, int idstudent)
        {
            var dataStudent = new Data.Student();

            foreach (var p in student.Preferences)
            {
                dataStudent.CreatePreferenceStudent(p, idstudent);
            }
        }
        // 유저로 로그인하는건지 확인
        public bool CheckUserLogin(Data.Student student)
        {
            sqlQuery = "SELECT MEMBERNAME FROM MEMBER WHERE studentno = '" + student.StudentNo + "' AND password = '******';";
            MySqlDataReader reader  = DB.SelectQuery(sqlQuery);
            bool            success = DB.IsThereOneValue(reader, "membername");

            reader.Close();
            return(success);
        }
        // 관리자로 로그인하는건지 확인
        public bool CheckAdminLogin(Data.Student student)
        {
            sqlQuery = "SELECT ID FROM admin WHERE ID = '" + student.StudentNo + "' AND password = '******';";
            MySqlDataReader reader  = DB.SelectQuery(sqlQuery);
            bool            success = DB.IsThereOneValue(reader, "ID");

            reader.Close();
            return(success);
        }
Example #14
0
        /// <summary>
        /// Llama a capa de data para guardar los datos en la DB.
        /// </summary>
        /// <param name="student">Contiene los datos que se quiere guardar.</param>
        public void CreateStudent(Entities.Student student)
        {
            var dataStudent = new Data.Student();
            int idstudent   = 0;

            CreatePerson(student);

            idstudent = dataStudent.CreateStudent(student.Prom, student.Dni, student.Assigned);

            CreatePreferenceStudent(student, idstudent);
        }
        private void OnFilter(object sender, RoutedEventArgs e)
        {
            var studentViewSource = FindResource("studentViewSource") as CollectionViewSource;

            ICollectionView view = studentViewSource.View as ICollectionView;

            view.Filter = (item) =>
            {
                Data.Student student = item as Data.Student;
                return(student.Section.SectionName == "Mahogany" ? true : false);
            };
        }
Example #16
0
        private void CopyStudent(Data.Student source, EditableStudent target)
        {
            target.StudentGuid = source.StudentGuid;
            target.EditMode    = EditMode;

            EditableContact.Contacts = new ObservableCollection <Contact>(source.Contacts.ToList());
            target.Biometrics        = new ObservableCollection <Biometric>();
            target.Organizations     = new ObservableCollection <Organization>();

            if (EditMode)
            {
                target.OrigStudentId        = source.StudentID;
                target.StudentID            = source.StudentID;
                target.FirstName            = source.FirstName;
                target.MiddleName           = source.MiddleName;
                target.LastName             = source.LastName;
                target.LevelID              = source.LevelID;
                target.SectionID            = source.SectionID;
                target.BirthDate            = source.BirthDate;
                target.Gender               = source.Gender;
                target.Street               = source.Street;
                target.City                 = source.City;
                target.State                = source.State;
                target.ImageData            = source.ImageData;
                target.Attendances          = source.Attendances;
                target.Contacts             = new ObservableCollection <Contact>(source.Contacts);
                target.Level                = source.Level;
                target.Section              = source.Section;
                target.RelBiometrics        = new ObservableCollection <RelBiometric>(source.RelBiometrics);
                target.RelDistributionLists = source.RelDistributionLists;
                target.RelOrganizations     = new ObservableCollection <RelOrganization>(source.RelOrganizations);


                SelectedLevelId   = source.LevelID;
                SelectedSectionId = source.SectionID;
            }

            if (target.RelBiometrics != null)
            {
                foreach (RelBiometric relBiometric in target.RelBiometrics)
                {
                    target.Biometrics.Add(relBiometric.Biometric);
                }
            }
            if (target.RelOrganizations != null)
            {
                foreach (RelOrganization group in target.RelOrganizations)
                {
                    target.Organizations.Add(group.Organization);
                }
            }
        }
Example #17
0
        // 멤버정보를 객체에 로드한다.
        public void LoadMemberInformation(Data.Student student)
        {
            string sqlQuery = "SELECT membername, address, phonenumber FROM MEMBER WHERE studentno = " + student.StudentNo + ";";

            reader = SelectQuery(sqlQuery);
            while (reader.Read())
            {
                student.name        = reader["membername"].ToString();
                student.address     = reader["address"].ToString();
                student.phoneNumber = reader["phonenumber"].ToString();
            }
            reader.Close();
        }
Example #18
0
 public static StudentResponse MapStudentResponse(this Data.Student student)
 => new StudentResponse
 {
     Id              = student.Id,
     Name            = student.Name,
     Bio             = student.Bio,
     EmailAddress    = student.EmailAddress,
     ProfileImageUrl = student.ProfileImageUrl,
     Tests           = student.Tests?.Select(t => new DTO.Test
     {
         AverageGrade    = t.AverageGrade,
         QuestionPaperId = t.QuestionPaperId
     }).ToList(),
     Username = student.Username
 };
Example #19
0
 private void UpdateStudent(EditableStudent source, Data.Student target)
 {
     target.StudentID  = source.StudentID;
     target.FirstName  = source.FirstName;
     target.MiddleName = source.MiddleName;
     target.LastName   = source.LastName;
     target.LevelID    = SelectedLevelId;
     target.SectionID  = SelectedSectionId;
     target.BirthDate  = source.BirthDate;
     target.Gender     = source.Gender;
     target.Street     = source.Street;
     target.City       = source.City;
     target.State      = source.State;
     target.ImageData  = source.ImageData;
 }
        private void NavToEditStudent(Data.Student selectedStudent)
        {
            CurrentViewModel = _addEditStudentViewModel;

            try
            {
                _attendanceViewModel.SwitchOff();
                _addEditStudentViewModel.EditMode = true;
                _addEditStudentViewModel.SetStudent(selectedStudent);
                _addEditStudentViewModel.Initialize();
            }
            catch (Exception error)
            {
                var result = DialogHelper.ShowDialog(DialogType.Error, "Something went wrong. Please try again.");
                Logger.Error(error);
            }
        }
Example #21
0
        public Data.Student GetOrCreate()
        {
            var now    = DateTime.Now;
            var entity = _StudentRepository.Entities.Where(p => p.uid == _User.Uid).FirstOrDefault();

            if (entity == null)
            {
                entity = new Data.Student
                {
                    uid     = _User.Uid,
                    created = now,
                    updated = now
                };
                _StudentRepository.Add(entity);
                _StudentRepository.SaveChanges();
            }
            return(entity);
        }
Example #22
0
        public void SetStudent(Data.Student student)
        {
            _editingStudent = student;

            if (Student != null)
            {
                Student.ErrorsChanged -= RaiseCanExecuteChanged;
            }
            if (EditableContact != null)
            {
                EditableContact.ErrorsChanged -= RaiseCanExecuteChanged;
            }

            Student         = new EditableStudent();
            EditableContact = new EditableContact();

            Student.ErrorsChanged         += RaiseCanExecuteChanged;
            EditableContact.ErrorsChanged += RaiseCanExecuteChanged;

            CopyStudent(student, Student);
        }
Example #23
0
        public Data.Student ReadStudentInfo()
        {
            Data.Student st = new Data.Student();
            st.FirstName = txtFirstName.Text;
            st.SecondName = txtSecondName.Text;
            st.LastName = txtLastName.Text;
            st.Faculty = txtFaculty.Text;
            st.Specialty = txtSpecialty.Text;
            st.FacNumber = txtFacNumber.Text;
            int myInt;
            if (int.TryParse(txtGroup.Text, out myInt) == true)
            {
                st.Group = myInt;
            }
            st.Potok = txtPotok.Text;
            st.OKS = (short)comboOKS.SelectedIndex;
            st.StudentStatus = (short)comboStudentStatus.SelectedIndex;
            numCourse.Maximum = 4;
            numCourse.Minimum = 1;
            st.Course = (short)numCourse.Value;

            return st;
        }
Example #24
0
        // 로그인 데이터를 받아 Login 함수에서 처리
        public Data.Student LoginScreen()
        {
            Data.Student student      = new Data.Student();
            int          cursorLeft   = 20;
            int          screenHeight = ConsoleUI.PrintLoginPage();

            // 학번 입력 위치로 커서 이동
            Console.SetCursorPosition(cursorLeft, 10);
            student.StudentNo = inputProcessor.InputStudentNoFormat(cursorLeft);
            if (student.StudentNo == null)
            {
                return(null);
            }

            Console.SetCursorPosition(cursorLeft, 12);
            student.Password = inputProcessor.InputPassword(12, screenHeight, cursorLeft, 12);
            if (student.Password == null || student.Password.Contains("\\"))
            {
                return(null);
            }

            return(student);
        }
        private async void OnDelete(Data.Student student)
        {
            var result = await DialogHelper.ShowDialog(DialogType.Validation, "Are you sure you want to delete this student?");

            if (result)
            {
                try
                {
                    if (!student.Attendances.Any())
                    {
                        _studentsRepository.DeleteStudent(student.StudentGuid);
                        LoadStudents();
                    }
                    else
                    {
                        throw new ArgumentException("Cannot delete an active student.");
                    }
                }
                catch (Exception error)
                {
                    result = await DialogHelper.ShowDialog(DialogType.Error, error.Message);
                }
            }
        }
        private void OnResend()
        {
            SMSStatusVisibility = Visibility.Collapsed;
            List <Attendance> attendanceList = _attendancesRepository.GetAttendancesWithFailedSMSRecord();

            if (attendanceList == null || attendanceList.Count == 0)
            {
                return;
            }

            foreach (Attendance attendance in attendanceList)
            {
                Data.Student student = _studentsRepository.GetStudent(attendance.StudentID);
                if (String.IsNullOrEmpty(attendance.TimeInSMSID) || String.IsNullOrEmpty(attendance.TimeInSMSStatus))
                {
                    ProcessSMSIntegration(attendance.AttendanceID.ToString(), true, attendance.TimeIn, student);
                }

                if (attendance.TimeOut.HasValue && (String.IsNullOrEmpty(attendance.TimeOutSMSID) || String.IsNullOrEmpty(attendance.TimeOutSMSStatus)))
                {
                    ProcessSMSIntegration(attendance.AttendanceID.ToString(), false, (DateTime)attendance.TimeOut, student);
                }
            }
        }
        private Data.Student ReadStudentInfo()
        {
            Data.Student student = new Data.Student();
            student.FirstName = txtFirstName.Text;
            student.SecondName = txtSecondName.Text;
            student.LastName = txtLastName.Text;

            student.Faculty = txtFaculty.Text;
            student.Specialty = txtSpecialty.Text;
            student.OKS = (Int16)comboOKS.SelectedIndex;
            student.StudentStatus = (Int16)comboStudentStatus.SelectedIndex;
            student.FakNumber = txtFakNumber.Text;
            student.Course = (Int16)numCourse.Value;
            student.Potok = txtPotok.Text;
            student.Group = Int32.Parse(txtGrpup.Text);
            return student;
        }
 public void OnEdit(Data.Student selectedStudent)
 {
     EditRequested(selectedStudent);
 }
Example #29
0
        public Data.Student MemberRegistrationScreen()
        {
            Data.Student newStudent = new Data.Student();

            // 각각 항목들에 대해 문자열을 입력받는다.

            // 이름 입력 위치로 이동
            Console.SetCursorPosition(14, 11);
            // 이름 입력 형식 지정
            Console.ForegroundColor = ConsoleColor.DarkGray;
            Console.Write("성이름");
            Console.SetCursorPosition(14, 11);
            Console.ForegroundColor = ConsoleColor.White;
            newStudent.name         = inputProcessor.NameFormatInput(14);
            if (newStudent.name == null)
            {
                return(null);
            }

            // 학번 입력 위치로 이동
            Console.SetCursorPosition(14, 13);
            // 학번 형식 지정
            Console.ForegroundColor = ConsoleColor.DarkGray;
            Console.Write("________");
            Console.ForegroundColor = ConsoleColor.White;
            Console.SetCursorPosition(14, 13);
            newStudent.StudentNo = inputProcessor.InputStudentNoFormat(14);
            if (newStudent.StudentNo == null)
            {
                return(null);
            }

            CursorPoint cursor = new CursorPoint(14, 15);

            // 주소 입력 위치로 이동
            Console.SetCursorPosition(cursor.CursorLeft, cursor.CursorTop);
            Console.ForegroundColor = ConsoleColor.DarkGray;
            Console.Write("주소 선택");
            Console.ForegroundColor = ConsoleColor.White;
            Console.SetCursorPosition(cursor.CursorLeft, cursor.CursorTop);
            // 키보드로 주소 선택
            newStudent.address = inputProcessor.AddressFormatInput(cursor);
            if (newStudent.address == null)
            {
                return(null);
            }

            cursor = new CursorPoint(14, 17);
            // 전화번호 입력 위치로 이동
            Console.SetCursorPosition(cursor.CursorLeft, cursor.CursorTop);
            newStudent.phoneNumber = inputProcessor.PhoneNumberFormatInput(cursor);
            if (newStudent.phoneNumber == null)
            {
                return(null);
            }

            Console.SetCursorPosition(14, 19);
            newStudent.Password = inputProcessor.InputPassword(10, 30, 14, 19);
            if (newStudent.Password == null)
            {
                return(null);
            }

            Console.Clear();
            return(newStudent);
        }
Example #30
0
        public void UpdateStudent(Entities.Student student)
        {
            var dataStu = new Data.Student();

            dataStu.UpdateStudent(student.Assigned, student.Dni);
        }
Example #31
0
 public RentalManagement(Data.DBHandler DB, Data.Student student)
 {
     this.student = student;
     this.DB      = DB;
 }
Example #32
0
        /// <summary>
        /// LLama a la capa de data para buscar datos de la DB.
        /// </summary>
        /// <returns>Devuelve una lista de tipo Person.</returns>
        private List <Entities.Person> GetAllPersons()
        {
            var dataStudent = new Data.Student();

            return(dataStudent.GetAllPersons());
        }