public virtual void addNewStudenttoDB(IStudent theStudent)
 {
     try
     {
         SqlDataReader rdr = null;
         SqlCommand    cmd = new SqlCommand("dbo.CreateNewStudent", connection);
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.Add(new SqlParameter("@userID", theStudent.UserID));
         cmd.Parameters.Add(new SqlParameter("@course", theStudent.CourseID_fk));
         cmd.Parameters.Add(new SqlParameter("@noneu", theStudent.NonEU));
         cmd.Parameters.Add(new SqlParameter("@feespaid", theStudent.FeesPaid));
         cmd.Parameters.Add(new SqlParameter("@night", theStudent.NightStudent));
         cmd.Parameters.Add(new SqlParameter("@year", theStudent.Year));
         cmd.Parameters.Add(new SqlParameter("@parttime", theStudent.IsPartTime));
         cmd.Parameters.Add(new SqlParameter("@dob", theStudent.DOB));
         rdr = cmd.ExecuteReader();
         rdr.Close();
     }
     catch (System.Exception excep)
     {
         if (connection.State.ToString() == "Open")
         {
             connection.Close();
         }
         Application.Exit();
         //Environment.Exit(0); //Force the application to close
     }
 }
Exemple #2
0
 public void Remove(IStudent student)
 {
     if(this.students.Contains(student))
     {
         this.students.Remove(student);
     }
 }
Exemple #3
0
        public async Task RemoveFromElastic(IStudent removedStudent)
        {
            List <IBulkOperation> bulkOps = new List <IBulkOperation>();

            var updateReq = new BulkDeleteOperation <Class>(removedStudent.StudentId);

            updateReq.Index = ElasticConfig.Indices.Main.Name();
            bulkOps.Add(updateReq);

            var updateReqLog = new BulkIndexOperation <Activity <string> >(new Activity <string>()
            {
                Id        = Guid.NewGuid().ToString(),
                Timestamp = DateTime.UtcNow,
                Payload   = new ActivityPayload <string>()
                {
                    Data = string.Format($"SearchProvider: Delete(), Deleted Student - {JsonConvert.SerializeObject(removedStudent)}")
                },
                ActivityType = ActivityType.StudentDelete
            });

            updateReqLog.Index = ElasticConfig.Indices.Logs.Name();
            bulkOps.Add(updateReqLog);

            await _elasticProvider.BulkAsync(new BulkRequest()
            {
                Operations = bulkOps
            });
        }
Exemple #4
0
 public void Unsubscribe(IStudent student)
 {
     if (this.Students.Contains(student))
     {
         this.Students.Remove(student);
     }
 }
Exemple #5
0
 public StudentEntity(IStudent student)
     : this()
 {
     FirstName = student.FirstName;
     LastName  = student.LastName;
     RowKey    = student.MicrosoftId;
 }
        /// <summary>
        /// Get entry to college.
        /// </summary>
        /// <param name="student">Student object.</param>
        /// <returns>String representation of student object.</returns>
        public string Enter(IStudent student)
        {
            student.Name = "Rahul";
            student.Age = 100;

            return student.ToString();
        }
Exemple #7
0
        public async Task PublishToElastic(IStudent createdStudent)
        {
            List <IBulkOperation> bulkOps = new List <IBulkOperation>();

            var createReq = new BulkIndexOperation <Student>(createdStudent as Student);

            createReq.Index = ElasticConfig.Indices.Main.Name();
            bulkOps.Add(createReq);

            var createReqLog = new BulkIndexOperation <Activity <string> >(new Activity <string>()
            {
                Id        = Guid.NewGuid().ToString(),
                Timestamp = DateTime.UtcNow,
                Payload   = new ActivityPayload <string>()
                {
                    Data = string.Format($"SearchProvider: Create(), Created Student - {JsonConvert.SerializeObject(createdStudent)}")
                },
                ActivityType = ActivityType.Log
            });

            createReqLog.Index = ElasticConfig.Indices.Logs.Name();
            bulkOps.Add(createReqLog);

            await _elasticProvider.BulkAsync(new BulkRequest()
            {
                Operations = bulkOps
            });
        }
