Exemplo n.º 1
0
 //打印信息
 private void btnPrint_Click(object sender, RoutedEventArgs e)
 {
     selectStu = smDgStudentLsit.SelectedItem as StudentExt;
     if (selectStu == null)
     {
         MessageBox.Show("请选择你要打印的学员", "提示");
     }
     common.BItmapImg image = null;
     if (string.IsNullOrEmpty(selectStu.StuIMage))
     {
         selectStu.ImgPath = "/img/bg/zwzp.jpg";
     }
     else
     {
         image = SerializeObjectTostring.DeserializeObject(selectStu.StuIMage) 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";
     }
     Vime.FrmPrintStuInfo frmPrint = new FrmPrintStuInfo("PrintModel.xaml", selectStu);
     frmPrint.ShowInTaskbar = false;
     frmPrint.ShowDialog();
 }
Exemplo n.º 2
0
 public FrmStudentInfor(StudentExt stu)
 {
     InitializeComponent();
     StuID                  = stu.StudentID; //获取到当前的学员ID
     this.Title             = stu.StudentName + "信息";
     labName.Content        = stu.StudentName;
     labGender.Content      = stu.Gender;
     labStuID.Content       = stu.StudentID;
     labAge.Content         = stu.Age;
     labstuBirthday.Content = stu.Birthday.ToString("yyyy-mm-dd");
     labGardNo.Content      = stu.CardNO;
     labstuNub.Content      = stu.StudentIdNO;
     labstuClass.Content    = stu.ClassName;
     labstuPhon.Content     = stu.PhoneNumber;
     labstuAddress.Content  = stu.StudentAddress;
     //添加照片信息
     if (string.IsNullOrEmpty(stu.StuIMage))
     {
         stuImg.Source = new BitmapImage(new Uri("/img/bg/zwzp.jpg", UriKind.RelativeOrAbsolute));
     }
     else
     {
         common.BItmapImg image  = SerializeObjectTostring.DeserializeObject(stu.StuIMage) as common.BItmapImg;
         BitmapImage      bitmap = new BitmapImage();
         bitmap.BeginInit(); //初始化
         bitmap.StreamSource = new MemoryStream(image.Buffer);
         bitmap.EndInit();   //结束初始化
         stuImg.Source = bitmap;
     }
 }
Exemplo n.º 3
0
        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;
            }
        }
Exemplo n.º 4
0
        }                                       //学员对象
        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;
            }
        }