public string Register(string name, string username, string password, DbController dbc) { if (UserID == 0) { DataTable user = dbc.findUserByName(username); if (user.Rows.Count > 0) { return("A megadott felhasználói név foglalt!"); } dbc.registerUser(username, password, name); return("Sikeresen regisztrált! Kérem lépjen be."); } return("Már bejelentkezett mint " + Username + "!"); }
public string Login(string username, string password, DbController dbc) { if (UserID == 0) { DataTable user = dbc.userAuth(username, password); if (user.Rows.Count > 0) { UserID = Convert.ToInt32(user.Rows[0].Field <Int64>("UserID")); UserType = user.Rows[0].Field <string>("UserType"); Username = user.Rows[0].Field <string>("Username"); return(username + " sikeresen bejelentkezett!"); } return("Sikertelen! Felhasználónév vagy jelszó nem megfelelő!"); } else { return("Már korábban bejelentkezett!"); } }
public void readEveryOder(EventController evc, DbController dbc) { DataTable orderTable = dbc.readOrders(); foreach (DataRow row in orderTable.Rows) { Event ev = evc.getEventByID(Convert.ToInt32(row.Field <Int64>("Event_ID"))); Order order = new Order(ev.PerformName, ev.Location.Name, ev.Start, row.Field <string>("Username")); DataTable seatTable = dbc.readSeatsForEvent(ev.Id); foreach (DataRow seat in seatTable.Rows) { string status = ""; int statusNumber = Convert.ToInt32(seat.Field <Int64>("SeatStatus")); if (statusNumber == 1) { status = "foglalt"; } else if (statusNumber == 2) { status = "fizetett"; } else if (statusNumber == 3) { status = "hitelesitett"; } order.addSeat(new Seat(Convert.ToInt32(seat.Field <Int64>("RowNumber")), Convert.ToInt32(seat.Field <Int64>("ColumnNumber")), status)); } Orders.Add(order); } }