public AddstudentManager(StudentExt stu) { InitializeComponent(); student1 = stu; 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 = stu.ClassID - 1; cmbClassName.SelectedValue = 1; }
StudentExt student = new StudentExt(); //添加的学员对象 public FrmAddStudentInfor() { InitializeComponent(); //班级 List <StudentClass> stuclaslist = stuclass.GetClasses();//获取班级表数据 combstuClass.ItemsSource = stuclaslist; combstuClass.DisplayMemberPath = "ClassName"; //获取班级名 combstuClass.SelectedValuePath = "ClassID"; //通过班级获取路径 combstuClass.SelectedIndex = 0; //照片 if (string.IsNullOrEmpty(student.StuIMage)) { stuImg.Source = new BitmapImage(new Uri("/img/bg/zwzp.jpg", UriKind.RelativeOrAbsolute)); } else { image = SerializeObjectTostring.DeserializeObject(student.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; } }
public UpdateStuInfor(StudentsExt ext) { InitializeComponent(); //从上传照片 common.BitmapImg img = new common.BitmapImg(); //把获取的元素放在一个属性里方便下面的调用 studentSJ = ext; //开始在这个页面上显示修改按钮所点击的那个学生的所有信息在这里显示,点击是显示原有的 txtAddress.Text = ext.StudentAddress; //地址 txtAge.Text = ext.Age.ToString(); //年龄 txtCardNo.Text = ext.CardNo; //考勤卡号 txtName.Text = ext.StudentName; //姓名 txtPhoneNumber.Text = ext.PhoneNumber; //电话 txtStuNoId.Text = ext.StudentIdNo; //ID if (ext.Gender == "男") //性别 { radBoy.IsChecked = true; } else { radGirl.IsChecked = true; } /*//获取或设置要选定的日期 * datePkBirthday.DisplayDate =Convert.ToDateTime(ext.Birthday); * //获取或设置当前要选定的日期 * datePkBirthday.SelectedDate = Convert.ToDateTime(ext.Birthday);*/ datePkBirthday.Text = ext.Birthday; //图片的显示,如果当前图片为空时进入获取这下面zwzp图片 if (string.IsNullOrEmpty(ext.StuImage)) { stuImg.Source = new BitmapImage(new Uri("/img1/bg/zwzp.jpg", UriKind.RelativeOrAbsolute)); } else { //如果学员的Iamge字段中能够查询到数据,那么就可以直接将这个数据反序列化成BitmapImage对象 image = BinaryStuObjcet.FBinaryForStu(ext.StuImage) as common.BitmapImg; img1.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 = ext.ClassId - 1; }
public ADDstudent() { InitializeComponent(); //获取StudentClass下拉列表的内容 List <StudentClass> classes = SCM.GetClasses(); cmbClassName.ItemsSource = classes; cmbClassName.DisplayMemberPath = "ClassName"; cmbClassName.SelectedValuePath = "ClassId"; }
public ADDStudent() { InitializeComponent(); List <StudentClass> classes = csm.GetClasses(); cmbClassName.ItemsSource = classes; cmbClassName.DisplayMemberPath = "ClassName"; cmbClassName.SelectedValuePath = "ClassID"; cmbClassName.SelectedIndex = stu.ClssID - 1; }
public FrmAddStudent() { InitializeComponent(); StudentClassManager csm = new StudentClassManager(); List <StudentClass> classes = csm.GetClasses(); cmbClassName.ItemsSource = classes; cmbClassName.DisplayMemberPath = "ClassName"; cmbClassName.SelectedValuePath = "ClassId"; cmbClassName.SelectedIndex = student.ClassId; }
StuCoreExt selesco = null; //成绩表实例对象 public ScoreInquiry() { InitializeComponent(); List <StudentClass> stuclass = stuclassManager.GetClasses(); //获取班级表数据 smclassCmb.ItemsSource = stuclass; smclassCmb.DisplayMemberPath = "ClassName"; smclassCmb.SelectedValuePath = "ClassID"; smclassCmb.SelectedIndex = 1; score = scoreManager.GetScore(Convert.ToInt32(smclassCmb.SelectedValue)); smDgStudentLsit.ItemsSource = score; }
List <AttInforExt> attInfo = null; //考勤表对象 public FrmAttendanceManager() { InitializeComponent(); List <StudentClass> stuclass = stuclassManager.GetClasses(); //获取班级表数据 smclassCmb.ItemsSource = stuclass; smclassCmb.DisplayMemberPath = "ClassName"; smclassCmb.SelectedValuePath = "ClassID"; smclassCmb.SelectedIndex = 1; attInfo = attManager.GetAttInfors(Convert.ToInt32(smclassCmb.SelectedValue)); smDgScoreLsit.ItemsSource = attInfo; }
public FrmStuManager() { InitializeComponent(); List <StudentClass> classes = csm.GetClasses(); smclassCmb.ItemsSource = classes; smclassCmb.DisplayMemberPath = "ClassName"; //设置下拉框的显示文本 smclassCmb.SelectedValuePath = "ClassId"; //设置下拉框显示文本对应的value smclassCmb.SelectedIndex = 0; //给DataGrid进行数据绑定,需要针对DG中列进行绑定对应的数据列 RefreshDG(); }
public KaoqinGuanli() { InitializeComponent(); List <StudentClass> classes = csm.GetClasses(); smclassCmb.ItemsSource = classes; smclassCmb.DisplayMemberPath = "ClassName"; //设置下拉框的显示文本 smclassCmb.SelectedValuePath = "ClassID"; //设置下拉框显示文本对应的value smclassCmb.SelectedIndex = 0; //给DataGrid进行数据绑定,需要针对DG中列进行绑定对应的数据列 students = sm.GetStudents(Convert.ToInt32(smclassCmb.SelectedValue)); smDgkapqinLsit.ItemsSource = students; }
public FrmSruManager() { InitializeComponent(); List <StudentClass> classes = csm.GetClasses(); smclassCmb.ItemsSource = classes; smclassCmb.DisplayMemberPath = "ClassName"; //设置下拉框的显示文本 与数据库绑定 smclassCmb.SelectedValuePath = "ClassId"; //下拉框的显示文本对应的value smclassCmb.SelectedIndex = 0; //第一项 //DataGrid数据绑定,绑定对应的数据列 students = sm.GetStudents(Convert.ToInt32(smclassCmb.SelectedValue)); smDgStudentLsit.ItemsSource = students; }
public FrmStuManager() { InitializeComponent(); List <StudentClass> clas = stucm.GetClasses();//获取到班级信息 smclassCmb.ItemsSource = clas; smclassCmb.DisplayMemberPath = "ClassName"; smclassCmb.SelectedValuePath = "ClassID"; smclassCmb.SelectedIndex = 1;//默认为第二项 students = stum.GetStudents(Convert.ToInt32(smclassCmb.SelectedValue)); smDgStudentLsit.ItemsSource = students; }
public scorelistFENGXI() { InitializeComponent(); List <StudentClass> classes = csm.GetClasses(); smclassCmb.ItemsSource = classes; //设置下拉框的显示文本 smclassCmb.DisplayMemberPath = "ClassName"; //设置下拉框显示文本对应的value smclassCmb.SelectedValuePath = "Classid"; smclassCmb.SelectedIndex = 0; //给DataGrid进行对应列数据绑定 students = sm.GetScoreList(Convert.ToInt32(smclassCmb.SelectedValue)); smDgStudentLsit.ItemsSource = students; }
private void btnSureUpdate_Click(object sender, RoutedEventArgs e) { StudentClassManager csm = new StudentClassManager(); List <StudentClass> classes = csm.GetClasses(); //改变数据之前的最终验证 if (CheckInfor()) { student1.StudentidNo = txtStuNoId.Text; student1.Age = (int)txtAge.Content; student1.Birthday = (string)datePkBirthday.Content; student1.StudentName = txtName.Text; student1.StudentidNo = txtStuNoId.Text; student1.CardNo = txtCardNo.Text; student1.ClasslD = (int)cmbClassName.SelectedValue; student1.StudentSex = (radboy.IsChecked == true ? "男" : "女"); student1.PhoneNumber = txtPhoneNumber.Text; student1.StudentAddress = (string.IsNullOrEmpty(txtAddress.Text) ? null : txtAddress.Text); //判断是否重新选择了Image if (stuImg.Source == new BitmapImage(new Uri("/img/bg/zw.jpg", UriKind.RelativeOrAbsolute))) { student1.StuImage = null; } //判断数据库中的图片是否和目前的上传图片一样 else { //证明未修改图片,目前的图片和原来数据库中的一致 if (image != null && img.Buffer == image.Buffer) { student1.StuImage = Common.SerializeObjectTostring.SerializeObject(image); } else { student1.StuImage = Common.SerializeObjectTostring.SerializeObject(img); } } if (manager.AddstudentManager(student1)) { System.Windows.MessageBox.Show("添加成功!", "提示"); this.Visibility = Visibility.Hidden; } else { System.Windows.MessageBox.Show("添加失败,请稍后再试!", "提示"); } } }
public FrmUpdateStuInfor(StudentExt stu) { InitializeComponent(); //信息绑定 this.Title = "修改【" + stu.StudentName + "】信息"; student = stu; txtAddress.Text = stu.StudentAddress; txtAge.Text = stu.Age.ToString(); txtCardNo.Text = stu.CardNo; txtName.Text = stu.StudentName; txtPhoneNumber.Text = stu.PhoneNumber; txtStuNoId.Text = stu.StudentIdNo; if (stu.Gender == "男") { radBoy.IsChecked = true;//如果性别为男 则界面男选中 } else { radGirl.IsChecked = true; } datePkBirthday.DisplayDate = stu.Birthday; datePkBirthday.SelectedDate = stu.Birthday; if (string.IsNullOrEmpty(stu.StuImage)) { //如果数据库为存储照片则展示预定照片 stuImg.Source = new BitmapImage(new Uri("/img/zwzp.jpg", UriKind.RelativeOrAbsolute)); } else { //如果查询到Image字段,则进行反序列化进行处理 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 = stu.ClassId; }
public FrmStudentGrade() { InitializeComponent(); select.SelectedIndex = 0; List <StudentClass> classes = csm.GetClasses(); smclass.ItemsSource = classes; //班级绑定 smclass.DisplayMemberPath = "ClassName"; //绑定班级名称 smclass.SelectedValuePath = "ClassId"; //班级id smclass.SelectedIndex = 0; //加载展示数据 通过所选择的班级去查询班级里面的学生 studentExt = score.GetStudent(Convert.ToInt32(smclass.SelectedValue)); //展示所有的学生成绩表 scoreLists = score.GetScores(); smDgStudentLsit.ItemsSource = scoreLists; }
} //学员对象 public FrmUpdateStudentInfor(StudentExt stu) { InitializeComponent(); this.Title = "修改【" + stu.StudentName + "】信息"; student = stu; textName.Text = stu.StudentName; //姓名 if (stu.Gender == "男") { radBoy.IsChecked = true; } //性别 else { radGirl.IsChecked = true; } dateBirthday.Content = stu.Birthday.ToString("yyyy-MM-dd"); //生日 textAge.Content = stu.Age.ToString(); //年龄 textGardNo.Text = stu.CardNO; //打卡号 textstuNub.Text = stu.StudentIdNO; //身份证号 textstuPhon.Text = stu.PhoneNumber; //手机号 textstuAddress.Text = stu.StudentAddress; //地址 //班级 List <StudentClass> stuclaslist = stuclass.GetClasses(); combstuClass.ItemsSource = stuclaslist; combstuClass.DisplayMemberPath = "ClassName"; combstuClass.SelectedValuePath = "ClassID"; combstuClass.SelectedIndex = stu.ClassID - 101; //照片 if (string.IsNullOrEmpty(stu.StuIMage)) { stuImg.Source = new BitmapImage(new Uri("/img/bg/zwzp.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; } }
public FrmUpdateStuInfor(StudentExt stu) { InitializeComponent(); this.Title = "修改【" + stu.StudentName + "】信息"; 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("yyyy-MM-dd"); if (string.IsNullOrEmpty(stu.StuImage)) { stuImg.Source = new BitmapImage(new Uri("/img/zwzp.jpg", UriKind.RelativeOrAbsolute)); } else { //如果学员的Iamge字段中能够查询到数据,那么就可以直接将这个数据反序列化成BitmapImage对象 imge = SerializeObjectTostring.DeserializeObject(stu.StuImage) as common.BitmapImg;//照片字符串格式 img.Buffer = imge.Buffer; BitmapImage bitmap = new BitmapImage(); bitmap.BeginInit(); //开始 bitmap.StreamSource = new MemoryStream(imge.Buffer); //获取流 bitmap.EndInit(); //结束 stuImg.Source = bitmap; //获取照片 } List <StudentClass> classes = csm.GetClasses(); cmbClassName.ItemsSource = classes; cmbClassName.DisplayMemberPath = "ClassName"; cmbClassName.SelectedValuePath = "ClassId"; cmbClassName.SelectedIndex = stu.ClssID; }
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 FrmStuManager() { InitializeComponent(); //下拉框中内容填写 List <StudentClass> list = csm.GetClasses(); //现在现在combox绑定要给里面放的值 smclassCmb.ItemsSource = list; //设置放在某个具体的对象上,可视表示设置再combox上面可以看见的,要显示ClassName的属性 smclassCmb.DisplayMemberPath = "ClassName"; //设置下拉框显示文本 //这个表示给过来的数据一一对应,才可以填写进去 smclassCmb.SelectedValuePath = "ClassId"; //设置下拉框显示对应文本的value //并获取索引为0的选项 smclassCmb.SelectedIndex = 0; //获取当选中某个科目时选中学生ID值对应显示绑定 students = sm.GetStudentsExts(Convert.ToInt32(smclassCmb.SelectedValue)); //DataGrid进行数据绑定,DataGrid的名字叫smDgStudentLsit smDgStudentLsit.ItemsSource = students;//把获取到的路径students赋给DataGrid表里 }