private void buttonCancel_Click(object sender, EventArgs e) { AdminPanel AP = new AdminPanel(); AP.Show(); this.Close(); }
private void buttonLogin_Click(object sender, EventArgs e) { AdminPanel adminPanel = new AdminPanel(); adminPanel.Show(); this.Close(); }
private void buttonReturn_Click(object sender, EventArgs e) // Button to return admin panel { AdminPanel Ap = new AdminPanel(); Ap.Show(); this.Close(); }
private void buttonCancel_Click(object sender, EventArgs e) { AdminPanel AP = new AdminPanel(); AP.Show(); AP.labelUsername.Text = username; this.Close(); }
private void buttonLogin_Click(object sender, EventArgs e) { bool loginCheck = false; XmlDocument admins = new XmlDocument(); admins.Load(adminXmlFileLocation); XmlNodeList usernameList = admins.GetElementsByTagName("username"); XmlNodeList passwordList = admins.GetElementsByTagName("password"); for (int i = 0; i < usernameList.Count; i++) { adminsRecordsList.Add(new adminsRecords { username = usernameList[i].InnerXml.ToString(), password = passwordList[i].InnerXml.ToString(), }); } for (int i = 0; i < adminsRecordsList.Count; i++) { if (textBoxName.Text == adminsRecordsList[i].username.ToString() && textBoxPassword.Text == adminsRecordsList[i].password.ToString()) { var adminsDoc = XDocument.Load(adminXmlFileLocation); var items = from item in adminsDoc.Descendants("admin") where (item.Element("username").Value == textBoxName.Text.ToString() && item.Element("password").Value == textBoxPassword.Text.ToString()) select item; foreach (XElement itemElement in items) { itemElement.SetElementValue("username", textBoxName.Text.ToString()); itemElement.SetElementValue("password", textBoxPassword.Text.ToString()); itemElement.SetElementValue("lastLogin", System.DateTime.Now.ToString()); } adminsDoc.Save(adminXmlFileLocation); AdminPanel AP = new AdminPanel(); AP.labelUsername.Text = textBoxName.Text.ToString(); AP.Show(); this.Hide(); loginCheck = true; break; } else /*doNothing*/ } { } if (!loginCheck) //login fails { labelErrorMessage.Visible = true; } else /*doNothing*/ } {