private void BT_GetVipCard_Click(object sender, EventArgs e)
{
openFileDialog1.Filter = "*jpg|*.JPG|*.gif|*.GIF|*.bmp|*.BMP|*.png|*.PNG";
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
string fullpath = openFileDialog1.FileName;//文件路径
try
{
FileStream fs = new FileStream(fullpath, FileMode.Open);
byte[] imagebytes = new byte[fs.Length];
BinaryReader br = new BinaryReader(fs);
imagebytes = br.ReadBytes(Convert.ToInt32(fs.Length));
Model.Vip Vipinfo = new Model.Vip();
Vipinfo.Photo = imagebytes;
Vipinfo.CustomerID = 10031;
BLL.Vip vipmng = new BLL.Vip();
if (
vipmng.UpdateUserPhoto(Vipinfo))
{
MessageBox.Show("上传用户头像成功");
}
}
catch
{
MessageBox.Show("异常!!");
}
}
}