private void cbStatus_SelectedValueChanged(object sender, EventArgs e) { var bll = new MovieBLL(); int movieId = int.Parse(lblID.Text); Movie m = bll.Retrieve(movieId); m.isActive = ((Func <bool>)(() => { if (cbStatus.Text == "Active") { return(true); } else { return(false); } }))(); if (m.BaseAuditObject == null) { m.BaseAuditObject = new BaseAudit() { UpdateBy = UserSession.CurrentUser.ID }; } else { m.BaseAuditObject.UpdateBy = UserSession.CurrentUser.ID; } bll.Update(m); }
private void button2_Click(object sender, EventArgs e) { Movie me = movieBindingSource.Current as Movie; byte[] img = Get2bytes(this.pictureBox1.BackgroundImage); string movieId = me.Id; try { mb.Update(movieId, img); MessageBox.Show("照片修改成功!"); me.Poster = this.pictureBox1.BackgroundImage; } catch (Exception) { throw; } }