public updateForm(User incomingUser, int incomingEventID) { currentUser = incomingUser; currentEventID = incomingEventID; InitializeComponent(); endTime = EventEntity.getEndTime(currentEventID); }
public attendanceForm(User currentUser, int incomingEventID, attendanceListState incomingState) { this.currentUser = currentUser; currentEventID = incomingEventID; currentState = incomingState; InitializeComponent(); }
public eventInfoForm(User incomingUser, int incomingEventID) { currentUser = incomingUser; currentEventID = incomingEventID; InitializeComponent(); initMainEventList(); }
public createEventForm(User incomingUser) { currentUser = incomingUser; InitializeComponent(); initMainEventList(); initBudgetList(); }
public editBudgetForm(User incomingUser, int incomingEventID) { currentUser = incomingUser; currentEventID = incomingEventID; InitializeComponent(); initBudgetList(); }
public ActiveUser(User copyingUser) { userId = copyingUser.getUserId(); userName = copyingUser.getUserName(); name = copyingUser.getName(); matricNo = copyingUser.getMatricNo(); password = copyingUser.getPW(); email = copyingUser.getEmail(); age = copyingUser.getAge(); loggedIn = copyingUser.getLoggedIn(); contactHome = copyingUser.getContactHome(); contactHP = copyingUser.getContactHP(); }
//Constructor public Facilitator(User copyingUser) { userId = copyingUser.getUserId(); userName = copyingUser.getUserName(); name = copyingUser.getName(); matricNo = copyingUser.getMatricNo(); password = copyingUser.getPW(); email = copyingUser.getEmail(); age = copyingUser.getAge(); loggedIn = copyingUser.getLoggedIn(); contactHome = copyingUser.getContactHome(); contactHP = copyingUser.getContactHP(); loadAllJoinedEvents(); }
public Participant(User copyingUser) { userId = copyingUser.getUserId(); userName = copyingUser.getUserName(); name = copyingUser.getName(); matricNo = copyingUser.getMatricNo(); password = copyingUser.getPW(); email = copyingUser.getEmail(); age = copyingUser.getAge(); loggedIn = copyingUser.getLoggedIn(); contactHome = copyingUser.getContactHome(); contactHP = copyingUser.getContactHP(); loadAllRegisteredEvents(); }
//Initiatisation public mainPage(User incomingUser) { InitializeComponent(); currentUser = incomingUser; //initialise Timer for AmazonWebService pollingTimer = new System.Timers.Timer(AmazonWebServicePollInterval); pollingTimer.Enabled = true; pollingTimer.Elapsed += new ElapsedEventHandler(pollingTimeReached); pollingTimer.AutoReset = true; pollingTimer.Start(); //initialise Timer for Alerts alertTimer = new System.Timers.Timer(alertInterval); alertTimer.Enabled = true; alertTimer.Elapsed += new ElapsedEventHandler(alertTimeReached); alertTimer.AutoReset = true; alertTimer.Start(); //Initialised Dynamic Controls initAnnouncementList(); initMainEventList(); initSideDDL(); initSideEventBar(); //Check Internet Connection checkInternetConnection(); // Check For Starting Events concerning this current user ActiveUser au = new ActiveUser(currentUser); au.checkForStartingEvent(); // Start Alert Check/Display displayAlert(); }
public AlertForm(User currentUser) { this.currentUser = currentUser; InitializeComponent(); }
public bool login(string tokenUserName, string tokenPassWord,ref User returningUser) { bool auth = false; this.userName = tokenUserName; this.password = tokenPassWord; if (loggedIn == true) auth = true; else { Database db = Database.CreateDatabase(DatabaseToken); List<User> obtainedUserList = db.getListOfUsers(); foreach(User cu in obtainedUserList) { if (cu.userName == tokenUserName && tokenPassWord == cu.password) { auth = true; //Set user to loggedIn cu.loggedIn = true; //Set all attributes of this user userId = cu.userId; userName = cu.userName; name = cu.name; matricNo = cu.matricNo; password = cu.password; email = cu.email; age = cu.age; loggedIn = true; contactHome = cu.contactHome; contactHP = cu.contactHP; break; } } //Save LoginIn Status db.saveListOfUsers(obtainedUserList); } if (auth) { returningUser = this; return true; } else { // returningUser = returningUser; return false; } }
public bool createNewUser() { Database db = Database.CreateDatabase(DatabaseToken); bool userCreated = true; bool checkUNameExist = false; List<User> listOfUsers = db.getListOfUsers(); foreach(User checkUser in listOfUsers) { if (checkUser.userName == userName) checkUNameExist = true; } if (checkUNameExist == false) { User test = new User(findTheNextUnusedUserId(listOfUsers), userName, name, matricNo, password, email, age, loggedIn, contactHome, contactHP); listOfUsers.Add(test); db.saveListOfUsers(listOfUsers); } else { userCreated = false; } return userCreated; }
private void signupButton_Click_1(object sender, EventArgs e) { string emailFmt = @"^(?("")(""[^""]+?""@)|(([0-9a-z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-z])@))(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-z][-\w]*[0-9a-z]*\.)+[a-z0-9]{2,17}))$"; Regex emailFormat = new Regex(emailFmt); if (usernameTextBox.Text == "" && passwordTextBox.Text == "" && cfmPasswordTextBox.Text == "" && ageComboBox.SelectedItem == null && nameTextBox.Text == "" && matricNoTextBox.Text == "" && phoneNumberTextBox.Text == "" && emailTextBox.Text == "" && homeTextBox.Text == "") { MessageBox.Show("Please complete all your details. Thank You.", "Detail Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (usernameTextBox.Text == "") { MessageBox.Show("Please enter your username.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (passwordTextBox.Text == "") { MessageBox.Show("Please enter your password.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (cfmPasswordTextBox.Text == "") { MessageBox.Show("Please confirm your password.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (ageComboBox.SelectedItem == null) { MessageBox.Show("Please select your age.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (matricNoTextBox.Text == "") { MessageBox.Show("Please enter your matric no.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (phoneNumberTextBox.Text == "" || homeTextBox.Text == "") { MessageBox.Show("Please enter a contact number", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (emailTextBox.Text == "") { MessageBox.Show("Please enter your email.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (nameTextBox.Text == "") { MessageBox.Show("Please enter your name.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (!passwordTextBox.Text.Equals(cfmPasswordTextBox.Text)) { MessageBox.Show("Your Passwords do not match. Please Try Again.", "Password Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (!emailFormat.IsMatch(emailTextBox.Text)) { MessageBox.Show("You Email Address is not in a correct format.", "Email address error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { int userNameErrorCount = 0; int nameErrorCount = 0; string matricNo = matricNoTextBox.Text; matricNo = matricNo.ToUpper(); string PhoneNo = phoneNumberTextBox.Text; string pwdLength = passwordTextBox.Text; string username = usernameTextBox.Text; username = username.ToLower(); string temp = nameTextBox.Text; temp = temp.ToLower(); int nameLength = temp.Length; for (int i = 0; i < nameLength; i++) { if (temp[i] >= 'a' && temp[i] <= 'z') { // do nothing } else { if (temp[i] == ' ' || temp[i] == '/' || temp[i] == '.') { // do nothing } else nameErrorCount++; } } if (username.Length < 6) { MessageBox.Show("Your Username must have at least 6 characters.", "Username Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (nameErrorCount > 0) { MessageBox.Show("Invalid Name.", "Name Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (pwdLength.Length < 6) { MessageBox.Show("Your Password must have at least 6 characters.", "Password Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (PhoneNo.Length < 8) { MessageBox.Show("Your Contact Number is not in a correct format. Please Try Again.", "Phone No Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (matricNo.Length < 9) { MessageBox.Show("Your Matriculation Number is not in a correct format. Please Try Again.", "Matric No Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { int uNameLength = username.Length; for (int i = 0; i < uNameLength; i++) { if (username[i] >= 'a' && username[i] <= 'z') { // do nothing } else { if (username[i] < '0' || username[i] > '9') userNameErrorCount++; } } if (userNameErrorCount > 0) { MessageBox.Show("Your Username should only have alphanumeric characters. Please Try Again.", "Username Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if ((matricNo[0] != 'A' && matricNo[0] != 'U') || (matricNo[8] < 'A' || matricNo[8] > 'Z')) { MessageBox.Show("Your Matriculation Number is not in a correct format. Please Try Again.", "Matric No Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { int matricNoCountError = 0; for (int i = 1; i < 8; i++) { if (matricNo[i] < '0' || matricNo[i] > '9') matricNoCountError++; } if (matricNoCountError > 0) { MessageBox.Show("Your Matriculation Number is not in a correct format. Please Try Again.", "Matric No Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { DialogResult result = MessageBox.Show("Confirm signup?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (result == DialogResult.Yes) { string filename = "users.xml"; int getID = 1; if (File.Exists(filename)) { getID = User.retrievelastID(); } User signUp = new User(getID, username, nameTextBox.Text, matricNo, passwordTextBox.Text, emailTextBox.Text, int.Parse(ageComboBox.SelectedItem.ToString()), false, double.Parse(homeTextBox.Text), double.Parse(phoneNumberTextBox.Text)); bool checkUNameExist = signUp.createNewUser(); if (checkUNameExist == true) { MessageBox.Show("You have successfully created an account. Thank You!", "Create success", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } else { MessageBox.Show("Username already exists. Please choose another Username. Thank You.", "Username existed.", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } } } }
public static void ThreadProc() { User newUser = new User(); Application.Run(new loginForm(newUser)); }
public Analytic(User incomingUser) { currentUser = new Organiser(incomingUser); InitializeComponent(); }
public welcomeForm(User incomingUser) { InitializeComponent(); currentUser = incomingUser; }
public loginForm(User incomingUser) { InitializeComponent(); currentUser = incomingUser; }
//Users Database Interaction Implementation public List<User> getListOfUsers() { List<User> listToPop = new List<User>(); XmlReaderSettings settings = new XmlReaderSettings(); settings.IgnoreWhitespace = true; using (XmlReader scanner = XmlReader.Create("users.xml", settings)) { scanner.MoveToContent(); scanner.ReadToDescendant("User"); do { scanner.ReadToDescendant("userId"); int userId = scanner.ReadElementContentAsInt(); string userName = scanner.ReadElementContentAsString("userName", ""); string name = scanner.ReadElementContentAsString("name", ""); string matricNo = scanner.ReadElementContentAsString("matricNo", ""); string pw = scanner.ReadElementContentAsString("password", ""); string em = scanner.ReadElementContentAsString("email", ""); int age = scanner.ReadElementContentAsInt(); bool loggedIn = scanner.ReadElementContentAsBoolean(); double HomeNum = scanner.ReadElementContentAsDouble(); double HPContact = scanner.ReadElementContentAsDouble(); User newlyReadUser = new User(userId, userName, name, matricNo, pw, em, age, loggedIn, HomeNum, HPContact); listToPop.Add(newlyReadUser); } while (scanner.ReadToNextSibling("User")); } return listToPop; }