private Docent GetModuleCoordinater(string moduleID) { Docent coordinater = new Docent(); con.Open(); SqlCommand cmd = new SqlCommand("SELECT FirstName, LastName, Email, Phone, " + "DocentCode, Room FROM Module " + "INNER JOIN Users " + "ON Module.AdministratorID = Users.UserID " + "INNER JOIN DocentData " + "ON Module.AdministratorID = DocentData.DocentID " + "WHERE ModuleID = @moduleID", con); cmd.Parameters.AddWithValue("@moduleID", moduleID.Trim()); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { coordinater.FirstName = reader.GetString(0); coordinater.LastName = reader.GetString(1); coordinater.Email = reader.GetString(2); if (!reader.IsDBNull(3)) { coordinater.Phone = reader.GetString(3); } coordinater.DocentCode = reader.GetString(4); coordinater.Room = reader.GetString(5); con.Close(); return(coordinater); } con.Close(); return(coordinater); }
public async Task <IActionResult> PutDocent(int id, Docent docent) { if (id != docent.DocentID) { return(BadRequest()); } _context.Entry(docent).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DocentExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <Docent> > PostDocent(Docent docent) { _context.Docenten.Add(docent); await _context.SaveChangesAsync(); return(CreatedAtAction("GetDocent", new { id = docent.DocentID }, docent)); }
public VoorkeurMemoryContext() { Docent docent1 = new Docent(1, 1, 400, "User1") { MedewerkerId = "User1" }; docenten.Add(docent1); trajecten = new List <Traject>(); docenten = new List <Docent>(); eenheden = new List <Eenheid>() { new Eenheid(1, "Eenheid1", 1) }; onderdelen = new List <Onderdeel>() { new Onderdeel(1, "OnderdeelTest", 1) }; taken = new List <Taak>() { new Taak(1, "TaakTest", 1, "TaakTestOmschrijving", "TrajectTest", "OnderdeelTest", "EenheidTest") }; voorkeuren = new List <Voorkeur>() { new Voorkeur(1, "TestVoorkeur") }; }
public async Task <IActionResult> Edit(int id, [Bind("DocentID,DocentNaam,DocentTitel,DocentAfbeeldingURL,DocentFB,DocentIG,DocentPin,DocentBio")] Docent docent) { if (id != docent.DocentID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(docent); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DocentExists(docent.DocentID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(docent)); }
public UpdateOLA(Hoofdvenster hoofdvenster) { InitializeComponent(); logic = new Logica(); CmbDocent.DataSource = logic.GetDocents(); CmbDocent.DisplayMember = "fullname"; CmbOPO.DataSource = logic.GetAllOPOs(); CmbOPO.DisplayMember = "Naam"; if (hoofdvenster.GetIndex().Equals("Edit")) { edit = true; GetVorigeDocent = (Docent)hoofdvenster.GetDocent();; GetVorigeOpo = hoofdvenster.GetValues().SelectedItems[0].SubItems[2].Text; TxtCode.Text = hoofdvenster.GetValues().SelectedItems[0].SubItems[0].Text; TxtCode.ReadOnly = true; TxtNaam.Text = hoofdvenster.GetValues().SelectedItems[0].SubItems[1].Text; NudStudiepunten.Value = Convert.ToInt32(hoofdvenster.GetValues().SelectedItems[0].SubItems[3].Text); CmbOPO.SelectedIndex = CmbOPO.FindStringExact(hoofdvenster.GetValues().SelectedItems[0].SubItems[2].Text); CmbDocent.SelectedIndex = CmbDocent.FindStringExact(hoofdvenster.GetCmb()); docent = (Docent)CmbDocent.SelectedItem; opo = (OPO)CmbOPO.SelectedItem; } }
private List <Docent> GetModuleAuthors(string moduleID) { List <Docent> authors = new List <Docent>(); con.Open(); SqlCommand cmd = new SqlCommand("SELECT FirstName, LastName, Email, " + "Phone, DocentCode, Room FROM ModuleAuthor " + "INNER JOIN Users " + "ON ModuleAuthor.AuthorID = Users.UserID " + "INNER JOIN DocentData " + "ON ModuleAuthor.AuthorID = DocentData.DocentID " + "WHERE ModuleID = @moduleID", con); cmd.Parameters.AddWithValue("@moduleID", moduleID.Trim()); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { Docent author = new Docent(); author.FirstName = reader.GetString(0); author.LastName = reader.GetString(1); author.Email = reader.GetString(2); if (!reader.IsDBNull(3)) { author.Phone = reader.GetString(3); } author.DocentCode = reader.GetString(4); author.Room = reader.GetString(5); authors.Add(author); } con.Close(); return(authors); }
private void OpleidingenDocent(Docent docent) { grpDocent.Visibility = Visibility.Visible; grpDocent.Margin = new Thickness(345, 184, 0, 0); lstGeeftWel.Items.Clear(); lstGeeftNiet.Items.Clear(); foreach (Opleiding cursus in deopleidingen.opleidingen) { bool gevonden = false; foreach (Opleiding tegeven in docent.Opdrachten) { if (tegeven == cursus) { gevonden = true; break; } } if (gevonden) { lstGeeftWel.Items.Add(cursus); } else { lstGeeftNiet.Items.Add(cursus); } } }
private static void Two() { Console.WriteLine("----------DOCENT----------"); Docent docent = new Docent(true); docent.BecomeProfessor(); Console.WriteLine("----------PROFESSOR----------"); Professor professor = new Professor(true); }
//Constructor public OPO(string code, string naam, int stp, Docent verantwoordelijke, List <OLA> olas, Semester sem, Fase fase) { this._code = code; this.naam = naam; this.stp = stp; this.verantwoordelijke = verantwoordelijke; this.olas = olas; this.sem = sem; this.fase = fase; }
public void Delete(ViewDocent docent) { using (var ctx = new AanwezigheidslijstDBContext()) { Docent delDocent = ctx.Docenten.SingleOrDefault(d => d.Id == docent.Id); ctx.Docenten.Remove(delDocent); ctx.SaveChanges(); } }
public async Task <IActionResult> Create([Bind("DocentID,DocentNaam,DocentTitel,DocentAfbeeldingURL,DocentFB,DocentIG,DocentPin,DocentBio")] Docent docent) { if (ModelState.IsValid) { _context.Add(docent); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(docent)); }
public void ToevoegenDocent(Docent docent) { //throw new NotImplementedException(); if (String.IsNullOrEmpty(docent.LandCode)) { docent.LandCode = "BE"; } context.Docenten.Add(docent); }
public void Update(ViewDocent docent) { using (var ctx = new AanwezigheidslijstDBContext()) { Docent updDocent = ctx.Docenten.SingleOrDefault(d => d.Id == docent.Id); updDocent.Naam = docent.Naam; updDocent.Bedrijf = docent.Bedrijf; ctx.SaveChanges(); } }
private void btnSubmit_Click(object sender, EventArgs e) { IService service = GemeenschapFactory.GetService(); string voornaam = tbxVoornaam.Text; string familienaam = tbxFamilienaam.Text; decimal wedde = decimal.Parse(tbxWedde.Text); int campusNr = ((Campus)cmbCampus.SelectedItem).CampusNr; Docent docent = GemeenschapFactory.GetDocent(voornaam, familienaam, wedde, campusNr); service.InsertDocent(docent); LoadDocenten(); }
private void lbxDocenten_MouseDoubleClick(object sender, MouseEventArgs e) { if (lbxDocenten.SelectedIndex > -1) { Docent docent = (Docent)lbxDocenten.SelectedItem; tbxDetailVoornaam.Text = docent.Voornaam; tbxDetailFamilienaam.Text = docent.Familienaam; tbxDetailWedde.Text = docent.Wedde.ToString(); btnDelete.Text = $"{docent.ToString()} verwijderen"; btnUpdate.Text = $"{docent.ToString()} updaten"; } }
public List <Docent> DocentInTeamOphalen(int id) { List <Docent> docentList = new List <Docent>(); try { using (SqlConnection conn = dbconn.GetConnString()) { conn.Open(); using (SqlCommand cmd = new SqlCommand("SELECT D.DocentID, D.TeamID ,(ANU.Voornaam + ' ' + ANU.Achternaam) as Naam, D.RuimteVoorInzet " + "FROM [dbo].[Docent] D " + "INNER JOIN [dbo].[AspNetUsers] ANU ON ANU.Id = D.MedewerkerID where TeamID = @id", conn)) { cmd.Parameters.AddWithValue("@id", id); using (SqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { Docent docent = new Docent { DocentId = (int)reader["DocentID"], TeamId = (int)reader["TeamID"] }; if (DBNull.Value.Equals(reader["RuimteVoorInzet"])) { docent.RuimteVoorInzet = 0; } else { docent.RuimteVoorInzet = (int)reader["RuimteVoorInzet"]; } if (DBNull.Value.Equals(reader["Naam"])) { docent.Naam = "Geen naam opgegeven"; } else { docent.Naam = (string)reader["Naam"]; } //docent.MedewerkerId = (string) reader["MedewerkerID"]; docentList.Add(docent); } } } } } catch (SqlException fout) { Debug.WriteLine(fout.Message); } return(docentList); }
public List <Algoritme> ActiverenSysteem() { try { List <Algoritme> algoritmes = new List <Algoritme>(); using (SqlConnection connectie = dbconn.GetConnString()) { connectie.Open(); using (SqlCommand command = new SqlCommand("SELECT Eind.*, D.Naam, D.TeamID, T.TaakNaam " + "FROM EindTabelAlgoritme as Eind " + "LEFT JOIN Docent as D ON D.DocentID = eind.Docent_id " + "INNER JOIN Taak as T ON T.TaakId = Eind.Taak_id", connectie)) { using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { Docent docent = new Docent(); if (reader["Docent_id"] != System.DBNull.Value) { docent.DocentId = (int?)reader["Docent_id"]; } if (reader["TeamId"] != System.DBNull.Value) { docent.TeamId = (int?)reader["TeamID"]; } docent.Naam = reader["Naam"].ToString(); Taak taak = new Taak(); taak.TaakId = (int)reader["Taak_id"]; taak.TaakNaam = reader["TaakNaam"].ToString(); Algoritme algoritme = new Algoritme(); algoritme.AlgoritmeId = (int)reader["Row_id"]; algoritme.Taak = taak; algoritme.Docent = docent; algoritmes.Add(algoritme); } } } } return(algoritmes); } catch (SqlException fout) { Debug.WriteLine(fout.Message); throw new ArgumentException("Er is iets fout gegaan bij het ophalen van de data"); } }
private void btnUpdate_Click(object sender, EventArgs e) { IService service = GemeenschapFactory.GetService(); int docentNr = ((Docent)lbxDocenten.SelectedItem).DocentNr; string voornaam = tbxDetailVoornaam.Text; string familienaam = tbxDetailFamilienaam.Text; decimal wedde = decimal.Parse(tbxDetailWedde.Text); int campusNr = ((Campus)cmbCampus.SelectedItem).CampusNr; Docent docent = GemeenschapFactory.GetDocent(docentNr, voornaam, familienaam, wedde, campusNr); service.UpdateDocent(docent); LoadDocenten(); }
private void BtnDocentVerwijderen_Click(object sender, RoutedEventArgs e) { if (lstGeeftWel.SelectedIndex == -1) { return; } Docent docent = (Docent)lstPersonen.SelectedItem; Opleiding opleiding = (Opleiding)lstGeeftWel.SelectedItem; docent.Opdrachten.Remove(opleiding); OpleidingenDocent(docent); }
private void BtnDocentToevoegen_Click(object sender, RoutedEventArgs e) { if (lstGeeftNiet.SelectedIndex == -1) { return; } Docent docent = (Docent)lstPersonen.SelectedItem; Opleiding opleiding = (Opleiding)lstGeeftNiet.SelectedItem; docent.Opdrachten.Add(opleiding); OpleidingenDocent(docent); }
static void Main(string[] args) { Console.WriteLine("Hello World!"); Persoon p = new Persoon(); Persoon1 p1 = new Persoon1(); p1.voornaam = "Kristof"; p1.Geslacht = 'M'; p1.Naam = "Raes"; Gebruiker g1 = new Gebruiker(); Student s1 = new Student(); Docent d1 = new Docent(); }
public void Delete(int id) { using (var ctx = new AanwezigheidslijstDbContext()) { var doc = new Docent() { Id = id }; ctx.Attach(doc); ctx.Remove(doc); ctx.SaveChanges(); } }
public List <ListViewItem> GetOlaDocent(Docent docent) { var olas = new List <ListViewItem>(); if (docent.olas != null) { foreach (var ola in docent.olas) { olas.Add(new ListViewItem(new string[] { ola.Code, ola.Naam, ola.Opo.Naam, ola.Studiepunten.ToString() })); } } return(olas); }
public Docent HaalDocentOpMetID(int id) { Docent docent = new Docent(); try { using (SqlConnection conn = dbconn.GetConnString()) { conn.Open(); using (SqlCommand cmd = new SqlCommand("SELECT D.DocentID, D.TeamID, D.RuimteVoorInzet,(ANU.Voornaam + ' ' + ANU.Achternaam) as Naam, D.RuimteVoorInzet FROM [dbo].[Docent] D INNER JOIN [dbo].[AspNetUsers] ANU ON ANU.Id = D.MedewerkerID where d.DocentID = @DocentID", conn)) { cmd.Parameters.AddWithValue("@DocentID", id); using (SqlDataReader reader = cmd.ExecuteReader()) { if (reader.Read()) { docent = new Docent { DocentId = (int)reader["DocentID"] }; if (!(DBNull.Value.Equals(reader["TeamID"]))) { docent.TeamId = (int)reader["TeamID"]; } if (!(DBNull.Value.Equals(reader["Naam"]))) { docent.Naam = (string)reader["Naam"]; } else { docent.Naam = "Geen naam opgegeven"; } if (!(DBNull.Value.Equals(reader["RuimteVoorInzet"]))) { docent.RuimteVoorInzet = (int)reader["RuimteVoorInzet"]; } } } } } return(docent); } catch (SqlException fout) { Debug.WriteLine(fout.Message); return(null); } }
public int AddDocent(Docent d) { if (Docent != null && Docenten == null) { Docenten = new List<Docent>() { Docent, d }; Docent = null; return 2; } else if (Docenten != null) { Docenten.Add(d); return Docenten.Count; } else { Docent = d; return 1; } }
// --------- // Menu-item // --------- static void Item01() { using var context = new EFCoreMappingContext(); var campus = new Campus { Naam = "VDAB Wondelgem", Adres = new Adres { Straat = "Industrieweg", Huisnummer = "50", Postcode = "9032", Gemeente = "Gent" } }; var johan = new Docent { Voornaam = "Johan", Familienaam = "Vandaele", Wedde = 1000m, InDienst = new DateTime(2016, 2, 1), HeeftRijbewijs = true, AdresThuis = new Adres { Straat = "Ter Lake", Huisnummer = "7", Postcode = "8310", Gemeente = "Brugge" }, AdresWerk = new Adres { Straat = "Hertsbergsestraat", Huisnummer = "91", Postcode = "8020", Gemeente = "Oostkamp" }, Campus = campus }; context.Add(johan); context.SaveChanges(); }
public List <Docent> HaalDocentenZonderTeamOp() { List <Docent> docenten = new List <Docent>(); try { using (SqlConnection conn = dbconn.GetConnString()) { conn.Open(); using (SqlCommand cmd = new SqlCommand("SELECT D.DocentID, (ANU.Voornaam + ' ' + ANU.Achternaam) as Naam, D.RuimteVoorInzet FROM [dbo].[Docent] D INNER JOIN [dbo].[AspNetUsers] ANU ON ANU.Id = D.MedewerkerID WHERE D.TeamID is null", conn)) { using (SqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { Docent docent = new Docent { DocentId = (int)reader["DocentID"], Naam = (string)reader["Naam"] }; if (DBNull.Value.Equals(reader["RuimteVoorInzet"])) { docent.RuimteVoorInzet = 0; } else { docent.RuimteVoorInzet = (int)reader["RuimteVoorInzet"]; } docenten.Add(docent); } } } } } catch (SqlException fout) { Debug.WriteLine(fout.Message); return(null); } return(docenten); }
public void ToevoegenDocent_DocentZonderLand_DocentHeeftLandBE() { //Arrange //var options = new DbContextOptionsBuilder<EFOpleidingenContext>() // .UseInMemoryDatabase($"InMemoryDatabase{Guid.NewGuid()}") // .Options; using var context = new EFOpleidingenContext(options); context.Landen.Add(new Land() { LandCode = "BE", Naam = "Belgie" }); context.SaveChanges(); var docent = new Docent() { DocentId = 20, Voornaam = "Fanny", Familienaam = "Kiekeboe", Wedde = 10100, InDienst = new DateTime(2019, 1, 1), CampusId = 1 }; //Act var docentService = new DocentService(context); docentService.ToevoegenDocent(docent); context.SaveChanges(); //Assert var testDocent = docentService.GetDocent(20); Assert.AreEqual("BE", testDocent.LandCode); }
partial void DeleteDocent(Docent instance);
partial void UpdateDocent(Docent instance);
public IActionResult DetailsDocent(int id) { Docent docent = _teamLogic.HaalDocentOpMetID(id); return(View(docent)); }
public List <ListViewItem> GetOlaDocent(Docent docent) { return(datalaag.GetOlaDocent(docent)); }
partial void InsertDocent(Docent instance);