public XiugaiStudentManage(StudentExt stu) { InitializeComponent(); student = stu; txtAddress.Text = stu.StudentAddress; txtAge.Content = stu.Age.ToString(); txtCardNo.Text = stu.CardNo; txtName.Text = stu.StudentName; txtPhoneNumber.Text = stu.PhoneNumber; txtStuNoId.Text = stu.StudentidNo; if (stu.StudentSex == "男") { radboy.IsChecked = true; } else { radGirl.IsChecked = true; } datePkBirthday.Content = stu.Birthday.ToString(); if (string.IsNullOrEmpty(stu.StuImage)) { stuImg.Source = new BitmapImage(new Uri("/img/bg/zw.jpg", UriKind.RelativeOrAbsolute)); } else { image = SerializeObjectTostring.DeserializeObject(stu.StuImage) as common.BitmapImg; img.Buffer = image.Buffer; BitmapImage bitmap = new BitmapImage(); bitmap.BeginInit(); bitmap.StreamSource = new MemoryStream(image.Buffer); bitmap.EndInit(); stuImg.Source = bitmap; } List <StudentClass> classes = csm.GetClasses(); cmbClassName.ItemsSource = classes; cmbClassName.DisplayMemberPath = "ClassName"; cmbClassName.SelectedValuePath = "ClassID"; cmbClassName.SelectedIndex = 0; }
public ActionResult Create(int schoolYear) { try { dbTIREntities db = new dbTIREntities(); StudentExt studentExt = new StudentExt(); ModelServices modelService = new ModelServices(); studentExt.SchoolYear = schoolYear; PopulateViewData(studentExt); studentExt.SchoolYearDesc = HelperService.SchoolYearDescription(db); studentExt.SchoolYearId = modelService.SchoolYearId(); return(View(studentExt)); } catch (Exception ex) { Logging log = new Logging(); log.LogException(ex); return(View("GeneralError")); } }
private void FormStudentInfo_Load(object sender, EventArgs e) { tabcMain.SelectedTabPageIndex = 0; Student = new StudentDAO().GetModel(Student.StudentID); Sum = new StudentSummaryDao().GetModel(Student.StudentID); Ext = new StudentExtDao().GetModel(Student.StudentID); BindLoadStudent(); if (Ext != null) { BindLoadExt(); } if (Sum != null) { BindLoadExam(); BindLoadSummary(); BindLoadOther(); BindLoadInterval(); } Init(); }
/// <summary> /// 修改信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void gai_Click(object sender, RoutedEventArgs e) { selectStu = smDgStudentLsit.SelectedItem as StudentExt; if (IdList.Contains(selectStu.Studentid)) { MessageBox.Show("请关闭正在查看的学员信息界面", "提示"); return; } if (selectStu == null) { MessageBox.Show("请选择要修改的学员!", "提示"); return; } StudentExt objStu = sm.GetStudentById(selectStu.Studentid); FrmUpdateStuInfor updateStuInfor = new FrmUpdateStuInfor(objStu); updateStuInfor.ShowDialog(); students = sm.GetStudents(Convert.ToInt32(smclassCmb.SelectedValue)); smDgStudentLsit.ItemsSource = students; }
//修改学员对象 private void btnEidt_Click(object sender, EventArgs e) { //判断是否有修改的信息 if (this.dgvStudentList.RowCount == 0 || this.dgvStudentList.CurrentRow == null) { MessageBox.Show("没有要修改的信息", "修改提示"); return; } //获取要修改的学员学号 string studentId = this.dgvStudentList.CurrentRow.Cells["StudentId"].Value.ToString(); StudentExt objStudent = objStudentSerive.GetStudentByStuId(studentId); //显示修改窗体 FrmEditStudent objEditForm = new FrmEditStudent(objStudent); DialogResult result = objEditForm.ShowDialog(); //判断是否修改成功 if (result == DialogResult.OK) { btnQuery_Click(null, null); } }
public FrmEditStudent(StudentExt objStudent) : this() { //显示学员信息 this.txtStudentId.Text = objStudent.StudentId.ToString(); this.txtStudentName.Text = objStudent.StudentName; this.txtStudentIdNo.Text = objStudent.StudentIdNo; this.txtPhoneNumber.Text = objStudent.PhoneNumber; this.dtpBirthday.Text = objStudent.Birthday.ToShortDateString(); this.txtAddress.Text = objStudent.StudentAddress; if (objStudent.Gender == "男") { this.rdoMale.Checked = true; } else { this.rdoFemale.Checked = true; } this.cboClassName.Text = objStudent.ClassName; this.txtCardNo.Text = objStudent.CardNo; }
//修改学员对象 private void btnEidt_Click(object sender, EventArgs e) { if (dgvStudentList.RowCount == 0 || dgvStudentList.CurrentRow == null) { MessageBox.Show("没有要修改的学员信息!", "打印提示:"); return; } //修改学员信息 string stuid = dgvStudentList.CurrentRow.Cells["StudentId"].Value.ToString(); StudentExt objStudentExt = objStudnetService.GetStudentByStuID(stuid); objStudentExt.StudentId = Convert.ToInt32(stuid); //显示修改窗体 FrmEditStudent frmEditStudent = new FrmEditStudent(objStudentExt); DialogResult result = frmEditStudent.ShowDialog(); if (result == DialogResult.Cancel) { btnQuery_Click(null, null); } }
//修改学员对象 private void btnEidt_Click(object sender, EventArgs e) { if (this.dgvStudentList.RowCount == 0) { MessageBox.Show("没有任何需要修改的学员信息!", "提示"); return; } if (this.dgvStudentList.CurrentRow == null) { MessageBox.Show("请选中需要修改的学员信息!", "提示"); return; } //获取学号 string studentId = this.dgvStudentList.CurrentRow.Cells["StudentId"].Value.ToString(); StudentExt objStudent = objStuService.GetStudentById(studentId); //根据学号获取学员对象 //显示修改学员信息窗口 FrmEditStudent objEditStudent = new FrmEditStudent(objStudent); objEditStudent.ShowDialog(); btnQuery_Click(null, null); //同步刷新显示 }
/// <summary> /// 根据学号精确查找学员 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnQueryById_Click(object sender, EventArgs e) { if (this.txtStudentId.Text.Trim().Length == 0) { MessageBox.Show("请输入您要查询的学号!", "提示信息"); return; } var studentId = Convert.ToInt32(this.txtStudentId.Text.Trim()); StudentExt result = studentService.QueryStudentByStudengtId(studentId); if (result == null) { MessageBox.Show($"没有学号为{studentId}的学生,请输入正确的学号!", "提示信息"); return; } else { FrmStudentInfo frmStudentInfo = new FrmStudentInfo(result); frmStudentInfo.Show(); } }
public ActionResult Edit(int studentId, int schoolYear) { try { dbTIREntities db = new dbTIREntities(); SiteUser siteUser = ((SiteUser)Session["SiteUser"]); StudentService studentService = new StudentService(siteUser, db); ModelServices modelService = new ModelServices(); StudentExt studentExt = studentService.GetStudentDetail(studentId, schoolYear); PopulateViewData(studentExt); ViewBag.AllowEdit = HelperService.AllowUiEdits(siteUser.RoleDesc, "STUDENT"); return(View(studentExt)); } catch (Exception ex) { Logging log = new Logging(); log.LogException(ex); return(View("GeneralError")); } }
//修改学生信息 private void xgxs_Click(object sender, RoutedEventArgs e) { selectStu = smDgStudentLsit.SelectedItem as StudentExt; //检测当前选择的学员,查看详细信息的界面还未关闭 if (IDlist.Contains(selectStu.Sid)) { MessageBox.Show("请关闭正在查看的学员信息界面", "提示"); return; } if (selectStu == null) { MessageBox.Show("请选择要修改的学生!", "提示"); return; } StudentExt objStu = sm.GetStudentById(selectStu.Sid); UpdateStuInfor updateStuInfor = new UpdateStuInfor(objStu); updateStuInfor.ShowDialog(); //刷新DG中这个学员的信息 students = sm.GetStudents(Convert.ToInt32(smclassCmb.SelectedValue)); smDgStudentLsit.ItemsSource = students; }
/// <summary> /// 修改学生信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void XiuGai_Click(object sender, RoutedEventArgs e) { StudentExt selectStu = smDgStudentLsit.SelectedItem as StudentExt; //检测当前选择的学员,查看详细信息的界面还未关闭 if (IdList.Contains(selectStu.StudentID)) { MessageBox.Show("请关闭正在查看的学员信息界面", "提示"); return; } if (selectStu == null) { MessageBox.Show("请选择要修改的学员!", "提示"); return; } StudentExt objStu = sm.GetStudentById(selectStu.StudentID); FrmUpdateStuInfor updateStuInfor = new FrmUpdateStuInfor(objStu); updateStuInfor.ShowDialog();//打开修改界面 //刷新DG中这个学员的信息 RefreshDG(); }
//¸ù¾ÝѧºÅ²éѯ private void btnQueryById_Click(object sender, EventArgs e) { if (this.txtStudentId.Text.Trim().Length == 0) { MessageBox.Show("please input student ID!", "information"); this.txtStudentId.Focus(); return; } //进一步验证,用正则表达式验证学号必须是数字 StudentExt objStudent = objStuService.GetStudentById(this.txtStudentId.Text.Trim()); if (objStudent == null) { MessageBox.Show("No Student!", "Information"); this.txtStudentId.Focus(); } else { //在学员详细信息显示 (new FrmStudentInfo(objStudent)).Show(); } }
public FrmEditStudent(StudentExt student) : this() { this.txtStudentId.Text = student.StudentId.ToString(); this.txtStudentName.Text = student.StudentName; this.cboClassName.SelectedValue = student.ClassId; this.dtpBirthday.Text = student.Birthday.ToShortDateString(); this.txtStudentIdNo.Text = student.StudentIdNo; this.txtCardNo.Text = student.CardNo; this.txtPhoneNumber.Text = student.PhoneNumber; this.txtAddress.Text = student.StudentAddress; if (student.Gender == "男") { this.rdoMale.Checked = true; this.rdoFemale.Checked = false; } else { this.rdoMale.Checked = false; this.rdoFemale.Checked = true; } }
public FrmEditStudent(StudentExt studentExt) : this() { this.txtStudentId.Text = studentExt.StudentId.ToString(); this.txtStudentName.Text = studentExt.StudentName; this.rdoMale.Checked = studentExt.Gender == "男"; this.cboClassName.Text = studentExt.ClassName; this.dtpBirthday.Text = studentExt.Birthday.ToShortDateString(); this.txtStudentIdNo.Text = studentExt.StudentIdNo; this.txtCardNo.Text = studentExt.CardNo; this.txtPhoneNumber.Text = studentExt.PhoneNumber; this.txtAddress.Text = studentExt.StudentAddress; this.pbStu.Image = studentExt.StuImage.Length == 0 ? Image.FromFile("default.png") : (Image)SerializeObjectToString.DeserializeObject(studentExt.StuImage); if (studentExt.Gender == "男") { this.rdoMale.Checked = true; } else { this.rdoFemale.Checked = true; } }
public List <StudentExt> GetStudentExt() { string sql = "select Students.StudentId, StudentName, ClassName, CSharp, SQLServer from Students"; sql += " inner join StudentClass on Students.ClassId = StudentClass.ClassId"; sql += " inner join ScoreList on Students.StudentId = ScoreList.StudentId"; // 执行查询并封装对象 SqlDataReader objReader = SQLHelper.GetReader(sql); List <StudentExt> extList = new List <StudentExt>(); while (objReader.Read()) { StudentExt ext = new StudentExt(); ext.ObjStudent = new Student() { StudentId = Convert.ToInt32(objReader["StudentId"]), StudentName = objReader["StudentName"].ToString() }; ext.ObjClass = new StudentClass() { ClassName = objReader["ClassName"].ToString() }; ext.ObjScore = new StudentScore() { CSharp = Convert.ToInt32(objReader["CSharp"]), SQLServe = Convert.ToInt32(objReader["SQLServe"]) }; extList.Add(ext); } objReader.Close(); return(extList); }
/// <summary> /// 删除学生 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Button_Click(object sender, RoutedEventArgs e) { selectStu = smDgStudentLsit.SelectedItem as StudentExt; //测试是否为空 if (IdList.Contains(selectStu.StudentId)) //检查该学号学生是否在集合中 { MessageBox.Show("请先关闭学员信息查看界面", "提示"); return; } if (selectStu == null) { MessageBox.Show("请选择要删除的学员", "提示"); return; } StudentExt student = sm.GetStudentById(selectStu.StudentId);//获取该学号学员信息 if (student != null) { MessageBox.Show("该学员已被删除", "提示"); return; } //删除 //弹框处理 MessageBoxResult mbr = MessageBox.Show("您确定要删除【" + student.StudentName + "】学员信息?", "警告", MessageBoxButton.OKCancel, MessageBoxImage.Warning); if (mbr == MessageBoxResult.OK) { if (sm.DeleteStudentBid(student.StudentId)) { MessageBox.Show("删除成功!"); } else { MessageBox.Show("删除失败!请稍后重试!"); } } }
protected void btnEditStudent_Click(object sender, EventArgs e) { int stuId = Convert.ToInt32(Request.QueryString["StudentId"]); String StuIdNo = txtStuIdNo.Text.ToString(); if (StudentServices.isExistedStudent(StuIdNo, stuId)) { ltaMsg.Text = "<script type='text/javascript'>alert('该身份证已存在!');</script>"; return; } else { StudentExt stu = new StudentExt() { StudentId = stuId, StudentName = txtStuName.Text.ToString(), Gender = ddlGender.Text.ToString(), StudentIdNo = txtStuIdNo.Text.ToString(), StudentAddress = txtStuAddress.Text.ToString(), Birthday = Convert.ToDateTime(txtStuBirthday.Text), PhoneNumber = txtPhoneNumber.Text.ToString(), ClassId = Convert.ToInt32(ddlClass.SelectedValue) }; int result = new StudentServices().updateStudent(stu); if (result > 0) { Response.Redirect("~/Student/UpLoadImage.aspx?update=1&id=" + stuId); } else { ltaMsg.Text = "<script type='text/javascript'>alert('更新失败')</script>"; return; } } }
/// <summary> /// 根据专业获取学生列表 /// </summary> /// <param name="classId"></param> /// <returns></returns> public List <StudentExt> getStudentExtByClassId(int classId) { string sql = "select a.img, a.birthday, a.studentName, a.studentId, a.sex, b.className "; sql += "from student a left join studentClass b on a.classId = b.id "; sql += "where b.id = '" + classId + "'"; MySqlDataReader reader = SQLHelper.getReader(sql); List <StudentExt> studentList = new List <StudentExt>(); while (reader.Read()) { StudentExt studentExt = new StudentExt() { img = reader["img"].ToString(), birthday = Convert.ToDateTime(reader["birthday"]), sex = reader["sex"].ToString(), studentId = Convert.ToInt32(reader["studentId"]), studentName = reader["studentName"].ToString(), className = reader["className"].ToString() }; studentList.Add(studentExt); } return(studentList); }
private void btnQueryById_Click(object sender, EventArgs e) { if (this.txtStudentId.Text.Trim().Length == 0) { MessageBox.Show("StudentId can't be empty !"); this.txtStudentId.Focus(); return; } StudentExt objStudent = objStudentService.GetStudentByStudentNo(this.txtStudentId.Text.Trim()); if (objStudent == null) { MessageBox.Show("Can't find the student !"); this.txtStudentId.Focus(); this.txtStudentId.SelectAll(); return; } else { //Create Studentinf form FrmStudentInfo objFrmStudentInfo = new FrmStudentInfo(objStudent); objFrmStudentInfo.Show(); } }
/// <summary> /// 查询学员信息 /// </summary> /// <param name="whereSql"></param> /// <returns></returns> private StudentExt QueryStudent(string whereSql) { string sql = "select StudentId, StudentName, Gender, Birthday, StudentIdNo, CardNo, StuImage, PhoneNumber, StudentAddress, Students.ClassId,ClassName"; sql += " from Students inner join StudentClass on Students.ClassId=StudentClass.ClassId"; sql += whereSql; StudentExt studentInfo = null; try { SqlDataReader reader = SQLHelper.GetReader(sql); if (reader.Read()) { studentInfo = new StudentExt { StudentId = Convert.ToInt32(reader["StudentId"]), StudentName = reader["StudentName"].ToString(), Gender = reader["Gender"].ToString(), Birthday = Convert.ToDateTime(reader["Birthday"]), StudentIdNo = reader["StudentIdNo"].ToString(), PhoneNumber = reader["PhoneNumber"].ToString(), CardNo = reader["CardNo"].ToString(), StuImage = reader["StuImage"] == null ? "" : reader["StuImage"].ToString(), StudentAddress = reader["StudentAddress"].ToString(), ClassId = Convert.ToInt32(reader["ClassId"]), ClassName = reader["ClassName"].ToString(), }; } reader.Close(); return(studentInfo); } catch (Exception ex) { throw new Exception("获取学生信息时数据库访问异常" + ex.Message); } }
//实现打印及打印预览 private void BtnPrint_Click(object sender, RoutedEventArgs e) { selectStu = smDgStudentLsit.SelectedItem as StudentExt; if (selectStu == null) { MessageBox.Show("请选择您要打印的学员", "提示"); return; } common.Bitmapimg image = null; if (string.IsNullOrEmpty(selectStu.SImage)) { selectStu.ImgPath = "/img/bg/zwzp.jpg"; } else { image = SerializeObjectTostring.DeserializeObject(selectStu.SImage) as common.Bitmapimg; BitmapImage bitmap = new BitmapImage(); bitmap.BeginInit(); bitmap.StreamSource = new MemoryStream(image.Buffer); bitmap.EndInit(); BitmapEncoder encoder = new PngBitmapEncoder(); encoder.Frames.Add(BitmapFrame.Create(bitmap)); long sc = DateTime.Now.Ticks; using (MemoryStream stream = new MemoryStream()) { encoder.Save(stream); byte[] buffer = stream.ToArray(); File.WriteAllBytes(AppDomain.CurrentDomain.BaseDirectory + "/printImg/" + sc + ".png", buffer); stream.Close(); } selectStu.ImgPath = AppDomain.CurrentDomain.BaseDirectory + "/printImg/" + sc + ".png"; } View.PrintWindow frmPrint = new PrintWindow("PrintModel.xaml", selectStu); frmPrint.ShowInTaskbar = false; frmPrint.ShowDialog(); }
//根据学号查询 private void btnQueryById_Click(object sender, EventArgs e) { if (this.txtStudentId.Text.Trim().Length == 0) { MessageBox.Show("请输入要查询的学号", "查询提示"); this.txtStudentId.Focus(); return; } //根据学号查询学员对象 StudentExt objStudent = objStudentSerive.GetStudentByStuId(this.txtStudentId.Text.Trim()); if (objStudent == null) { MessageBox.Show("您输入的学号不正确,未找到该学员信息", "查询提示"); this.txtStudentId.Focus(); this.txtStudentId.SelectAll(); } else { //创建学员信息显示窗体 FrmStudentInfo objStudentForm = new FrmStudentInfo(objStudent); objStudentForm.Show(); } }
private void btnQueryById_Click(object sender, EventArgs e) { if (this.txtStudentId.Text.Length == 0) { MessageBox.Show("Please entry the StudentID"); this.txtStudentId.Focus(); return; } StudentExt objStudentExt = objStudentService.GetStudentByStudentId(Convert.ToInt32(this.txtStudentId.Text.Trim())); if (objStudentExt == null) { MessageBox.Show("This studentd not exist !"); this.txtStudentId.Focus(); return; } else { FrmStudentInfo objFrmStudentInfo = new FrmStudentInfo(objStudentExt); objFrmStudentInfo.Show(); } }
/// <summary> /// 查询相关学生信息 /// </summary> /// <param name="stu"></param> /// <returns></returns> public int InsertStudent(StudentExt stu) { string sql = string.Format("INSERT INTO Students(StudentName,Gender,Birthday,StudentIdNo,CardNo,Age,PhoneNumber,StudentAddress,ClassId) VALUES('{0}', '{1}', '{2}', '{3}', '{4}', {5}, '{6}', '{7}', {8})", stu.StudentName, stu.Gender, stu.Birthday, stu.StudentIdNo, stu.CardNo, stu.Age, stu.PhoneNumber, stu.StudentAddress, stu.ClassId); return(DBHelper.SQLHelper.ExecuteNonQurey(sql)); }
/// <summary> /// This function is used to Add and Update student /// </summary> /// <param name="studentExtend"></param> public void SaveStudents(StudentExt studentExtend) { using (var context = new dbTIREntities()) { using (var dbContextTransaction = context.Database.BeginTransaction()) { try { tblStudent newtblStudent = new tblStudent() { FirstName = studentExtend.FirstName, MiddleName = studentExtend.MiddleName, LastName = studentExtend.LastName, DistrictId = studentExtend.DistrictId, StateId = studentExtend.StateId, LocalId = studentExtend.LocalId, LineageId = studentExtend.LineageId == -1 ? null : studentExtend.LineageId, RaceId = studentExtend.RaceId == -1 ? null : studentExtend.RaceId, GenderId = studentExtend.GenderId, BirthDate = studentExtend.BirthDate, HomeLanguageId = studentExtend.HomeLanguageId == -1 ? null : studentExtend.HomeLanguageId, NativeLanguageId = studentExtend.NativeLanguageId == -1 ? null : studentExtend.NativeLanguageId, ChangeDatetime = DateTime.Now }; if (studentExtend.StudentId == 0) { context.tblStudents.Add(newtblStudent); } else { newtblStudent.StudentId = studentExtend.StudentId; context.tblStudents.Add(newtblStudent); context.Entry(newtblStudent).State = EntityState.Modified; } context.SaveChanges(); tblStudentSchoolYear newtblStudentSchoolYear = new tblStudentSchoolYear() { StudentId = newtblStudent.StudentId, SchoolYearId = studentExtend.SchoolYearId, ServingSchoolId = studentExtend.ServingSchoolId, GradeLevel = studentExtend.GradeLevel, StateId = studentExtend.StateId, LocalId = studentExtend.LocalId, LepIndicator = studentExtend.LepIndicator, IepIndicator = studentExtend.IepIndicator, FrlIndicator = studentExtend.FrlIndicator, EnrollmentDate = studentExtend.EnrollmentDate, ChangeDateTIme = DateTime.Now, Hispanic = studentExtend.Hispanic }; if (studentExtend.StudentSchoolYearId == 0) { context.tblStudentSchoolYears.Add(newtblStudentSchoolYear); } else { newtblStudentSchoolYear.StudentSchoolYearId = studentExtend.StudentSchoolYearId; context.tblStudentSchoolYears.Add(newtblStudentSchoolYear); context.Entry(newtblStudentSchoolYear).State = EntityState.Modified; } context.SaveChanges(); dbContextTransaction.Commit(); } catch (Exception ex) { dbContextTransaction.Rollback(); throw ex; } } } }
public static bool CheckStuInfo(StudentExt studentExt) { if (studentExt.Student_name.Length == 0) { MessageBox.Show("姓名不可为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } if (!CheckName(studentExt.Student_name)) { MessageBox.Show("姓名错误", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } if (studentExt.Student_id.Length != 12) { MessageBox.Show("学号错误", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } if (studentExt.Student_birthday > DateTime.Now) { MessageBox.Show("生日错误", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } if (studentExt.ID_card.Length != 18) { MessageBox.Show("身份证长度错误错误", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } if (studentExt.ID_card.Substring(7, 4) != studentExt.Student_birthday.Year.ToString() || studentExt.ID_card.Substring(11, 2) != studentExt.Student_birthday.Month.ToString() || studentExt.ID_card.Substring(13, 2) != studentExt.Student_birthday.Day.ToString()) { MessageBox.Show("身份证与生日不符", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } if (studentExt.Phone_num.Length == 0) { MessageBox.Show("电话不可为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } if (CheckPhoneNum(studentExt.Phone_num)) { MessageBox.Show("电话格式错误", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } if (studentExt.Email.Length == 0) { MessageBox.Show("邮箱不可为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } if (CheckEmail(studentExt.Email)) { MessageBox.Show("邮箱错误", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } if (studentExt.Nation_name.Trim() == "") { MessageBox.Show("民族不可为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } if (studentExt.Class_name.Trim() == "") { MessageBox.Show("学院不可为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } if (studentExt.Profession_name.Trim() == "") { MessageBox.Show("专业不可为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } if (studentExt.Class_name.Trim() == "") { MessageBox.Show("班级不可为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } return(true); }
public int AddStudent(StudentExt stu) { string sql = string.Format("INSERT INTO Student(Sname,Ssex,Birthday,SidNo,CardNo,Sage,Sphone,Saddress,Sclassid) VALUES('{0}', '{1}', '{2}', '{3}', '{4}', {5}, '{6}', '{7}', {8})", stu.Sname, stu.Ssex, stu.Birthday, stu.SidNo, stu.CardNo, stu.Sage, stu.Sphone, stu.Saddress, stu.Sclassid); return(DBHepler.SQLHelper.ExecuteNonQuery(sql)); }
public int UpdateStudentInfor(StudentExt student) { string sql = string.Format("UPDATE Student SET Sname='{0}',Ssex='{1}',Birthday='{2}',SidNo='{3}',CardNo='{4}',SImage='{5}',Sage={6},Sphone='{7}',Saddress='{8}',Sclassid={9}WHERE Sid={10}", student.Sname, student.Ssex, student.Birthday, student.SidNo, student.CardNo, student.SImage, student.Sage, student.Sphone, student.Saddress, student.Sclassid, student.Sid); return(DBHepler.SQLHelper.ExecuteNonQuery(sql)); }
/// <summary> /// 根据学生姓名查询 /// </summary> /// <param name="student"></param> /// <returns></returns> public int UpdateStudentInfor(StudentExt student) { string sql = string.Format("UPDATE Students SET StudentName='{0}',Gender='{1}',Birthday='{2}',StudentIdNo='{3}',CardNo='{4}',StuImage='{5}',Age={6},PhoneNumber='{7}',StudentAddress='{8}',ClassId={9} WHERE StudentId={10}", student.StudentName, student.Gender, student.Birthday, student.StudentIdNo, student.CardNo, student.StuImage, student.Age, student.PhoneNumber, student.StudentAddress, student.ClassId, student.StudentId); return(DBHelper.SQLHelper.ExecuteNonQurey(sql)); }