Exemple #8
0
        /// <summary>
        /// Compare two IStudent objects by IStudent.BirthDate value.
        /// </summary>
        /// <param name="other"></param>
        /// <returns></returns>
        public bool IsOlderThan(IStudent other)
        {
            var thisBirthDate  = this.OtherInfo.BirthDate;
            var otherBirthDate = other.OtherInfo.BirthDate;

            return(thisBirthDate < otherBirthDate);
        }
 public bool EditStudentCourseinDB(IStudent user)
 {
     try
     {
         ds = new DataSet();
         string sql = "SELECT * From Student";
         da = new SqlDataAdapter(sql, connection);
         da.MissingSchemaAction = MissingSchemaAction.AddWithKey;
         cb = new SqlCommandBuilder(da);
         da.Fill(ds, "StudentsData");
         DataRow findRow = ds.Tables["StudentsData"].Rows.Find(user.UserID);
         if (findRow != null)
         {
             findRow[1] = user.CourseID_fk;
         }
         da.Update(ds, "StudentsData");
     }
     catch (System.Exception excep)
     {
         MessageBox.Show(excep.Message);
         if (getConnection().ToString() == "Open")
         {
             closeConnection();
         }
         Application.Exit();
     }
     return(true);
 }
 public CourseController(ICourse CourseRepo, ITeacher TeacherRepo, IStudent StudentRepo, ICourseAssignmnet CourseAssignmentRepo)
 {
     this.CourseRepo           = CourseRepo;
     this.TeacherRepo          = TeacherRepo;
     this.StudentRepo          = StudentRepo;
     this.CourseAssignmentRepo = CourseAssignmentRepo;
 }
        public async Task Insert(IStudent entity)
        {
            var student = entity as Student ?? new Student();

            _context.Students.Add(student);
            await _context.SaveChangesAsync();
        }
 public StudentController(IStudentServices studentServices, IStudent student, IDepartmentServices departmentServices)
 {
     _Student             = new Student();
     _IStudent            = student;
     _IStudentServices    = studentServices;
     _IDepartmentServices = departmentServices;
 }
Exemple #13
0
 static void WriteStudentInfo(IStudent student)
 {
     WritePersonInfo(student);
     Console.WriteLine();
     Console.WriteLine("Program of Study: {0}", student.ProgramOfStudy);
     Console.WriteLine("Degree Pursued: {0}", student.PursuedDegree);
 }
Exemple #14
0
 public void Unsubscribe(IStudent student)
 {
     if (this.Students.Contains(student))
     {
         this.Students.Remove(student);
     }
 }
 public void removeStudent(IStudent student)
 {
     if (students.Contains(student))
     {
         students.Remove(student);
     }
 }
Exemple #16
0
        static void Main(string[] args)
        {
            ChannelFactory <IStudent> factory = new ChannelFactory <IStudent>(new NetTcpBinding(), new EndpointAddress("net.tcp://127.255.0.0:11000/InputRequest"));

            IStudent proxy = factory.CreateChannel();


            proxy.AddStudent("pr88-2015", "Stefan", "Ruvceski");
            proxy.AddStudent("pr89-2015", "Stefana", "Ruvceska");
            proxy.AddStudent("pr90-2015", "Stefani", "Ruvceska");
            proxy.AddStudent("pr91-2015", "Stefanu", "Ruvceski");
            proxy.AddStudent("pr92-2015", "Stefa", "Ruvceska");

            foreach (Student s in proxy.RetrieveAllStudents())
            {
                Console.WriteLine(s.Index);
            }
            Console.WriteLine("-----------------------------------------------");
            proxy.RemoveStudent("pr90-2015");

            foreach (Student s in proxy.RetrieveAllStudents())
            {
                Console.WriteLine(s.Index);
            }
            Console.WriteLine("-----------------------------------------------");
            proxy.EditStudent("pr89-2015", "Teodora", "Ruvceska");

            foreach (Student s in proxy.RetrieveAllStudents())
            {
                Console.WriteLine(s.Index);
            }

            Console.ReadKey();
        }
 public void addStudent(IStudent student)
 {
     if (!students.Contains(student))
     {
         students.Add(student);
     }
 }
