private void Pb_Click(object sender, EventArgs e) { PictureBox tamthoi = sender as PictureBox; Phim tim = dsphimmoi.Where(x => x.PhimID == Convert.ToInt32(tamthoi.Tag)).FirstOrDefault(); lblTenPhim.Text = tim.Ten; lblHangPhim.Text = tim.HangPhim; lblTheLoai.Text = tim.TheLoai; lblDienVien.Text = tim.DaoDien; lblDaoDien.Text = tim.DienVien; pictureBox1.ImageLocation = tim.PosterURL; }
public void Xuat() { Phim current = bs.Current as Phim; txtDaoDien.Text = current.DaoDien; txtDoDai.Text = Convert.ToString(current.DoDai); txtGioiThieu.Text = current.GioiThieu; txtHangSanXuat.Text = current.HangPhim; txtNuocSanXuat.Text = current.NuocSanXuat; txtPhienBan.Text = current.PhienBan; txtTenPhim.Text = current.Ten; txtTheLoai.Text = current.TheLoai; txtDienVien.Text = current.DienVien; }
private void btnGhi_Click(object sender, EventArgs e) { if (them == true) { using (WebClient wc = new WebClient()) { wc.Encoding = Encoding.UTF8; wc.Headers[HttpRequestHeader.ContentType] = "application/json"; string diachi = "http://192.168.1.5/QLPhimService/PhimService.svc/themphim"; Phim obj = new Phim { Ten = txtTenPhim.Text, DienVien = txtDienVien.Text, DaoDien = txtDaoDien.Text, DoDai = Convert.ToInt32(txtDoDai.Text), GioiThieu = txtGioiThieu.Text, HangPhim = txtHangSanXuat.Text, NuocSanXuat = txtNuocSanXuat.Text, PhienBan = txtPhienBan.Text, TheLoai = txtTheLoai.Text }; string chuoijson = JsonConvert.SerializeObject(obj); string ketquatrave = wc.UploadString(diachi, "POST", chuoijson); bs.Add(obj); bs.MoveLast(); them = false; MessageBox.Show(ketquatrave); } } else { using (WebClient wc = new WebClient()) { wc.Encoding = Encoding.UTF8; wc.Headers[HttpRequestHeader.ContentType] = "application/json"; string diachi = "http://192.168.1.5/QLPhimService/PhimService.svc/suaphim"; Phim current = bs.Current as Phim; current.Ten = txtTenPhim.Text; current.DaoDien = txtDaoDien.Text; current.DienVien = txtDienVien.Text; current.DoDai = Convert.ToInt32(txtDoDai.Text); current.GioiThieu = txtDoDai.Text; current.HangPhim = txtHangSanXuat.Text; current.NuocSanXuat = txtNuocSanXuat.Text; current.PhienBan = txtPhienBan.Text; current.TheLoai = txtTheLoai.Text; string chuoijson = JsonConvert.SerializeObject(current); string ketquatrave = wc.UploadString(diachi, "PUT", chuoijson); bs.EndEdit(); MessageBox.Show(ketquatrave); } } }