예제 #1
0
        static void Main(string[] args)
        {
            StudentsData studentsData = new StudentsData();

            studentsData.Create("Jhon Smith");
            studentsData.Retrieve();
        }
예제 #2
0
        public IHttpActionResult GetAllStudents()
        {
            var obj = StudentsData.getStudents();


            return(Ok(obj));
        }
        static void Main(string[] args)
        {
            StudentsData data = new StudentsData();

            var weakStudentsList = data.Students.WeakStudentsList();

            // here we'll use the PrintStudentsInfo - the extended method from the first project in this solution
            Print.PrintStudentsInfo(weakStudentsList);
        }
        /// <summary>
        /// Method that removes target student's note from list.
        /// </summary>
        /// <param name="commandParameter">Taeget student's object.</param>
        private void RemoveStudentNote(object commandParameter)
        {
            var result = MessageBox.Show(AssemblyInfo.QUESTION_REMOVE_STUDENT, AssemblyInfo.QUESTION_REMOVE_STUDENT_HEADER,
                                         MessageBoxButton.YesNo);

            if (result == MessageBoxResult.Yes)
            {
                StudentsData.Remove(commandParameter as Student);
            }
        }
예제 #5
0
        public IHttpActionResult PutStudents(Student param)
        {
            if (param.id <= 0)
            {
                return(BadRequest());
            }
            var obj = StudentsData.PutStudent(param);

            return(Ok(obj));
        }
        protected override void Seed(ContosoUniversityContext context)
        {
            base.Seed(context);

            StudentsData.Seed(context);
            InstructorData.Seed(context);
            DepartmentData.Seed(context);
            CourseData.Seed(context);
            OfficeAssignmentData.Seed(context);
            EnrollmentData.Seed(context);
        }
        public ActionResult ManageStudentMod(StudentsData Data)
        {
            JObject joResult = new JObject();

            try
            {
                Students st = new Students();
                st.name     = Data.Name;
                st.datatype = Data.DataType;
                st.kind     = Data.Kind;
                st.no       = Convert.ToInt32(Data.no);
                dbDapper.Update(st);

                if (Data.ExperienceList != null)
                {
                    ssql = " delete from studentd where studentno = '{0}' and type = '{1}' ";
                    ssql = string.Format(ssql, Data.no.ToString(), "exp");
                    dbDapper.Execute(ssql);
                    foreach (string item in Data.ExperienceList)
                    {
                        StudentD sd = new StudentD();
                        sd.studentno = Convert.ToInt32(Data.no);
                        sd.type      = "exp";
                        sd.value     = item;
                        dbDapper.Insert(sd);
                    }
                }

                if (Data.ResearchList != null)
                {
                    ssql = " delete from studentd where studentno = '{0}' and type = '{1}' ";
                    ssql = string.Format(ssql, Data.no.ToString(), "res");
                    dbDapper.Execute(ssql);
                    foreach (string item in Data.ResearchList)
                    {
                        StudentD sd = new StudentD();
                        sd.studentno = Convert.ToInt32(Data.no);
                        sd.type      = "res";
                        sd.value     = item;
                        dbDapper.Insert(sd);
                    }
                }



                joResult.Add("msg", "ok");
            }
            catch (Exception ex)
            {
                joResult.Add("msg", ex.Message);
            }

            return(Content(JsonConvert.SerializeObject(joResult), "application/json"));
        }
예제 #8
0
        public IHttpActionResult Delete(Student param)
        {
            Student obj = new Student();

            obj.id = param.id;
            if (obj.id <= 0)
            {
                return(BadRequest());
            }
            var temp = StudentsData.deleteStudent(obj);

            return(Ok(temp));
        }
예제 #9
0
        public IHttpActionResult GetStudentsById(Student param)
        {
            Student obj = new Student();

            obj.id = param.id;
            if (obj.id <= 0)
            {
                return(BadRequest());
            }
            var temp = StudentsData.getStudentById(obj);

            return(Ok(temp));
        }
        static void Main(string[] args)
        {
            StudentsData data = new StudentsData();
            var          excellentStudents = from student in data.Students
                                             where student.Marks.Contains(6)
                                             // here we'll select all students that have at least one mark Excellent (6) into a new anonymous class that holds { FullName + Marks}
                                             select new { FullName = string.Join(" ", student.FirstName, student.LastName), Marks = string.Join(", ", student.Marks) };

            // print the result
            foreach (var student in excellentStudents)
            {
                Console.WriteLine("Name: {0}, Grades: {{{1}}},",
                                  student.FullName, student.Marks);
            }
        }