Exemple #18
0
        public void GenerateStudents()
        {
            #region Sample Single Initialization
            IStudent Studenti1 = FactoryStudent.CreateStudent(StudentType.Bachelor);
            Studenti1.Name    = "St1Name";
            Studenti1.Surname = "St1Surname";
            IStudent Studenti2 = FactoryStudent.CreateStudent(StudentType.Master);
            Studenti2.Name    = "St2Name";
            Studenti2.Surname = "St2Surname";

            Studentet.Add(Studenti1);
            Studentet.Add(Studenti2);
            #endregion

            #region Sample Group Initialization
            for (int i = 2; i < 100; i++)
            {
                IStudent X;
                if (i % 2 == 0)
                {
                    X = FactoryStudent.CreateStudent(StudentType.Bachelor);
                }
                else
                {
                    X = FactoryStudent.CreateStudent(StudentType.Master);
                }
                X.Name    = "St" + i.ToString() + "Name";
                X.Surname = "St" + i.ToString() + "Surname";
                Studentet.Add(X);
            }
            #endregion
        }
Exemple #19
0
 public StudentEntity(IStudent student)
     : this()
 {
     FirstName = student.FirstName;
     LastName = student.LastName;
     RowKey = student.MicrosoftId;
 }
        public override void UpdateStudent(IStudent student)
        {
            XElement xroot = _doc.Root;

            foreach (XElement xr in xroot.Elements(Constant.StudentElementName))
            {
                string id = xr.Attribute(Constant.Id).Value;
                if (id == student.Id.ToString())
                {
                    xr.Attribute(Constant.Id).Value      = student.Id.ToString();
                    xr.Element(Constant.FirstName).Value = student.FirstName;
                    xr.Element(Constant.LastName).Value  = student.LastName;
                    xr.Element(Constant.Age).Value       = student.Age.ToString();
                    if (student.Gender == "Муж")
                    {
                        xr.Element(Constant.Gender).Value = String.Format("0");
                    }
                    else
                    {
                        xr.Element(Constant.Gender).Value = String.Format("1");
                    }
                    break;
                }
            }
            _doc.Save(_fileName);
        }
Exemple #21
0
 /// <summary>
 /// Method for setting mark of student who listen this course in the dictionary and saving in the file.
 /// </summary>
 /// <param name="student">Student</param>
 /// <param name="course">Course</param>
 /// <param name="professor">Lector of the course</param>
 public void SetMark(IStudent student, ICourse course, Professor professor)
 {
     NLogger.Logger.Trace("Archive open");
     if (!dictionary.ContainsKey(student))
     {
         dictionary.Add(student, new Dictionary <ICourse, double>());
     }
     if (!dictionary[student].ContainsKey(course))
     {
         dictionary[student].Add(course, professor.SetTheMark(student));
     }
     try
     {
         NLogger.Logger.Trace("Trying to write mark at the file");
         using (BinaryWriter writer = new BinaryWriter(File.OpenWrite(fileName)))
         {
             writer.Write(student.StudentName + ": " + dictionary[student][course] + ".");
         }
     }
     catch (IOException e)
     {
         NLogger.Logger.Error("Error of writing. " + e.Message);
         throw;
     }
     catch (ObjectDisposedException e)
     {
         NLogger.Logger.Error("The stream is closed. " + e.Message);
         throw;
     }
     NLogger.Logger.Trace("Marks were setted and write.");
 }
Exemple #22
0
        public static void LiveADay(object obj)
        {
            // declare Person class reference variable
            Person person = (Person)obj;

            // declare IPerson interface reference variable
            IPerson iPerson = (IPerson)obj;

            // declare IStudent interface reference variable
            // initialize to null because we do not know if obj is Student or Teacher
            IStudent iStudent = null;

            // notice how we can use the IPerson interface to call Eat() for both Student and Teacher
            // because that method is defined in the shared interface
            iPerson.Eat();

            // notice how we can use a Person reference to call Work()
            // because the virtual method is defined in the shared Person class
            // even though the method implementation is different between the 2 classes
            person.Work();

            // but because Party() is only a member of Student
            // as a result of inheriting IStudent
            // we need to ensure obj is a Student
            if (obj.GetType() == typeof(Student))
            {
                // we use an IStudent reference to call Party()
                iStudent = (IStudent)person;
                iStudent.Party();
            }
        }
        public void Should_Return_False1()
        {
            // Arrange
            _student = new Student()
            {
                Id                = 1,
                FirstName         = "John",
                LastName          = "Cena",
                RegisteredCourses = new List <RegisteredCourse>()
                {
                    new RegisteredCourse()
                    {
                        Id        = 1,
                        StudentId = 1,
                        CourseId  = 1
                    }
                }
            };
            var course = new Course()
            {
                Id          = 1,
                Name        = "python",
                Description = "Wow"
            };

            // Act
            var result = _student.RegisterForCourse(course);

            // Assert
            Assert.IsFalse(result);
        }
