Example #1
0
        private void btnXoaAlbum_Click(object sender, EventArgs e)
        {
            if (lvwAlbum.SelectedItems.Count == 0)
            {
                return;
            }
            DialogResult tb = MessageBox.Show("Bạn có thực sự muốn xóa Album[" + lvwAlbum.SelectedItems[0].SubItems[1].ToString() + " không !", "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);

            if (tb == DialogResult.Cancel)
            {
                return;
            }
            string   maal = lvwAlbum.SelectedItems[0].Tag.ToString();
            tblAlbum dt   = new tblAlbum(maal);
            int      kq   = dt.xoaAlbum();

            if (kq == 0)
            {
                MessageBox.Show("Bạn đã xóa Album[" + lvwAlbum.SelectedItems[0].SubItems[1].ToString() + "] thành công!)", "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("Bạn chưa xóa được Album!", "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
            }
            loadlai_listview();
        }
Example #2
0
        private void btnDongy_Click(object sender, EventArgs e)
        {
            tblAlbum objAlbum;

            try
            {
                objAlbum = new tblAlbum(txtMaalbum.Text, txtTenalbum.Text, txtNamphathanh.Text);
            }
            catch (Exception ex)
            {
                string erro = ex.Message;
                MessageBox.Show(erro, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                if (erro.Contains("mã"))
                {
                    txtMaalbum.Focus();
                }
                else if (erro.Contains("tên"))
                {
                    txtTenalbum.Focus();
                }
                return;
            }
            tblAlbum objALbum = new tblAlbum(txtMaalbum.Text, txtTenalbum.Text, txtNamphathanh.Text);
            int      result   = objALbum.themAlbum();

            if (result == 0)
            {
                MessageBox.Show("Thêm Album [" + txtTenalbum.Text + "] thành công!");
            }
            else
            {
                MessageBox.Show("Chưa thêm được Album mới!");
            }
            this.DialogResult = DialogResult.OK;
        }
        private void btnDongy_Click(object sender, EventArgs e)
        {
            tblAlbum objAbum;

            try
            {
                objAbum = new tblAlbum(txtMaalbum.Text, txtTenalbum.Text, txtNamphathanh.Text);
            }
            catch (Exception ex)
            {
                string loi = ex.Message;
                MessageBox.Show(loi, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                if (loi.Contains("mã"))
                {
                    txtMaalbum.Focus();
                }
                else if (loi.Contains("tên"))
                {
                    txtTenalbum.Focus();
                }
                return;
            }
            tblAlbum a      = new tblAlbum(txtMaalbum.Text, txtTenalbum.Text, txtNamphathanh.Text);
            int      resutl = a.capnhatalbum();

            if (resutl == 0)
            {
                MessageBox.Show("Cập nhật thành công album [" + txtTenalbum.Text + "] với mã album là [" + txtMaalbum.Text + "]");
            }
            else
            {
                MessageBox.Show("That bai");
            }

            this.DialogResult = DialogResult.OK;
        }