コード例 #1
0
        private void btnSubmit_Click(object sender, System.EventArgs e)
        {
            if (btnExtendTerm.Visible)
            {
                MessageBox.Show("Gia hạn thẻ xe trước khi xuất bến!", "Thông báo", MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
                return;
            }

            if (tbTicketIdInput.Text.Equals(""))
            {
                return;
            }

            bool mode = (tbCustomerName.Text.Equals(""));

            if (mode)
            {
                DialogResult dialogResult =
                    MessageBox.Show("Phí giữ xe là: " + customer.Fee.Price.ToString("###,###") + "đ, \nTiếp tục?",
                                    "Xác nhận", MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.Yes)
                {
                    if (parkingDao.GetOutParking(tbTicketIdInput.Text.Trim(), mode) == Constants.RESULT_OK)
                    {
                        btnRefresh_Click(null, null);
                    }
                    else
                    {
                        MessageBox.Show("Có lỗi xảy ra!", "Thông báo", MessageBoxButtons.OK,
                                        MessageBoxIcon.Error);
                    }
                }
            }
            else
            {
                if (parkingDao.GetOutParking(tbTicketIdInput.Text.Trim(), mode) == Constants.RESULT_OK)
                {
                    btnRefresh_Click(null, null);
                }
                else
                {
                    MessageBox.Show("Có lỗi xảy ra!", "Thông báo", MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                }
            }
        }