private void openToolStripMenuItem_Click(object sender, EventArgs e) { var mainPageForm = new MainPageForm(); Hide(); mainPageForm.Show(); }
private void btn_backtoMainPage_Click(object sender, EventArgs e) { var mainPageForm = new MainPageForm(); Hide(); mainPageForm.Show(); }
private void LoginButton_Click(object sender, EventArgs e) { //define local variables from the user inputs string user = nametxtbox.Text; string pass = pwdtxtbox.Text; //check if eligible to be logged in if (login.IsLoggedIn(user, pass)) { /* var Landingpage = (LandingPage.LandingPageForm)Tag; * Hide(); * Landingpage.Show();*/ try { var dateTimeToday = DateTime.Today.ToString("yyyy-MM-dd"); MySqlConnection conCal = DietTracker.DatabaseConnect.OpenDefaultDBConnection(); MySqlConnection conCCal = DietTracker.DatabaseConnect.OpenDefaultDBConnection(); MySqlCommand WhatIsCurrentCalorieCommand = new MySqlCommand(); WhatIsCurrentCalorieCommand.CommandText = "SELECT Calories FROM diettracker.day WHERE UserID = '" + user + "' AND Date = '" + dateTimeToday + "';"; WhatIsCurrentCalorieCommand.Connection = conCCal; conCCal.Open(); MySqlDataReader ReadCalories = WhatIsCurrentCalorieCommand.ExecuteReader(); if (ReadCalories.Read() == false) { int CaloriesRead = 0; MessageBox.Show("You are logged in successfully!"); MainPageForm mainPage = new MainPageForm(user, CaloriesRead); mainPage.Tag = this; Hide(); mainPage.Show(this); } else { int CaloriesRead = ReadCalories.GetInt32(0); conCCal.Close(); MessageBox.Show("You are logged in successfully!"); MainPageForm mainPage = new MainPageForm(user, CaloriesRead); mainPage.Tag = this; Hide(); mainPage.Show(this); } } catch { MessageBox.Show("Couldn't log in"); } } }
private void bntLogin_Click(object sender, EventArgs e) { if (txbId.Text == "") { MessageBox.Show("ID를 입력해주세요."); return; } if (txbPassword.Text == "") { MessageBox.Show("비밀번호를 입력해주세요."); return; } Customer customer = DataRepository.Customer.Login(txbId.Text, txbPassword.Text); if (customer == null) { MessageBox.Show("사용자 정보가 올바르지 않습니다."); } else if (DataRepository.Seat.LoginCheck(customer.CustomerID)) { MessageBox.Show("이미 사용중인 사용자 입니다."); } else if (customer.RemainingTime <= 0) { MessageBox.Show("잔여시간이 부족합니다."); } else { String seatNumber = cbbSeat.Text; MainPageForm MainPage = new MainPageForm(customer, seatNumber); MainPage.ShowDialog(); } }