// to use private void btnPaymentField_Click(object sender, EventArgs e) { frmPayment frmPayment = new frmPayment(); frmPayment.Show(); /*get data to form payment here*/ }
private void countDownTimerField2_Tick(object sender, EventArgs e) { durationField2--; int hours, minutes, seconds; hours = durationField2 / 3600; minutes = (durationField2 % 3600) / 60; seconds = (durationField2 % 3600) % 60; tbTimerField2.Text = (hours >= 10 ? hours.ToString() : "0" + hours) + ":" + (minutes >= 10 ? minutes.ToString() : "0" + minutes) + ":" + (seconds >= 10 ? seconds.ToString() : "0" + seconds); if (durationField2 == 0) { countDownTimerField2.Stop(); btnPaymentField2.Visible = true; tbTimerField2.BackColor = Color.Green; frmPayment frmPayment = new frmPayment(); frmPayment.Show(); // to show data of bill } }
private void btnField2_Click(object sender, EventArgs e) { durationField2 = changeStringIntoIntTime(tbTimerField2.Text); if (tbTimerField2.BackColor == Color.Green) // to check field busy { if (!String.IsNullOrEmpty(tbCustomerField2.Text)) { countDownTimerField2.Start(); countDownTimerField2.Enabled = true; tbTimerField2.BackColor = Color.Red; } } else if (tbTimerField2.BackColor == Color.Red) // to click another time { if (!String.IsNullOrEmpty(tbCustomerField1.Text)) { countDownTimerField2.Stop(); tbTimerField2.BackColor = Color.Green; DialogResult result = MessageBox.Show("Bạn có muốn tính tiền sân này không?", "Thông báo", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { SetValueForNameCustomer = tbCustomerField2.Text; SetValueForTongGioDa = (changeStringIntoIntTime(SetValueForSoGioDatSan1) - durationField2).ToString(); SetValueForMaSan = "2"; frmPayment frmPayment = new frmPayment(); frmPayment.Show(); /*get data to form payment here*/ /*Update database functionin here*/ loadInfo(); } else if (result == DialogResult.No) { countDownTimerField2.Start(); tbTimerField2.BackColor = Color.Red; } } } }