Example #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);
                }
            }
        }
Example #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);
                    }
                }
            }
        }
Example #3
0
 private void button_Update_Click(object sender, EventArgs e)
 {
     if (CheckData())
     {
         if (bllHV.UpdateHangve(textBox_mahv.Text, textBox_tenhv.Text, comboBox_tinhtrang.Text, textBox_tyle.Text))
         {
             //QL_Hangve_Load(null, null);
             MessageBox.Show("Cập nhật 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.Exclamation);
         }
     }
 }
Example #4
0
        private void button_Delete_Click(object sender, EventArgs e)
        {
            //--------------- MINH CHINH SUA

            //int total = dataGridView_Sanbay.Rows.Cast<DataGridViewRow>().Where(p => Convert.ToBoolean(p.Cells["select"].Value) == true).Count();
            //if (total > 0)
            //{
            //    for (int i = dataGridView_Sanbay.RowCount - 1; i >= 0; i--)
            //    {
            //        DataGridViewRow row = dataGridView_Sanbay.Rows[i];
            //        if (Convert.ToBoolean(row.Cells["select"].Value) == true)
            //        {
            //            dataGridView_Sanbay.Rows.Remove(row);
            //        }
            //    }
            //}



            //--------------



            if (MessageBox.Show("Bạn có chắc chắn muốn xóa những sân bay này không?", "Cảnh báo", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
            {
                Sanbay sb = new Sanbay();

                foreach (DataGridViewRow row in dataGridView_Sanbay.SelectedRows)
                {
                    //sb.id = _ID;

                    sb.masb = row.Cells[0].Value.ToString();
                    if (bllSB.DeleteSanbay(sb))
                    {
                        sl_canxoa -= 1;
                        //ShowAllSanbay();
                        textBox_masb.Clear();    // Clear() để xóa hết kí tự khi vừa thêm xong
                        textBox_tensb.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);
                    }
                }
                if (sl_canxoa == -1)
                {
                    ShowAllSanbay();
                }
                else
                {
                    if (trigger != true)
                    {
                        ShowSB_HoatDong();
                    }
                    else
                    {
                        ShowAllSanbay();
                    }
                    if (sl_canxoa == 0)
                    {
                        button_Delete.Enabled = false;

                        if (MessageBox.Show("Cập nhật số lượng sân bay thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information) == DialogResult.OK)
                        {
                            if (UIParent is Thaydoiquydinh)
                            {
                                Thaydoiquydinh frm = UIParent as Thaydoiquydinh;
                                frm.UpdateSoluongSB();
                            }

                            this.Dispose();
                        }
                    }
                }
            }
        }
Example #5
0
        private void thayĐổiQuyĐịnhToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Thaydoiquydinh frm = new Thaydoiquydinh();

            frm.ShowDialog();
        }