Пример #1
0
        private void button_Add_Click(object sender, EventArgs e)
        {
            if (CheckData())
            {
                DTO.Hangve hv = new DTO.Hangve();
                //sb.masb = textBox_masb.Text;
                hv.tenhv     = textBox_tenhv.Text;
                hv.tyle      = int.Parse(textBox_tyle.Text);
                hv.tinhtrang = comboBox_tinhtrang.Text;

                if (bllHV.InsertHangve(hv))
                {
                    MessageBox.Show("Thêm hạng vé thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    if (UIParent is Thaydoiquydinh)
                    {
                        Thaydoiquydinh frm = UIParent as Thaydoiquydinh;
                        frm.Thaydoiquydinh_Load(null, null);
                    }
                    ShowAll_Hangve();
                    textBox_mahv.Clear();    // Clear() để xóa hết kí tự khi vừa thêm xong
                    textBox_tenhv.Clear();
                    textBox_tyle.Clear();
                }
                else
                {
                    MessageBox.Show("Có lỗi xảy ra, xin hãy thử lại!", "Thông báo lỗi", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                }
            }
        }
Пример #2
0
        private void button_Delete_Click(object sender, EventArgs e)
        {
            if (CheckData())
            {
                if (MessageBox.Show("Bạn có chắc chắn muốn xóa những hạng vé này không?", "Cảnh báo", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                {
                    DTO.Hangve hv    = new DTO.Hangve();
                    int        check = -1;
                    foreach (DataGridViewRow row in dataGridView_hangve.SelectedRows)
                    {
                        hv.mahv = row.Cells[0].Value.ToString();
                        if (bllHV.DeleteHangve(hv))
                        {
                            check = 1;
                            //QL_Hangve_Load(null, null);

                            if (UIParent is Thaydoiquydinh)
                            {
                                Thaydoiquydinh frm = UIParent as Thaydoiquydinh;
                                frm.Thaydoiquydinh_Load(null, null);
                            }
                            //ShowAll_Hangve();
                            textBox_mahv.Clear();    // Clear() để xóa hết kí tự khi vừa thêm xong
                            textBox_tenhv.Clear();
                            textBox_tyle.Clear();
                        }
                        else
                        {
                            check = 0;
                            MessageBox.Show("Có lỗi xảy ra, xin hãy thử lại!", "Thông báo lỗi", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                    }
                    if (check == 1)
                    {
                        MessageBox.Show("Xóa hạng vé thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
        }