private void InitInformation(STUDENT student) { // Khởi tạo các giá trị ban đầu txtStudentId.Text = student.STUDENTID; txtFullName.Text = student.STUDENTNAME; txtAddress.Text = student.ADDRESSS; txtCMND.Text = student.CMND; txtDepartment.Text = student.DEPARTMENT; txtFolk.Text = student.FOLK; txtIssuedBy.Text = student.ISSUEDBY; txtNation.Text = student.NATION; txtPhoneNumber.Text = student.PHONENUMBER; txtReligion.Text = student.RELIGION; txtSchool.Text = student.STUDYAT; txtYear.Text = student.STUDENTYEAR.ToString(); txtEmail.Text = student.EMAIL; if (student.GENDER == 1) { cbbGender.SelectedItem = "Nam"; } else { cbbGender.SelectedItem = "Nữ"; } dob.Value = (DateTime)student.DOB; dateCMND.Value = (DateTime)student.DATECMND; if (student.PHOTO != "") { avatarBox.Image = new Bitmap(CommonUsing.ImagePath() + student.PHOTO); } lbImageName.Text = student.PHOTO; lbInformation.Text = ""; }
public List <EVENT> GetEventsForStudent(STUDENT student) { List <EVENT> events = null; try { DateTime todayStartTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0, 0, 0); DateTime todayEndTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 23, 59, 59); events = base.GetEntitiesBy(e => e.Date >= todayStartTime && e.Date <= todayEndTime && (e.Active == true || e.Active == null)); StudentLevelLogic studentLevelLogic = new StudentLevelLogic(); STUDENT_LEVEL studentLevel = studentLevelLogic.GetEntitiesBy(s => s.Student_Id == student.Person_Id).LastOrDefault(); if (studentLevel != null) { events = events.Where(e => e.Programme_Id == studentLevel.Programme_Id && e.Department_Id == studentLevel.Department_Id && e.Level_Id == studentLevel.Level_Id).ToList(); } } catch (Exception ex) { throw ex; } return(events); }
private void loadDgData() { List <RENT> lstRent = db.RENTs.Select(d => d).ToList(); int i = 0; foreach (RENT rt in lstRent) { i = dgRent.Rows.Add(); STUDENT st = db.STUDENTs.Where(s => s.STUDENTID == rt.RENTER).FirstOrDefault(); ROOM rm = db.ROOMs.Where(r => r.ROOMID == rt.ROOM).FirstOrDefault(); dgRent.Rows[i].Cells[0].Value = rt.ID; dgRent.Rows[i].Cells[1].Value = st.STUDENTNAME; dgRent.Rows[i].Cells[2].Value = rm.ROOMNAME; dgRent.Rows[i].Cells[3].Value = rt.THELEASE; dgRent.Rows[i].Cells[4].Value = rt.TOTALFEE.ToString(); dgRent.Rows[i].Cells[5].Value = rt.PAID.ToString(); dgRent.Rows[i].Cells[6].Value = ((DateTime)rt.CREATEDATE).ToString("dd/MM/yyyy"); dgRent.Rows[i].Cells[7].Value = ((DateTime)rt.STARTDATE).ToString("dd/MM/yyyy"); dgRent.Rows[i].Cells[8].Value = ((DateTime)rt.ENDDATE).ToString("dd/MM/yyyy"); if (rt.STATUSS == 1) { dgRent.Rows[i].Cells[9].Value = "Đã thanh toán"; } else if (rt.STATUSS == 0) { dgRent.Rows[i].Cells[9].Value = "Chưa thanh toán"; } else if (rt.STATUSS == 2) { dgRent.Rows[i].Cells[9].Value = "Đã hết hạn"; } } }
public IHttpActionResult PostSTUDENT(STUDENT sTUDENT) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.STUDENTs.Add(sTUDENT); try { db.SaveChanges(); } catch (DbUpdateException) { if (STUDENTExists(sTUDENT.STU_ID)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = sTUDENT.STU_ID }, sTUDENT)); }
private bool IsCorrectDevice(STUDENT student) { try { StudentLogic studentLogic = new StudentLogic(); string hostname = Dns.GetHostName(); string ip = Dns.GetHostByName(hostname).AddressList[0].ToString(); if (student.Ip_Address == null) { student.Ip_Address = ip; studentLogic.Modify(student); return(true); } else { if (student.Ip_Address == ip) { return(true); } else { return(false); } } } catch (Exception) { throw; } }
public FmStudentDetail(STUDENT std) { InitializeComponent(); this.student = std; InitInformation(std); }
public void UpdateTrainingScheduling(List <Student> students, Training training) { var dbTraining = _trainingRepo.Get(t => t.TRAINING_INTERNAL_ID == training.Training_Internal_Id); _studentTrainingRepo.Delete(ts => ts.TRAINING_ID == dbTraining.TRAINING_ID); if (students != null) { foreach (Student student in students) { STUDENT dbstudent = _studentRepo.Get(s => s.STUDENT_INTERNAL_ID == student.Student_Internal_Id); _studentTrainingRepo.Add(new STUDENT_TRAINING { STUDENT = dbstudent, TRAINING = dbTraining, AMOUNT = 100, PAYMENTTYPE = "mesecno", RELATIONSHIP = "something", TRAININGQUALITY = "something" }); } } _unitOfWork.Commit(); }
public ActionResult Update(STUDENT student, HttpPostedFileBase postedFile) { int Id = (Session["student"] as STUDENT).Id; STUDENT stu = ManageStudent.STUDENTs.SingleOrDefault(u => u.Id == Id && u.Status == false); if (stu != null) { if (SaveImage(postedFile)) { stu.Avatar = "images/" + postedFile.FileName; } stu.FirstName = student.FirstName; stu.LastName = student.LastName; stu.Birthday = student.Birthday; stu.Gender = student.Gender; stu.FatherName = student.FatherName; stu.MotherName = student.MotherName; stu.ResidentialAddress = student.ResidentialAddress; stu.PermanentAddress = student.PermanentAddress; stu.AdmissionFor = student.AdmissionFor; stu.Sports = student.Sports; ManageStudent.SaveChanges(); Session["student"] = stu; ViewBag.Status = "Update Successful"; SetTempData(); return(View("Profile", stu)); } ViewBag.Status = "Update failed"; SetTempData(); return(View("Profile", stu)); }
protected void Page_Load(object sender, EventArgs e) { //设置序列,程序起动时设置一次便可 OracleConfig.SequenceMapping = new List <PubModel.SequenceModel>() { new PubModel.SequenceModel() { ColumnName = "ID", TableName = "STUDENT", Value = "SEQ_D" } }; using (SqlSugarClient db = SugarDao.GetInstance())//开启数据库连接 { STUDENT s = new STUDENT() { NAME = "张" + new Random().Next(1, int.MaxValue) }; db.Insert(s); //插入一条记录 (有主键也好,没主键也好,有自增列也好都可以插进去) List <STUDENT> list = new List <STUDENT>() { new STUDENT() { NAME = "张" + new Random().Next(1, int.MaxValue) }, new STUDENT() { NAME = "张" + new Random().Next(1, int.MaxValue) } }; db.InsertRange(list); //批量插入 } }
private void frmStudent_Load(object sender, EventArgs e) { /*Load thông tin học sinh đăng nhập*/ var rs = TracNghiem.LayDanhSachHocSinh(); var r = rs.Where(s => s.id == temp.id).Select(s => s).SingleOrDefault(); lbstudentID.Text = r.id.ToString(); lbFullnameStudent.Text = r.studentFullname.ToString(); lbBirthdayStudent.Text = string.Format("{0}-{1}-{2}", r.studentBirthday.Value.Day, r.studentBirthday.Value.Month, r.studentBirthday.Value.Year); lbClassStudent.Text = r.studentClass.ToString(); lbEmailStudent.Text = r.studentEmail.ToString(); temp = r; /*load lịch thi cho học sinh này*/ var rs1 = TracNghiem.LayDanhSachKyThi().Where(s => Convert.ToInt32(s.gradeid) == Convert.ToInt32(temp.studentClass)).Select(s => s).ToList(); dgvCompetition.DataSource = rs1; //dgvCompetition.Columns["SUBTRACT"].Visible = false; //dgvCompetition.Columns["clidCompetition"].Visible = false; //load luyện thi var rs2 = TracNghiem.LayDanhSachMonHoc(); cbSubDemo.DataSource = rs2; cbSubDemo.DisplayMember = "name"; cbSubDemo.ValueMember = "id"; string idmh = cbSubDemo.SelectedValue.ToString(); var rs3 = TracNghiem.LayDanhSachDeThi().Where(s => s.subtractID == idmh).ToList(); cbDe.DataSource = rs3; cbDe.DisplayMember = "id"; cbDe.ValueMember = "id"; dgvShowDemo.DataSource = rs3; }
public void DeleteOfStudentsAsUsers(DataClasses1DataContext db, int studentID, int userID, int courseID, int assignmentIDThisUser) { ASSIGNMENT_PER_STUDENT assignmnetPerStudent = new ASSIGNMENT_PER_STUDENT(); STUDENT_PER_COURSE sTudentPerCourse = new STUDENT_PER_COURSE(); StudentPerAssignment studentPerAssignment = new StudentPerAssignment(); StudentPerCourse studentPerCourse = new StudentPerCourse(); STUDENT sTudent = new STUDENT(); Student student = new Student(); USERR user = new USERR(); if (studentID < 1) { DeleteUser(user, userID, db); } else if (studentID > 0 && courseID < 1 && assignmentIDThisUser < 1) { student.DeleteStudent(db, sTudent, studentID); DeleteUser(user, userID, db); } else if (studentID > 0 && courseID > 0 && assignmentIDThisUser < 1) { studentPerCourse.DeleteCourses(studentID, sTudentPerCourse, db); student.DeleteStudent(db, sTudent, studentID); DeleteUser(user, userID, db); } else if (studentID > 0 && courseID > 0 && assignmentIDThisUser > 0) { studentPerAssignment.DeleteAssignemnts(studentID, assignmnetPerStudent, db); studentPerCourse.DeleteCourses(studentID, sTudentPerCourse, db); student.DeleteStudent(db, sTudent, studentID); DeleteUser(user, userID, db); } Console.WriteLine("\n\tDeleted Succesfully!!!"); }
public ActionResult DangKy(USER u, string sex) { using (var db = new DBTuVanSinhVien()){ var x = from i in db.USERS where i.Email == u.Email select i.IDUser; if (x.Count() == 0) { if (sex == "Nam") { u.Sex = true; } else { u.Sex = false; } u.Permission = 1; db.USERS.Add(u); STUDENT st = new STUDENT(); st.IDUser = u.IDUser; db.STUDENTs.Add(st); db.SaveChanges(); ViewBag.message = "Đăng ký thành công"; } else { ViewBag.message = "Email đã được sử dụng"; return(View("DangKy", u)); } } return(View()); }
public frmStudent(STUDENT pass) { InitializeComponent(); temp = pass; dgvCompetition.SelectionChanged += DgvCompetition_SelectionChanged; cbSubDemo.SelectedIndexChanged += CbSubDemo_SelectedIndexChanged; }
private StudentModel UpdateStudentQuery(StudentModel studentModel) { PERSON person = DB.PERSONS.Where(p => p.personId.Equals(studentModel.personId)).SingleOrDefault(); if (person == null) { return(null); } person.personId = studentModel.personId; person.personFirstName = studentModel.personFirstName; person.personLastName = studentModel.personLastName; person.personBeforeTelephone = studentModel.personBeforeTelephone; person.personTelephone = studentModel.personTelephone; person.personBeforeCellphone = studentModel.personBeforeCellphone; person.personCellphone = studentModel.personCellphone; person.personCode = studentModel.personCode; STUDENT student = DB.STUDENTS.Where(s => s.studentId.Equals(studentModel.studentId)).SingleOrDefault(); if (person == null) { return(null); } student.studentId = studentModel.studentId; student.studentType = studentModel.studentType; student.studentYear = studentModel.studentYear; student.studentFacultyCode = studentModel.studentFacultyCode; DB.SaveChanges(); return(GetOneStudentById(student.studentId)); }
private StudentModel AddStudentQuery(StudentModel studentModel) { PERSON person = new PERSON { personId = studentModel.personId, personFirstName = studentModel.personFirstName, personLastName = studentModel.personLastName, personBeforeTelephone = studentModel.personBeforeTelephone, personTelephone = studentModel.personTelephone, personBeforeCellphone = studentModel.personBeforeCellphone, personCellphone = studentModel.personCellphone, personCode = studentModel.personCode }; STUDENT student = new STUDENT { studentId = studentModel.studentId, studentType = studentModel.studentType, studentYear = studentModel.studentYear, studentFacultyCode = studentModel.studentFacultyCode }; DB.PERSONS.Add(person); DB.STUDENTS.Add(student); DB.SaveChanges(); return(GetOneStudentById(student.studentId)); }
private void InitInformation(STUDENT student) { // Khởi tạo các giá trị ban đầu lbDOB.Text = ((DateTime)student.DOB).ToString("dd/MM/yyyy"); if (student.GENDER == 1) { lbGender.Text = "Nam"; } else { lbGender.Text = "Nữ"; } lbStudentId.Text = student.STUDENTID; lbStudentName.Text = student.STUDENTNAME.ToUpper(); lbAddress.Text = student.ADDRESSS; lbCMND.Text = student.CMND; lbDepartment.Text = student.DEPARTMENT; lbFolk.Text = student.FOLK; lbIssuedBy.Text = student.ISSUEDBY; lbNation.Text = student.NATION; lbPhoneNumber.Text = student.PHONENUMBER; lbReligion.Text = student.RELIGION; lbStudyAt.Text = student.STUDYAT; lbStudyYear.Text = student.STUDENTYEAR.ToString(); lbEmail.Text = student.EMAIL; lbDateCMND.Text = ((DateTime)student.DATECMND).ToString("dd/MM/yyyy"); if (student.PHOTO != "") { avatarBox.Image = new Bitmap(CommonUsing.ImagePath() + student.PHOTO); } }
public ActionResult ViewMyAttendance(AttendanceViewModel viewModel) { try { _student = _studentLogic.GetEntityBy(s => s.Matric_Number == User.Identity.Name); DateTime date = new DateTime(); if (!DateTime.TryParse(viewModel.Date, out date)) { date = DateTime.Now; } viewModel.AttendanceList = _attendanceLogic.GetAttendanceForStudent(_student, date); if (viewModel.AttendanceList == null || viewModel.AttendanceList.Count <= 0) { SetMessage("No attendance record found for today! ", Message.Category.Warning); return(View(viewModel)); } viewModel.AttendanceList = viewModel.AttendanceList.OrderBy(s => s.EVENT.Date).ThenBy(s => s.EVENT.Event_Type_Id).ToList(); } catch (Exception ex) { SetMessage("Error! " + ex.Message, Message.Category.Error); } return(View(viewModel)); }
private void loadCbbData() { try { List <STUDENT> lstStudent = db.STUDENTs.Where(st => st.STATUSS == 1).ToList(); STUDENT s = lstStudent.ElementAt(0); List <HOMEFLEET> lstHomeFleet = db.HOMEFLEETs.Select(d => d).ToList(); HOMEFLEET hf = lstHomeFleet.ElementAt(0); List <ROOM> lstRoom = db.ROOMs.Where(r => r.STATUSS == 1 && r.FORGENDER == s.GENDER && r.HOMEFLEET == hf.HFID).ToList(); cbbRoom.DataSource = lstRoom; cbbRoom.DisplayMember = "ROOMNAME"; cbbHomeFleet.DataSource = lstHomeFleet; cbbHomeFleet.DisplayMember = "HFNAME"; cbbStudent.DataSource = lstStudent; cbbStudent.DisplayMember = "STUDENTNAME"; } catch (Exception ex) { lbInformation.Text = "Đã xảy ra lỗi khi tải dữ liệu từ Database"; } }
public ActionResult ViewCurrentEvents() { _viewModel = new AttendanceViewModel(); ViewBag.AbsentType = _absentTypeLogic.GetEntitiesBy(a => a.Active); try { _student = _studentLogic.GetEntityBy(s => s.Matric_Number == User.Identity.Name); _viewModel.Events = _eventLogic.GetEventsForStudent(_student); if (_viewModel.Events == null || _viewModel.Events.Count <= 0) { SetMessage("No event found for today! ", Message.Category.Warning); return(View(_viewModel)); } _viewModel.Events.ForEach(e => { e.Status = _eventLogic.GetEventStatus(e); }); _viewModel.Events = _viewModel.Events.OrderBy(e => e.Event_Type_Id).ThenBy(e => e.Event_Start).ToList(); } catch (Exception ex) { SetMessage("Error! " + ex.Message, Message.Category.Error); } return(View(_viewModel)); }
private void bntInsert_Click(object sender, EventArgs e) { if (txtName.Text == string.Empty || txtAddress.Text == string.Empty || txtPhone.Text == string.Empty) { MessageBox.Show("Vui lòng nhập đầy đủ thông tin", "Thông báo"); } else { decimal?sex; if (radioNam.Checked) { sex = 1; } else { sex = 0; } STUDENT student = new STUDENT(); student.NAME = txtName.Text; student.ADDRESS = txtAddress.Text; student.PHONE = txtPhone.Text; student.SEX = sex; student.BIRTHDAY = dateTimeBirthday.Value; StudentController studentController = new StudentController(); bool isInsert = studentController.AddStudent(student, cmbYear.SelectedValue.ToString(), cmbClass.Text); if (isInsert) { MessageBox.Show("Nhập thành công", "Thông báo"); } else { MessageBox.Show("Nhập thất bại, vui lòng thử lại sau", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
public void DeleteStudent(DataClasses1DataContext db, STUDENT student, int studentID) { student = db.STUDENTs.Single(i => i.STUDENT_ID == studentID); student.STUDENT_ID = studentID; db.STUDENTs.DeleteOnSubmit(student); db.SubmitChanges(); }
private void btnDelete_Click(object sender, EventArgs e) { try { var option = MessageBox.Show(MessageDefine.ConfirmDeleteStudent, "Xác nhận xóa", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (option == DialogResult.Yes) { STUDENT student = new STUDENT(); string studentId = dgAllStudent.CurrentRow.Cells["ColStudentId"].Value.ToString(); student = db.STUDENTs.Where(d => d.STUDENTID.Equals(studentId)).FirstOrDefault(); if (student == null) { MessageBox.Show(MessageDefine.RecordRequestedNoExist); return; } db.STUDENTs.Remove(student); db.SaveChanges(); MessageBox.Show(MessageDefine.DeleteRecordSuccessful, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); dgAllStudent.Rows.Remove(dgAllStudent.CurrentRow); } } catch (Exception ex) { MessageBox.Show(MessageDefine.ExceptionMessage + ex.Message); } }
public ActionResult SignUp(STUDENT student, string ConfirmPassword) { STUDENT stu = ManageStudent.STUDENTs.SingleOrDefault(u => u.StudentID == student.StudentID && u.Status == false); if (stu.Email != student.Email) { ViewBag.Status = "Email is invalid !"; SetTempData(); return(View("Register")); } if (student.Password != ConfirmPassword) { ViewBag.Status = "Password Confirmation Failed !"; SetTempData(); return(View("Register")); } stu.Password = student.Password.ToMD5(); ManageStudent.SaveChanges(); Session["student"] = stu; if (stu.CourseId != null) { return(RedirectToAction("Index", "Index")); } return(RedirectToAction("Select", "Admission")); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new ADMINSTRATOR_SCREEN()); try { using (var con = new Context("Server=.;Database=STUDENT_INFORMATION_SYSTEM;Trusted_Connection=True;")) { //Eklemek // if (!con.Database.Exists()) { con.Database.Create(); } STUDENT sTUDENT = con.STUDENTS.Where(x => x.Id == 1).FirstOrDefault(); sTUDENT.NAME = "can"; sTUDENT.SURNAME = "Soner"; sTUDENT.PASSWORD = "******"; con.STUDENTS.Add(sTUDENT); con.SaveChanges(); } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }
public IHttpActionResult PutSTUDENT(string id, STUDENT sTUDENT) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != sTUDENT.STU_ID) { return(BadRequest()); } db.Entry(sTUDENT).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!STUDENTExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public FmEditStudent(STUDENT student) { InitializeComponent(); string[] gender = { "Nam", "Nữ" }; cbbGender.DataSource = gender; InitInformation(student); }
public ActionResult DeleteConfirmed(string id) { STUDENT sTUDENT = db.STUDENTS.Find(id); db.STUDENTS.Remove(sTUDENT); db.SaveChanges(); return(RedirectToAction("Index")); }
public frmThiThat(COMPETION p, STUDENT t) { InitializeComponent(); pemp = p; temp = t; timerTest.Tick += TimerTest_Tick; txtCurrentQuiz.TextChanged += TxtCurrentQuiz_TextChanged; }
public ActionResult DeleteConfirmed(string id) { STUDENT student = db.STUDENTS.Find(id); db.STUDENTS.Remove(student); db.SaveChanges(); TempData["notice"] = "Student Has Been Successfully deleted!"; return(RedirectToAction("Index")); }
public JsonResult MarkAttendance(long eventId, decimal latitude, decimal longitude) { JsonResponseModel result = new JsonResponseModel(); try { EVENT currentEvent = _eventLogic.GetEntityBy(e => e.Id == eventId); bool eventStatus = _eventLogic.GetEventStatus(currentEvent); if (eventStatus) { bool inLocation = _eventLogic.InLocation(currentEvent, latitude, longitude); if (inLocation) { _student = _studentLogic.GetEntityBy(s => s.Matric_Number == User.Identity.Name); if (IsCorrectDevice(_student)) { //check if attendance record exist ATTENDANCE attendance = _attendanceLogic.GetEntitiesBy(a => a.Event_Id == eventId && a.Student_Id == _student.Person_Id).LastOrDefault(); if (attendance == null) { _attendanceLogic.PopulateAttendanceForEvent(currentEvent); } _attendanceLogic.MarkAttendance(_student, currentEvent, AttendanceStatuses.Present); result.IsError = false; result.Message = "Attendance Marked"; } else { result.IsError = true; result.Message = "Kindly login with your own device to take this attendnace."; } } else { result.IsError = true; result.Message = "You are not currently at the venue of this event."; } } else { result.IsError = true; result.Message = "Event is not ongoing"; } } catch (Exception ex) { result.IsError = true; result.Message = ex.Message; } return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult Create(STUDENT student) { if (ModelState.IsValid) { db.STUDENTS.Add(student); db.SaveChanges(); TempData["notice"] = "Student Has Been Successfully Added"; return RedirectToAction("Index"); } ViewBag.AVAIL_COURSE_ID = new SelectList(db.AVAILABLE_COURSE, "AVAIL_COURSE_ID", "AVAIL_COURSE_ID", student.AVAIL_COURSE_ID); ViewBag.DETAILED_ETHINICITY_ID = new SelectList(db.DETAILED_ETHINICITY_TABLE, "DETAILED_ETHINICITY_ID", "DETAILED_ETHINICITY", student.DETAILED_ETHINICITY_ID); ViewBag.ETHINICITY_ID = new SelectList(db.ETHINICITY_TABLE, "ETHINICITY_ID", "ETHINICITY", student.ETHINICITY_ID); return View(student); }