Пример #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (linkPic.Equals(""))
            {
                return;
            }

            MemoryStream pic = new MemoryStream();

            pbPoster.Image.Save(pic, pbPoster.Image.RawFormat);
            if (Them)
            {
                try
                {
                    BLPhim blPhim = new BLPhim();

                    blPhim.ThemPhim(this.txtTenPhim.Text.Trim(), this.txtMaPhim.Text.Trim(),
                                    int.Parse(txtGiaVe.Text.ToString()), linkPic, ref err);
                    LoadData();
                    MessageBox.Show("Đã thêm xong!");
                }
                catch (SqlException)
                {
                    MessageBox.Show("Không thêm được. Lỗi rồi!");
                }
            }
            else
            {
                try
                {
                    BLPhim blPhim = new BLPhim();
                    blPhim.CapNhatPhim(this.txtMaPhim.Text.Trim(), this.txtTenPhim.Text.Trim(), Int32.Parse(this.txtGiaVe.Text), linkPic, ref err);
                    LoadData();
                    MessageBox.Show("Đã sửa xong!");
                }
                catch (SqlException)
                {
                    MessageBox.Show("Không sửa được. Lỗi rồi!");
                }
            }
        }