示例#1
0
 public Picture DataRowToPicture(DataRow dr)
 {
     Picture pic = new Picture();
     pic.image = (byte[])dr["picture"];
     pic.pic_owner = (int)dr["pic_owner"];
     pic.pic_style = (int)dr["pic_style"];
     return pic;
 }
        //static int add_or_not=0;

        public BitmapImage picture_show(int pic_style, int pic_owner)
        {
            Picture pic = new Picture();
            pic = p_dal.select_picture(pic_style, pic_owner);
            BitmapImage image = new BitmapImage();
            image.BeginInit();
            image.StreamSource = new MemoryStream(pic.image);
            image.EndInit();
            return image;
        }
示例#3
0
 public int Update_picture(Picture pic, int ID)
 {
     String sql = "update picture_information set picture=@picture,pic_style=@pic_style,pic_owner=@pic_owner";
     SqlParameter[] param =
     {
         new SqlParameter("@picture",SqlDbType.VarBinary),
         new SqlParameter("@pic_style",SqlDbType.Int),
         new SqlParameter("@pic_owner",SqlDbType.Int)
     };
     param[0].Value = pic.image;
     param[1].Value = pic.pic_style;
     param[2].Value = pic.pic_owner;
     return SqlHelper.ExecuteQuery(sql, param);
 }
示例#4
0
 public int Add_picture(Picture pic)
 {
     String sql = "insert into picture_information values(@picture,@pic_style,@pic_owner)";
     SqlParameter[] param =
     {
         new SqlParameter("@picture",SqlDbType.VarBinary),
         new SqlParameter("@pic_style",SqlDbType.Int),
         new SqlParameter("@pic_owner",SqlDbType.Int)
     };
     param[0].Value = pic.image;
     param[1].Value = pic.pic_style;
     param[2].Value = pic.pic_owner;
     return SqlHelper.ExecuteQuery(sql, param);
 }
示例#5
0
 public Picture select_picture(int pic_style, int pic_owner)
 {
     String sql = "select * from picture_information where pic_style=@pic_style and pic_owner=@pic_owner";
     SqlParameter[] param =
     {
         new SqlParameter("@pic_style",SqlDbType.Int),
         new SqlParameter("@pic_owner",SqlDbType.Int)
     };
     param[0].Value = pic_style;
     param[1].Value = pic_owner;
     Picture pic = new Picture();
     DataTable dt = SqlHelper.ExecuteSelect(sql, param);
     foreach (DataRow dr in dt.Rows)
     {
         pic = DataRowToPicture(dr);
     }
     return pic;
 }