/// <summary> /// 个人信息 /// </summary> /// <param name="stuid"></param> /// <returns></returns> //[HttpGet] public ActionResult info(Int64 stuid) { ViewBag.id = stuid; tb_student stu = stuBll.GetStudentInfo(stuid); return(View(stu)); }
public ActionResult ModifyPwd(Int64 stuId) { ViewBag.stuid = stuId; tb_student stu = stuBll.GetStudentInfo(stuId); return(View()); }
public void ModifyPwd(Int64 stuId, string pwd) { tb_student result = db.tb_student.FirstOrDefault(a => a.id == stuId); result.password = pwd; db.SubmitChanges(); }
public ActionResult DeleteConfirmed(string id) { tb_student tb_student = db.tb_student.Find(id); db.tb_student.Remove(tb_student); db.SaveChanges(); return(RedirectToAction("Index")); }
public tb_student GetStudentModel(int id) { tb_student result = null; using (SchoolContext context = new SchoolContext()) { result = context.tb_student.FirstOrDefault(x => x.Id == id); } return(result); }
public ActionResult Edit([Bind(Include = "no,card,name,grade,wechat,department,college,class,weapp")] tb_student tb_student) { if (ModelState.IsValid) { db.Entry(tb_student).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.no = new SelectList(db.tb_seat_student, "no", "no", tb_student.no); return(View(tb_student)); }
// GET: Admin/Stu/Details/5 public ActionResult Details(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } tb_student tb_student = db.tb_student.Find(id); if (tb_student == null) { return(HttpNotFound()); } return(View(tb_student)); }
// GET: Admin/Stu/Edit/5 public ActionResult Edit(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } tb_student tb_student = db.tb_student.Find(id); if (tb_student == null) { return(HttpNotFound()); } ViewBag.no = new SelectList(db.tb_seat_student, "no", "no", tb_student.no); return(View(tb_student)); }
public bool Update(string db, string id, tb_student newstu) { if (db == "student") { try { tb_student stu = DB.tb_student.FirstOrDefault(a => a.id == Convert.ToInt64(id)); } catch (Exception) { return(false); } } return(true); }
public void UpdateStuInfo(tb_student stu) { tb_student s = db.tb_student.FirstOrDefault(a => a.id == stu.id); s.id_card = stu.id_card; s.image = stu.image; s.name = stu.name; s.nplace = stu.nplace; s.othertwo = stu.othertwo; s.phone = stu.phone; s.sex = stu.sex; s.education = stu.education; s.stu_class = stu.stu_class; s.bid = stu.bid; s.bname = stu.bname; db.SubmitChanges(); }
public int InsertRegister(tb_student student, tb_Register reg) { int result = 0; using (SchoolContext context = new SchoolContext()) { if (student.Id > 0) { var dataStudent = context.tb_student.FirstOrDefault(x => x.Id == student.Id); dataStudent.Name = student.Name; dataStudent.Sex = student.Sex; dataStudent.Contact = student.Contact; dataStudent.Address = student.Address; dataStudent.Description = student.Description; } else { context.tb_student.Add(student); } if (reg.Id > 0) { var dataReg = context.tb_Register.FirstOrDefault(x => x.Id == reg.Id); dataReg.Money = reg.Money; dataReg.States = reg.States; dataReg.Year = reg.Year; dataReg.CourseId = reg.CourseId; dataReg.GradeId = reg.GradeId; } else { reg.Student = student; reg.Course = context.tb_course.FirstOrDefault(x => x.Id == reg.CourseId); reg.Grade = context.tb_grade.FirstOrDefault(x => x.Id == reg.GradeId); context.tb_Register.Add(reg); } result = context.SaveChanges(); } return(result); }
public List <tb_student> QueryStudentList(tb_student student) { var result = new List <tb_student>(); using (SchoolContext context = new SchoolContext()) { var data = context.tb_student.AsQueryable(); if (student != null && !string.IsNullOrWhiteSpace(student.Name)) { data = data.Where(x => x.Name.Contains(student.Name)); } if (student != null && student.Id > 0) { data = data.Where(x => x.Id == student.Id); } result = data.ToList(); } return(result); }
public int SaveStudent(tb_student student) { int result = 0; using (SchoolContext context = new SchoolContext()) { if (student.Id > 0) { var dataStudent = context.tb_student.FirstOrDefault(x => x.Id == student.Id); dataStudent.Name = student.Name; dataStudent.Sex = student.Sex; dataStudent.Contact = student.Contact; dataStudent.Address = student.Address; dataStudent.Description = student.Description; } else { context.tb_student.Add(student); } result = context.SaveChanges(); } return(result); }
private void btnOK_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(txtStudentName.Text)) { MessageBox.Show("请输入学生姓名!"); return; } if (string.IsNullOrWhiteSpace(txtMoney.Text)) { MessageBox.Show("请输入金额!"); return; } if (cbxYear.SelectedValue.ToInt() == 0) { MessageBox.Show("请选择入学年份!"); return; } if (cbxGrade.SelectedValue.ToInt() == 0) { MessageBox.Show("请选择入学年级!"); return; } if (cbxCourse.SelectedValue.ToInt() == 0) { MessageBox.Show("请选择入学班类!"); return; } if (cbxStates.SelectedValue.ToInt() == -1) { MessageBox.Show("请选择缴费状态!"); return; } try { tb_student student = new tb_student(); student.Id = _studentId; student.Address = txtAddress.Text.Trim(); student.Contact = txtPhone.Text.Trim(); student.Description = txtRemarks.Text.Trim(); student.Name = txtStudentName.Text.Trim(); student.Sex = radioButton1.Checked ? 1 : 0; tb_Register reg = new tb_Register(); reg.Id = _regId; reg.CourseId = cbxCourse.SelectedValue.ToInt(); reg.CreateAt = DateTime.Now; reg.GradeId = cbxGrade.SelectedValue.ToInt(); reg.Money = txtMoney.Text.ToToDecimal(); reg.States = cbxStates.SelectedValue.ToInt(); reg.Year = cbxYear.SelectedValue.ToInt(); if (service.InsertRegister(student, reg) > 0) { MessageBox.Show("成功"); DialogResult = DialogResult.OK; } else { MessageBox.Show("失败"); } } catch (Exception ex) { MessageBox.Show("失败"); } }
public void ModifyStuInfo(tb_student stu) { dal.UpdateStuInfo(stu); }
public ActionResult ModifyInfo(tb_student stu) { stuBll.ModifyStuInfo(stu); return(RedirectToAction("info", new { stuid = stu.id })); }
public ActionResult ModifyInfo(Int64 stuid) { tb_student stu = stuBll.GetStudentInfo(stuid); return(View(stu)); }
public ActionResult Index(string account, string password, string Role) { try { Int64 user = Convert.ToInt64(account); if (password == null || password == null || Role == null) { return(View()); } else { if (Role == "1") { tb_teacher tea = bll.Selfin(user); if (user == tea.id && password == tea.password) { object a = account; string jiami = md5slt.MD5Encoding(password, a); var data1 = getredis.GetDatabase(2); getredis.GetDatabase(1).StringSet(account, jiami, TimeSpan.FromMinutes(20)); getredis.GetDatabase(2).StringSet(account, Role, TimeSpan.FromMinutes(20)); Response.AddHeader("Set-Cookie", "ASPSESSION=" + jiami + "; HttpOnly"); Response.AddHeader("Set-Cookie", "username="******";HttpOnly"); Response.AddHeader("Set-Cookie", "name=" + tea.name); Response.Write("OK"); return(RedirectToRoute("Default", new { controller = "Home", action = "First" })); } else { return(View()); } } else { if (Role == "0") { tb_student stu = bll.StuSelf(user); if (user == stu.id && password == stu.password) { object a = account; string jiami = md5slt.MD5Encoding(password, a); var data1 = getredis.GetDatabase(2); getredis.GetDatabase(1).StringSet(account, jiami, TimeSpan.FromMinutes(20)); getredis.GetDatabase(2).StringSet(account, Role, TimeSpan.FromMinutes(20)); Response.AddHeader("Set-Cookie", "ASPSESSION=" + jiami + "; HttpOnly"); Response.AddHeader("Set-Cookie", "username="******";HttpOnly"); Response.AddHeader("Set-Cookie", "name=" + stu.name); Response.Write("OK"); return(RedirectToRoute("Default", new { controller = "StudentD", action = "Student", stuID = Convert.ToInt64(account), stuPwd = password })); } else { return(View()); } } return(View()); } } } catch { return(RedirectToRoute("Default", new { controller = "Home", action = "Index" })); } }
public tb_student StuSelf(Int64 id) { tb_student StuS = DB.tb_student.FirstOrDefault(a => a.id == id); return(StuS); }