public AdminWindow(User AdminInfo) { InitializeComponent(); }
public User GetAdminLoginDetails(string UserName) { User AdminInfo = null; string commandText = "SELECT * FROM AdminInfo WHERE (UserName = @userName)"; using (SqlCeConnection connection = new SqlCeConnection(connectionSting)) { using (SqlCeCommand command = new SqlCeCommand(commandText, connection)) { try { connection.Open(); command.Parameters.AddWithValue("@userName", UserName); SqlCeDataReader reader = command.ExecuteReader(); AdminInfo = new User(); while (reader.Read()) { AdminInfo.UID = new Guid(reader[0].ToString()); AdminInfo.Name = reader[1].ToString(); AdminInfo.UserName = reader[2].ToString(); AdminInfo.Password = reader[3].ToString(); AdminInfo.IDNumber = reader[4].ToString(); } } catch (Exception e) { MessageBox.Show(e.ToString()); } } } return AdminInfo; }