public watchListForm(BusinessTier.User usr, BusinessTier.BusinessLogic b) { InitializeComponent(); this.loggedUser = usr; this.bLogic = b; searchAutocomplete(); if (bLogic.isWatchlistEmpty(loggedUser.id)) { watchlistDataGridView.Rows.Clear(); removeFromWatchlist.Enabled = false; } else { populateWatchListTable(); removeFromWatchlist.Enabled = true; //populateGraph(); } industriesComboBox.ValueMember = "Industry"; industriesComboBox.DisplayMember = "Industry"; industriesComboBox.DataSource = bLogic.populateIndustryDropDown(); }
public HistoryStatementForm(BusinessTier.User usr, BusinessTier.BusinessLogic b) { InitializeComponent(); this.loggedUser = usr; this.bLogic = b; displayHistoryStatementGrid(); }
public HistoryStatementForm(BusinessTier.User usr, BusinessTier.BusinessLogic b) { InitializeComponent(); this.loggedUser = usr; this.bLogic = b; displayHistoryStatementGrid(); }
public bool validateUser(User usr) { if (usr.userName == string.Empty || usr.password == string.Empty) { throw new System.ArgumentException("UserName or password can't be empty"); } else { string sql = string.Format(@" SELECT ID, FirstName, LastName, Email, Balance FROM Users WHERE UserName='******' AND UserPassword='******'; ", usr.userName, usr.password); DataSet ds = dataTier.ExecuteNonScalarQuery(sql); if (ds.Tables[0].Rows.Count == 0) { return false; } DataTable dt = ds.Tables["TABLE"]; foreach (DataRow r in dt.Rows) { usr.id = System.Convert.ToInt32(r["ID"]); usr.firstName = System.Convert.ToString(r["FirstName"]); usr.lastName = System.Convert.ToString(r["LastName"]); usr.email = System.Convert.ToString(r["Email"]); usr.balance = System.Convert.ToDouble(r["Balance"]); return true; } } return false; }
public PurchaseForm(BusinessTier.User usr, BusinessTier.BusinessLogic b) { InitializeComponent(); this.loggedUser = usr; this.bLogic = b; this.nameLabel.Text += " " + loggedUser.firstName.ToString() + " " + loggedUser.lastName.ToString(); this.cashTextBox.Text = loggedUser.balance.ToString(); this.Size = new Size(851, 620); searchAutocomplete(); industriesComboBox.ValueMember = "Industry"; industriesComboBox.DisplayMember = "Industry"; industriesComboBox.DataSource = bLogic.populateIndustryDropDown(); }
public PurchaseForm(BusinessTier.User usr, BusinessTier.BusinessLogic b) { InitializeComponent(); this.loggedUser = usr; this.bLogic = b; this.nameLabel.Text += " " + loggedUser.firstName.ToString() +" "+ loggedUser.lastName.ToString(); this.cashTextBox.Text = loggedUser.balance.ToString(); this.Size = new Size(851, 620); searchAutocomplete(); industriesComboBox.ValueMember = "Industry"; industriesComboBox.DisplayMember = "Industry"; industriesComboBox.DataSource = bLogic.populateIndustryDropDown(); }
private void lstMovies_SelectedIndexChanged(object sender, EventArgs e) { this.txtMovieID.Items.Clear(); this.movieRating.Items.Clear(); this.userID.Items.Clear(); this.occupation.Items.Clear(); this.secondBox.Items.Clear(); string dbfilename = this.txtDatabase.Text; BusinessTier.Business biztier = new BusinessTier.Business(dbfilename); BusinessTier.User user = biztier.GetNamedUser(this.lstMovies.Text); BusinessTier.Movie movie = biztier.GetMovie(this.lstMovies.Text); if (user == null) { this.txtMovieID.Items.Add(string.Format("{0}", movie.MovieID)); var details = biztier.GetMovieDetail(movie.MovieID); this.movieRating.Items.Add(string.Format("{0}", details.AvgRating)); BusinessTier.MovieDetail detail = biztier.GetMovieDetail(movie.MovieID); foreach (BusinessTier.Review i in detail.Reviews) { this.secondBox.Items.Add(string.Format("{0}: {1}", i.UserID, i.Rating)); } } if (movie == null) { this.userID.Items.Add(string.Format("{0}", user.UserID)); this.occupation.Items.Add(string.Format("{0}", user.Occupation)); BusinessTier.UserDetail detail = biztier.GetUserDetail(user.UserID); foreach (BusinessTier.Review i in detail.Reviews) { var movieName = biztier.GetMovie(i.MovieID); this.secondBox.Items.Add(string.Format("{0}-> {1}", movieName.MovieName, i.Rating)); } } }
public MainForm(BusinessTier.User usr, BusinessTier.BusinessLogic b) { InitializeComponent(); this.loggedUser = usr; this.bLogic = b; this.mainFormLoadingCircle.Visible = false; this.mainFormLoadingCircle.Active = true; this.mainFormLoadingCircle.OuterCircleRadius = 42; this.mainFormLoadingCircle.InnerCircleRadius = 14; this.mainFormLoadingCircle.SpokeThickness = 4; this.mainFormLoadingCircle.NumberSpoke = 14; // this enforces the user to see the hotkeys mainFormMenuStrip.Renderer = new CustomMenuStripRenderer(); this.KeyPreview = true; this.KeyDown += new KeyEventHandler(Form_KeyDown); this.Size = new Size(1002, 783); populateControls(this.zedPieControl); this.nameLabel.Text += " " + loggedUser.firstName.ToString() + " " + loggedUser.lastName.ToString(); this.cashTextBox.Text = loggedUser.balance.ToString(String.Format("c")); }
public MainForm(BusinessTier.User usr, BusinessTier.BusinessLogic b) { InitializeComponent(); this.loggedUser = usr; this.bLogic = b; this.mainFormLoadingCircle.Visible = false; this.mainFormLoadingCircle.Active = true; this.mainFormLoadingCircle.OuterCircleRadius = 42; this.mainFormLoadingCircle.InnerCircleRadius = 14; this.mainFormLoadingCircle.SpokeThickness = 4; this.mainFormLoadingCircle.NumberSpoke = 14; // this enforces the user to see the hotkeys mainFormMenuStrip.Renderer = new CustomMenuStripRenderer(); this.KeyPreview = true; this.KeyDown += new KeyEventHandler(Form_KeyDown); this.Size = new Size(1002, 783); populateControls(this.zedPieControl); this.nameLabel.Text += " " + loggedUser.firstName.ToString() + " " + loggedUser.lastName.ToString(); this.cashTextBox.Text = loggedUser.balance.ToString(String.Format("c")); }
private void button1_Click_1(object sender, EventArgs e) { // string username = this.namebox.Text; string rate = this.comboBox1.Text; string dbfilename = this.txtDatabase.Text; BusinessTier.Business biztier = new BusinessTier.Business(dbfilename); BusinessTier.Movie movie = biztier.GetMovie(this.movieBox.Text); BusinessTier.User user = biztier.GetNamedUser(this.namebox.Text); if (movie != null && user != null && (Convert.ToInt32(rate)) <= 5 && (Convert.ToInt32(rate)) > 0) { biztier.AddReview(Convert.ToInt32(movie.MovieID), Convert.ToInt32(user.UserID), Convert.ToInt32(rate)); } else { MessageBox.Show("invalid input"); } }
public watchListForm(BusinessTier.User usr, BusinessTier.BusinessLogic b) { InitializeComponent(); this.loggedUser = usr; this.bLogic = b; searchAutocomplete(); if (bLogic.isWatchlistEmpty(loggedUser.id)) { watchlistDataGridView.Rows.Clear(); removeFromWatchlist.Enabled = false; } else { populateWatchListTable(); removeFromWatchlist.Enabled = true; //populateGraph(); } industriesComboBox.ValueMember = "Industry"; industriesComboBox.DisplayMember = "Industry"; industriesComboBox.DataSource = bLogic.populateIndustryDropDown(); }
private async void signInButton_Click(object sender, EventArgs e) { string userName = this.userNameTextBox.Text.Trim(); string userPassword = this.PasswordTextBox.Text.Trim(); if (userName == string.Empty) { MessageBox.Show("User Name field cannot be empty.\n\nPlease enter user name.", "Empty User Name text box", MessageBoxButtons.OK, MessageBoxIcon.Warning); this.userNameTextBox.SelectAll(); this.userNameTextBox.Focus(); return; } else if (userPassword == string.Empty) { MessageBox.Show("Password field cannot be empty.\n\nPlease enter password.", "Empty Password text box", MessageBoxButtons.OK, MessageBoxIcon.Warning); this.PasswordTextBox.SelectAll(); this.PasswordTextBox.Focus(); return; } loggedUser = new BusinessTier.User(userName, userPassword); // check if password matches loginFormLoadingCircle.Visible = true; //await PutTaskDelay(); bool result; try { result = await Task.Run(() => bLogic.validateUser(loggedUser)); } catch (Exception ex) { MessageBox.Show(ex.ToString()); return; } loginFormLoadingCircle.Visible = false; if (result == true) { MainForm mainForm = new MainForm(loggedUser, bLogic); // creating event handler to catch the main form closed event // this will fire when mainForm closed mainForm.FormClosed += new FormClosedEventHandler(mainForm_FormClosed); //showing the main form mainForm.Show(); //hiding the current form this.Hide(); } else { MessageBox.Show("User Name or Password did not match our records.\nPlease try again.", "Invalid User", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private async void signInButton_Click(object sender, EventArgs e) { string userName = this.userNameTextBox.Text.Trim(); string userPassword = this.PasswordTextBox.Text.Trim(); if (userName == string.Empty) { MessageBox.Show("User Name field cannot be empty.\n\nPlease enter user name.", "Empty User Name text box", MessageBoxButtons.OK, MessageBoxIcon.Warning); this.userNameTextBox.SelectAll(); this.userNameTextBox.Focus(); return; } else if (userPassword == string.Empty) { MessageBox.Show("Password field cannot be empty.\n\nPlease enter password.", "Empty Password text box", MessageBoxButtons.OK, MessageBoxIcon.Warning); this.PasswordTextBox.SelectAll(); this.PasswordTextBox.Focus(); return; } loggedUser = new BusinessTier.User(userName, userPassword); // check if password matches loginFormLoadingCircle.Visible = true; //await PutTaskDelay(); bool result; try { result = await Task.Run(() => bLogic.validateUser(loggedUser)); } catch(Exception ex) { MessageBox.Show(ex.ToString()); return; } loginFormLoadingCircle.Visible = false; if (result == true) { MainForm mainForm = new MainForm(loggedUser, bLogic); // creating event handler to catch the main form closed event // this will fire when mainForm closed mainForm.FormClosed += new FormClosedEventHandler(mainForm_FormClosed); //showing the main form mainForm.Show(); //hiding the current form this.Hide(); } else { MessageBox.Show("User Name or Password did not match our records.\nPlease try again.", "Invalid User", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void eachRating_Click(object sender, EventArgs e) { this.secondBox.Items.Clear(); string dbfilename = this.txtDatabase.Text; BusinessTier.Business biztier = new BusinessTier.Business(dbfilename); BusinessTier.User user = biztier.GetNamedUser(this.lstMovies.Text); BusinessTier.Movie movie = biztier.GetMovie(this.lstMovies.Text); if (user == null) { var bb = biztier.GetMovieDetail(biztier.GetMovie(Convert.ToInt32(movie.MovieID)).MovieID).Reviews; List <Review> ListRev = new List <Review>(); foreach (var f in bb) { ListRev.Add(f); } int one = 0, two = 0, three = 0, four = 0, five = 0; foreach (var b in ListRev) { if (b.Rating == 1) { one++; } if (b.Rating == 2) { two++; } if (b.Rating == 3) { three++; } if (b.Rating == 4) { four++; } if (b.Rating == 5) { five++; } } int totel = one + two + three + four + five; secondBox.Items.Add(string.Format("{0}", movie.MovieName)); secondBox.Items.Add(string.Format(" ")); secondBox.Items.Add(string.Format("5: {0}", five)); secondBox.Items.Add(string.Format("4: {0}", four)); secondBox.Items.Add(string.Format("3: {0}", three)); secondBox.Items.Add(string.Format("2: {0}", two)); secondBox.Items.Add(string.Format("1: {0}", one)); secondBox.Items.Add(string.Format("Totel: {0}", totel)); } else { MessageBox.Show("Please select a Movie from the movie list"); } }