public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View root = inflater.Inflate(Resource.Layout.leader_fragment_lesson_details, container, false); lvEntry = root.FindViewById <ListView>(Resource.Id.lv_leader_add_entry); tvLessonNumb = root.FindViewById <TextView>(Resource.Id.tv_leader_lesson_number); tvDate = root.FindViewById <TextView>(Resource.Id.tv_leader_lesson_date); tvSubject = root.FindViewById <TextView>(Resource.Id.tv_leader_lesson_subject); tvProfessor = root.FindViewById <TextView>(Resource.Id.tv_leader_lesson_professor); tvRoom = root.FindViewById <TextView>(Resource.Id.tv_leader_lesson_room); if (Arguments != null) { if (Arguments.ContainsKey("UserID")) { UserID = Arguments.GetInt("UserID"); user = DataBaseHelper.GetStudentByUserID(UserID); } if (Arguments.ContainsKey("Date")) { date = DateTime.Parse(Arguments.GetString("Date")); } if (Arguments.ContainsKey("NumberOfLesson")) { numberOfLesson = Arguments.GetInt("NumberOfLesson"); } } entries = new List <Entry>(); //todo change to user group id userGroupID = 2; mainEntry = DataBaseHelper.GetEntryDetailsByLessonNumbAndDate(userGroupID, numberOfLesson, date); entries = DataBaseHelper.GetListOfLessonDelailEntriesByLessonNumbAndDate(userGroupID, numberOfLesson, date); //entries.Add(new Entry { EntryDate = date, NumberOfLesson = 2, Room = 500, Professor = new Professor { nameOfProfessor = "professor1" }, Subject = new Subject { nameofSubject = "subj" }, Student=new Students { Name="stud" } , Mark=0}); tvLessonNumb.Text = mainEntry.NumberOfLesson.ToString(); tvDate.Text = mainEntry.EntryDate.ToString("dd.MM.yyyy"); tvSubject.Text = mainEntry.Subject.nameofSubject; tvProfessor.Text = mainEntry.Professor.nameOfProfessor.ToString(); tvRoom.Text = mainEntry.Room.ToString(); List <String> studentNames = new List <String>(); //students.Add(new Students { ID = 1,Name = "Студент 1", Phone = 380666, Head = false }); //students.Add(new Students { ID = 2,Name = "Студент 2", Phone = 380111, Head = false }); //students.Add(new Students { ID = 2, Name = "Студент 3", Phone = 380111, Head = false }); LeadEntryReadOnlyAdapter adapter = new LeadEntryReadOnlyAdapter(root.Context, entries); lvEntry.Adapter = adapter; return(root); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View root = inflater.Inflate(Resource.Layout.leader_fragment_day, container, false); lvEntry = root.FindViewById <ListView>(Resource.Id.lv_leader_day_entry); btnLeft = root.FindViewById <Button>(Resource.Id.btn_leader_day_left); btnRight = root.FindViewById <Button>(Resource.Id.btn_leader_day_right); tvDate = root.FindViewById <TextView>(Resource.Id.tv_leader_day); context = root.Context; btnLeft.Click += delegate { date = date.AddDays(-1); tvDate.Text = date.ToString("dd.MM.yyyy"); updateListView(); }; btnRight.Click += delegate { date = date.AddDays(1); tvDate.Text = date.ToString("dd.MM.yyyy"); updateListView(); }; if (Arguments != null && Arguments.ContainsKey("UserID")) { UserID = Arguments.GetInt("UserID"); user = DataBaseHelper.GetStudentByUserID(UserID); } //userGroupID = user.Group.ID; userGroupID = 2; entries = new List <Entry>(); date = DateTime.Today; entries = DataBaseHelper.GetListOfDayEntriesByGroupIDAndDate(userGroupID, date); //foreach(Entry entry in entries) // System.Diagnostics.Debug.WriteLine(entry.Professor.nameOfProfessor); //entries.Add(new Entry { EntryDate=date, NumberOfLesson=2, Room=500, Professor=new Professor { },Subject=new Subject { }, Student=new Students { } }); //entries.Add(new Students { Group = 0, Name = "Студент 2", Phone = 380111, Head = false }); adapter = new LeaderEntryAdapter(root.Context, entries); lvEntry.Adapter = adapter; FloatingActionButton fab = root.FindViewById <FloatingActionButton>(Resource.Id.fab_leader_add_entry); fab.Click += FabOnClick; tvDate.Text = date.ToString("dd.MM.yyyy"); tvDate.Click += (sender, e) => { DatePickerDialog dialog = new DatePickerDialog(root.Context, OnDateSet, date.Year, date.Month - 1, date.Day); dialog.Show(); }; return(root); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View root = inflater.Inflate(Resource.Layout.leader_fragment_day_details, container, false); lvEntry = root.FindViewById <ListView>(Resource.Id.lv_leader_day_details); if (Arguments != null) { if (Arguments.ContainsKey("UserID")) { UserID = Arguments.GetInt("UserID"); user = DataBaseHelper.GetStudentByUserID(UserID); } if (Arguments.ContainsKey("Date")) { date = DateTime.Parse(Arguments.GetString("Date")); } } //todo change to user group id userGroupID = 2; entries = new List <Entry>(); entries = DataBaseHelper.GetListOfDayDelailEntriesByGroupIDAndDate(userGroupID, date); //entries.Add(new Entry { EntryDate = date, NumberOfLesson = 2, Room = 500, Professor = new Professor {nameOfProfessor="professor1" }, Subject = new Subject {nameofSubject="subj" } }); adapter = new LeaderEntryDetailsAdapter(root.Context, entries); lvEntry.Adapter = adapter; lvEntry.ItemClick += (s, e) => { int p = e.Position; Bundle bundle = new Bundle(); bundle.PutInt("UserID", UserID); bundle.PutInt("NumberOfLesson", entries[p].NumberOfLesson); bundle.PutString("Date", date.ToString()); Android.Support.V4.App.Fragment fragment = new LeaderLessonDetailsFragment(); fragment.Arguments = bundle; FragmentManager.BeginTransaction() .Replace(Resource.Id.content_frame, fragment) .Commit(); }; return(root); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View root = inflater.Inflate(Resource.Layout.leader_fragment_students, container, false); lvStudents = root.FindViewById <ListView>(Resource.Id.lv_leader_students); if (Arguments != null && Arguments.ContainsKey("UserID")) { UserID = Arguments.GetInt("UserID"); user = DataBaseHelper.GetStudentByUserID(UserID); } StudentsList = new List <Students>(); //todo change to user group id StudentsList = DataBaseHelper.GetListOfStudentsByGroupID(2); //StudentsList.Add(new Students { Group = 0, Name = "Студент 1", Phone = 380666, Head=false }); //StudentsList.Add(new Students { Group = 0, Name = "Студент 2", Phone = 380111, Head = false }); stAdapter = new LeadStudentsAdapter(root.Context, StudentsList); lvStudents.Adapter = stAdapter; return(root); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View root = inflater.Inflate(Resource.Layout.leader_fragment_add_entry, container, false); lvEntry = root.FindViewById <ListView>(Resource.Id.lv_leader_add_entry); tvDate = root.FindViewById <TextView>(Resource.Id.tv_leader_add_entry_date); etNumbOfLesson = root.FindViewById <EditText>(Resource.Id.et_leader_add_entry_lesson); etRoom = root.FindViewById <EditText>(Resource.Id.et_leader_add_entry_room); spSubject = root.FindViewById <Spinner>(Resource.Id.sp_leader_add_entry_subject); spProfessor = root.FindViewById <Spinner>(Resource.Id.sp_leader_add_entry_professor); context = root.Context; if (Arguments != null) { if (Arguments.ContainsKey("UserID")) { UserID = Arguments.GetInt("UserID"); user = DataBaseHelper.GetStudentByUserID(UserID); } if (Arguments.ContainsKey("Date")) { date = DateTime.Parse(Arguments.GetString("Date")); } } //userGroupID = user.Group.ID; userGroupID = 2; tvDate.Text = date.ToShortDateString(); tvDate.Click += (sender, e) => { DatePickerDialog dialog = new DatePickerDialog(root.Context, OnDateSet, date.Year, date.Month - 1, date.Day); //dialog.DatePicker.MaxDate = DateTime.Today.Millisecond; dialog.Show(); }; entries = new List <Entry>(); //todo change to user group id students = new List <Students>(); students = DataBaseHelper.GetListOfStudentsByGroupID(userGroupID); List <String> studentNames = new List <String>(); //students.Add(new Students { ID = 1, Name = "Студент 1", Phone = 380666, Head = false }); //students.Add(new Students { ID = 2, Name = "Студент 2", Phone = 380111, Head = false }); //students.Add(new Students { ID = 2, Name = "Студент 3", Phone = 380111, Head = false }); foreach (Students s in students) { entries.Add(new Entry { Student = s }); } foreach (Students s in students) { studentNames.Add(s.Name); } lvEntry.ChoiceMode = Android.Widget.ChoiceMode.Multiple; adapter = new ArrayAdapter <String>(root.Context, Android.Resource.Layout.SimpleListItemMultipleChoice, studentNames); lvEntry.Adapter = adapter; //subjects = DataBaseHelper.GetListOfSubject(); subjects = new List <Subject>(); subjects = DataBaseHelper.GetListOfSubject(); //subjects.Add(new Subject { nameofSubject = "Физика", ID=0 }); //subjects.Add(new Subject { nameofSubject = "Математика", ID = 1 }); subjectsNames = new List <String>(); foreach (Subject s in subjects) { subjectsNames.Add(s.nameofSubject); } //professors = DataBaseHelper.GetListOfProfessors(); professors = new List <Professor>(); professors = DataBaseHelper.GetListOfProfessors(); //professors.Add(new Professor { ID=0, room = 510, nameOfProfessor = "Преподаватель 1", phone = 380666 }); //professors.Add(new Professor { ID=1, room = 310, nameOfProfessor = "Преподаватель 2", phone = 380556 }); professorsNames = new List <String>(); foreach (Professor p in professors) { professorsNames.Add(p.nameOfProfessor); } ArrayAdapter subjectAdapter = new ArrayAdapter <String>(root.Context, Android.Resource.Layout.SimpleSpinnerItem, subjectsNames); subjectAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spSubject.Adapter = subjectAdapter; ArrayAdapter professorAdapter = new ArrayAdapter <String>(root.Context, Android.Resource.Layout.SimpleSpinnerItem, professorsNames); professorAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spProfessor.Adapter = professorAdapter; return(root); }