//look for the user enetering their userid private void EmployeeID_KeyUp(object sender, KeyEventArgs e) { if (e.Key != System.Windows.Input.Key.Enter) { return; } int empid; employeeID = EmployeeID.Text; if (!Int32.TryParse(employeeID, out empid)) { Errormsg.Text = string.Format("invalid employeeid"); ErrorTxt.Visibility = Visibility.Visible; return; } OnTheSpot.Models.Employee employee = vm.GetEmployee(empid); vm.Employeename = employee.FirstName + " " + employee.LastName; if (employee == null) { Errormsg.Text = string.Format("invalid employeeid"); ErrorTxt.Visibility = Visibility.Visible; return; } UI.Visibility = Visibility.Visible; Login.Visibility = Visibility.Collapsed; msg.Text = vm.Employeename + " logged in"; Loggedin.Visibility = Visibility.Visible; Barcode.Focus(); }
//look for the user enetering their userid private void EmployeeID_KeyUp(object sender, KeyEventArgs e) { if (e.Key != System.Windows.Input.Key.Enter) { return; } int empid; Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait; employeeID = EmployeeID.Text; if (!Int32.TryParse(employeeID, out empid)) { Errormsg.Text = string.Format("invalid employeeid"); ErrorTxt.Visibility = Visibility.Visible; return; } Employee employee = vm.GetEmployee(empid); vm.Employeename = employee.FirstName + " " + employee.LastName; if (employee == null) { Errormsg.Text = string.Format("invalid employeeid"); ErrorTxt.Visibility = Visibility.Visible; return; } Mouse.OverrideCursor = System.Windows.Input.Cursors.Arrow; UI.Visibility = Visibility.Visible; //DoubleAnimation da = new DoubleAnimation(0, 1, TimeSpan.FromSeconds(2)); //da.AutoReverse = false; //UI.BeginAnimation(Line.OpacityProperty, da); Login.Visibility = Visibility.Collapsed; msg.Text = vm.Employeename + " currently logged in"; Loggedin.Visibility = Visibility.Visible; Note.Visibility = Visibility.Hidden; if (employeeID == "1") { Note.Visibility = Visibility.Visible; ShowPass.Visibility = Visibility.Visible; } Barcode.Focus(); }