private void MyDevice_TransactionEvent(object sender, TransactionEventArgs e) { timer1.Enabled = false; var item = new BiometricUser(); var reader = new BiometricUserDataReader(); item = reader.GetBasicInfoForSmsOf(e.UserData.BiometricId); LoadImage((item.PersonClass.CameraCounter)); lblTime.BackColor = e.State == 0 ? Color.SpringGreen : Color.Red; if (e.State == 0) { lblTime.Text = string.Format(" LOG IN : \n{0}", e.TransactionDate.ToString("dddd dd MMM yyyy\n hh:mm:ss tt")); } else { lblTime.Text = string.Format(" LOG OUT: \n{0}", e.TransactionDate.ToString("dddd dd MMM yyyy\n hh:mm:ss tt")); } lblName.Text = " Name:\n<h1>%name%</h1>".Replace("%name%", item.PersonClass.Name.Fullname); timer1.Enabled = true; }
private bool SendSMS(BiometricTransaction transaction) { try { Cursor.Current = Cursors.WaitCursor; var reader = new BiometricUserDataReader(); var data = reader.GetBasicInfoForSmsOf(transaction.BiometricId); data.PhoneNumber = data.PhoneNumber.Replace(" ", "").Replace("-", ""); //var cellNum = reader.GetPhoneNumberOf(transaction.BiometricId); //cellNum = cellNum.Replace(" ", "").Replace("-", ""); var message = "%date%\n\n"; message += "Name: %name%\n"; message += "Biometric Id: %biometricid%\n"; //message += "Good day! This confirms your biometric entry on the above mentioned time.\n"; message += "This is a system generated message. Do not reply"; message = message.Replace("%date%", transaction.TimeLog.ToString("dd MMM yyyy, hh:mm:ss tt")); message = message.Replace("%name%", data.PersonClass.Name.Fullname); var cellNum = data.PhoneNumber; if (_redirectedSmsNumber.Length > 2) { cellNum = _redirectedSmsNumber; } txtStatus.AppendText(@"Sending SMS...to: " + cellNum); if (!MySms.SendSms(Port, cellNum, message)) { txtStatus.AppendText("Failed to send message"); // MySms.SendSms(Port, cellNum, "Good day!This confirms your biometric entry on the above mentioned time.\n"); return(true); } // MySms.SendSms(Port, cellNum, "Good day!This confirms your biometric entry on the above mentioned time.\n"); //Console.WriteLine(result); txtStatus.AppendText("Message has sent successfully\n"); return(true); } catch (Exception ex) { //MessageBox.Show(ex.Message); txtStatus.AppendText(ex.Message + "\n"); return(false); } }
private void btnBiometricLog_Click(object sender, EventArgs e) { var biometricUser = new Dll.Biometric.BiometricUser(); using (var frmOpen = new Biometric.frmBiometric_Open()) { if (frmOpen.ShowDialog() != DialogResult.OK) { return; } var reader = new BiometricUserDataReader(); biometricUser = reader.GetBasicInfoForSmsOf(frmOpen.BiometricId); } var frm = new frmBiometric_Log(); frm.ItemData = biometricUser; OpenForm(frm, @"Biometric Log\" + biometricUser.BiometricId.ToString()); }