예제 #11
0
        static void Main(string[] args)
        {
            StudentsData data = new StudentsData();

            var sortStudents = data.Students.OrderByDescending(item => item.FirstName).ThenByDescending(item => item.LastName);

            // print the result
            foreach (var student in sortStudents)
            {
                Console.WriteLine("Name: {0} {1}, Age: {2}, Faculty Number: {3} " +
                                  "\n\tPhone: {4}, Email: {5} \n\tGrades: {{{6}}}, Group: {7}",
                                  student.FirstName, student.LastName, student.Age, student.FacultyNumber,
                                  student.Phone, student.Email, string.Join(", ", student.Marks), student.GroupNumber);
            }
        }
예제 #12
0
        public ActionResult ManageStudentAdd(StudentsData Data)
        {
            Students st = new Students();

            st.name     = Data.Name;
            st.datatype = Data.DataType;
            st.kind     = Data.Kind;
            dbDapper.Insert(Data);


            JObject joResult = new JObject();

            joResult.Add("msg", "ok");

            return(Content(JsonConvert.SerializeObject(joResult), "application/json"));
        }
        static void Main(string[] args)
        {
            StudentsData data = new StudentsData();

            var studentsByAge = from student in data.Students
                                where student.Age > 18
                                where student.Age < 24
                                select student;

            // print the result
            foreach (var student in studentsByAge)
            {
                Console.WriteLine("Name: {0} {1}, Age: {2}",
                                  student.FirstName, student.LastName, student.Age);
            }
        }
        static void Main(string[] args)
        {
            StudentsData data = new StudentsData();

            var studentsByMail = from student in data.Students
                                 where student.Email.Contains("@abv.bg")
                                 select student;

            // print the result
            foreach (var student in studentsByMail)
            {
                Console.WriteLine("Name: {0} {1}, Age: {2}, Faculty Number: {3} " +
                                  "\n\tPhone: {4}, Email: {5} \n\tGrades: {{{6}}}, Group: {7}",
                                  student.FirstName, student.LastName, student.Age, student.FacultyNumber,
                                  student.Phone, student.Email, string.Join(", ", student.Marks), student.GroupNumber);
            }
        }
예제 #15
0
        static void Main(string[] args)
        {
            StudentsData data = new StudentsData();

            string pattern = @"(?<=\d{4})(14)";
            Regex  reg     = new Regex(pattern);

            var studentsEnrolled = from student in data.Students
                                   where reg.IsMatch(student.FacultyNumber.ToString())
                                   select student;

            foreach (var student in studentsEnrolled)
            {
                Console.WriteLine("Name: {0} {1}, , Faculty Number: {2}, Grades: {{{3}}}",
                                  student.FirstName, student.LastName, student.FacultyNumber, string.Join(", ", student.Marks));
            }
        }
        static void Main(string[] args)
        {
            // here we'll create an instance of the StudentsData class, so we'll use its IList <Student>
            StudentsData data = new StudentsData();

            // here we'll use LINQ query
            var studentsByName = from student in data.Students
                                 where student.FirstName.CompareTo(student.LastName) < 0
                                 select student;

            // print the result
            foreach (var student in studentsByName)
            {
                Console.WriteLine("Name: {0} {1}, Age: {2}, Faculty Number: {3} " +
                                  "\n\tPhone: {4}, Email: {5} \n\tGrades: {{{6}}}, Group: {7}",
                                  student.FirstName, student.LastName, student.Age, student.FacultyNumber,
                                  student.Phone, student.Email, string.Join(", ", student.Marks), student.GroupNumber);
            }
        }
예제 #17
0
        static void Main()
        {
            StudentsData data = new StudentsData();

            // here we'll use LINQ query
            var studentsByGroup =
                from student in data.Students
                orderby student.FirstName
                group student by student.GroupNumber
                into studentGroup
                where studentGroup.Key == 2
                select studentGroup;


            foreach (var student in studentsByGroup)
            {
                Console.WriteLine("All students from group {0}:", student.Key);
                foreach (var item in student)
                {
                    Console.WriteLine("Name: {0} {1}, Age: {2}, Faculty Number: {3} " +
                                      "\n\tPhone: {4}, Email: {5} \n\tGrades: {{{6}}}", item.FirstName, item.LastName, item.Age, item.FacultyNumber, item.Phone, item.Email, string.Join(", ", item.Marks));
                }
            }
        }
예제 #18
0
 public HomeController()
 {
     this.studentsData = new StudentsData();
 }
예제 #19
0
        public IHttpActionResult PostStudents(Student param)
        {
            var obj = StudentsData.postStudent(param);

            return(Ok(obj));
        }