Exemple #24
0
 public LoginController(IStudent studentRepository, ICaheRepository caheRepository, IFiliereRepository filiereRepository)
 {
     _studentRepository     = studentRepository;
     _caheRepository        = caheRepository;
     this.filiereRepository = filiereRepository;
     vm.Filieres            = filiereRepository.All();
 }
Exemple #25
0
        public StudentDetailViewModel(StudentTableViewModel viewModel, IStudent studentStore, IPageService pageService)
        {
            if (viewModel == null)
            {
                throw new ArgumentNullException(nameof(viewModel));
            }

            _pageService  = pageService;
            _studentStore = studentStore;

            SaveCommand = new Command(async() => await Save());

            Student = new Student
            {
                id          = viewModel.Id,
                studentID   = viewModel.StudentID,
                firstName   = viewModel.FirstName,
                lastName    = viewModel.LastName,
                email       = viewModel.Email,
                city        = viewModel.City,
                postCode    = viewModel.PostCode,
                accountType = viewModel.AccountType,
                status      = viewModel.Status,
                courseID    = viewModel.CourseID,
                dayOfBirth  = viewModel.DayOfBirth,
                gender      = viewModel.Gender,
                idNumber    = viewModel.IdNumber,
                password    = viewModel.Password,
                phoneNumber = viewModel.PhoneNumber,
                street      = viewModel.Street
            };
        }
        public async Task Update(IStudent entity)
        {
            var student = entity as Student ?? new Student();

            _context.Students.Update(student);
            await _context.SaveChangesAsync();
        }
Exemple #27
0
 public StudentController(IStudent studentManager, ITrainer trainerManager, IBeltEarning beltEarningManager, ITraining trainingManager)
 {
     this.studentManager     = studentManager;
     this.beltEarningManager = beltEarningManager;
     this.trainerManager     = trainerManager;
     this.trainingManager    = trainingManager;
 }
Exemple #28
0
        public IStudent Update(IStudent student, HttpPostedFileBase Photo = null)
        {
            var studentInDb = _context.Students.Single(s => s.Id == student.Id);

            studentInDb.Name = student.Name;
            studentInDb.LastName = student.LastName;
            studentInDb.IsVIP = student.IsVIP;
            studentInDb.PaymentTypeId = student.PaymentTypeId;
            studentInDb.SeccionId = student.SeccionId;
            studentInDb.GroupOfStudentId = student.GroupOfStudentId;

            if (student.GroupOfStudentId != 0)
                studentInDb.PaymentDate = student.PaymentDate;

            if(Photo != null)
            {
                studentInDb.Photo = new byte[Photo.ContentLength];
                Photo.InputStream.Read(studentInDb.Photo, 0, Photo.ContentLength);
            }

            _context.SaveChanges();

            // retrieving all new info, updated.
            studentInDb = _context.Students.Include(s => s.Seccion).Include(s => s.PaymentType).Single(s => s.Id == student.Id);

            return studentInDb;
        }
Exemple #29
0
        public async Task UpdateElastic(IStudent updatedStudent)
        {
            List <IBulkOperation> bulkOps = new List <IBulkOperation>();

            var updateReq = new BulkUpdateOperation <Student, object>(updatedStudent.StudentId);

            updateReq.Index       = ElasticConfig.Indices.Main.Name();
            updateReq.DocAsUpsert = true;
            updateReq.Doc         = updatedStudent;
            bulkOps.Add(updateReq);

            var updateReqLog = new BulkIndexOperation <Activity <string> >(new Activity <string>()
            {
                Id        = Guid.NewGuid().ToString(),
                Timestamp = DateTime.UtcNow,
                Payload   = new ActivityPayload <string>()
                {
                    Data = string.Format($"SearchProvider: Edit(), Edited Student - {JsonConvert.SerializeObject(updatedStudent)}")
                },
                ActivityType = ActivityType.StudentEdit
            });

            updateReqLog.Index = ElasticConfig.Indices.Logs.Name();
            bulkOps.Add(updateReqLog);

            await _elasticProvider.BulkAsync(new BulkRequest()
            {
                Operations = bulkOps
            });
        }
