{//оценка : ID предмет оценка статус номер сессии idстудента public static void GiveStudents() { Student.Add(new student(1, "Студентов", "Студент", "Студентович", 161)); MArks.Add(new marks(1, "ООП", 5, "Сдано", 1, 1)); MArks.Add(new marks(2, "Матан", 5, "Сдано", 1, 1)); MArks.Add(new marks(3, "Алгебра", 4, "Не сдано", 1, 1)); MArks.Add(new marks(4, "Матан", 4, "Сдано", 2, 1)); MArks.Add(new marks(5, "ООП", 4, "Сдано", 2, 1)); Student.Add(new student(2, "Фиитова", "Фиита", "Фиитовна", 161)); MArks.Add(new marks(6, "ООП", 5, "Сдано", 1, 2)); MArks.Add(new marks(7, "Алгебра", 4, "Сдано", 1, 2)); MArks.Add(new marks(8, "Матан", 5, "Сдано", 1, 2)); MArks.Add(new marks(9, "ООП", 5, "Сдано", 2, 2)); Student.Add(new student(3, "Рандомов", "Рандом", "Рандомович", 233)); MArks.Add(new marks(10, "ООП", 5, "Сдано", 3, 3)); MArks.Add(new marks(11, "Алгебра", 4, "Сдано", 3, 3)); MArks.Add(new marks(12, "Матан", 5, "Сдано", 3, 3)); MArks.Add(new marks(13, "ООП", 5, "Сдано", 4, 3)); Student.Add(new student(4, "Программистов", "Программист", "Программистович", 233)); MArks.Add(new marks(14, "ООП", 5, "Сдано", 3, 4)); MArks.Add(new marks(15, "Алгебра", 4, "Сдано", 3, 4)); MArks.Add(new marks(16, "Матан", 5, "Сдано", 3, 4)); MArks.Add(new marks(17, "ООП", 5, "Сдано", 4, 4)); DateTime d = new DateTime(2014, 11, 06); Redact.Add(new redact(1, 1, 3, d)); }
static void Main() { Resultt r1 = new Resultt(); Student s1 = new Student(); s1.Add(r1); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); List <SystemUser> objSystemUser = new List <SystemUser>(); List <Modules> objModele = new List <Modules>(); List <Role> oRole = new List <Role>(); List <RoleModule> oRoleModule = new List <RoleModule>(); ApplicationEntity.objSystemUser = objSystemUser; ApplicationEntity.objModele = objModele; ApplicationEntity.oRole = oRole; ApplicationEntity.oRoleModule = oRoleModule; Application.Run(new MainFrm()); //Application.Run(new Adminastrator()); }
/// <summary> /// Event triggered on clicking the add button /// </summary> private void addButton_Click(object sender, EventArgs e) { //std = new Student(); std = ReadDataIntoStudent(); std.Add(); ClearEntriesInForm(); }
static void Main(string[] args) { Console.WriteLine("AOP拦截"); Student student = (Student)ObjectContainer.GetSingletonObject("StudentProxy"); Teacher t = (Teacher)ObjectContainer.GetSingletonObject("TeacherProxy"); t.Say(); if (student != null) { student.Say(); Console.WriteLine("12=13={0}", student.Add(12, 13)); Console.WriteLine("25的平方={0}", student.Sqrt(25)); student.Spell("Hello"); } Console.WriteLine("\n\n\n"); Console.WriteLine("依赖注入"); student = (Student)ObjectContainer.GetSingletonObject("Student"); t = (Teacher)ObjectContainer.GetSingletonObject("Teacher"); t.Say(); if (student != null) { student.Say(); } //Console.WriteLine("\n\n\n"); //Console.WriteLine("数据访问,执行update emp set sal=sal*1"); //GreenData data = new GreenData(new OracleClientInit(), new ReadConfig()); //data.ExecuteNonQuery("update emp set sal=sal*1", null); //Console.WriteLine("数据访问成功"); Console.Read(); }
public void Add() { var student = new Student(); int a = 10; int b = 20; Assert.AreEqual(30, student.Add(a, b)); }
public ViewModel() { for (var i = 0; i < 10; i++) { Student.Add("Student " + i); Teacher.Add("Teacher " + i); } IsCopyWhenDrag = true; }
public void Add() { var person = new StudentViewModel(); person.PropertyChanged += Person_OnNotifyPropertyChanged; Student.Add(person); organization.Add(person); SelectedIndex = Student.IndexOf(person); }
public async Task OnPostGetAttendance(string date, int classid) { ThisDate = date; DateTime Date = Convert.ToDateTime(date); DateTime firstDay = Date.FirstDayOfWeek(); DateTime lastDay = Date.LastDayOfWeek(); Class = await _context.Class.Where(c => c.ClassID == classid).ToListAsync(); for (int i = 0; i < Class.Count; i++) { Course = await _context.Course.Where(c => c.CourseID == Class[i].CourseID).FirstOrDefaultAsync(); } Schedule = await _context.Schedule.ToListAsync(); ClassSchedule = await _context.ClassSchedule.Where(c => c.ClassID == classid).ToListAsync(); StudentClass = await _context.StudentClass .Where(c => c.ClassID == classid) .ToListAsync(); Student = await _context.Student.Where(u => u.StudentID == -1).ToListAsync(); for (int i = 0; i < StudentClass.Count; i++) { Student.Add(await _context.Student .Where(s => s.StudentID == StudentClass[i].StudentID).FirstOrDefaultAsync()); } //get all attendances in our date range Attendance = await _context.Attendance .Where(c => c.Date >= firstDay).Where(c => c.Date <= lastDay).Where(c => c.CourseName == Course.Name) .ToListAsync(); int count = 0; foreach (var attend in Attendance) { if (count == 0) { DayOne = attend.Date; } else if (attend.Date != DayOne) { DayTwo = attend.Date; } count++; } }
public async Task OnGetAsync(int classId) { this.classId = classId; Student = await _context.Student.Where(s => s.StudentID == -1).ToListAsync(); IList <StudentClass> studentClasses = await _context.StudentClass.Where(c => c.ClassID == classId).ToListAsync(); for (int i = 0; i < studentClasses.Count; i++) { Student.Add(await _context.Student .Where(c => c.StudentID == studentClasses[i].StudentID).FirstOrDefaultAsync()); } }
public async Task LoadData() { IsBusy = true; Student.Clear(); List <Students> list = await UniversityServiceApi.GetItems <Students>("api/Students"); foreach (Students item in list) { Student.Add(item); } IsBusy = false; }
private void btnSave_Click(object sender, RoutedEventArgs e) { string studentId = txtstuID1.Text + txtstuID2.Text + txtstuID3.Text; string conStuId = txtConID1.Text + txtConID2.Text + txtConID3.Text; //id must be 9 characters long if (studentId.Length == STUDENT_ID_MAX_LENGTH) { if (studentId.Equals(conStuId)) { long id = 0; if (long.TryParse(studentId, out id)) { if (Student.GetStudent(id) == null) { Student newStudent = new Student(id, username); if (student != null) { Student.Update(student, newStudent); student.Id = newStudent.Id; } else { student = newStudent; Student.Add(student); } DialogResult = true; } else { MessageBox.Show("Student id already exists. Please ask you Instructor if this is an issue."); } } else { MessageBox.Show("Student id must be a number."); } } else { MessageBox.Show("Student id must match the confirm Id."); } } else { MessageBox.Show("Student id must contain " + STUDENT_ID_MAX_LENGTH + " digits."); } }
public TestModule() { Get("/GetCurrentDirectory", a => AppContext.BaseDirectory); Get("/GetUserDataDb", a => { DirectoryInfo dir = new DirectoryInfo(AppContext.BaseDirectory).Parent?.Parent?.Parent; return(dir?.FullName); }); Get("/GetPasswordFromRabbitMq", a => "liza1999"); Get("/GetStudents", arg => Response.AsJson(Student.GetStudents())); Get("/GetGroups", arg => Response.AsJson(Group.GetGroups())); Get("/GetTeachers", a => Response.AsJson(Teacher.GetTeachers())); Get("/GetServerIp", a => { var host = Dns.GetHostEntry(Dns.GetHostName()); foreach (var ip in host.AddressList) { if (ip.AddressFamily == AddressFamily.InterNetwork) { return(ip.ToString()); } } return("Ip - wasnt found"); }); Post("/AddStudent/{StudentName}", a => { Student.Add(new Student(a.StudentName)); return($"Student {a.StudenName} was added to dataBase"); }); Post("/UploadFile/{FileExtension}/{GroupName}/{TeacherName}", async(parameters) => { DirectoryInfo dir = new DirectoryInfo(AppContext.BaseDirectory).Parent?.Parent?.Parent; Directory.CreateDirectory(dir.FullName + $"/{parameters.TeacherName}"); DirectoryInfo Info = Directory. CreateDirectory(dir.FullName + $"/{parameters.TeacherName}/{parameters.GroupName}"); var file = Request.Files.FirstOrDefault(); using (Stream output = File.OpenWrite (Info.FullName + $"/{parameters.GroupName}{parameters.FileExtension}")) using (Stream input = file.Value) { input.CopyTo(output); } return(HttpStatusCode.OK.ToString()); }); }
public ActionResult Update(Student view) { try { if (ModelState.IsValid == false) { return(Edit(view, true)); } view.CPF = view.CPF.Trim(); view.Email = view.Email.Trim(); view.Name = view.Name.Trim(); if (Equals(view.IdStudent, System.Guid.Empty)) { var insert = Student.Add(view); if (insert == false) { return(Edit(view, true)); } return(RedirectToAction("Index", "Student")); } var update = Student.Update(view); if (update == false) { return(Edit(view, true)); } return(RedirectToAction("Index", "Student")); } catch (Exception e) { string notes = LogHelper.Notes(view, e.Message); Log.Add(Log.TYPE_ERROR, "SistemaMatricula.Controllers.StudentController.Update", notes); ViewBag.Message = "Não foi possível realizar a solicitação. Erro de execução."; ViewBag.HideScreen = true; } return(View("Edit")); }
static void Main(string[] args) { Student st = new Student(); int s; s = Convert.ToInt32(Console.ReadLine()); switch (s) { case 1: st.Add(); break; case 2: st.del(); break; case 3: st.find(); break; case 4: st.findid(); break; case 5: st.familia_s(); break; case 6: st.familia_a(); break; case 7: st.Phoisk(); break; case 8: Environment.Exit(0); break; default: break; } }
/// <summary> /// Handles the form's submit action. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void SubmitButton_Click(object sender, EventArgs e) { if (!ValidateForm()) { return; } string firstName = firstNameTextBox.Text; string lastName = lastNameTextBox.Text; if (student == null) { if (Student.Add(firstName, lastName)) { MessageBox.Show(this, String.Format("Added {0}, {1}", firstName, lastName), "Student Added", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); ResetForm(); } else { MessageBox.Show(this, String.Format("Error adding student {0}, {1}", lastName, firstName), "Error Adding Student", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { if (student.Edit(firstName, lastName)) { MessageBox.Show(this, String.Format("Updated {0}, {1}", firstName, lastName), "Student Updated", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else { MessageBox.Show(this, String.Format("Error updating student {0}, {1}", lastName, firstName), "Error Updating Student", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
public ShellViewModel(ICalculations calculations) { _calculations = calculations; People.Add(new PersonModal { FirstName = "Faheem", LastName = "Ahmad" }); People.Add(new PersonModal { FirstName = "Salman", LastName = "Khan" }); People.Add(new PersonModal { FirstName = "Qasim", LastName = "Ali" }); Student.Add(new StudentModel { FullName = "Faheem Ahmad", IsAlive = true }); Student.Add(new StudentModel { FullName = "Ali Hasan", IsAlive = false });; Student.Add(new StudentModel { FullName = "Qasim Ali", IsAlive = false }); }
protected void dgStudent_ItemCommand(object sender, System.Web.UI.WebControls.DataGridCommandEventArgs e) { Student student = new Student(); if (e.CommandName == "AddStudent") { TextBox txtTempStudentID = (TextBox)e.Item.Cells[0].FindControl("txtStudentIDNew"); DropDownList txtTempYear = (DropDownList)e.Item.Cells[1].FindControl("ddlYearNew"); DropDownList txtTempIntake = (DropDownList)e.Item.Cells[2].FindControl("ddlIntakeNew"); DropDownList txtTempProgramme = (DropDownList)e.Item.Cells[3].FindControl("ddlProgrammeIDNew"); TextBox txtTempName = (TextBox)e.Item.Cells[4].FindControl("txtNameNew"); TextBox txtTempPhone = (TextBox)e.Item.Cells[5].FindControl("txtPhoneNew"); //Validation for name (No digit allowed and only up to 30 characters) Regex nameRegex = new Regex(@"[a-zA-Z ]{1,30}$"); Match checkName = nameRegex.Match(txtTempName.Text); //Validation for phone (Only 10-11 digit is allowed) Regex phoneRegex = new Regex(@"^(01)[0-9]*[0-9]{8,9}$"); Match checkPhone = phoneRegex.Match(txtTempPhone.Text); if (txtTempName.Text.Trim() == "") { ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script type='text/javascript'>swal('Error!', 'Please fill in the student name!', 'error')</script>'"); } else if (txtTempStudentID.Text.Trim() == "") { ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script type='text/javascript'>swal('Error!', 'Please fill in the student ID!', 'error')</script>'"); } else if (!checkName.Success) { ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script type='text/javascript'>swal('Error!', 'The Admin Name is not allowed. Admin name is only support character, space and up to 30 characters only.', 'error')</script>'"); } else if (!checkPhone.Success) { ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script type='text/javascript'>swal('Error!', 'The phone number is not allowed. Phone number must start with 01 and is only support 7 or 8 digits', 'error')</script>'"); } else { if (student.Add(txtTempStudentID.Text, txtTempYear.Text, txtTempIntake.Text, txtTempProgramme.Text, txtTempName.Text, txtTempPhone.Text) == false) { ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script type='text/javascript'>swal('Error!', 'Cannot have same duplicate student ID!', 'error')</script>'"); } else { ClientScript.RegisterStartupScript(this.GetType(), "Success", "<script type='text/javascript'>swal({title: 'Added!', text: 'This " + txtTempName.Text + " student is added successfully, your new password is (holdDoc)', type : 'success', confirmButtonText : 'OK'}, function (isConfirm) { if (isConfirm) { window.location.href = 'manageStudent.aspx'; }});</script>'"); } } } else if (e.CommandName == "DeleteStudent") { Label rowStudentID = (Label)e.Item.Cells[0].FindControl("lblStudentID"); if (student.DeleteStudent(rowStudentID.Text) == false) { ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script type='text/javascript'>swal('Error!', 'Delete this student record unsuccessfully', 'error')</script>'"); } else { ClientScript.RegisterStartupScript(this.GetType(), "Success", "<script type='text/javascript'>swal({title: 'Deleted!', text: 'Deleted this student record successfully', type : 'success', confirmButtonText : 'OK'}, function (isConfirm) { if (isConfirm) { window.location.href = 'manageStudent.aspx'; }});</script>'"); } } else if (e.CommandName == "ResetPassword") { Label rowStudentID = (Label)e.Item.Cells[0].FindControl("lblStudentID"); if (student.ResetPassword(rowStudentID.Text) == false) { ClientScript.RegisterStartupScript(this.GetType(), "Error", "<script type='text/javascript'>swal('Error!', 'Reset Password unsuccessfully', 'error')</script>'"); } else { ClientScript.RegisterStartupScript(this.GetType(), "Success", "<script type='text/javascript'>swal({title: 'Reset!', text: 'Reset Password successfully, your new password is (holdDoc)', type : 'success', confirmButtonText : 'OK'}, function (isConfirm) { if (isConfirm) { window.location.href = 'manageStudent.aspx'; }});</script>'"); } } }
private void Create_btn_Click(object sender, EventArgs e) { LibraryDBDataContext db = new LibraryDBDataContext(); if (Username_TB.Text == "" || Password_TB.Text == "" || Repass_TB.Text == "") { MessageBox.Show("Please Enter Username and Passwords"); } else if (User.LoadByUsername(Username_TB.Text) != null) { MessageBox.Show("UserName Exists!"); } else if (Password_TB.Text != Repass_TB.Text) { MessageBox.Show("Passwords aren't identical!"); } else if (FName_TB.Text == "" || SName_TB.Text == "") { MessageBox.Show("Please Enter Your Name!"); } else if (Phone_TB.Text == "") { MessageBox.Show("Please Enter Your Phone Number!"); } else if (Admin_CB.Checked && Admin_Panel.Visible && Salary_TB.Text == "") { MessageBox.Show("Please Enter Your Salary!"); } else if (Admin_CB.Checked && Admin_Panel.Visible && Shift_TB.Text == "") { MessageBox.Show("Please Enter Your Shift!"); } else { User u = new User(); u.Username = Username_TB.Text; u.Password = Password_TB.Text; u.FName = FName_TB.Text; u.SName = SName_TB.Text; u.Birthdate = Birthdate_Picker.Value.Date; u.Address = Address_TB.Text; u.Email = Email_TB.Text; u.PhoneNumber = Phone_TB.Text; u.NationalID = NationalID_TB.Text; if (Admin_CB.Checked) { if (Admin_Panel.Visible == true) { u.Rolename = RolesEnum.Admin; Admin a = new Admin(); a.CopyInto(ref u); a.Shift = int.Parse(Shift_TB.Text); a.Salary = double.Parse(Salary_TB.Text); a.HireDate = HireDate_DB.Value.Date; a.Add(); this.Close(); } else { MessageBox.Show("Please Enter The Code First"); } } else { Student s = new Student(); u.Rolename = RolesEnum.Student; s.CopyInto(u); s.University = University_TB.Text; s.University_ID = Uni_ID_TB.Text; if (GPA_TB.Text != "") { s.GPA = double.Parse(GPA_TB.Text); } s.Add(); this.Close(); } } }
private void Submit() { Student.JoiningDate = DateTime.Today.Date; Student.Add(Student); Student = new Student(); }