static void Main() { SchoolClass PHPClass = new SchoolClass(); Teacher firstTeacher = new Teacher("Ivan Vankov"); PHPClass.AddTeacher(firstTeacher); Teacher secondTeacher = new Teacher("Stamat Trendafilov"); PHPClass.AddTeacher(secondTeacher); Student newStudent = new Student("Dobromir Ivanov", "756A"); PHPClass.AddStudent(newStudent); Console.WriteLine("List of all teachers: "); foreach (Human teacher in PHPClass.ClassTeachersList) { Console.WriteLine(teacher); } Console.WriteLine("\nList of all Students: "); foreach (Human student in PHPClass.ClassStudentsList) { Console.WriteLine(student); } }
///<summary>Inserts one SchoolClass into the database. Returns the new priKey.</summary> internal static long Insert(SchoolClass schoolClass) { if(DataConnection.DBtype==DatabaseType.Oracle) { schoolClass.SchoolClassNum=DbHelper.GetNextOracleKey("schoolclass","SchoolClassNum"); int loopcount=0; while(loopcount<100){ try { return Insert(schoolClass,true); } catch(Oracle.DataAccess.Client.OracleException ex){ if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){ schoolClass.SchoolClassNum++; loopcount++; } else{ throw ex; } } } throw new ApplicationException("Insert failed. Could not generate primary key."); } else { return Insert(schoolClass,false); } }
public static void Main() { var tupacDisciplines = new List<Discipline> { new Discipline(DisciplineName.Music, 10, 10), new Discipline(DisciplineName.History, 8, 8) }; var studentsFromClassA = new List<Student> { new Student("Marshall", "Mathers"), new Student("Earl", "Simmons"), new Student("Mary", "Blige") }; var studentsFromClassB = new List<Student> { new Student("William", "Roberts"), new Student("Dwayne", "Carter"), new Student("Kimberly", "Jones") }; var teachers = new List<Teacher> { new Teacher("Tupac", "Shakur", tupacDisciplines) }; var classA = new SchoolClass(teachers, studentsFromClassA); var classB = new SchoolClass(teachers, studentsFromClassB); var school = new School(new List<SchoolClass> { classA, classB }); Console.WriteLine(school); }
public void RemoveNonExistingCourseTest() { List<Course> courses = new List<Course>(); SchoolClass school = new SchoolClass(courses); Course javascript = new Course("Javascript"); school.RemoveCourse(javascript); }
public void AddCourseTest() { List<Course> courses = new List<Course>(); Course javascript = new Course("Javascript"); SchoolClass school = new SchoolClass(courses); school.AddCourse(javascript); Assert.AreEqual(javascript.Name, school.Courses[0].Name); }
public void RemoveCourseTest() { List<Course> courses = new List<Course>(); SchoolClass school = new SchoolClass(courses); Course javascript = new Course("Javascript"); school.AddCourse(javascript); school.RemoveCourse(javascript); Assert.IsTrue(school.Courses.Count == 0); }
public PartialViewResult GetASchoolClass(int?id) { SchoolClassViewModel _schoolClassViewModel = new SchoolClassViewModel(); if (id == null) { var _exitGradeBlank = from grad in db.GradeMajors //年级和专业来自gradeMajor; where grad.GradeMajorIsValidate == true select grad.Grade; _schoolClassViewModel.GradesList = new SelectList(_exitGradeBlank.Distinct().OrderBy(g => g.GradeID), "GradeID", "GradeName"); var _exitDepartmentBlank = from grad in db.GradeMajors.Include(x => x.Major.Department) select grad.Major.Department; _schoolClassViewModel.DepartmentList = new SelectList(_exitDepartmentBlank.Distinct().OrderBy(x => x.DepartmentID), "DepartmentID", "DepartmentName"); var _exitMajorBlank = from maj in db.GradeMajors.Include(x => x.Major) select maj.Major; _schoolClassViewModel.MajorsList = new SelectList(_exitMajorBlank.Distinct().OrderBy(x => x.MajorID), "MajorID", "MajorName"); _schoolClassViewModel.StudentNumber = 0; return(PartialView("_Modal.FormContent", _schoolClassViewModel)); } SchoolClass _schoolClass = db.SchoolClasses.Find(id); _schoolClassViewModel.SchoolClassID = _schoolClass.SchoolClassID; var _exitGrade = from grad in db.GradeMajors //年级和专业来自gradeMajor; where grad.GradeMajorIsValidate == true select grad.Grade; _schoolClassViewModel.GradesList = new SelectList(_exitGrade.Distinct().OrderBy(g => g.GradeID), "GradeID", "GradeName", _schoolClass.GradeMajor.GradeID); var _exitDepartment = from grad in db.GradeMajors.Include(x => x.Major.Department) select grad.Major.Department; _schoolClassViewModel.DepartmentList = new SelectList(_exitDepartment.Distinct().OrderBy(x => x.DepartmentID), "DepartmentID", "DepartmentName", _schoolClass.GradeMajor.Major.DepartmentID); var _exitMajor = from maj in db.GradeMajors.Include(x => x.Major) where (maj.GradeMajorIsValidate == true) select maj.Major; _schoolClassViewModel.MajorsList = new SelectList(_exitMajor.Distinct().OrderBy(x => x.MajorID), "MajorID", "MajorName", _schoolClass.GradeMajor.MajorID); _schoolClassViewModel.SchoolClassName = _schoolClass.SchoolClassName; _schoolClassViewModel.StudentNumber = _schoolClass.StudentNumber; return(PartialView("_Modal.FormContent", _schoolClassViewModel)); }
public async Task <IActionResult> Create([Bind("Id,ClassName,TeacherId")] SchoolClass schoolClass) { if (ModelState.IsValid) { schoolClass.Id = Guid.NewGuid(); _context.Add(schoolClass); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(schoolClass)); }
public void addClass(SchoolClass c){ if(c.School.GetType() == typeof(GradeSchool)) gradeSchoolClasses.Add (c.Id, c); else if(c.School.GetType() == typeof(CombatU)) combatClasses.Add (c.Id, c); else if(c.School.GetType() == typeof(TeachingU)) teachingClasses.Add (c.Id, c); else if(c.School.GetType() == typeof(IntelligenceU)) intelligenceClasses.Add (c.Id, c); else Debug.Log ("Error adding " + c.SchoolClassName); }
// GET: Home public ActionResult Index() { SchoolClass studentsList = new SchoolClass(); XElement classe = XElement.Load(Server.MapPath("~/App_Data/datas.xml")); IEnumerable<XElement> studentsTags = classe.Element("students").Elements("student"); foreach (XElement xe in studentsTags) { Student alu = new Student(xe); studentsList.Add(alu); } return View(studentsList); }
///<summary>Converts a DataTable to a list of objects.</summary> public static List<SchoolClass> TableToList(DataTable table){ List<SchoolClass> retVal=new List<SchoolClass>(); SchoolClass schoolClass; for(int i=0;i<table.Rows.Count;i++) { schoolClass=new SchoolClass(); schoolClass.SchoolClassNum= PIn.Long (table.Rows[i]["SchoolClassNum"].ToString()); schoolClass.GradYear = PIn.Int (table.Rows[i]["GradYear"].ToString()); schoolClass.Descript = PIn.String(table.Rows[i]["Descript"].ToString()); retVal.Add(schoolClass); } return retVal; }
public IActionResult Delete(long id) { SchoolClass schoolClass = _context.SchoolClasses.Find(id); if (schoolClass != null) { _context.SchoolClasses.Remove(schoolClass); _context.SaveChanges(); return(RedirectToAction("Index")); } return(RedirectToAction("Index")); }
public ActionResult ViewClass(string deleteIdsList) { List <int> idsToDelete = (List <int>)_js.Deserialize(deleteIdsList, typeof(List <int>)); foreach (int id in idsToDelete) { SchoolClass classs = _schoolClassDbContext.dbSet.Find(id); _schoolClassDbContext.dbSet.Remove(classs); _schoolClassDbContext.SaveChanges(); } return(RedirectToAction("Index")); }
///<summary>Returns true if Update(SchoolClass,SchoolClass) would make changes to the database. ///Does not make any changes to the database and can be called before remoting role is checked.</summary> public static bool UpdateComparison(SchoolClass schoolClass, SchoolClass oldSchoolClass) { if (schoolClass.GradYear != oldSchoolClass.GradYear) { return(true); } if (schoolClass.Descript != oldSchoolClass.Descript) { return(true); } return(false); }
public void TestForTwoClassesThatHaveDifferentNamesReturnsFalse() { double[] grades1 = { 5, 8, 9, 10 }; string className1 = "Math"; double[] grades2 = { 2, 1, 5, 7 }; string className2 = "Sport"; SchoolClass class1 = new SchoolClass(className1, grades1); SchoolClass class2 = new SchoolClass(className2, grades2); Assert.False(class1.HasSameName(class2)); }
public void ImplementTwoClassesByVectorGrades() { double[] grades1 = { 5, 8, 9, 10 }; string className1 = "Math"; double[] grades2 = { 2, 1, 5, 7 }; string className2 = "Math"; SchoolClass class1 = new SchoolClass(className1, grades1); SchoolClass class2 = new SchoolClass(className2, grades2); Assert.True(class1.HasSameName(class2)); }
public static SchoolClassDTO SchoolClassToSchoolClassDTO(SchoolClass sc) { SchoolClassDTO retVal = new SchoolClassDTO() { Id = sc.Id, SchoolGrade = sc.SchoolGrade, ClassName = sc.Name }; logger.Info("Converting SchoolClass to SchoolClassDTO"); return(retVal); }
public void New_SetsName() { //Given string name = "School Class A"; //When SchoolClass schoolClass = new SchoolClass(name); //Then Assert.NotEqual(Guid.Empty, schoolClass.Id); Assert.NotNull(schoolClass.Students); Assert.Equal(name, schoolClass.Name); }
public async Task <ActionResult> Edit([Bind(Include = "CID,ClassName")] SchoolClass schoolClass) { if (ModelState.IsValid) { db.Entry(schoolClass).State = EntityState.Modified; await db.SaveChangesAsync(); TempData["Success"] = "Updated Successfully"; return(RedirectToAction("Index")); } return(View(schoolClass)); }
public List <Student> GetAllStudentFromSchoolClass(SchoolClass schoolClass) { Student s = new Student() { SchoolClass = schoolClass }; GetAllStudentsSO getAll = new GetAllStudentsSO(); getAll.ExecuteTemplate(s); return(getAll.Students); }
private void AddClasses() { for (int i = 1; i < 13; i++) { var schoolClassA = new SchoolClass(i + "A"); var schoolClassB = new SchoolClass(i + ("B")); var schoolClassC = new SchoolClass(i + ("C")); _ctx.Classes.AddAsync(schoolClassA); _ctx.Classes.AddAsync(schoolClassB); _ctx.Classes.AddAsync(schoolClassC); } }
private void chkListClass_ItemCheck(object sender, ItemCheckEventArgs e) { try { SchoolClass selectedClass = (chkListClass.Items[e.Index] as SchoolClass); updateSeriesListBinding(e.NewValue, selectedClass, e.Index); } catch (Exception ex) { ExceptionHandler.HandleException(ex); } }
protected void Page_Load(object sender, EventArgs e) { /* Load all courses */ List <Course> allCourses = new List <Course>(); List <SchoolClass> allclasses = new List <SchoolClass>(); List <StudentEnrollmentEntry> allEnrollment = new List <StudentEnrollmentEntry>(); String dbConnectionString = ConfigurationManager.ConnectionStrings["SchoolLogicDatabase"].ConnectionString; using (SqlConnection connection = new SqlConnection(dbConnectionString)) { allCourses = Course.loadAllCourses(connection); allclasses = SchoolClass.loadAllClasses(connection); allEnrollment = StudentEnrollmentEntry.loadAllStudentEnrollment(connection); } /* Populate table */ tblCourses.Rows.Clear(); foreach (Course course in allCourses) { tblCourses.Rows.Add(addCourseTableRow(course)); tblCourses.Rows.Add(addClassTableHeaders()); int classCount = 0; foreach (SchoolClass thisClass in allclasses) { if (thisClass.courseid == course.id) { /* Figure out student enrollment */ foreach (StudentEnrollmentEntry studentEE in allEnrollment) { if (studentEE.classID == thisClass.classid) { thisClass.enrollmentCount++; } } tblCourses.Rows.Add(addClassTableRow(thisClass)); classCount++; } } if (classCount == 0) { tblCourses.Rows.Add(addNoClassesRow()); } tblCourses.Rows.Add(addEmptyRow()); } lblClassCount.Text = allclasses.Count.ToString(); lblCourseCount.Text = allCourses.Count.ToString(); }
private Command CreateExercise( ScheduleService service, Func <string, string> requestInput) => args => { var dayStr = requestInput("Введите день недели (число)"); if (!int.TryParse(dayStr, out int day)) { throw new CommandException($"Неверный формат числа {dayStr}"); } var numberStr = requestInput("Введите номер занятия"); if (!int.TryParse(numberStr, out int number)) { throw new CommandException($"Неверный формат числа {numberStr}"); } var classId = requestInput("Введите ID класса"); SchoolClass schoolClass = null; if (classId != "") { schoolClass = service.Find((SchoolClass c) => c.Id == classId); if (schoolClass == null) { throw new CommandException($"Класс с Id={classId} не найден"); } } var auditoryStr = requestInput("Введите номер аудитории"); if (!int.TryParse(auditoryStr, out int auditory)) { throw new CommandException($"Неверный формат числа {auditoryStr}"); } var teacherId = requestInput("Введите ID преподавателя"); var lessonId = requestInput("Введите ID предмета"); var exercise = new Exercise { Id = Guid.NewGuid().ToString(), DayOfWeek = day, ExerciseNumber = number, SchoolClass = schoolClass, Auditory = auditory, TeacherId = teacherId, LessonId = lessonId }; Save(() => service.Save(exercise)); };
static void Main() { //got inspired for the comments from one of your colleagues :) Discipline Chemistry = new Discipline("Chemistry", 20, 2, "Chemisty is sux!"); Discipline Mathematics = new Discipline("Mathematics", 30, 3, "Matematic is helpfull!"); Discipline Literature = new Discipline("Literature", 30, 3, "Literature is okay!"); Discipline English = new Discipline("English", 20, 2, "English is very important!"); Teacher Mendeleev = new Teacher("Pascal", "Mendeleev", "1 + 1 = h2o"); Teacher Dimcho = new Teacher("Dimcho", "Negramotniq", "Sometimes Win Sometimes Lun"); Teacher White = new Teacher("Walter", "White", "You Know The Business And I Know The Chemistry"); Mendeleev.AddDiscipline(Chemistry); Mendeleev.AddDiscipline(Mathematics); Dimcho.AddDiscipline(Literature); Dimcho.AddDiscipline(English); White.AddDiscipline(Chemistry); Student Ivancho = new Student("Ivancho", "Ivanov", 1, "The big boss"); Student Mariika = new Student("Mariika", "Ivanova", 2, "Ivancho's girlfriend"); Student Jesse = new Student("Jesse", "Pinkman", 3, "Yo Bitch!"); SchoolClass Overacheivers = new SchoolClass("1a", "Excellent"); SchoolClass Narcos = new SchoolClass("high level", "Haisenberg team"); Overacheivers.AddTeacher(Mendeleev); Overacheivers.AddTeacher(Dimcho); Overacheivers.AddStudent(Ivancho); Overacheivers.AddStudent(Mariika); Narcos.AddTeacher(White); Narcos.AddStudent(Jesse); School PriBatJoro = new School(); PriBatJoro.AddClass(Overacheivers); PriBatJoro.AddClass(Narcos); List <IComment> comments = new List <IComment>() { Mendeleev, Dimcho, White, Ivancho, Mariika, Jesse, Chemistry, Mathematics, Literature, English, Overacheivers, Narcos }; foreach (var obj in comments) { Console.WriteLine(obj.Comment); } }
// Add SchoolClass public async Task <SchoolClass> AddSchoolClassAsync(SchoolClass schoolClass) { try { dbContext.SchoolClasses.Add(schoolClass); await dbContext.SaveChangesAsync(); } catch (Exception) { throw; } return(schoolClass); }
public void testAddSchoolClassExistingId() { Assert.Null(serv.GetByDetails(23, "ע")); // Arrange int count = serv.All().Count(); SchoolClass existing = serv.All().FirstOrDefault(); // Act MichtavaResult res = serv.Add(existing); // Assert Assert.True(res is MichtavaFailure); }
public void testGetSchoolClassByIdFalse() { Assert.Null(serv.GetByDetails(23, "ע")); // Arrange int count = serv.All().Count(); // Act SchoolClass actual = serv.GetById(Guid.NewGuid()); // Assert Assert.Null(actual); }
public static SchoolClassDetailsDTO SchoolClassToSchoolClassDetailsDTO(SchoolClass sc) { SchoolClassDetailsDTO retVal = new SchoolClassDetailsDTO() { Id = sc.Id, SchoolGrade = sc.SchoolGrade, ClassName = sc.Name, Students = sc.Students.Select(student => UserToUserDTOConverters.StudentToStudentBasicDTO(student)) }; logger.Info("Converting SchoolClass to SchoolClassDetaildSTO"); return(retVal); }
public async Task <ActionResult> Create([Bind(Include = "CID,ClassName")] SchoolClass schoolClass) { if (ModelState.IsValid) { db.SchoolClasses.Add(schoolClass); await db.SaveChangesAsync(); TempData["Success"] = "Saved Successfully"; return(RedirectToAction("Index")); } return(View(schoolClass)); }
public async Task <IActionResult> Create([Bind("Id,ClassName,ProgramManagerId,Created")] SchoolClass schoolClass) { if (ModelState.IsValid) { schoolClass.Id = Guid.NewGuid(); _context.Add(schoolClass); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ProgramManagerId"] = new SelectList(_context.Set <AppUser>(), "Id", "Id", schoolClass.ProgramManagerId); return(View(schoolClass)); }
public ActionResult RemoveTeacherFromClass(Guid id, string username) { Teacher t = this.teacherService.GetByUserName(username); SchoolClass sc = schoolClassService.GetById(id); MichtavaResult res = this.schoolClassService.RemoveTeacherFromClass(t, sc); if (res is MichtavaFailure) { ModelState.AddModelError(string.Empty, res.Message); } return(RedirectToAction("Teachers", "SchoolClasses", new { id = sc.Id })); }
public async Task <ActionResult> Edit([Bind(Include = "SchoolClassId,ClassCode,ClassName")] SchoolClass schoolClass) { if (ModelState.IsValid) { Db.Entry(schoolClass).State = EntityState.Modified; await Db.SaveChangesAsync(); TempData["UserMessage"] = "School Class Updated Successfully."; TempData["Title"] = "Success."; return(RedirectToAction("Index")); } return(View(schoolClass)); }
public void AddStudent_ToFullClass_Throws() { var schoolClass = new SchoolClass(); int start = 10000; int stop = 10000 + SchoolClass.MaxStudentsInClass + 1; for (int i = start; i <= stop; i++) { var student = this.CreateStudent(i); schoolClass.AddStudent(student); } }
public ActionResult ViewEvents() { using (var context = new StripeEntities()) { int id = Convert.ToInt32(Session["loginid"]); SchoolClass schoolRecord = new SchoolClass(context); var schoolDetails = schoolRecord.getSchoolDetailsFromDirector(id); var eventList = context.SP_GET_EVENT_BY_SCHOOLID(schoolDetails.sch_ID).ToList(); return(View(eventList)); } }
public ActionResult Create(SchoolClassCreateSubmitModel model) { if (!ModelState.IsValid) { return(View(model)); } SchoolClass schoolClass = Mapper.Map <SchoolClassCreateSubmitModel, SchoolClass>(model); this.schoolClassService.Add(schoolClass); return(RedirectToAction("Details", "Grades", new { id = schoolClass.GradeId })); }
public ActionResult DeleteConfirmed(int id) { SchoolClass schoolClass = db.SchoolClasses.Find(id); db.SchoolClasses.Remove(schoolClass); db.SaveChanges(); if (Request.UrlReferrer != null) { var returnUrl = Request.UrlReferrer.ToString(); return(new RedirectResult(returnUrl)); //由于使用的是隐藏表单提交而非Ajax无刷新异步提交。所以使用jquery将表单提交到控制器后,返回Request.UrlReferrer返回到上一个页面将是数据库更新后的状态。 } return(RedirectToAction("Index")); }
public ActionResult Create(SchoolClassCreateSubmitModel model) { if (!ModelState.IsValid) { return(View(model)); } SchoolClass schoolClass = Mapper.Map <SchoolClassCreateSubmitModel, SchoolClass>(model); this.schoolClassService.Add(schoolClass); return(RedirectToAction("Index", "SchoolClasses")); }
public IEnumerable <StudentDTO> GetSchoolClassStudents(string id) { SchoolClass schoolClass = db.SchoolClassRepository.GetByID(id); List <StudentDTO> studentsDto = new List <StudentDTO>(); foreach (var item in schoolClass.Students) { studentsDto.Add(Utils.ConvertStudentToDto(item)); } return(studentsDto); //return schoolClass.Students; }
private void btnAdd_Click(object sender, RoutedEventArgs e) { int schClass = int.Parse(txtBoxClass.Text); char schSubClass = char.Parse(txtBoxSubClass.Text); SchoolClass newClass = new SchoolClass(schClass, schSubClass); // Add the new class in the "DB" ESchoolDiaryData.SchoolClasses.Add(newClass); txtBoxClass.Clear(); txtBoxSubClass.Clear(); MessageBox.Show("New class has been added!"); Close(); }
internal void AddSchoolClass(SchoolClass sclass) { String query = " INSERT INTO school_class(name, start_date, end_date, class_type_id, semester_id) VALUES(" + " '" + sclass.Name + "'" + ", " + (sclass.StartDate != null ? "'" + ((DateTime)sclass.StartDate).ToString("yyyy-MM-dd HH:mm:ss") + "'" : "null") + ", " + (sclass.EndDate != null ? "'" + ((DateTime)sclass.EndDate).ToString("yyyy-MM-dd HH:mm:ss") + "'" : "null") + ", " + sclass.ClassTypeId + ", " + sclass.SemesterId + "); "; try { SQLiteCommand command = new SQLiteCommand(query, conn); command.ExecuteNonQuery(); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
static void Main() { School firstLanguageSchool = new School("First Language School"); Discipline math = new Discipline("Basic Mathematics", 15, 11, "Kofti predmet"); Discipline math2 = new Discipline("Mathematics 2-nd part", 14, 2); Console.WriteLine(math); Teacher first = new Teacher("Kolio", "Ivanov", "Idiot"); first.AddDiscipline(math); first.AddDiscipline(math2); Console.WriteLine(first); Student firstStudent = new Student("Liolio", "Peshev", "Very poor performance", "11b"); Console.WriteLine(firstStudent); SchoolClass eleven = new SchoolClass("Eleventh grade"); eleven.AddTeacher(first); }
static void Main(string[] args) { SchoolManager school = new SchoolManager(); SchoolClass schoolClass = new SchoolClass("4C"); school.AddClass(schoolClass); schoolClass.Teacher = new Teacher("Janusz", "Kowalski", "Podstawy języka C#"); schoolClass.AddStudent(new Student("Ania", "Misia")); schoolClass.AddStudent(new Student("Zuzia", "Pysia")); schoolClass.AddStudent(new Student("Grześ", "Kowalski")); schoolClass.AddStudent(new Student("Jaś", "Nowak")); Console.WriteLine(schoolClass.GetDescription()); Console.WriteLine("=============================================\n"); foreach (Person person in school.FindPersonsBySurname("Kowalski")) Console.WriteLine(" * " + person.ToString()); Console.ReadKey(); }
public static void Main() { SchoolClass firstClass = new SchoolClass(); Teacher firstTeacher = new Teacher("Ivan"); firstClass.AddTeacher(firstTeacher); Teacher secondTeacher = new Teacher("Stoian"); firstClass.AddTeacher(secondTeacher); Teacher thirdTeacher = new Teacher("Dragan"); firstClass.AddTeacher(thirdTeacher); thirdTeacher.AddComment("Test wtf!"); Console.WriteLine(thirdTeacher.Comments[0]); foreach (var teacher in firstClass.SetOfTeachers) { teacher.Name = "test"; } }
static void Main() { School school = new School("ГПЧЕ"); Console.WriteLine(school); SchoolClass schoolClass = new SchoolClass('A'); Console.WriteLine(schoolClass); Student pesho = new Student("Pesho", 23); Console.WriteLine(pesho); Discipline disciplines = new Discipline("Programing in C", 1, 1); Console.WriteLine(disciplines); List<string> teacherDisciplines = new List<string>(); teacherDisciplines.Add("Informatics"); teacherDisciplines.Add("Mathematics"); Teacher marinov = new Teacher("Marinov", teacherDisciplines); Console.WriteLine(marinov); }
///<summary>Inserts one SchoolClass into the database. Provides option to use the existing priKey.</summary> public static long Insert(SchoolClass schoolClass,bool useExistingPK){ if(!useExistingPK && PrefC.RandomKeys) { schoolClass.SchoolClassNum=ReplicationServers.GetKey("schoolclass","SchoolClassNum"); } string command="INSERT INTO schoolclass ("; if(useExistingPK || PrefC.RandomKeys) { command+="SchoolClassNum,"; } command+="GradYear,Descript) VALUES("; if(useExistingPK || PrefC.RandomKeys) { command+=POut.Long(schoolClass.SchoolClassNum)+","; } command+= POut.Int (schoolClass.GradYear)+"," +"'"+POut.String(schoolClass.Descript)+"')"; if(useExistingPK || PrefC.RandomKeys) { Db.NonQ(command); } else { schoolClass.SchoolClassNum=Db.NonQ(command,true); } return schoolClass.SchoolClassNum; }
public void Teach(SchoolClass clas) { clas.AddTeacher(this); }
public void SchoolRemoveSchoolClass(SchoolClass item) { this.schoolSchoolClassList.Remove(item); }
public void SchoolAddSchoolClass(SchoolClass item) { this.schoolSchoolClassList.Add(item); }
internal void SearchSchoolClass() { _currentSelectedClass = _classModel.FindSchoolClassById(_selectedSchoolClassSummary.Id); ClassOpertionErrorMesage = ""; ShowClassInformationPanel = "Visible"; ClassInformationEditButtonLabel = "Edit"; CanEditClassIfnormation = false; CanClickClassInformationSave = false; NotifyPropertyChanged(""); }
public void TestSchoolClassConstructor1() { Student[] students = new Student[] { new Student("Kiril", "Nikolov", 1), new Student("Stamo", "Petkov", 2) }; Course[] courses = new Course[] { new Course("C# Fundamentals Part I", 10, 10), new Course("C# Fundamentals Part II", 18, 3), new Course("Object-Oriented Programming", 8, 1), new Course("Knowledge Sharing and Teamwork", 10, 0) }; Teacher[] teachers = new Teacher[] { new Teacher("Svetlin", "Nakov", courses) }; SchoolClass schoolClass = new SchoolClass("XIIc", students, teachers); Assert.AreEqual("Nakov", schoolClass.Teachers[0].LastName); }
public bool ContainsClass(SchoolClass schoolClass){ return schoolClasses.ContainsValue(schoolClass); }
public void AddClass(SchoolClass newClass) { this.Classes.Add(newClass); }
public void AddClass(SchoolClass myClass) { this.Classes.Add(myClass); }
public void addClass(SchoolClass sc){ if (schoolClasses.Count() < 4 && school == sc.School.GetType() && !schoolClasses.ContainsKey(sc.Id)) schoolClasses.Add(sc.Id, sc); }
///<summary>Updates one SchoolClass in the database.</summary> public static void Update(SchoolClass schoolClass){ string command="UPDATE schoolclass SET " +"GradYear = "+POut.Int (schoolClass.GradYear)+", " +"Descript = '"+POut.String(schoolClass.Descript)+"' " +"WHERE SchoolClassNum = "+POut.Long(schoolClass.SchoolClassNum); Db.NonQ(command); }
///<summary>Updates one SchoolClass in the database. Uses an old object to compare to, and only alters changed fields. This prevents collisions and concurrency problems in heavily used tables.</summary> public static void Update(SchoolClass schoolClass,SchoolClass oldSchoolClass){ string command=""; if(schoolClass.GradYear != oldSchoolClass.GradYear) { if(command!=""){ command+=",";} command+="GradYear = "+POut.Int(schoolClass.GradYear)+""; } if(schoolClass.Descript != oldSchoolClass.Descript) { if(command!=""){ command+=",";} command+="Descript = '"+POut.String(schoolClass.Descript)+"'"; } if(command==""){ return; } command="UPDATE schoolclass SET "+command +" WHERE SchoolClassNum = "+POut.Long(schoolClass.SchoolClassNum); Db.NonQ(command); }
public ClassNotEmptyException(SchoolClass schoolClass) : base("The teacher's class \""+schoolClass.Name + schoolClass.Level +"\" is still existing and contains pupils") { this.schoolClass = schoolClass; }
public void RemoveClass(SchoolClass oneSchoolClass) { this.classes.Remove(oneSchoolClass); }
public void AddClass(SchoolClass oneSchoolClass) { this.classes.Add(oneSchoolClass); }