Exemple #30
0
        public static void DoMain()
        {
            IFactory factory = new CNFactory();
            IStudent stu     = factory.getStudent();

            stu.work();
        }
        public void RemoveStudent(IStudent studentToRemove)
        {
            if (studentToRemove == null)
            {
                throw new ArgumentNullException("Cannot remove student null!");
            }

            bool isStudentExistingInCourse = false;

            foreach (IStudent student in this.students)
            {
                if (student.FirstName != studentToRemove.FirstName || student.LastName != studentToRemove.LastName)
                {
                    continue;
                }
                isStudentExistingInCourse = true;
                break;
            }

            if (isStudentExistingInCourse)
            {
                Console.WriteLine($"Student {studentToRemove.FirstName} {studentToRemove.LastName} removed successfully!");
            }
            else
            {
                Console.WriteLine($"Student {studentToRemove.FirstName} {studentToRemove.LastName} is not listed in current course!");
            }
        }
Exemple #32
0
 public ManageStudentController(ICoordinator coordinator, IUsers users, IStudent student, IUsersInRoles usersInRoles)
 {
     _users        = users;
     _student      = student;
     _usersInRoles = usersInRoles;
     _coordinator  = coordinator;
 }
Exemple #33
0
 public void JoinCourse(IStudent student)
 {
     if (this.CanStudentJoinCourse(student))
     {
         this.studentsList.Add(student);
     }
 }
Exemple #34
0
        static void Main(string[] args)
        {
            //object initilizing
            Student student = new Student(1);

            //initilize field value using object
            student.FirstName = "pankajan";
            //access object field
            Console.WriteLine(student.FirstName);

            Course SoftwareEngineering = new Course();

            SoftwareEngineering.CourseName = "Software Engineering"; //use setter
            Console.WriteLine(SoftwareEngineering.CourseName);       //use getter

            //object initilizing and add field values
            Student pankajan = new Student(10011)
            {
                FirstName = "Pankajan",
                LastName  = "Satkunam",
                id        = 10011
            };

            Console.WriteLine(pankajan.max_sports);
            Console.WriteLine(Student.School);
            //call function
            Console.WriteLine(pankajan.getFullName());

            //check the reference type and the out that use to assign return value
            int x     = 10;
            int y     = 20;
            int total = 0;

            SoftwareEngineering.calculate(x, ref y, out total);
            Console.WriteLine(total);

            //method overloading
            Staff.print();
            Staff.print("this is printed by overloading");

            //assign object to interface class reference type
            IStudent stu = new Student("sabinaya", "jeyakumar", 12);

            IStudent.getType();
            Console.WriteLine(IStudent.No);
            Console.WriteLine(stu.sing());

            //inheritance
            Person person = new Student("tharindu", "bandara", 33);

            //type casting using explicit
            if (person is Student)
            {
                Student s = person as Student;  //or (Student(person)) can be usable
                s.getFullName();
                Console.WriteLine(s.sing());    //access the student class after typecast
            }

            person.getFullName();
        }
Exemple #35
0
        public int AddStudent(IStudent student)
        {
            var id = this.idProvider.GenerateStudentId();

            this.students.Entities.Add(id, student);

            return id;
        }
 public AdminController(std s, Postings p, Filings f, Contactus c, Commenting com)
 {
     studnt = s;
     post = p;
     comment = com;
     file = f;
     cont = c;
 }
        public void EnrollStudent(IStudent student)
        {
            if (this.studentsByName.ContainsKey(student.UserName))
            {
                throw new DuplicateEntryInStructureException(student.UserName, this.Name);
            }

            this.studentsByName.Add(student.UserName, student);
        }
Exemple #38
0
        public bool IsOlderThan(IStudent other)
        {
            DateTime firstDate =
                DateTime.Parse(this.OtherInfo.Substring(this.OtherInfo.Length - 10));
            DateTime secondDate =
                DateTime.Parse(other.OtherInfo.Substring(other.OtherInfo.Length - 10));

            return firstDate < secondDate;
        }
