Exemplo n.º 1
0
        private void lnkXoa_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            grdDSGara.SelectionMode = Janus.Windows.GridEX.SelectionMode.SingleSelection;
            if (grdDSGara.SelectedItems.Count > 0)
            {
                GridEXRow row  = grdDSGara.SelectedItems[0].GetRow();
                int       ID   = int.Parse(row.Cells["ID"].Value.ToString());
                string    Name = row.Cells["Name"].Value.ToString();

                if (new MessageBox.MessageBoxBA().Show(this, "Bạn có đồng ý xóa gara, xóa thông tin gara ảnh hưởng tới thông tin xe", "Thông báo", Taxi.MessageBox.MessageBoxButtonsBA.YesNoCancel, Taxi.MessageBox.MessageBoxIconBA.Question).ToString() == DialogResult.Yes.ToString())
                {
                    Gara objGara = new Gara(ID, Name);
                    if (objGara.Delete())
                    {
                        new MessageBox.MessageBoxBA().Show(this, "Xóa gara thành công.", "Thông báo",
                                                           Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Information);
                        this.GetDSGara();
                        return;
                    }
                    else
                    {
                        new MessageBox.MessageBoxBA().Show(this, "Lỗi xóa gara.", "Thông báo",
                                                           Taxi.MessageBox.MessageBoxButtonsBA.OK, Taxi.MessageBox.MessageBoxIconBA.Information);
                        return;
                    }
                }
            }
        }