public Alert(string context, string alertColor, int time) { text = context; //StyleManager.Style = eStyle.Office2016; InitializeComponent(); // We can get access to desktop alert window before its displayed by handling this event DesktopAlert.BeforeAlertDisplayed += new EventHandler(BeforeAlertDisplayed); _RunningAlertId++; eDesktopAlertColor color; if (alertColor == "red") { color = (eDesktopAlertColor)(comboColors.SelectedItem ?? eDesktopAlertColor.Red); } else if (alertColor == "darkred") { color = (eDesktopAlertColor)(comboColors.SelectedItem ?? eDesktopAlertColor.DarkRed); } else if (alertColor == "darkblue") { color = (eDesktopAlertColor)(comboColors.SelectedItem ?? eDesktopAlertColor.DarkBlue); } else if (alertColor == "blue") { color = (eDesktopAlertColor)(comboColors.SelectedItem ?? eDesktopAlertColor.Blue); } else if (alertColor == "gray") { color = (eDesktopAlertColor)(comboColors.SelectedItem ?? eDesktopAlertColor.Gray); } else if (alertColor == "bluegray") { color = (eDesktopAlertColor)(comboColors.SelectedItem ?? eDesktopAlertColor.BlueGray); } else if (alertColor == "green") { color = (eDesktopAlertColor)(comboColors.SelectedItem ?? eDesktopAlertColor.Green); } else if (alertColor == "black") { color = (eDesktopAlertColor)(comboColors.SelectedItem ?? eDesktopAlertColor.Black); } else if (alertColor == "orange") { color = (eDesktopAlertColor)(comboColors.SelectedItem ?? eDesktopAlertColor.Orange); } else { color = (eDesktopAlertColor)(comboColors.SelectedItem ?? eDesktopAlertColor.Default); } eAlertPosition position = (eAlertPosition)(comboLocations.SelectedItem ?? eAlertPosition.BottomRight); DesktopAlert.Show(text, "\uf005", eSymbolSet.Awesome, Color.Transparent, color, position, time, _RunningAlertId, AlertClicked); }
private void metroCaixa_Click(object sender, EventArgs e) { string text = "Bem vindo ao Caixa"; var valorTempo = 6; _RunningAlertId++; eDesktopAlertColor color = eDesktopAlertColor.Default; eAlertPosition position = eAlertPosition.BottomRight; DesktopAlert.Show(text, "\uf005", eSymbolSet.Awesome, Color.Empty, color, position, valorTempo, _RunningAlertId, AlertClicked); }
private void buttonX1_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(text)) { MessageBoxEx.Show("Please enter alert text..."); return; } _RunningAlertId++; eDesktopAlertColor color = (eDesktopAlertColor)(comboColors.SelectedItem ?? eDesktopAlertColor.Default); eAlertPosition position = (eAlertPosition)(comboLocations.SelectedItem ?? eAlertPosition.BottomRight); DesktopAlert.Show(text, "\uf005", eSymbolSet.Awesome, Color.Empty, color, position, integerInput1.Value, _RunningAlertId, AlertClicked); }
private void videoTimer_Tick(object sender, EventArgs e) { BarcodeReader bReader = new BarcodeReader(); Result result = null; try { if (pboReader.Image == null) { } else { result = bReader.Decode(new Bitmap(pboReader.Image)); string decoded = result.ToString().Trim(); if (decoded == string.Empty) { MessageBox.Show("Empty String"); } else { videoTimer.Stop(); videoTimer.Enabled = false; // proceed to log in try { string sql = "SELECT * " + "FROM tblPatient " + "WHERE strPatientID = '" + decoded + "' AND " + "boolIsActive;"; int resultCounter = 0; MessageBox.Show(sql); MySqlCommand cmd = new MySqlCommand(sql, conn); MySqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { resultCounter++; } reader.Close(); if (resultCounter >= 1) { string logID = ""; lblPatID.Text = decoded; resultCounter = 0; sql = "SELECT a.strLogID " + "FROM tblPatientLogs a, tblPatientLogDetails b " + "WHERE a.strPatientID = '" + decoded + "' AND a.strLogID = b.strLogID AND " + "b.dtmDateTimeOut IS NULL ORDER BY b.dtmDateTimeLog ASC LIMIT 1;"; cmd = new MySqlCommand(sql, conn); cmd.Prepare(); try { reader = cmd.ExecuteReader(); } catch (MySqlException me) { Integrity.GetExceptionDetails(me); } while (reader.Read()) { logID = reader.GetString("strLogID"); resultCounter++; } reader.Close(); if (resultCounter == 1) { sql = "UPDATE tblPatientLogDetails " + "SET dtmDateTimeOut = NOW(), " + "strLogType = 'OUT' " + "WHERE strLogID = '" + logID + "';"; cmd = new MySqlCommand(sql, conn); cmd.ExecuteNonQuery(); sql = "SELECT strQueueNumber " + "FROM tblQueue " + "WHERE strPatientID = '" + decoded + "' AND " + "strQueueStatus = 'WAITING';"; cmd = new MySqlCommand(sql, conn); reader = cmd.ExecuteReader(); int resCount = 0; string queueNumber = ""; while (reader.Read()) { queueNumber = reader.GetString("strQueueNumber"); resCount++; } reader.Close(); if (resCount > 0) { sql = "UPDATE tblQueue " + "SET strQueueStatus = 'CANCELLED' " + "WHERE strQueueNumber = '" + queueNumber + "';"; cmd = new MySqlCommand(sql, conn); cmd.ExecuteNonQuery(); } MessageBox.Show("Successfully logged out!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); videoTimer.Start(); videoTimer.Enabled = true; } else { bool valid = true; int cboIndex = 0; string logType = ""; DialogResult dr = ExternalForm.InputComboBox(ref cboIndex, ref logType); if (dr == DialogResult.OK) { if (cboIndex >= 5) { MessageBox.Show("Please select a valid log type!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); valid = false; videoTimer.Start(); videoTimer.Enabled = true; } else { switch (cboIndex) { case 1: logType = "APPT"; break; case 2: logType = "WALK"; break; case 3: logType = "EMER"; break; case 4: logType = "OTHER"; break; } } } else { valid = false; } if (valid) { string dateToday = TimeHandler.GetCurrentDateTime() + "-LOGS"; sql = "INSERT INTO tblPatientLogs(strLogID, strPatientID, strStaffID) " + "VALUES('" + dateToday + "', '" + decoded + "', '" + userID + "');"; cmd = new MySqlCommand(sql, conn); cmd.ExecuteNonQuery(); sql = "INSERT INTO tblPatientLogDetails(strLogID, dtmDateTimeLog, strLogPurposeCode, strLogType) " + "VALUES('" + dateToday + "', NOW(), '" + logType + "', 'IN');"; cmd = new MySqlCommand(sql, conn); cmd.ExecuteNonQuery(); switch (cboIndex) { case 1: formQueue.AddQueue(patientList[dgvSearch.CurrentRow.Index][0], 1); break; case 2: formQueue.AddQueue(patientList[dgvSearch.CurrentRow.Index][0], 1); break; } MessageBox.Show("Successfully logged in!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); lblPatID.Text = "Scanning"; videoTimer.Start(); videoTimer.Enabled = true; eDesktopAlertColor color = eDesktopAlertColor.Green; eAlertPosition position = eAlertPosition.BottomRight; string report = "Patient # <b>" + decoded + "</b><br />" + "has logged!"; DesktopAlert.Show(report, "\uf005", eSymbolSet.Awesome, Color.Blue, color, position, 6, _RunningAlertId, AlertClicked); } } } else { MessageBox.Show("QR Code not recognized!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); videoTimer.Start(); videoTimer.Enabled = true; } } catch (MySqlException me) { MessageBox.Show("Exception Caught!\n" + me.Message); videoTimer.Start(); videoTimer.Enabled = true; } } } } catch (Exception) { //MessageBox.Show(ex.Message + "\n" + ex.StackTrace); //vdeoTimer.Stop(); } }
private void UpdateTaggedThread(object sender, EventArgs e) { dgvTagged.Rows.Clear(); Queue <string> doctorString = new Queue <string>(); int resultCount = 0; if (dgvQueue.Rows.Count > 0) { try { string sql = "SELECT DISTINCT strStaffID " + "FROM tblLogIn " + "WHERE strDoctStatus = 'ON' AND " + "strStaffID NOT IN(SELECT strStaffID " + "FROM tblTag " + "WHERE strStatus = 'PENDING');"; MySqlCommand cmd = new MySqlCommand(sql, conn); MySqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { doctorString.Enqueue(reader.GetString("strStaffID")); resultCount++; } reader.Close(); //MessageBox.Show("BEfore if"); if (resultCount != 0 && patientID.Count != 0) { string patientDequeued = patientID.Dequeue(); string doctorDequeued = doctorString.Dequeue(); string staffID = ""; string staffLastName = ""; string extPat = ""; string patNo = ""; string patientLastName = ""; string patientFirstName = ""; //MessageBox.Show("Entered if"); sql = "INSERT INTO tblTag " + "VALUES ('" + patientDequeued + "', '" + doctorDequeued + "', NOW(), 'PENDING');"; cmd = new MySqlCommand(sql, conn); cmd.ExecuteNonQuery(); sql = "UPDATE tblQueue " + "SET strQueueStatus = 'TAGGED' " + "WHERE strPatientID = '" + patientDequeued + "';"; cmd = new MySqlCommand(sql, conn); cmd.ExecuteNonQuery(); sql = "UPDATE tblLogIn " + "SET strDoctStatus = 'OFF' " + "WHERE strStaffID = '" + doctorDequeued + "';"; cmd = new MySqlCommand(sql, conn); cmd.ExecuteNonQuery(); UpdateQueueThread(sender, e); string report = "Patient # <b>"; sql = "SELECT strPatientID, strIDNumber, strPatientLastName, strPatientFirstName, strPatientMiddleName " + "FROM tblPatient " + "WHERE strPatientID = '" + patientDequeued + "';"; cmd = new MySqlCommand(sql, conn); reader = cmd.ExecuteReader(); while (reader.Read()) { report += reader.GetString("strPatientID"); report += "</b><br />"; report += reader.GetString("strPatientLastName"); report += ", "; report += reader.GetString("strPatientFirstName"); report += " "; report += reader.GetString("strPatientMiddleName"); extPat = reader.GetString("strPatientID"); patNo = reader.GetString("strIDNumber"); patientLastName = reader.GetString("strPatientLastName"); patientFirstName = reader.GetString("strPatientFirstName"); } reader.Close(); report += "<br />TAGGED TO<br />"; sql = "SELECT strStaffID, strLastName " + "FROM tblStaff " + "WHERE strStaffID = '" + doctorDequeued + "';"; cmd = new MySqlCommand(sql, conn); reader = cmd.ExecuteReader(); while (reader.Read()) { report += "DR. <b>" + reader.GetString("strLastName") + "</b>"; staffID = reader.GetString("strStaffID"); staffLastName = reader.GetString("strLastName"); } reader.Close(); dgvTagged.Rows.Add(staffID, staffLastName, extPat, patNo, patientLastName, patientFirstName); eDesktopAlertColor color = eDesktopAlertColor.Green; eAlertPosition position = eAlertPosition.BottomRight; DesktopAlert.Show(report, "\uf005", eSymbolSet.Awesome, Color.Blue, color, position, 6, _RunningAlertId, AlertClicked); } } catch (MySqlException me) { Integrity.GetExceptionDetails(me); } catch (Exception ex) { Integrity.GetExceptionDetails(ex); } if (resultCount > 0) { } } }
public void Generate() { try { string text = ""; string texto = ""; if (swtSelect.Value == true && !String.IsNullOrEmpty(txtEncrypt.Text)) { text = txtEncrypt.Text; txtResponse.Text = Result(cmbSelect.Text, text); //Alert Message texto = Resource.encrypText; _RunningAlertId++; eDesktopAlertColor color = eDesktopAlertColor.BlueGray; eAlertPosition position = eAlertPosition.BottomRight; DesktopAlert.Show(texto, "\uf005", eSymbolSet.Awesome, Color.Empty, color, position, 4, _RunningAlertId, AlertClicked); return; } if (swtSelect.Value == false && !String.IsNullOrEmpty(txtDecrypt.Text)) { text = txtDecrypt.Text; txtResponse.Text = Result(cmbSelect.Text, text); //Alert Message texto = Resource.decryptText; _RunningAlertId++; eDesktopAlertColor color = eDesktopAlertColor.BlueGray; eAlertPosition position = eAlertPosition.BottomRight; DesktopAlert.Show(texto, "\uf005", eSymbolSet.Awesome, Color.Empty, color, position, 4, _RunningAlertId, AlertClicked); return; } MessageBox.Show(Resource.errorMessageComplete, "EncryptDecrypt SEMP", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } catch (Exception ex) { MessageBox.Show(Resource.errorMessage + ex.Message, "EncryptDecrypt SEMP", MessageBoxButtons.OK, MessageBoxIcon.Information); } }