Exemple #39
0
        public static void AddStudentToDatabase(IStudent student)
        {
            if (!ValidateStudentNumber(student))
            {
                throw new ArgumentException("Duplicate class number. Students in a class should have unique numbers.", "studentNumber");
            }

            students.Add(student);
        }
        public void JoinCourse(IStudent student)
        {
            if (this.ListOfStudents.Count > MAX_NUMBER_OF_STUDENTS_IN_CLASS)
            {
                throw new IndexOutOfRangeException(String.Format("the maximum count of students in any one course has reached the limit of {0}", MAX_NUMBER_OF_STUDENTS_IN_CLASS));
            }

            this.listOfStudents.Add(student);
        }
Exemple #41
0
        public void AddMark(IStudent student, IMark mark)
        {
            if (student.Marks.Count >= MaxStudentMarksCount)
            {
                throw new ArgumentException($"The student's marks count exceed the maximum count of {MaxStudentMarksCount} marks");
            }

            student.Marks.Add(mark);
        }
Exemple #42
0
 private StudentViewModel MapStudents(IStudent student)
 {
     StudentViewModel model = new StudentViewModel();
     model.Photo = student.Photo;
     model.AboutMe = student.AboutMe;
     model.FirstName = student.FirstName;
     model.Surname = student.Surname;
     model.StudentId = student.StudentId;
     return model;
 }
        private void AddNewStudent(IStudent student, int id, string name, string surname, bool isactive, Course course)
        {
            student.Id = id;
            student.Name = name;
            student.Surname = surname;
            student.IsActive = isactive;
            student.Course = course;

            _students.Add(student);
        }
Exemple #44
0
 public StudentWithSite(IStudent student, IWebSite site)
     : base(student)
 {
     if (site != null)
     {
         WebSiteUri = site.WebSiteUri;
         FtpUri = site.FtpUri;
         FtpUsername = site.FtpUsername;
         FtpPassword = site.FtpPassword;
     }
 }
Exemple #45
0
        public void RemoveStudent(IStudent student)
        {
            Validator.CheckIfNull<IStudent>(student);
            var indexOfStudent = FindFirstIndex(student);

            if (indexOfStudent < 0)
            {
                throw new ArgumentException("Student cannot be found.");
            }

            this.students.RemoveAt(indexOfStudent);
        }
Exemple #46
0
        public void Subscribe(IStudent student)
        {
            if (this.Students.Contains(student))
            {
                return;
            }

            if (this.Students.Count < 30)
            {
                this.Students.Add(student);
            }
        }
Exemple #47
0
        public void AddStudent(IStudent student)
        {
            Validator.CheckIfNull<IStudent>(student);

            if (this.students.Count >= 30)
            {
                throw new ArgumentOutOfRangeException("Courses cannot exceed more than 30 students per each.");
            }

            CheckIfStudentIsInCourse(student);

            this.students.Add(student);
        }
        public void AddStudentByCourseName(IStudent student)
        {
            if(student == null)
            {
                throw new ArgumentNullException("Parameter cannot be null.");
            }

            if (!this.Courses.ContainsKey(student.CourseName))
            {
                this.Courses[student.CourseName] = new OrderedBag<IStudent>();
            }

            this.Courses[student.CourseName].Add(student);
        }
Exemple #49
0
        public bool IsOlderThan(IStudent other)
        {
            try
            {
                DateTime firstStudentBirthday = this.GetBirthday(this.AdditionalInfo);
                DateTime secondStudentBirthday = other.GetBirthday(other.AdditionalInfo);

                return firstStudentBirthday < secondStudentBirthday;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw new ArgumentException("One or both students do not have valid date of birth information provided.");
            }
        }
Exemple #50
0
        public void CreateStudent(IStudent student)
        {
            if (student == null)
            {
                throw new ArgumentNullException("Students date is null");
            }
            else
            {
                try
                {

                    using (SqlConnection stringConnection = new SqlConnection(ConnString.localConnection()))
                    {
                        using (SqlCommand sqlCom = new SqlCommand())
                        {
                            sqlCom.Connection = stringConnection;

                            sqlCom.CommandType = CommandType.StoredProcedure;
                            sqlCom.CommandText = "stPcd_StudentCreate";

                            sqlCom.Parameters.AddWithValue("@studentName", student.ID);
                            sqlCom.Parameters.AddWithValue("@studentSirName", student.SirName);
                            sqlCom.Parameters.AddWithValue("@studentCountry", student.Country);
                            sqlCom.Parameters.AddWithValue("@studentAddress", student.Address);
                            sqlCom.Parameters.AddWithValue("@studentTelephone", student.PhoneNumber);
                            sqlCom.Parameters.AddWithValue("@studentMobil", student.MobilNumber);
                            sqlCom.Parameters.AddWithValue("@studentBirthDate", student.BirthDate);
                            sqlCom.Parameters.AddWithValue("@studentOccupation", student.Occupation);
                            sqlCom.Parameters.AddWithValue("@studentDenomination", student.Denomination);
                            sqlCom.Parameters.AddWithValue("@studentClass", student.MartialStutus);

                            stringConnection.Open();
                            stringConnection.Close();
                        }
                    }
                }
                catch (Exception ee)
                {
                    Console.Write(ee);
                }
                finally
                {

                }
            }
        }
