private void button_finish_Click(object sender, EventArgs e) { String statusMsg = ""; bool isSuccess; int chkStockStatus = consMgr.chkPharmStock(Login.user.CurrentLoginClinicId, int.Parse(consId), ref statusMsg); isSuccess = (chkStockStatus >= 2 || chkStockStatus < 0) ? true : false; if (!isSuccess) { DialogResult needChange = MessageBox.Show(statusMsg + "\n\n需要修改處方?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (needChange == System.Windows.Forms.DialogResult.No) { isSuccess = false; } else { return; } } if (isSuccess && chkStockStatus >= 1 && chkStockStatus < 3) { DialogResult needReserv = MessageBox.Show("需要於藥房預留藥物?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (needReserv == System.Windows.Forms.DialogResult.Yes) { isSuccess = consMgr.pharmStockReserv(Login.user.CurrentLoginClinicId, int.Parse(consId)); if (isSuccess) { MessageBox.Show("已於藥房預留藥物", "", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("於藥房預留藥物失敗, 詳情情聯絡有關藥房", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } isSuccess = consMgr.finishConsultation(consId, ref statusMsg); if (!isSuccess) { MessageBox.Show(statusMsg, "", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { this.Close(); } }