private void DGV_Waiting_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e) { DataGridView dgv = (DataGridView)sender; sp_get_waiting_room_hdrResult data = (sp_get_waiting_room_hdrResult)dgv.Rows[e.RowIndex].DataBoundItem; switch (data.holded) { case true: dgv.Rows[e.RowIndex].DefaultCellStyle.ForeColor = Color.Red; dgv.Rows[e.RowIndex].DefaultCellStyle.SelectionForeColor = Color.Red; break; } if (mrm_code == "DC") { bool passCheckB = new Class.FunctionDataCls().checkPassedCheckPointB((int)data.tpr_id); bool isResult = new Class.FunctionDataCls().checkEventDoctorResult((int)data.mvt_id); if (!passCheckB || isResult) { dgv.Rows[e.RowIndex].Cells["colBtnCancelQueue"] = new DataGridViewTextBoxCell(); dgv.Rows[e.RowIndex].Cells["colSendToCheckB"] = new DataGridViewTextBoxCell(); } } }
private void DGV_Waiting_CellContentClick(object sender, DataGridViewCellEventArgs e) { DataGridView dgv = (DataGridView)sender; if (dgv.Columns[e.ColumnIndex].Name == "colBtnCancelQueue") { sp_get_waiting_room_hdrResult data = (sp_get_waiting_room_hdrResult)dgv.Rows[e.RowIndex].DataBoundItem; if (checkStatusCanSend((int)data.tps_id)) { Class.FunctionDataCls func = new Class.FunctionDataCls(); if (func.checkPassedCheckPointB((int)data.tpr_id)) { frmCancelQueue frmCancelQueue = new frmCancelQueue((int)data.tpr_id, (int)data.mvt_id, mrm_id, mhs_id, (int)data.tps_id, false, frmCancelQueue.useform.onWaiting); if (frmCancelQueue.DialogResult == System.Windows.Forms.DialogResult.OK) { string alert = func.getStringGotoNextRoom((int)data.tpr_id); MessageBox.Show(alert); _OnCompleteAction(false); new Class.ReserveSkipCls().SendAndReserve((int)data.tpr_id); return; } else if (frmCancelQueue.DialogResult == System.Windows.Forms.DialogResult.Cancel) { _OnCompleteAction(true); return; } } } else { MessageBox.Show("คนไข้ไม่ได้อยู่ในสถานะที่ดำเนินการ skip ได้", "Alert.", MessageBoxButtons.OK, MessageBoxIcon.Information); _OnCompleteAction(true); } } else if (((DataGridView)sender).Columns[e.ColumnIndex].Name == "colSendToCheckB") { sp_get_waiting_room_hdrResult data = (sp_get_waiting_room_hdrResult)dgv.Rows[e.RowIndex].DataBoundItem; if (checkStatusCanSend((int)data.tps_id)) { DialogResult result = MessageBox.Show("คุณต้องการส่ง คนไข้ไปยัง Check Point B หรือไม่?", "Alert.", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2); if (result == DialogResult.Yes) { Class.SendToCheckBCls sendB = new Class.SendToCheckBCls(); StatusTransaction complete = sendB.SendToCheckBOnWaiting((int)data.tpr_id, (int)mrm_id); if (complete == StatusTransaction.True) { MessageBox.Show("Sent To Checkpoint B Complete.", "Alert.", MessageBoxButtons.OK, MessageBoxIcon.Information); _OnCompleteAction(false); } else if (complete == StatusTransaction.NoProcess) { MessageBox.Show("คนไข้ไม่ได้อยู่ในสถานะที่จะส่งไปยัง checkpoint B ได้", "Alert.", MessageBoxButtons.OK, MessageBoxIcon.Information); _OnCompleteAction(true); } else if (complete == StatusTransaction.Error) { MessageBox.Show("ระบบเกิดความผิดพลาดไม่สามารถส่งไปยัง checkpoin B ได้ กรุณาทำอีกครั้ง", "Alert.", MessageBoxButtons.OK, MessageBoxIcon.Information); _OnCompleteAction(true); } } } else { MessageBox.Show("คนไข้ไม่ได้อยู่ในสถานะที่จะส่งไปยัง checkpoint B ได้", "Alert.", MessageBoxButtons.OK, MessageBoxIcon.Information); _OnCompleteAction(true); } } }