void Counter_Closing(object sender, System.ComponentModel.CancelEventArgs e) { this.timeCounter.Stop(); new MainWindow().Show(); this.LogoutOperation(); MiraculousMethods.conterInformation.CustomerID = null; MiraculousMethods.conterInformation.Status = CounterStatus.Free; customerDetail = null; }
/// <summary> /// Default Constructor /// </summary> public Counter() { customerDetail = new UserInfoViewer(); this.InitializeComponent(); this.Top = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height - (this.Height + 50); this.Left = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width - (this.Width + 10); timeCounter.Interval = new TimeSpan(0, 0, 59); counterNumber = Properties.Settings.Default.CounterNumber; timeCounter.Start(); this.Closing += new System.ComponentModel.CancelEventHandler(Counter_Closing); counterWindow = this; }
/// <summary> /// With User Information /// </summary> /// <param name="userinfo"></param> public static void CounterWindow(UserInfoViewer loggedInUserInfo) { Counter counterWindow = new Counter(); counterWindow.customerDetail = loggedInUserInfo; MiraculousMethods.conterInformation.CustomerID = loggedInUserInfo.Username; MiraculousMethods.conterInformation.Status = CounterStatus.Busy; if (String.IsNullOrEmpty(loggedInUserInfo.TeamName) || String.IsNullOrWhiteSpace(loggedInUserInfo.TeamName)) { counterWindow.userLoginTimer(); } else { counterWindow.teamLoginTimer(); } counterWindow.Show(); }
private void customerLogin(object obj) { this.IsBusy = true; this.CustomerLogin.IsEnabled = false; Mouse.OverrideCursor = Cursors.Wait; try { UserInfoViewer loggedInCutomer = obj as UserInfoViewer; if (String.IsNullOrEmpty(loggedInCutomer.Username) || String.IsNullOrWhiteSpace(loggedInCutomer.Username) || String.IsNullOrEmpty(loggedInCutomer.Password) || string.IsNullOrWhiteSpace(loggedInCutomer.Password)) { DXMessageBox.Show("Please enter Username and Password", CVsVariables.ERROR_MESSAGES[0, 0], MessageBoxButton.OK, MessageBoxImage.Error); return; } if (ServerConnection.serviceFromServer == null || !ServerConnection.ServerAliveIs((ICommunicationObject)ServerConnection.serviceFromServer)) { ServerConnection.ConnectToService(); } if (String.IsNullOrEmpty(loggedInCutomer.TeamName) || String.IsNullOrWhiteSpace(loggedInCutomer.TeamName)) { List <Int64> userInformation = ServerConnection.serviceFromServer.UserLogin(loggedInCutomer.Username, loggedInCutomer.Password, Properties.Settings.Default.CounterNumber); loggedInCutomer.Minutes = userInformation.First(); loggedInCutomer.LoginHistoryID = userInformation.Last(); } else { List <Int64> teamInformation = ServerConnection.serviceFromServer.TeamLogin(loggedInCutomer.Username, loggedInCutomer.Password, Properties.Settings.Default.CounterNumber, loggedInCutomer.TeamName); loggedInCutomer.Minutes = teamInformation.First(); loggedInCutomer.LoginHistoryID = teamInformation.Last(); } loggedInCutomer.Photo = ServerConnection.serviceFromServer.GetUserImage(loggedInCutomer.Username); Counter.CounterWindow(loggedInCutomer); this.Close(); } catch (Exception error) { Mouse.OverrideCursor = null; DXMessageBox.Show(error.Message, CVsVariables.ERROR_MESSAGES[0, 0], MessageBoxButton.OK, MessageBoxImage.Error); } finally { this.CustomerLogin.IsEnabled = true; Mouse.OverrideCursor = null; this.IsBusy = false; } }