/// <summary> /// 构造函数。 /// </summary> public UCLogin(ICoreService service, EnumLoginMethod method, Students students) : base(service) { this.loginMethod = method; this.students = students; InitializeComponent(); }
protected void Page_Load(object sender, EventArgs e) { if (TheSessions.StudentID == null) { Label1.Visible = false; StName.Visible = false; Button14.Visible = false; } else { Students st = new Students(); Button14.Visible = true; Label1.Visible = true; StName.Visible = true; StName.Text = new Codes().StudentName(Convert.ToInt64(TheSessions.StudentID)); string s = st.GetGender(); if (s.Trim() == "1") { GenderImg.ImageUrl = "Man.png"; GenderImg.ToolTip = "ذكر"; } else { GenderImg.ImageUrl = "Woman.png"; GenderImg.ToolTip = "انثى"; } } }
public string GetCourse() { Course course = new Course(); System.Console.WriteLine("Enter Course Name: "); Course.courseName = System.Console.ReadLine(); System.Console.WriteLine("Enter Couse Number: "); Course.CRN = System.Console.ReadLine(); System.Console.WriteLine("Enter Number of Students: "); Course.numStudents = System.Console.ReadLine(); for (Course.numStudents > 1) { Students student = new Students(); System.Console.WriteLine("Enter Student Name: "); Student.studentName = System.Console.ReadLine(); System.Console.WriteLine("Enter Student S-Number: "); Student.sNumber = System.Console.ReadLine(); Course.numStudents = Course.numStudents - 1; System.Console.WriteLine(student.studentName); System.Console.WriteLine(student.sNumber); } System.Console.WriteLine(Course.courseName); System.Console.WriteLine(Course.CRN); }
static List<Students> AgeSort(Students[] input) // problem 4 { var result = new List<Students>(); foreach (var student in input) { if (student.Age >= 18 && student.Age <= 24) { result.Add(student); } } return result; }
public static List<Students> NameSorter(Students[] students) { var result = new List<Students>(); for (int i = 0; i < students.Length; i++) { if (students[i].FirstName.CompareTo(students[i].LastName) < 0) { result.Add(students[i]); } } return result; }
private void Main_Load(object sender, EventArgs e) { Student stu1 = new Student("Kai Zhou", Gender.male, 26); Student stu2 = new Student("Shiyang Liu", Gender.femal, 25); Student stu3 = new Student("Yaqiao Liu", Gender.femal, 25); Students stuList = new Students(); stuList.Add(stu1); stuList.Add(stu2); stuList.Add(stu3); bindingSourceStudents.DataSource = stuList; bindingSourceStudents.ResetBindings(false); }
public void Add() { Students s = new Students() { Id = Guid.NewGuid(), Age = 1234, Name = "dsad", IsDeleted = false, CreationTime = DateTime.Now, CreatorUserId = 11 }; TestApplicationBiz Service = _iocManager.Resolve<TestApplicationBiz>(); Students dto = Service.Add(s); }
static void Main() { Students students = new Students(); students.Add(new Student() { Roll = 10, Name = "Raj" }); students.Add(new Student() { Roll = 20, Name = "Man" }); Student search = new Student() { Roll = 10, Name = "Raj" }; Console.WriteLine(students.Contains(search,new StudentCompareByRoll())); students.Remove(search); foreach (var t in students) { Console.WriteLine(t.Roll + " " + t.Name); } }
static bool SelectWeakStudent(Students x) { int counter = 0; foreach (var mark in x.Marks) { if (mark.Equals(2)) { counter++; } } if (counter == 2) { return true; } return false; }
static void Main() { Students std = new Students("Bojidar", "Boqnov", "Penchev", 544, "Mlasdost-5", "32131", "*****@*****.**", Specialties.Economy, University.Unwe, Faculty.Economy); Students std1 = new Students("Bojidar", "Boqnov", "Penchev", 1134, "Mlasdost-5", "32131", "*****@*****.**", Specialties.Economy, University.Unwe, Faculty.Economy); Students std3 = new Students("Bojidar", "Boqnov", "Penchev", 1034, "Mlasdost-5", "32131", "*****@*****.**", Specialties.Economy, University.Unwe, Faculty.Economy); // Console.WriteLine(std != std1); // Console.WriteLine(std); //Students std4 = (Students)std.Clone(); // Console.WriteLine(std4); Students[] arr = {std1,std,std3}; Array.Sort(arr); foreach (var item in arr) { Console.WriteLine(item); } }
static void Main() { // creating teachers // we need e set of discip Disciplines disc1 = new Disciplines("Math", 23, 140); Disciplines disc2 = new Disciplines("Biology", 23, 140); Disciplines disc3 = new Disciplines("OOP", 23, 140); IList<Disciplines> disciplines = new List<Disciplines>(); disciplines.Add(disc1); disciplines.Add(disc2); disciplines.Add(disc3); //disciplines can have comments disc1.Comment("I am free this week"); // and that is the teacher with his disciplines Teachers teacher1 = new Teachers("Petrow",disciplines); //he can make comments teacher1.Comment("Ivancho is bad"); //you can see his comment Console.WriteLine(teacher1.SayComment()); //we can make second teacher and than a set of teachers Teachers teacher2 = new Teachers("Stoqnow", disciplines); IList<Teachers> setOfTeachers = new List<Teachers>(); setOfTeachers.Add(teacher1); setOfTeachers.Add(teacher2); // to create a class we need and a set of students // first we create a few students Students student1 = new Students("Ivancho", 7); Students student2 = new Students("Mariika", 16); Students student3 = new Students("Qworcho",25); IList<Students> setOfStudents = new List<Students>(); setOfStudents.Add(student1); setOfStudents.Add(student2); setOfStudents.Add(student3); // now we can ctreate class Classes class1 = new Classes("10b", setOfStudents, setOfTeachers); // the classes can make comments class1.Comment("We are happy class"); // finaly we make a list of classes Classes class2 = new Classes("11v",setOfStudents,setOfTeachers); IList<Classes> setOfClasses = new List<Classes>(); setOfClasses.Add(class1); setOfClasses.Add(class2); //school School school1 = new School(setOfClasses); Console.WriteLine(school1.ToString()); }
public ActionResult StudentDetails() { Course programming = new Course(); programming.CourseId = 01; programming.CourseName = "Programming 101"; programming.TotalCredits = 70; Students alex = new Students(); alex.StudentId = 1; alex.Name = "Alex"; alex.Surname = "Xela"; alex.Gender = "Male"; alex.Age = 21; alex.Country = "Sweden"; Students xobile = new Students(); xobile.StudentId = 2; xobile.Name = "Xobile"; xobile.Surname = "Elibox"; xobile.Gender = "Male"; xobile.Age = 21; xobile.Country = "England"; Students samantha = new Students(); samantha.StudentId = 3; samantha.Name = "Samantha"; samantha.Surname = "Athnamas"; samantha.Gender = "Female"; samantha.Age = 21; samantha.Country = "Russia"; List<Students> studentInfo = new List<Students>(); studentInfo.Add(alex); studentInfo.Add(xobile); studentInfo.Add(samantha); Course_Student obj = new Course_Student(); obj.course = programming; obj.students = studentInfo; return View(obj); }
private void btnSave_Click(object sender, EventArgs e) { double idNumber = 0; try { idNumber = Convert.ToDouble(textBoxId.Text); } catch (Exception exc) { MessageBox.Show(exc.Message); } aStudent = new Students(textBoxFirstName.Text, textBoxLastName.Text, idNumber, textBoxAddress.Text); if (form1.StudentIndex == -1) { _data.AddStudent(aStudent); } else { _data.UpdateStudent(form1.StudentIndex, aStudent); } }
public void LoadStudent() { if (form1.StudentIndex != -1) { List<Students> _studentsList = _data.GetStudentList(); aStudent = _studentsList[form1.StudentIndex]; textBoxFirstName.Text = aStudent.FirstName; textBoxLastName.Text = aStudent.LastName; textBoxId.Text = Convert.ToString(aStudent.StudentID); textBoxAddress.Text = aStudent.Address; aStudent.StudentHasPapersList = _data.FindPapersForStudent(aStudent.StudentID); listBoxPapers.DataSource = aStudent.StudentHasPapersList; } else { textBoxFirstName.Clear(); textBoxLastName.Clear(); textBoxId.Clear(); textBoxAddress.Clear(); listBoxPapers.DataSource = null; } }
public StudForm(Students obj) { this.InitializeComponent(); Student = obj; ImageSelect(); LayoutRoot.DataContext = Student; // для биндинга #region Привязка события LostFocus для обновления контента this.snils_st.LostFocus += (s, e) => { SavData(Students.EditUpdate(Id, snils_st.Text, snils_st.Name)); }; this.PassportNum_st.LostFocus += (s, e) => { SavData(Students.EditUpdate(Id, PassportNum_st.Text, PassportNum_st.Name)); }; this.PassportVidan_st.LostFocus += (s, e) => { SavData(Students.EditUpdate(Id, PassportVidan_st.Text, PassportVidan_st.Name)); }; this.propiska_st.LostFocus += (s, e) => { SavData(Students.EditUpdate(Id, propiska_st.Text, propiska_st.Name)); }; this.faktAddr_st.LostFocus += (s, e) => { SavData(Students.EditUpdate(Id, faktAddr_st.Text, faktAddr_st.Name)); }; this.forma_st.LostFocus += (s, e) => { SavData(Students.EditUpdate(Id, forma_st.Text, forma_st.Name)); }; this.birth_st.LostFocus += (s, e) => { SavData(Students.EditUpdate(Id, birth_st.Text, birth_st.Name)); }; //this.oplata_st.LostFocus += (s, e) => { SavData(Students.EditUpdate(Id, oplata_st.Text, oplata_st.Name)); }; #endregion }
private void SearchStudent_Click(object sender, RoutedEventArgs e) { string searchTxt = studentCodeSearchTxt.Text; this.student = (from s in CourseData.db.Students where s.StudentCode.Equals(searchTxt) select s).FirstOrDefault(); if (student != null) { StudentCodeTxt.Text = this.student.StudentCode; StudentFirstNameTxt.Text = this.student.StudentFirstName; StudentLastNameTxt.Text = this.student.StudentLastName; StudentGroupTxt.Text = this.student.StudentGroup.GroupTitle; AddStudentBth.IsEnabled = true; } else { MessageBox.Show("Can't Find Student\nPlease Try Again", "Can't Find"); } }
public virtual void CalculateStatistics() { var allStudentsPoints = 0d; var campusPoints = 0d; var statePoints = 0d; var nationalPoints = 0d; var internationalPoints = 0d; var standardPoints = 0d; var honorPoints = 0d; var dualEnrolledPoints = 0d; foreach (var student in Students) { student.LetterGrade = GetLetterGrade(student.AverageGrade); student.GPA = GetGPA(student.LetterGrade, student.Type); Console.WriteLine("{0} ({1}:{2}) GPA: {3}.", student.Name, student.LetterGrade, student.AverageGrade, student.GPA); allStudentsPoints += student.AverageGrade; switch (student.Enrollment) { case EnrollmentType.Campus: campusPoints += student.AverageGrade; break; case EnrollmentType.State: statePoints += student.AverageGrade; break; case EnrollmentType.National: nationalPoints += student.AverageGrade; break; case EnrollmentType.International: internationalPoints += student.AverageGrade; break; } switch (student.Type) { case StudentType.Standard: standardPoints += student.AverageGrade; break; case StudentType.Honors: honorPoints += student.AverageGrade; break; case StudentType.DualEnrolled: dualEnrolledPoints += student.AverageGrade; break; } } // #todo refactor into it's own method with calculations performed here Console.WriteLine("Average Grade of all students is " + (allStudentsPoints / Students.Count)); if (campusPoints != 0) { Console.WriteLine("Average for only local students is " + (campusPoints / Students.Where(e => e.Enrollment == EnrollmentType.Campus).Count())); } if (statePoints != 0) { Console.WriteLine("Average for only state students (excluding local) is " + (statePoints / Students.Where(e => e.Enrollment == EnrollmentType.State).Count())); } if (nationalPoints != 0) { Console.WriteLine("Average for only national students (excluding state and local) is " + (nationalPoints / Students.Where(e => e.Enrollment == EnrollmentType.National).Count())); } if (internationalPoints != 0) { Console.WriteLine("Average for only international students is " + (internationalPoints / Students.Where(e => e.Enrollment == EnrollmentType.International).Count())); } if (standardPoints != 0) { Console.WriteLine("Average for students excluding honors and dual enrollment is " + (standardPoints / Students.Where(e => e.Type == StudentType.Standard).Count())); } if (honorPoints != 0) { Console.WriteLine("Average for only honors students is " + (honorPoints / Students.Where(e => e.Type == StudentType.Honors).Count())); } if (dualEnrolledPoints != 0) { Console.WriteLine("Average for only dual enrolled students is " + (dualEnrolledPoints / Students.Where(e => e.Type == StudentType.DualEnrolled).Count())); } }
public async Task <ViewResult> DatabaseOperations() { Students student = new Students(); student.StudentId = 1; student.StudentName = "Sutama"; dbContext.Add(student); student = new Students(); student.StudentId = 2; student.StudentName = "Shiva"; dbContext.Add(student); student = new Students(); student.StudentId = 3; student.StudentName = "Simon"; dbContext.Add(student); student = new Students(); student.StudentId = 4; student.StudentName = "Aurora"; dbContext.Add(student); Courses course = new Courses(); course.CourseId = 1; course.CourseName = "Distibuted Information System"; dbContext.Add(course); course = new Courses(); course.CourseId = 2; course.CourseName = "Database"; dbContext.Add(course); course = new Courses(); course.CourseId = 3; course.CourseName = "Distributed Management"; dbContext.Add(course); course = new Courses(); course.CourseId = 4; course.CourseName = "Advance System Analysis"; dbContext.Add(course); course = new Courses(); course.CourseId = 5; course.CourseName = "Data Mining"; dbContext.Add(course); course = new Courses(); course.CourseId = 6; course.CourseName = "Python Class"; dbContext.Add(course); StudentCourseEnrollment sce = new StudentCourseEnrollment(); sce.StudentId = 1; sce.CourseId = 1; dbContext.Add(sce); sce = new StudentCourseEnrollment(); sce.StudentId = 1; sce.CourseId = 2; dbContext.Add(sce); sce = new StudentCourseEnrollment(); sce.StudentId = 1; sce.CourseId = 3; dbContext.Add(sce); sce = new StudentCourseEnrollment(); sce.StudentId = 2; sce.CourseId = 3; dbContext.Add(sce); sce = new StudentCourseEnrollment(); sce.StudentId = 2; sce.CourseId = 4; dbContext.Add(sce); sce = new StudentCourseEnrollment(); sce.StudentId = 3; sce.CourseId = 4; dbContext.Add(sce); dbContext.SaveChanges(); return(View()); }
public void Insert(Students Students) { _StudentList.Add(Students); }
static void MyIterator() { #region student Students students = new Students(); Student st = new Student(); st.Name = "lili"; students.Add(st); st = new Student(); st.Name = "OK"; students.Add(st); foreach (Student obj in students) { Console.WriteLine(obj.Name); } #endregion #region teacher Teachers ts = new Teachers(); Teacher t1 = new Teacher(1001, "t1", 33); Teacher t2 = new Teacher(1002, "t2", 34); ts.Add(t1); ts.Add(t2); foreach (Teacher t in ts) { Console.WriteLine("{0}, {1}, {2};", t.Tid.ToString(), t.Name, t.Age.ToString()); } // other methods for the foreach { IEnumerator enumerator = ts.GetEnumerator(); Teacher t; while (enumerator.MoveNext()) { t = (Teacher)enumerator.Current; Console.WriteLine("{0}, {1}, {2};", t.Tid.ToString(), t.Name, t.Age.ToString()); } } #endregion #region doctor // using IEnumerable<T> interface Doctors ds = new Doctors(); Doctor d1 = new Doctor("lili", 28); Doctor d2 = new Doctor("wang", 30); ds.Add(d1); ds.Add(d2); foreach (Doctor d in ds) { Console.WriteLine("{0}, {1};", d.Name, d.Age.ToString()); } Console.WriteLine(); { IEnumerator enumerator = ds.GetEnumerator(); Doctor d; while (enumerator.MoveNext()) { d = (Doctor)enumerator.Current; Console.WriteLine("{0}, {1};", d.Name, d.Age.ToString()); } } Console.WriteLine(); { IEnumerator<Doctor> enumerator = ds.GetEnumerator(); Doctor d; while (enumerator.MoveNext()) { d = enumerator.Current; Console.WriteLine("{0}, {1};", d.Name, d.Age.ToString()); } } #endregion #region myStack MyStack<int> s = new MyStack<int>(); for (int i = 0; i < 10; i++) { s.Push(i); } // Prints: 9 8 7 6 5 4 3 2 1 0 // Foreach legal since s implements IEnumerable<int> foreach (int n in s) { System.Console.Write("{0} ", n); } System.Console.WriteLine(); // Prints: 9 8 7 6 5 4 3 2 1 0 // Foreach legal since s.TopToBottom returns IEnumerable<int> foreach (int n in s.TopToBottom) { System.Console.Write("{0} ", n); } System.Console.WriteLine(); // Prints: 0 1 2 3 4 5 6 7 8 9 // Foreach legal since s.BottomToTop returns IEnumerable<int> foreach (int n in s.BottomToTop) { System.Console.Write("{0} ", n); } System.Console.WriteLine(); // Prints: 9 8 7 6 5 4 3 // Foreach legal since s.TopN returns IEnumerable<int> foreach (int n in s.TopN(7)) { System.Console.Write("{0} ", n); } System.Console.WriteLine(); #endregion }
public void AddStudent(Student student) { Students.Add(student); }
protected Team63LMSContext AddStudentstoMultipleClasses() { Team63LMSContext db = mockDB(); AdministratorController controller = new AdministratorController(); controller.UseLMSContext(db); StudentController sController = new StudentController(); sController.UseLMSContext(db); // Create Professor to teach class Professors p = new Professors(); p.FName = "Danny"; p.LName = "Kopta"; p.UId = uIDGen(db); p.WorksIn = "CS"; db.Professors.Add(p); db.SaveChanges(); controller.CreateCourse("CS", 5530, "Database Systems"); controller.CreateCourse("CS", 4400, "Computer Systems"); controller.CreateCourse("CS", 3500, "Software Practice I"); controller.CreateClass("CS", 1, "Spring", 2019, new DateTime(2009, 05, 30, 7, 9, 16), new DateTime(2009, 05, 30, 9, 16, 25), "WEB 1250", "u0000000"); controller.CreateClass("CS", 4400, "Spring", 2019, new DateTime(2009, 05, 30, 7, 9, 16), new DateTime(2009, 05, 30, 9, 16, 25), "WEB 2000", "u0000000"); controller.CreateClass("CS", 3500, "Spring", 2019, new DateTime(2009, 05, 30, 7, 9, 16), new DateTime(2009, 05, 30, 9, 16, 25), "WEB 1999", "u0000000"); //Add student to class Students s = new Students(); s.UId = "u0000001"; s.FName = "Steen"; s.LName = "Sia"; s.Dob = new DateTime(2000, 07, 01); s.Major = "Electrical Engineering"; Students s2 = new Students(); s.UId = "u0000002"; s.FName = "Benjamin"; s.LName = "Button"; s.Dob = new DateTime(2000, 07, 01); s.Major = "Electrical Engineering"; Students s3 = new Students(); s.UId = "u0000003"; s.FName = "J"; s.LName = "Fish"; s.Dob = new DateTime(2000, 07, 01); s.Major = "Computer Science"; db.Students.Add(s); db.Students.Add(s2); db.Students.Add(s3); db.SaveChanges(); sController.Enroll("CS", 5530, "Spring", 2019, "u0000001"); sController.Enroll("CS", 5530, "Spring", 2019, "u0000002"); sController.Enroll("CS", 4400, "Spring", 2019, "u0000001"); sController.Enroll("CS", 4400, "Spring", 2019, "u0000002"); sController.Enroll("CS", 3500, "Spring", 2019, "u0000003"); sController.Enroll("CS", 3500, "Spring", 2019, "u0000001"); return(db); }
public static Students CreateStudents(int stuID, string stuName, string pswd) { Students students = new Students(); students.StuID = stuID; students.StuName = stuName; students.Pswd = pswd; return students; }
//Add student in group public void AddStudent(Students student) { student.group = indGroup; Students.Add(student); }
void before_each() { seed = new Seed(); students = new Students(); }
public void CreateNewStudent(string Name) { Students.Add(new Student(Students.Count, Name)); SaveStudents(); }
Students s2 = new Students(); //Instance variable - outside any method but inside the class static void Main9(string[] args) { Students s3 = new Students(); //Local variable - inside the method }
// { // Fields - usually set as private. Guard against invalid user input values. // Properties - Public asscess modifier, so users can manipulate the data. Properites answer to the Fields. For each field you create // properites. // Methods - info that you expose to your client. Can be static or non- static. Basic part of a program, take parameters and return values. // Constructors - // Syntax of Fields - Camell case (lower case), Ex: Private, datatype, fieldname(lowercase) // Syntax of Properties - have a get : set , Pasquall case Ex: Public, datatype, PropertyName(Uppercase) // get { return this.fieldname;} set { this.fieldname = value;} // get- takes the field and returns it to the property,is an accessor. Set- sets the value of te field to the property, is accessor. this - refers to the object // that is enstanciated, also is already implied. value - user input, based off the field varible. // Syntax of Methods - Pasqual Case, Can be static or Non static, Can return values, can have parameters. // Ex: Public, static/void/&or datatype, MethodName(pasquelCase) () {} // Can have parameters and arguments. // Syntax of Constructors - static void Main(string[] args) { Students StudentInfo = new Students(); StudentInfo.DisplayCompleteInfo(); }
public void studentaigenerate() { for (int i = 1; i <= 10000000; i++) { var student = new Student(); Random rnd = new Random(); var vardas = "Vardas" + i.ToString(); var pavarde = "Pavarde" + i.ToString(); var egz = rnd.Next(1, 11); student.Vardas = vardas; student.Pavarde = pavarde; student.Egz = egz; for (int j = 1; j <= 6; j++) { student.Nd.Add(rnd.Next(1, 11)); } Students.Add(student); } galutinis(); Stopwatch sw = new Stopwatch(); string strPath = Environment.GetFolderPath( System.Environment.SpecialFolder.DesktopDirectory); string pathString = System.IO.Path.Combine(strPath, "Studentai"); System.IO.Directory.CreateDirectory(pathString); for (int i = 1; i <= 5; i++) { using (System.IO.StreamWriter file = new System.IO.StreamWriter(pathString + @"\Studentai" + i.ToString() + ".txt")) { if (i == 1) { sw.Start(); file.WriteLine("{0, -20} {1, -20} {2, 20} {3,20} {4, 20} {5,20} {6, 20} {7,20} {8, 20}", "Vardas", "Pavarde", "ND1", "ND2", "ND3", "ND4", "ND5", "ND6", "Egz.\n"); for (int j = 0; j < 1000; j++) { file.WriteLine("{0, -20} {1, -20} {2, 20} {3,20} {4, 20} {5,20} {6, 20} {7,20} {8, 20}", Students[j].Vardas, Students[j].Pavarde, Students[j].Nd[0], Students[j].Nd[1], Students[j].Nd[2], Students[j].Nd[3], Students[j].Nd[4], Students[j].Nd[5], Students[j].Egz); } sw.Stop(); Console.WriteLine("Time Taken-->{0} ms", sw.ElapsedMilliseconds); } if (i == 2) { sw.Start(); file.WriteLine("{0, -20} {1, -20} {2, 20} {3,20} {4, 20} {5,20} {6, 20} {7,20} {8, 20}", "Vardas", "Pavarde", "ND1", "ND2", "ND3", "ND4", "ND5", "ND6", "Egz.\n"); for (int j = 0; j < 10000; j++) { file.WriteLine("{0, -20} {1, -20} {2, 20} {3,20} {4, 20} {5,20} {6, 20} {7,20} {8, 20}", Students[j].Vardas, Students[j].Pavarde, Students[j].Nd[0], Students[j].Nd[1], Students[j].Nd[2], Students[j].Nd[3], Students[j].Nd[4], Students[j].Nd[5], Students[j].Egz); } sw.Stop(); Console.WriteLine("Time Taken-->{0} ms", sw.ElapsedMilliseconds); } if (i == 3) { sw.Start(); file.WriteLine("{0, -20} {1, -20} {2, 20} {3,20} {4, 20} {5,20} {6, 20} {7,20} {8, 20}", "Vardas", "Pavarde", "ND1", "ND2", "ND3", "ND4", "ND5", "ND6", "Egz.\n"); for (int j = 0; j < 100000; j++) { file.WriteLine("{0, -20} {1, -20} {2, 20} {3,20} {4, 20} {5,20} {6, 20} {7,20} {8, 20}", Students[j].Vardas, Students[j].Pavarde, Students[j].Nd[0], Students[j].Nd[1], Students[j].Nd[2], Students[j].Nd[3], Students[j].Nd[4], Students[j].Nd[5], Students[j].Egz); } sw.Stop(); Console.WriteLine("Time Taken-->{0} ms", sw.ElapsedMilliseconds); } if (i == 4) { sw.Start(); file.WriteLine("{0, -20} {1, -20} {2, 20} {3,20} {4, 20} {5,20} {6, 20} {7,20} {8, 20}", "Vardas", "Pavarde", "ND1", "ND2", "ND3", "ND4", "ND5", "ND6", "Egz.\n"); for (int j = 0; j < 1000000; j++) { file.WriteLine("{0, -20} {1, -20} {2, 20} {3,20} {4, 20} {5,20} {6, 20} {7,20} {8, 20}", Students[j].Vardas, Students[j].Pavarde, Students[j].Nd[0], Students[j].Nd[1], Students[j].Nd[2], Students[j].Nd[3], Students[j].Nd[4], Students[j].Nd[5], Students[j].Egz); } sw.Stop(); Console.WriteLine("Time Taken-->{0} ms", sw.ElapsedMilliseconds); } if (i == 5) { sw.Start(); file.WriteLine("{0, -20} {1, -20} {2, 20} {3,20} {4, 20} {5,20} {6, 20} {7,20} {8, 20}", "Vardas", "Pavarde", "ND1", "ND2", "ND3", "ND4", "ND5", "ND6", "Egz.\n"); for (int j = 0; j < 10000000; j++) { file.WriteLine("{0, -20} {1, -20} {2, 20} {3,20} {4, 20} {5,20} {6, 20} {7,20} {8, 20}", Students[j].Vardas, Students[j].Pavarde, Students[j].Nd[0], Students[j].Nd[1], Students[j].Nd[2], Students[j].Nd[3], Students[j].Nd[4], Students[j].Nd[5], Students[j].Egz); } sw.Stop(); Console.WriteLine("Time Taken-->{0} ms", sw.ElapsedMilliseconds); } } } }
public void AddStudent(Students Name) { Students.Add(Name); }
public void UpdateLot() { Students s = new Students() { Age = 123433333, Name = "dsad", IsDeleted = false, CreationTime = DateTime.Now, CreatorUserId = 11 }; TestApplicationBiz Service = _iocManager.Resolve<TestApplicationBiz>(); Service.UpdateLot(222, "QQ"); }
private void UnLoadData() { Students.Clear(); _isLoaded = false; }
private void OnDelete() { Students.Remove(SelectedStudent); }
// GET: StudentPlan/Details/5 public ActionResult Details(Students student)//int id { return(View()); }
public int DeleteStudent(Students student) { throw new NotImplementedException(); }
private void SetStudentObj(Students selected) { txtDni.Text = selected.Dni; txtApellidos.Text = selected.LastName; }
static void Main(string[] args) { int N; Console.Write("Введите количество учеников: "); do { Int32.TryParse(Console.ReadLine(), out N); if (!(N > 10 && N < 100)) { Console.Write("Вы ввели не число или это число выходит за пределы. Введите число от 10 до 100: "); } } while (N < 10 || N > 100); Students[] student = new Students[N]; Console.WriteLine("Введите Фамилию, имя и оценки ученика в формате:\n<Фамилия> <Имя> <оценки>.\nНапример:\nИванов Петр 4 5 3"); for (int i = 0; i < N; i++) { Console.Write($"Ученик {i + 1}: "); string[] s = Console.ReadLine().Split(' '); student[i].SurName = s[0]; student[i].Name = s[1]; student[i].ratings = new int[3]; for (int j = 2; j <= 4; j++) { student[i].ratings[j - 2] = int.Parse(s[j]); } } int k = 0; foreach (var x in student) { student[k].rating = ((float)(student[k].ratings[0] + student[k].ratings[1] + student[k].ratings[2]) / 3); k++; } Students temp = new Students(); for (int i = 0; i < N; i++) { for (int j = i + 1; j < N; j++) { if (student[i].rating > student[j].rating) { temp = student[i]; student[i] = student[j]; student[j] = temp; } } } int a = 0; int h = 0; do { if (h == student.Length) { a = 3; } Console.WriteLine($"Студент {h + 1}: Фамилия: {student[h].SurName}, Имя: {student[h].Name}, средний бал: {student[h].rating}"); if (student[h].rating != student[h + 1].rating) { a++; } h++; } while (a < 3); Console.ReadKey(); }
public ActionResult ViewStudents(Students students) { students.Data = students.viewStudents(); return(View(students)); }
public async Task <int> AddAsync(Students studentInfo) { //await _context.Students.AddAsync(studentInfo); return(await _context.SaveChangesAsync()); }
public virtual void Update(Students student) { _studentRepository.Update(student); }
protected void Page_Load(object sender, EventArgs e) { Students st = new Students(); GridView1.DataSource = st.Studentpunishments(); GridView1.DataBind(); }
public virtual void Delete(Students s) { _studentRepository.Delete(s); }
public QueryTestContext(DbContextOptions <QueryTestContext> dbContextOptions) : base(dbContextOptions) { var t = Students.AsQueryable(); }
public void UpdateStudent(int index, Students student) { studentsList[index] = student; }
public void stundentai() { Boolean stop = false; while (stop != true) { var student = new Student(); Console.WriteLine("Iveskite studento varda, pavarde "); var ivedimas = Console.ReadLine(); var vardas = ivedimas.Split(" ")?[0]; var pavarde = ivedimas.Split(" ")?[1]; student.Vardas = vardas; student.Pavarde = pavarde; Console.WriteLine("Jei norite sugeneruoti atsitiktinius pazymius iveskite (Y/N)"); var generuoti = Console.ReadLine(); if (generuoti.ToUpper() == "Y") { Random rnd = new Random(); for (int i = 0; i < 3; i++) { student.Nd.Add(rnd.Next(1, 11)); } student.Egz = rnd.Next(1, 11); } else { Console.WriteLine("Jei zinote atliktu namu darbu skaiciu iveskite (Y/N)"); var nezinomi = Console.ReadLine(); if (nezinomi.ToUpper() == "Y") { Console.WriteLine("Iveskite atliktu namu darbu skaiciu"); var n = Console.ReadLine(); for (int i = 0; i < int.Parse(n); i++) { Console.WriteLine("Iveskite namu darbu rezultatus"); var nd = Console.ReadLine(); student.Nd.Add(double.Parse(nd)); } } if (nezinomi.ToUpper() == "N") { List <double> nzn = new List <double>(); Console.WriteLine("Iveskite namu darbu rezultatus baigus ivedima iveskite 'STOP'"); bool no = false; while (no != true) { var pazymiai = Console.ReadLine(); if (pazymiai.ToUpper() == "STOP") { no = true; } else { student.Nd.Add(double.Parse(pazymiai)); } } } Console.WriteLine("Iveskite egzamino rezultata "); var egz = Console.ReadLine(); student.Egz = int.Parse(egz); } Students.Add(student); Console.WriteLine("testi studentu ivedima? (Y/N)"); var tb = Console.ReadLine(); if (tb.ToUpper() == "Y") { } else { stop = true; } } galutinis(); }
public static string FindAuthenticatedStudent(string h, string j) { string x = Students.FindAuthenStudent(h, j); return x; }
public void Update() { Students s = new Students() { Id = new Guid("11111111-1111-1111-1111-111111111111"), Age = 123433333, Name = "dsad", IsDeleted = false, CreationTime = DateTime.Now, CreatorUserId = 11 }; TestApplicationBiz Service = _iocManager.Resolve<TestApplicationBiz>(); Service.Update(s); }
public static void Main(string[] args) { //方法一: 在不使用Lambda的情况,使用委托调用方法 Students students = new Students(AddStudents); students(1, "cat", "1212"); //方法二:使用delegate匿名方法 Students student = new Students(delegate(int id, string username, string password) { Console.WriteLine("---------student学生添加成功---------"); Console.WriteLine("id:" + id); Console.WriteLine("username:"******"password:"******"tom", "1212"); //方法三:使用Lambda方法 Students studentLambda = new Students((int id, string username, string password) => { Console.WriteLine("---------studentLambda学生添加成功---------"); Console.WriteLine("id:" + id); Console.WriteLine("username:"******"password:"******"tom", "1212"); //另外几种使用Lambda的发方式 //返回无参简写 Action action1 = () => Console.WriteLine("无返回,无参数1"); action1(); Action action2 = () => { Console.WriteLine("无返回,无参数2"); }; action2(); Action <DateTime> action3 = d => { Console.WriteLine("带参数:现在的时间为:" + d); }; action3(DateTime.Now); //带返回值 Func <DateTime> func = () => { return(DateTime.Now); }; DateTime dateTime = func(); Console.WriteLine("dateTime:" + dateTime); //带返回值简写 Func <DateTime> func2 = () => DateTime.Now; DateTime dateTime2 = func2(); Console.WriteLine("dateTime2:" + dateTime2); }
public void AddStudent(Student student) { if (string.IsNullOrEmpty(student.Name)) throw new ArgumentException("A Name is required to add a student to a gradebook."); Students.Add(student); }
protected void Page_Load(object sender, EventArgs e) { Students st = new Students(); DetailsView1.DataSource = st.GetData("walealkmrname , saltalkarba_code , waleaalkamraddres , waleaalkamrjob,waleaalkamr_phone"); DetailsView1.DataBind(); }
public void AddToStudents(Students students) { base.AddObject("Students", students); }
protected void Button1_Click(object sender, EventArgs e) { if (Request.Form["id"] == "" || Request.Form["pwd"] == "") { return; } if (Request.Form["fx"] == "1")//学生登录 { StudentsDalServer studentsDalServer = new StudentsDalServer(); Students students = new Students(); students.id = Request.Form["id"]; students.pwd = Request.Form["pwd"]; if (studentsDalServer.login(students))//是否允许登录 { // students.GetType() Session["account"] = students; Session["type"] = "student"; // string str= "detailStudent.aspx?id="+students.id;//传去学生学号 // Server.Transfer(str); Server.Transfer("detailStudent.aspx"); } else { Response.Write("<script>alert('用户名或密码错误!')</script>"); } } else if (Request.Form["fx"] == "2")//管理员登录 { BASE_USERDalServer bASE_USERDalServer = new BASE_USERDalServer(); BASE_USER bASE_USER = new BASE_USER(); bASE_USER.pwd = Request.Form["pwd"]; bASE_USER.name = Request.Form["id"]; if (bASE_USERDalServer.login(bASE_USER)) { Session["account"] = bASE_USER; Session["type"] = "baseUser"; string str = "BaseUser.aspx"; Server.Transfer(str); } else { Response.Write("<script>alert('用户名或密码错误!')</script>"); } } else { BASE_USERDalServer bASE_USERDalServer = new BASE_USERDalServer(); teachers = new Teachers(); teachers.pwd = Request.Form["pwd"]; teachers.account = Request.Form["id"]; teachers = bASE_USERDalServer.loginTeacher(teachers); if (teachers.id == null) { Response.Write("<script>alert('用户名或密码错误!')</script>"); } else { Session["account"] = teachers; Session["type"] = "teacher"; string str = "Teacher.aspx"; //Response.Redirect(str); Server.Transfer(str); } } }
protected void Page_Load(object sender, EventArgs e) { Students st = new Students(); GridView1.DataSource = st.MedicalHistory(); GridView1.DataBind(); }
public async Task <ActionResult> Student(Students model) { IdentityResult result = null; if (model != null && model.Termsofuse && !string.IsNullOrWhiteSpace(model.FirstName) && !string.IsNullOrWhiteSpace(model.LastName) && !string.IsNullOrWhiteSpace(model.Email) && !string.IsNullOrWhiteSpace(model.Bio)) { string password = Membership.GeneratePassword(12, 1); string userName = getUserName(model.Email); var user = new ApplicationUser() { UserName = userName, Email = model.Email }; result = await UserManager.CreateAsync(user, password); if (result.Succeeded) { try { CultureInfo ci = ResolveCulture(); model.Language = ci.DisplayName; model.Country = getCountry(ci); model.Birthday = model.OptionalBirthDay.HasValue ? model.OptionalBirthDay.Value : DateTime.MinValue; var auth = HttpContext.GetOwinContext().Authentication; auth.SignOut(DefaultAuthenticationTypes.ExternalCookie); auth.SignIn(new AuthenticationProperties() { IsPersistent = true }, await user.GenerateUserIdentityAsync(UserManager)); var userCreated = await UserManager.FindByEmailAsync(model.Email); userCreated.Roles.Add(new IdentityUserRole { RoleId = 4.ToString() }); await UserManager.UpdateAsync(userCreated); model.Street = model.BusinessName = model.City = model.Phone = model.CellProvider = model.HomeOrganizationID = model.Zip = "-"; model.IsProfilePublic = false; await studentRepository.UpsetProspectData(userCreated.Id, model); string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id); var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme); await notificationManager.SendUserRegisteredNotification(user.Email, callbackUrl, password, userName); string registrationMessage = string.Format(Resources.Resources.RegistrationMessage, userName + "--" + model.Email, "StudentNewForm"); await notificationManager.SendSytemNotification(registrationMessage, Resources.Resources.NewUser, this.Request.IsLocal); } catch (Exception ex) { string registrationMessage = " === " + DateTime.Now.ToLongDateString() + " === " + Environment.NewLine + ex.Message + userName + model.Email + "----->" + ex.Message + "=== " + Environment.NewLine; _logger.Error(registrationMessage); } return(RedirectToAction("SetupProperty", "Home", new { guided = true })); } } _logger.Error(model == null ? "Model is null" : $"{model.Termsofuse.ToString()} - {model.FirstName} - {model.LastName} - {model.Email} - UserManager Errors:" + getErrorText(result?.Errors)); model.Error = true; return(View("~/Views/Landings/Student.cshtml", model)); }
public static bool AddStudent(string x, string y, string z) { bool a = Students.AddStudentMdl(x, y, z); return a; }
public int AddStudent(Students student) { return(objStudentService.AddStudent(student)); }
public virtual Students Add(Students s) { return _studentRepository.Insert(s); }
public static bool DeleteStudent(string x) { bool a = Students.RemoveStudent(x); return a; }
public virtual void TransactionMethod(Students s) { _studentRepository.InsertAsync(s); _uowManger.Current.SaveChanges(); throw new Exception("dc"); }
public static bool UpdateStudentC(Student stu) { bool a = Students.UpgradeStudent(stu); return a; }