Ejemplo n.º 1
0
   public void LoadWithPhoto(Photo reader)
   {
 
       if (reader!=null)
       {
           byte[] bImg = reader.PhotoData;
           this.Photo = AnnualPartySqlHelper.GetImage(bImg);
       }
   }
Ejemplo n.º 2
0
 /// <summary>
 /// 插入一个员工照片
 /// </summary>
 /// <param name="number"></param>
 /// <param name="img"></param>
 public void InitPhoto(string number, Image img)
 {
      AnnualPartyEntities entities = new AnnualPartyEntities();
      Photo p=new Photo() {EmployeeNumber = number,PhotoData = ImageToByte(img) };
     entities.Photo.Add(p);
     entities.SaveChanges();
     //string sql = "insert into Photo values(@num,@img)";
     //SqlParameter p1 = new SqlParameter("@num", number);
     //SqlParameter p2 = new SqlParameter("@img", ImageToByte(img));
     //SqlHelper.ExecuteNonQuery(conn, System.Data.CommandType.Text, sql,p1,p2);
 }