public static void EnrollStudents(ClassBook classBook, IList <Student> students) { foreach (Student student in students) { EnrollStudent(classBook, student); } }
internal void OnClassView(ClassBook selectedClass) { ClassViewModel.ClassBook = selectedClass; ClassViewModel.Teachers = Teachers; CurrentView = ClassView; OnPropertyChanged(nameof(CurrentView)); }
public Form1() { InitializeComponent(); _newMagazine = Magazine.GetSettings(); _newBook = Book.GetSettings(); _newClassBook = ClassBook.GetSettings(); }
public ClientBook(ClassBook book, int qtbook) : base(book) { this.qtBook = qtbook; startTime = DateTime.Today; lost = false; received = false; }
internal static void EnrollStudent(ClassBook classBook, Student student) { if (student.ClassBook != null) { student.ClassBook.Students.Remove(student); // remove student from old class } classBook.Students.Add(student); // add student to new class student.ClassBook = classBook; }
public async Task <HttpResponseMessage> CreateClassBook(ClassBook classBook) { classBook.TeacherId = Session["UserId"].ToString(); var content = new StringContent(JsonConvert.SerializeObject(classBook), Encoding.UTF8, "application/json"); var result = await _apiClient.PostAsync(new Uri(string.Format(_serviceUrl + "{0}", "/api/classBooks/create")), content); return(result); }
public static DummySchoolData GetDummySchoolData() { var result = new DummySchoolData(); IList <ClassBook> classBooks = new List <ClassBook>(); IList <Teacher> teachers = new List <Teacher>(); IList <Student> students = new List <Student>(); ClassBook classBook_1 = JsonConvert.DeserializeObject <ClassBook>(Resources.Class_1); ClassBook classBook_2 = JsonConvert.DeserializeObject <ClassBook>(Resources.Class_2); ClassBook classBook_3 = JsonConvert.DeserializeObject <ClassBook>(Resources.Class_3); Teacher teacher_1 = JsonConvert.DeserializeObject <Teacher>(Resources.Teacher_1); Teacher teacher_2 = JsonConvert.DeserializeObject <Teacher>(Resources.Teacher_2); Teacher teacher_3 = JsonConvert.DeserializeObject <Teacher>(Resources.Teacher_3); IList <Student> students_1 = JsonConvert.DeserializeObject <Student[]>(Resources.Students_1); IList <Student> students_2 = JsonConvert.DeserializeObject <Student[]>(Resources.Students_2); IList <Student> students_3 = JsonConvert.DeserializeObject <Student[]>(Resources.Students_3); SchoolUtil.HireTeacher(classBook_1, teacher_1); SchoolUtil.HireTeacher(classBook_2, teacher_2); SchoolUtil.HireTeacher(classBook_3, teacher_3); SchoolUtil.EnrollStudents(classBook_1, students_1); SchoolUtil.EnrollStudents(classBook_2, students_2); SchoolUtil.EnrollStudents(classBook_3, students_3); classBooks.Add(classBook_1); classBooks.Add(classBook_2); classBooks.Add(classBook_3); teachers.Add(teacher_1); teachers.Add(teacher_2); teachers.Add(teacher_3); foreach (var student in students_1) { students.Add(student); } foreach (var student in students_2) { students.Add(student); } foreach (var student in students_3) { students.Add(student); } result.ClassBooks = classBooks; result.Teachers = teachers; result.Students = students; return(result); }
public ClientBook GetClientBook(ClassBook book) { foreach (ClientBook e in cbook) { if (e == book) { return e; } } return null; }
public IHttpActionResult Create([FromBody] ClassBook classBook) { if (ModelState.IsValid) { classBook.Id = Guid.NewGuid().ToString(); var teacher = db.Users.FirstOrDefault(x => x.Id == classBook.TeacherId.Replace("\"", "")); db.ClassBooks.Add(classBook); classBook.Teacher = teacher; db.SaveChanges(); return(Ok()); } return(BadRequest("The catalogue already exists in the database.")); }
public Floor Clone() => new Floor( PartitionClass.ToArray(), ClassDimensions.ToArray(), ClassSubs.ToArray(), ClassBook.ToArray(), ClassSubBook.Select(s => s.ToArray()).ToArray(), Mult, PostList.ToArray(), MaxOver, MaxUnder, MaxError, TwoFitWeight, TwoFitAtten, N);
public bool AddBook(BaseBook bbook, ClassBook book,int qt) { if (book != null && qt>0) { Book inBaseBook = bbook.GetByBook(book); if (inBaseBook != null && inBaseBook.Pop(qt)) { cbook.Add(new ClientBook(book, qt)); return true; } return false; } else { return false; } }
public ClassBook(ClassBook book) : base(book.Name, book.Author, book.ID) { this.amount = book.amount; }
private void ComponentDynamicLoad(int page) { Panel.Controls.Clear(); PageButtonLoad(); PageTextBox.Text = maxPage.ToString(); JumpPTextBox.Text = page.ToString(); int start = (page - 1) * 10 + 1; int end = page * 10; if (page == maxPage) { end = ClassBackEnd.Userbsbook.Count; } int num = end - start + 1; int x = 86, y = 48; int x1 = 86, y1 = 251; for (int i = start, j = 1; i <= end; j++, i++) { PictureBox pic = new PictureBox(); pic.Cursor = Cursors.Hand; pic.BackColor = Color.FromArgb(244, 244, 244); pic.BorderStyle = BorderStyle.FixedSingle; pic.Dock = DockStyle.None; pic.Enabled = true; pic.Size = new Size(140, 200); try { string isbn = ClassBackEnd.Userbsbook[i - 1].Bookisbn.Substring(0, 10); ClassBook tmp = new ClassBook(isbn); pic.Image = Image.FromFile(tmp.Bookimage); } catch { pic.Image = Properties.Resources.BookNullImage;//set default image } pic.Location = new Point(x, y); pic.Name = (i - 1).ToString(); pic.SizeMode = PictureBoxSizeMode.Zoom; pic.Click += new EventHandler(pic_Click); Panel.Controls.Add(pic); x += 170; LinkLabel NameLink = new LinkLabel(); NameLink.ActiveLinkColor = Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(63)))), ((int)(((byte)(63))))); NameLink.AutoSize = false; NameLink.TextAlign = System.Drawing.ContentAlignment.TopCenter; NameLink.BackColor = System.Drawing.Color.Transparent; NameLink.Font = new Font("微软雅黑", 13F, FontStyle.Regular, GraphicsUnit.Point, 134); NameLink.LinkBehavior = LinkBehavior.HoverUnderline; NameLink.LinkColor = Color.FromArgb(((int)(((byte)(150)))), ((int)(((byte)(150)))), ((int)(((byte)(150))))); NameLink.Location = new Point(x1, y1); NameLink.Name = (i - 1).ToString(); NameLink.Size = new Size(140, 55); NameLink.TabStop = false; NameLink.Text = ClassBackEnd.Userbsbook[i - 1].Bookname; NameLink.Click += new EventHandler(NameLink_Click); Panel.Controls.Add(NameLink); x1 += 170; if (j % 5 == 0) { y = 309; y1 = 512; x = 86; x1 = 86; } } if (num == 0) { RemindLabel.Show(); } else { RemindLabel.Hide(); } RemindLabel.Parent = Panel; }
private void OnAddClass(object obj) { NewClass = new ClassBook(); NewClassDialogVisible = true; OnPropertyChanged(nameof(NewClassDialogVisible)); }
static void Main(string[] args) { int chooseMenu; Console.WriteLine("Меню программы" + "\n"); Console.WriteLine("========================================"); Console.WriteLine("1. Журналы (добавить/листать/еще че-то)" + "\n"); Console.WriteLine("========================================"); Console.WriteLine("========================================"); Console.WriteLine("2. Книги (добавить/читать/оставить отзыв)" + "\n"); Console.WriteLine("========================================"); Console.WriteLine("========================================"); Console.WriteLine("3. Учебники (добавить/изучать/выкинуть)" + "\n"); Console.WriteLine("========================================"); Console.Write("Выберите нужный пункт: "); chooseMenu = Convert.ToInt32(Console.ReadLine()); switch (chooseMenu) { case 1: Magazine newMagazine = new Magazine(); Console.WriteLine("\nСначала добавим журнал\n"); Console.Write("Название журнала: "); newMagazine.PublicationName = Console.ReadLine(); Console.Write("Месяц: "); newMagazine.Month = Console.ReadLine(); Console.Write("Номер: "); newMagazine.No = int.Parse(Console.ReadLine()); Console.Write("Кол-во страниц: "); newMagazine.NumberOfPages = int.Parse(Console.ReadLine()); Console.Write("Издательство: "); newMagazine.PublishingHouseName = Console.ReadLine(); Console.Write("Год: "); newMagazine.PublishingYear = int.Parse(Console.ReadLine()); Console.Write("Тираж: "); newMagazine.Edition = int.Parse(Console.ReadLine()); Console.WriteLine("\n============Журнал добавлен!============\n\n"); newMagazine.ShowPrint(); Console.WriteLine("\n========================================"); newMagazine.FlipThrough(); break; case 2: Book newBook = new Book(); Console.WriteLine("\nСначала добавим книгу\n"); Console.Write("Название книги: "); newBook.PublicationName = Console.ReadLine(); Console.Write("Автор: "); newBook.Author = Console.ReadLine(); Console.Write("Жанр: "); newBook.Genre = Console.ReadLine(); Console.Write("Серия: "); newBook.Seria = Console.ReadLine(); Console.Write("Язык: "); newBook.Language = Console.ReadLine(); Console.Write("Переводчик: "); newBook.Translator = Console.ReadLine(); Console.Write("Издательство: "); newBook.PublishingHouseName = Console.ReadLine(); Console.Write("Год: "); newBook.PublishingYear = int.Parse(Console.ReadLine()); Console.Write("Тираж: "); newBook.Edition = int.Parse(Console.ReadLine()); Console.WriteLine("\n============Книга добавлена!============\n\n"); newBook.ShowPrint(); Console.WriteLine("\n========================================"); Console.WriteLine("\nТеперь само чтение\n"); Console.WriteLine("========================================\n"); newBook.Read(); newBook.bookReview(); break; case 3: ClassBook newClassBook = new ClassBook(); Console.WriteLine("\nСначала добавим учебник\n"); Console.Write("Учебник: "); newClassBook.PublicationName = Console.ReadLine(); Console.Write("Предмет: "); newClassBook.Subject = Console.ReadLine(); Console.Write("Класс: "); newClassBook.Grade = int.Parse(Console.ReadLine()); Console.Write("Год: "); newClassBook.PublishingYear = int.Parse(Console.ReadLine()); Console.Write("Издательство: "); newClassBook.PublishingHouseName = Console.ReadLine(); Console.Write("Тираж: "); newClassBook.Edition = int.Parse(Console.ReadLine()); Console.WriteLine("\n============Учебник добавлен!============\n\n"); newClassBook.ShowPrint(); Console.WriteLine("\n========================================"); break; default: Console.WriteLine("Вы ничего не выбрали или натупили. Конец программы."); break; } Console.ReadKey(); }
public static void AssignClass(Teacher teacher, ClassBook classBook) { teacher.ClassBooks.Add(classBook); }
public static void HireTeacher(ClassBook classBook, Teacher teacher) { classBook.Teacher = teacher; AssignClass(teacher, classBook); }
internal static void ChangeClass(Student student, ClassBook oldClass, ClassBook newClass) { newClass.Students.Add(student); oldClass.Students.Remove(student); student.ClassBook = newClass; }
public Book GetByBook(ClassBook book) { foreach (Book e in bbook) { if (e == book) { return e; } } return null; }