Exemple #51
0
        public void Add(IStudent student)
        {
            if(this.Students.Count >= STUDENTS_COUNT_MAX)
            {
                throw new ArgumentOutOfRangeException("The number of students in the course cannot be greater than " +
                    STUDENTS_COUNT_MAX + ".");
            }

            foreach(var oldStudent in this.Students)
            {
                if(oldStudent.ID.Equals(student.ID))
                {
                    throw new ArgumentException("Students cannot have the same ID !");
                }
            }

            this.students.Add(student);
        }
        public bool IsOlderThan(IStudent other)
        {
            DateTime firstDate =
                DateTime.Parse(this.OtherInfo.Substring(this.OtherInfo.Length - 9));
            DateTime secondDate =
                DateTime.Parse(other.OtherInfo.Substring(other.OtherInfo.Length - 9));

            int isOlder = DateTime.Compare(firstDate, secondDate);

            if (isOlder < 0)
            {
                return true;
            }

            else
            {
                return false;
            }
        }
Exemple #53
0
 /**
  * Create the student object
  */
 protected void CreateStudent(string type, string name)
 {
     IStudent student;
     switch (type)
     {
         case "Full Time":
             student = new FullTimeStudent(name);
             break;
         case "Part Time":
             student = new PartTimeStudent(name);
             break;
         case "Co-Op":
             student = new CoopStudent(name);
             break;
         default:
             student = new FullTimeStudent(name);
             break;
     }
     _student = student;
 }
        public Boolean EditStudent(IStudent student)
        {
            var newstudent = Db.StudentDBs.SingleOrDefault(s => s.studentId == student.StudentId); ;

            newstudent.MatricNumber = student.MatricNumber;
            newstudent.DateOfBirth = student.DateOfBirth;
            newstudent.DepartmentCode = student.DepartmentCode;
            newstudent.Faculty = student.Faculty;
            newstudent.FirstName = student.FastName;
            newstudent.Gender = Convert.ToChar(student.Gender);
            newstudent.GraduationYear = student.GraduationYear;
            newstudent.LastName = student.LastName;
            newstudent.MiddleName = student.MiddleName;
            newstudent.Nationality = student.Nationality;
            newstudent.YearAdmitted = student.YearAdmitted;

            Db.SubmitChanges();

            return true;
        }
        public Boolean AddNewStudent(IStudent student)
        {
            var newstudent = new StudentDB
            {
                MatricNumber = student.MatricNumber,
                DateOfBirth = student.DateOfBirth,
                DepartmentCode = student.DepartmentCode,
                Faculty = student.Faculty,
                FirstName = student.FastName,
                Gender = Convert.ToChar(student.Gender),
                GraduationYear = student.GraduationYear,
                LastName = student.LastName,
                MiddleName = student.MiddleName,
                Nationality = student.Nationality,
                YearAdmitted = student.YearAdmitted
            };

              Db.StudentDBs.InsertOnSubmit(newstudent);
              Db.SubmitChanges();

            return true;
        }
Exemple #56
0
 public void GiveKnowledge(IStudent st)
 {
     // TODO maybe another formula --- Dificulty / 10
     st.ReceiveKnowledge(this.Dificulty / 5);
 }
 public void InsertOrUpdate(IStudent entity)
 {
     throw new NotImplementedException();
 }
Exemple #58
0
 public void InsertStudent(IStudent studentTobeInserted)
 {
     this.students.Add(studentTobeInserted);
 }
 public HomeController(Contactus c, std s)
 {
     icon = c;
     std = s;
 }
Exemple #60
0
 public void RemoveStudent(IStudent studentTobeInserted)
 {
     this.students.Remove(studentTobeInserted);
 }