예제 #1
0
        private void button_OK_Click(object sender, EventArgs e)
        {
            if (listView_users.SelectedItems.Count == 0)
            {
                // prompt user
                string title     = LanguageINI.GetString("headerSelectUserFromList");
                string msg       = LanguageINI.GetString("lblSelectUserFromList");
                string buttonTxt = LanguageINI.GetString("Ok");
                GUI_Controls.RoboMessagePanel prompt = new GUI_Controls.RoboMessagePanel(RoboSep_UserConsole.getInstance(), GUI_Controls.MessageIcon.MBICON_WARNING, msg, title, buttonTxt);
                RoboSep_UserConsole.showOverlay();
                prompt.ShowDialog();
                prompt.Dispose();
                RoboSep_UserConsole.hideOverlay();
                return;
            }
            SelectedUser = listView_users.SelectedItems[0].Tag as string;
            RoboSep_UserConsole.hideOverlay();
            this.DialogResult = DialogResult.OK;
            this.Close();

            // LOG
            string logMSG = "User " + listView_users.SelectedItems[0].Text + " Selected";

            LogFile.AddMessage(System.Diagnostics.TraceLevel.Info, logMSG);
        }
예제 #2
0
        private bool validateUser()
        {
            string username = textBox_UserName.Text.ToUpper();

            if (username.Length < 5)
            {
                string sTitle = GUI_Controls.UserDetails.getValue("GUI", "headerLoginError3");
                string sMSG   = GUI_Controls.UserDetails.getValue("GUI", "msgLoginError3");
                sMSG = sMSG == null ? "User Name entered is not long enough" : sMSG;
                GUI_Controls.RoboMessagePanel newPrompt = new GUI_Controls.RoboMessagePanel(RoboSep_UserConsole.getInstance(), GUI_Controls.MessageIcon.MBICON_ERROR,
                                                                                            sMSG, sTitle);
                RoboSep_UserConsole.getInstance().addForm(newPrompt, newPrompt.Offset);
                RoboSep_UserConsole.showOverlay();
                newPrompt.ShowDialog();
                newPrompt.Dispose();
                RoboSep_UserConsole.hideOverlay();
                //MessageBox.Show("User name not long enough");
                return(false);
            }
            for (int i = 0; i < username.Length; i++)
            {
                if (!((int)username[i] >= 65 && (int)username[i] <= 90 || (int)username[i] == 32))
                {
                    string sTitle  = GUI_Controls.UserDetails.getValue("GUI", "headerLoginError");
                    string sMSG    = GUI_Controls.UserDetails.getValue("GUI", "msgLoginError1");
                    string sButton = GUI_Controls.UserDetails.getValue("GUI", "Ok");
                    sMSG = sMSG == null ? "User name should not include numbers, symbols, or punctuation" : sMSG;
                    GUI_Controls.RoboMessagePanel newPrompt = new GUI_Controls.RoboMessagePanel(RoboSep_UserConsole.getInstance(), GUI_Controls.MessageIcon.MBICON_ERROR,
                                                                                                sMSG, sTitle, sButton);
                    RoboSep_UserConsole.getInstance().addForm(newPrompt, newPrompt.Offset);
                    RoboSep_UserConsole.showOverlay();
                    newPrompt.ShowDialog();
                    newPrompt.Dispose();
                    RoboSep_UserConsole.hideOverlay();
                    //MessageBox.Show("User name should not include symbols or punctuation");
                    return(false);
                }
                if (i < (username.Length - 2))
                {
                    if (username[i] == username[i + 1] && username[i] == username[i + 2])
                    {
                        string sTitle = GUI_Controls.UserDetails.getValue("GUI", "headerLoginError");
                        string sMSG   = GUI_Controls.UserDetails.getValue("GUI", "msgLoginError2");
                        sMSG = sMSG == null ? "Incorrenctly typed User Name" : sMSG;
                        string sButton = GUI_Controls.UserDetails.getValue("GUI", "Ok");
                        GUI_Controls.RoboMessagePanel newPrompt = new GUI_Controls.RoboMessagePanel(RoboSep_UserConsole.getInstance(), GUI_Controls.MessageIcon.MBICON_ERROR,
                                                                                                    sMSG, sTitle, sButton);
                        RoboSep_UserConsole.getInstance().addForm(newPrompt, newPrompt.Offset);
                        RoboSep_UserConsole.showOverlay();
                        newPrompt.ShowDialog();
                        newPrompt.Dispose();
                        RoboSep_UserConsole.hideOverlay();
                        //MessageBox.Show("Incorrectly typed user name");
                        return(false);
                    }
                }
            }
            return(true);
        }
예제 #3
0
 private void Login()
 {
     if (validateUser())
     {
         bool[] userType = new bool[3] {
             checkBox_standardUser.Check, checkBox_maintenanceUser.Check, checkBox_superUser.Check
         };
         for (int i = 0; i < 3; i++)
         {
             if (userType[i])
             {
                 if (textBox_servicePassword.Text == Passwords[i])
                 {
                     GUI_Controls.RoboMessagePanel newPrompt = new GUI_Controls.RoboMessagePanel(RoboSep_UserConsole.getInstance(), GUI_Controls.MessageIcon.MBICON_INFORMATION,
                                                                                                 "Success, you have entered the right password!", "Password Correct");
                     RoboSep_UserConsole.getInstance().addForm(newPrompt, newPrompt.Offset);
                     RoboSep_UserConsole.showOverlay();
                     newPrompt.ShowDialog();
                     RoboSep_UserConsole.hideOverlay();
                     if (newPrompt.DialogResult == DialogResult.OK)
                     {
                         ActiveControl = textBox_servicePassword;
                     }
                     newPrompt.Dispose();
                 }
                 else
                 {
                     GUI_Controls.RoboMessagePanel newPrompt = new GUI_Controls.RoboMessagePanel(RoboSep_UserConsole.getInstance(), GUI_Controls.MessageIcon.MBICON_ERROR,
                                                                                                 "Incorrect password, Password is case sensetive", "Incorrect Password");
                     RoboSep_UserConsole.showOverlay();
                     newPrompt.ShowDialog();
                     RoboSep_UserConsole.hideOverlay();
                     if (newPrompt.DialogResult == DialogResult.OK)
                     {
                         ActiveControl = textBox_servicePassword;
                     }
                     newPrompt.Dispose();
                 }
             }
         }
     }
 }