Exemplo n.º 1
0
        private void btThem_Click(object sender, EventArgs e)
        {
            Xe xe = new Xe();

            xe.Biensoxe  = txtBSX.Text;
            xe.idLoaiXe  = (int)cbbLoaiXe.SelectedValue;
            xe.TenXe     = txtTenXe.Text;
            xe.PhiXang   = txtPhiXang.Text;
            xe.PhiQuaKm  = txtPhiQuaKm.Text;
            xe.DonGia    = txtDonGia.Text;
            xe.MoTaTT    = txtMoTaTT.Text;
            xe.TrangThai = int.Parse(txtTrangThai.Text);



            if (XeController.AddXe(xe))
            {
                XtraMessageBox.Show("Thêm thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                XtraMessageBox.Show("Thêm thất bại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            CNPMEntities context = new CNPMEntities();
            List <Xe>    listXe  = context.Xes.ToList();

            BindGrid(listXe);
        }
Exemplo n.º 2
0
        private void btXoa_Click(object sender, EventArgs e)
        {
            if (XeController.RemoveXe(GetBSX))
            {
                MessageBox.Show("Xóa thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("Vui lòng chọn khách hàng để xóa");
            }

            CNPMEntities context = new CNPMEntities();
            List <Xe>    xes     = context.Xes.ToList();

            BindGrid(xes);
        }