private void btn_inlog_Click(object sender, EventArgs e) { Login_Service login = new Login_Service(); //Login_DAO login = new Login_DAO(); Inlog inlog = new Inlog(); string password = txt_Password.Text; inlog = login.GetEmployeeWithPassword(int.Parse(password)); if (inlog.functie == "manager" && inlog.wachtwoord == txt_Password.Text) { this.Hide(); ManagementActionForm managementOverview = new ManagementActionForm(inlog); managementOverview.Show(); } else if (inlog.functie == "barman" || inlog.functie == "kok" && inlog.wachtwoord == txt_Password.Text) { this.Hide(); KitchenActionForm kitchenAndBar = new KitchenActionForm(inlog); kitchenAndBar.Show(); } else if (inlog.functie == "bediening" && inlog.wachtwoord == txt_Password.Text) { this.Hide(); TableForm table = new TableForm(inlog); table.Show(); } else { lbl_IncorrectPassword.ForeColor = Color.Red; lbl_IncorrectPassword.Text = "Incorrect wachtwoord, probeer opnieuw"; txt_Password.Clear(); } }
public async Task <IActionResult> Edit(int id, [Bind("id,naam,wachtwoord")] Inlog inlog) { if (id != inlog.id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(inlog); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!InlogExists(inlog.id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(inlog)); }
private void ListView_Employee_SelectedIndexChanged(object sender, EventArgs e) { Inlog werknemer = new Inlog(); ShowAllControlls(); if (ListView_Employee.Items[0].Selected) { ClearAllTextFields(); btn_Remove.Hide(); NextID(); } else { if (ListView_Employee.SelectedItems.Count > 0) { werknemer = (Inlog)ListView_Employee.SelectedItems[0].Tag; txt_ID.Text = werknemer.werknemer_ID.ToString(); txt_Name.Text = werknemer.naam; txt_Function.Text = werknemer.functie; txt_Password.Text = werknemer.wachtwoord; } } }
public Inlog GetEmployeeWithPassword(string password) { Inlog Employee; string query = "Select * From Inlog Where wachtwoord = '" + password + "'"; con = new SqlConnection(conn); con.Open(); SqlCommand command = new SqlCommand(query, con); SqlDataReader datareader = command.ExecuteReader(); var dataTable = new DataTable(); dataTable.Load(datareader); if (dataTable.Rows.Count > 0) { DataRow dr = dataTable.Rows[0]; Employee = new Inlog() { werknemer_id = (int)dr["werknemer_id"], wachtwoord = (string)dr["wachtwoord"], naam = (string)dr["naam"], functie = (string)dr["functie"], status = (string)dr["status"] }; return(Employee); } else { return(null); } }
static void Main() { Inlog inlog = new Inlog(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new LoginForm()); }
public OrderActionForm2(Inlog werknemer, int tafelNummer) { InitializeComponent(); // Initialize MaterialSkinManager materialSkinManager = MaterialSkinManager.Instance; materialSkinManager.AddFormToManage(this); materialSkinManager.Theme = MaterialSkinManager.Themes.DARK; materialSkinManager.ColorScheme = new ColorScheme(Primary.BlueGrey800, Primary.BlueGrey900, Primary.BlueGrey500, Accent.LightBlue200, TextShade.WHITE); this.tafelNummer = tafelNummer; this.werknemer = werknemer; }
public ManagementSupplyForm(Inlog inlog) { InitializeComponent(); // Initialize MaterialSkinManager materialSkinManager = MaterialSkinManager.Instance; materialSkinManager.AddFormToManage(this); materialSkinManager.Theme = MaterialSkinManager.Themes.DARK; materialSkinManager.ColorScheme = new ColorScheme(Primary.BlueGrey800, Primary.BlueGrey900, Primary.BlueGrey500, Accent.LightBlue200, TextShade.WHITE); werknemer = inlog; }
public async Task <IActionResult> Create([Bind("id,naam,wachtwoord")] Inlog inlog) { if (ModelState.IsValid) { _context.Add(inlog); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(inlog)); }
public OrderOverviewForm(Inlog inlog, int tafelNummer) { InitializeComponent(); // Initialize MaterialSkinManager materialSkinManager = MaterialSkinManager.Instance; materialSkinManager.AddFormToManage(this); materialSkinManager.Theme = MaterialSkinManager.Themes.DARK; materialSkinManager.ColorScheme = new ColorScheme(Primary.BlueGrey800, Primary.BlueGrey900, Primary.BlueGrey500, Accent.LightBlue200, TextShade.WHITE); werknemer = inlog; this.tafelNummer = tafelNummer; bestellingen = new List <Bestelling>(); }
public KitchenActionForm(Inlog inlog) { InitializeComponent(); // Initialize MaterialSkinManager materialSkinManager = MaterialSkinManager.Instance; materialSkinManager.AddFormToManage(this); materialSkinManager.Theme = MaterialSkinManager.Themes.DARK; materialSkinManager.ColorScheme = new ColorScheme(Primary.BlueGrey800, Primary.BlueGrey900, Primary.BlueGrey500, Accent.LightBlue200, TextShade.WHITE); // We assign the inlog object we get to our own inlog property this.inlog = inlog; }
public PaymentForm(Inlog werknemer, int tafel_ID, OrderOverviewForm2 form2) { InitializeComponent(); //Initialize MaterialSkinManager materialSkinManager = MaterialSkinManager.Instance; materialSkinManager.AddFormToManage(this); materialSkinManager.Theme = MaterialSkinManager.Themes.DARK; materialSkinManager.ColorScheme = new ColorScheme(Primary.BlueGrey800, Primary.BlueGrey900, Primary.BlueGrey500, Accent.LightBlue200, TextShade.WHITE); this.tafel_ID = tafel_ID; this.werknemer = werknemer; this.form2 = form2; }
public OrderForm2(string sort, int tafelnummer, Bestelling order, Inlog werknemer, OrderMenusForm2 orderMenusForm) { InitializeComponent(); // Initialize MaterialSkinManager materialSkinManager = MaterialSkinManager.Instance; materialSkinManager.AddFormToManage(this); materialSkinManager.Theme = MaterialSkinManager.Themes.DARK; materialSkinManager.ColorScheme = new ColorScheme(Primary.BlueGrey800, Primary.BlueGrey900, Primary.BlueGrey500, Accent.LightBlue200, TextShade.WHITE); this.sort = sort; this.order = order; this.tafelnummer = tafelnummer; this.werknemer = werknemer; this.orderMenusForm = orderMenusForm; }
public PaymentActionForm(Inlog werknemer, int tafel_ID, decimal amount, decimal btw, Bon bon) { InitializeComponent(); // Initialize MaterialSkinManager materialSkinManager = MaterialSkinManager.Instance; materialSkinManager.AddFormToManage(this); materialSkinManager.Theme = MaterialSkinManager.Themes.DARK; materialSkinManager.ColorScheme = new ColorScheme(Primary.BlueGrey800, Primary.BlueGrey900, Primary.BlueGrey500, Accent.LightBlue200, TextShade.WHITE); this.bon = bon; this.werknemer = werknemer; this.tafel_ID = tafel_ID; this.amount = amount; this.btw = btw; }
public TableForm(Inlog inlog) { InitializeComponent(); lbl_Naam.Text = inlog.naam; werknemer = inlog; // Initialize MaterialSkinManager materialSkinManager = MaterialSkinManager.Instance; materialSkinManager.AddFormToManage(this); materialSkinManager.Theme = MaterialSkinManager.Themes.DARK; materialSkinManager.ColorScheme = new ColorScheme(Primary.BlueGrey800, Primary.BlueGrey900, Primary.BlueGrey500, Accent.LightBlue200, TextShade.WHITE); btnList = new Button[10] { btn_Tafel1, btn_Tafel2, btn_Tafel3, btn_Tafel4, btn_Tafel5, btn_Tafel6, btn_Tafel7, btn_Tafel8, btn_Tafel9, btn_Tafel10 }; }
private void txt_ID_TextChanged(object sender, EventArgs e) { if (ListView_Employee.Items[0].Selected) { OnlyNumbersAllowed(txt_ID); } else { Inlog employee = new Inlog(); if (ListView_Employee.SelectedItems.Count > 0) { employee = (Inlog)ListView_Employee.SelectedItems[0].Tag; } txt_ID.Text = employee.werknemer_ID.ToString(); } }
public List <Inlog> ReadTables(DataTable dataTable) { List <Inlog> EmployeeList = new List <Inlog>(); foreach (DataRow dr in dataTable.Rows) { Inlog Employee = new Inlog() { werknemer_id = (int)dr["werknemer_ID"], naam = (String)(dr["naam"]), wachtwoord = (string)dr["wachtwoord"], functie = (String)(dr["functie"]), status = (string)(dr["status"]) }; EmployeeList.Add(Employee); } return(EmployeeList); }
public async Task <IActionResult> Index(Inlog adminInfo) { _logger.LogInformation("Admin Inlog Metod"); LoginResponse validatedInlog = null;//= new User(); using (var httpClient = new HttpClient()) { StringContent content = new StringContent(JsonConvert.SerializeObject(adminInfo), Encoding.UTF8, "application/json"); using (var response = await httpClient.PostAsync("https://informatik10.ei.hv.se/UserService/Login", content)) { string apiResponse = await response.Content.ReadAsStringAsync(); validatedInlog = JsonConvert.DeserializeObject <LoginResponse>(apiResponse); } } if (validatedInlog != null) { if (validatedInlog.Status == true) { if (validatedInlog.Role.Contains("GuestAdmin")) { await SetUserAuthenticated(adminInfo.UserName); return(Redirect("~/Admin/Index")); } else { ModelState.AddModelError("", "Inloggningen är inte godkänd"); return(View()); } } else { ModelState.AddModelError("", "Inloggningen är inte godkänd"); return(View()); } } else { ModelState.AddModelError("", "Inloggningen är inte godkänd"); return(View()); } }
public Inlog GetEmployee(int ID) { string query = "Select * From Inlog Where werknemer_ID = '" + ID + "'"; con = new SqlConnection(conn); con.Open(); SqlCommand command = new SqlCommand(query, con); SqlDataReader datareader = command.ExecuteReader(); var dataTable = new DataTable(); dataTable.Load(datareader); DataRow dr = dataTable.Rows[0]; Inlog Employee = new Inlog() { werknemer_id = (int)dr["werknemer_id"], wachtwoord = (string)dr["wachtwoord"], naam = (string)dr["naam"], functie = (string)dr["functie"], status = (string)dr["status"] }; return(Employee); }
private bool KontrolleraAdmin(Inlog adminInfo) { //anrop till webbservicen grupp3. skicka med adminInfo using (var httpClient = new HttpClient()) { StringContent content = new StringContent(JsonConvert.SerializeObject(adminInfo), Encoding.UTF8, "application/json"); LoginResponse recievedResponse; using (var response = httpClient.PostAsync("https://informatik10.ei.hv.se/UserService/Login", content)) { string apiResponse = response.Result.Content.ReadAsStringAsync().ToString(); recievedResponse = JsonConvert.DeserializeObject <LoginResponse>(apiResponse); if (recievedResponse.Status == true) { return(true); } else { return(false); } } } }
public async Task <IActionResult> Index(Inlog adminInfo, string returnUrl = null) { //vi tror att här ska länkas till inlogservicen.. bool AdminGiltig = KontrolleraAdmin(adminInfo); if (AdminGiltig == true) { var identity = new ClaimsIdentity(CookieAuthenticationDefaults.AuthenticationScheme); identity.AddClaim(new Claim(ClaimTypes.Name, adminInfo.UserName)); await HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, new ClaimsPrincipal(identity)); if (returnUrl != null) { return(Redirect(returnUrl)); } else { return(RedirectToAction("Index", "Admin")); } } ViewBag.FelMeddelande = "Login failed. Please try again"; return(View()); }