//initialization of screen //passes in user info from login screen public WelcomeScreen(UserInfo loginInfo) { user = loginInfo; username = loginInfo.getUsername(); InitializeComponent(); //Check if any exercises need to be done NpgsqlConnection conn = new NpgsqlConnection("Server=127.0.0.1;Port=5432;User Id=postgres;Password=useitlab;Database=UserData;"); conn.Open(); //get all uncompleted exercises for dates before todays date string today = DateTime.Today.ToShortDateString(); string sql = "SELECT exercisenum FROM exerciseinfo WHERE (date < '"+today+"') AND (usernum = (SELECT usernum FROM userinfo WHERE username ='******')) AND (completed = false)"; NpgsqlDataAdapter da = new NpgsqlDataAdapter(sql, conn); ds.Reset(); da.Fill(ds); dt = ds.Tables[0]; if (dt.Rows.Count == 0) { } else { todayExercise = (int)dt.Rows[0].ItemArray[0]; } this.label1.Text = "Welcome " + username + "!"; conn.Close(); }
public void fillUsernameAndPass(CreateNewUser newUser, UserInfo newInfo) { username = newInfo.getUsername(); password = newInfo.getPassword(); //NewUser.Close(); //UserControl1 NewUser2 = new UserControl1(); }