/// <summary> /// Haal de bedrijfsinformatie op. /// </summary> /// <returns>Een object van entity class bedrijfsinformatie</returns> public static Bedrijfsinformatie ophalen() { Bedrijfsinformatie data = new Bedrijfsinformatie(); DatabaseCon.CONN.Open(); cmd = DatabaseCon.CONN.CreateCommand(); cmd.CommandText = "SELECT * FROM dbo.Bedrijfsinformatie WHERE kvk_nummer = 01101855"; SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); foreach (DataRow dr in dt.Rows) { data.kvk_nummer = Convert.ToInt32((dr["kvk_nummer"].ToString())); data.naam = (dr["naam"].ToString()); data.adres = (dr["adres"].ToString()); data.postcode = (dr["postcode"].ToString()); data.plaats = (dr["plaats"].ToString()); data.rekeningnummer = (dr["rekeningnummer"].ToString()); data.telefoonnummer = (dr["telefoonnummer"].ToString()); data.btw_nummer = (dr["btw_nummer"].ToString()); } cmd.ExecuteNonQuery(); DatabaseCon.CONN.Close(); return(data); }
//methode om te kijken of het edit scherm of het laten zien scherm moet worden geladen private void gegevens(Bedrijfsinformatie bedrijfsinformatie, Boolean is_edit) { this.bedrijfsinformatie = bedrijfsinformatie; if (is_edit) { foreach (Control c in this.Controls) { if (c.GetType().FullName != "System.Windows.Forms.Label") { c.Visible = true; } else { if (c.Name.Substring(0, 6) == "lblGeg") { c.Visible = false; } } } txtKvknummer.Text = bedrijfsinformatie.kvk_nummer.ToString(); txtBedrijfsnaam.Text = bedrijfsinformatie.naam.ToString(); txtAdres.Text = bedrijfsinformatie.adres.ToString(); txtPostcode.Text = bedrijfsinformatie.postcode.ToString(); txtPlaats.Text = bedrijfsinformatie.plaats.ToString(); txtRekeningnummer.Text = bedrijfsinformatie.rekeningnummer.ToString(); txtTelefoonnummer.Text = bedrijfsinformatie.telefoonnummer.ToString(); txtBtwnummer.Text = bedrijfsinformatie.btw_nummer.ToString(); } else { foreach (Control c in this.Controls) { if (c.GetType().FullName == "System.Windows.Forms.Label" && c.Name != "lblError") { c.Visible = true; } } lblGegKvknummer.Text = bedrijfsinformatie.kvk_nummer.ToString(); lblGegBedrijfsnaam.Text = bedrijfsinformatie.naam.ToString(); lblGegAdres.Text = bedrijfsinformatie.adres.ToString(); lblGegPostcode.Text = bedrijfsinformatie.postcode.ToString(); lblGegPlaats.Text = bedrijfsinformatie.plaats.ToString(); lblGegRekeningnummer.Text = bedrijfsinformatie.rekeningnummer.ToString(); lblGegTelefoonnummer.Text = bedrijfsinformatie.telefoonnummer.ToString(); lblGegBtwnummer.Text = bedrijfsinformatie.btw_nummer.ToString(); } }
/// <summary> /// Wijzig de bedrijfsinformatie. /// </summary> /// <param name="data">data = object van entity class bedrijfsinformatie</param> public static void wijzigen(Bedrijfsinformatie data) { DatabaseCon.CONN.Open(); cmd = DatabaseCon.CONN.CreateCommand(); cmd.CommandText = "UPDATE dbo.Bedrijfsinformatie SET naam =@naam, adres =@adres, postcode =@postcode, plaats =@plaats, rekeningnummer =@rekeningnummer, telefoonnummer =@telefoonnummer, btw_nummer =@btw_nummer where kvk_nummer ='" + data.kvk_nummer + "'"; cmd.Parameters.AddWithValue("@naam", data.naam); cmd.Parameters.AddWithValue("@adres", data.adres); cmd.Parameters.AddWithValue("@postcode", data.postcode); cmd.Parameters.AddWithValue("@plaats", data.plaats); cmd.Parameters.AddWithValue("@rekeningnummer", data.rekeningnummer); cmd.Parameters.AddWithValue("@telefoonnummer", data.telefoonnummer); cmd.Parameters.AddWithValue("@btw_nummer", data.btw_nummer); cmd.ExecuteNonQuery(); DatabaseCon.CONN.Close(); }
public BedrijfScherm(Bedrijfsinformatie bedrijfsinformatie, Boolean is_edit) { InitializeComponent(); gegevens(bedrijfsinformatie, is_edit); }
public string aanmaken(Klant klant, Bedrijfsinformatie bedrijf, Bestelling bestelling, string datum, string omschrijving, string aantal, string prijs, string prijsTotaal, string totaal) { string factuurdatum = bestelling.besteldatum.ToString().Substring(0, bestelling.besteldatum.ToString().Length - 3); object fileStandaard = Path.Combine(System.IO.Directory.GetCurrentDirectory(), "factuur.docx"); object fileSave = @"C:\Users\Giovanni\Documents\Facturen\" + "Factuur_" + bestelling.id + ".docx"; object fileSavePdf = @"C:\Users\Giovanni\Documents\Facturen\" + "Factuur_" + bestelling.id + ".pdf"; File.Copy(fileStandaard.ToString(), fileSave.ToString(), true); Microsoft.Office.Interop.Word.Application wordApp = new Microsoft.Office.Interop.Word.Application { Visible = true }; Document aDoc = wordApp.Documents.Open(ref fileSave, ReadOnly: false, Visible: true); Find fnd = wordApp.ActiveWindow.Selection.Find; fnd.ClearFormatting(); fnd.Replacement.ClearFormatting(); fnd.Forward = true; fnd.Wrap = WdFindWrap.wdFindContinue; //klantgegevens fnd.Text = "%voorletter%"; fnd.Replacement.Text = Convert.ToString(klant.voornaam[0]); fnd.Execute(Replace: WdReplace.wdReplaceAll); fnd.Text = "%achternaam%"; fnd.Replacement.Text = klant.achternaam; fnd.Execute(Replace: WdReplace.wdReplaceAll); fnd.Text = "%adres%"; fnd.Replacement.Text = klant.adres; fnd.Execute(Replace: WdReplace.wdReplaceAll); fnd.Text = "%postcode%"; fnd.Replacement.Text = klant.postcode; fnd.Execute(Replace: WdReplace.wdReplaceAll); fnd.Text = "%woonplaats%"; fnd.Replacement.Text = klant.woonplaats; fnd.Execute(Replace: WdReplace.wdReplaceAll); fnd.Text = "%email%"; fnd.Replacement.Text = klant.email; fnd.Execute(Replace: WdReplace.wdReplaceAll); fnd.Text = "%telefoon%"; fnd.Replacement.Text = klant.telefoon; fnd.Execute(Replace: WdReplace.wdReplaceAll); //bedrijfsgegevens fnd.Text = "%naamBed%"; fnd.Replacement.Text = bedrijf.naam; fnd.Execute(Replace: WdReplace.wdReplaceAll); fnd.Text = "%adresBed%"; fnd.Replacement.Text = bedrijf.adres; fnd.Execute(Replace: WdReplace.wdReplaceAll); fnd.Text = "%postcodeBed%"; fnd.Replacement.Text = bedrijf.postcode; fnd.Execute(Replace: WdReplace.wdReplaceAll); fnd.Text = "%plaatsBed%"; fnd.Replacement.Text = bedrijf.plaats; fnd.Execute(Replace: WdReplace.wdReplaceAll); fnd.Text = "%kvknummerBed%"; fnd.Replacement.Text = Convert.ToString(bedrijf.kvk_nummer); fnd.Execute(Replace: WdReplace.wdReplaceAll); fnd.Text = "%btwnummerBed%"; fnd.Replacement.Text = bedrijf.btw_nummer; fnd.Execute(Replace: WdReplace.wdReplaceAll); fnd.Text = "%rekeningnummerBed%"; fnd.Replacement.Text = bedrijf.rekeningnummer; fnd.Execute(Replace: WdReplace.wdReplaceAll); //factuurgegevens fnd.Text = "%factuurnummer%"; fnd.Replacement.Text = Convert.ToString(bestelling.id); fnd.Execute(Replace: WdReplace.wdReplaceAll); fnd.Text = "%factuurdatum%"; fnd.Replacement.Text = Convert.ToString(factuurdatum); fnd.Execute(Replace: WdReplace.wdReplaceAll); //orderregels fnd.Text = "%datum%"; fnd.Replacement.Text = datum; fnd.Execute(Replace: WdReplace.wdReplaceAll); fnd.Text = "%omschrijving%"; fnd.Replacement.Text = omschrijving; fnd.Execute(Replace: WdReplace.wdReplaceAll); fnd.Text = "%aantal%"; fnd.Replacement.Text = aantal; fnd.Execute(Replace: WdReplace.wdReplaceAll); fnd.Text = "%prijs%"; fnd.Replacement.Text = prijs; fnd.Execute(Replace: WdReplace.wdReplaceAll); fnd.Text = "%totaalprijs%"; fnd.Replacement.Text = prijsTotaal; fnd.Execute(Replace: WdReplace.wdReplaceAll); //totaal fnd.Text = "%totaal%"; fnd.Replacement.Text = totaal; fnd.Execute(Replace: WdReplace.wdReplaceAll); aDoc.Save(); foreach (Process p in Process.GetProcessesByName("WINWORD")) { p.Kill(); } converteerPdf(bestelling); return(Convert.ToString(fileSavePdf)); }
private void menuItem_Click(object sender, EventArgs e = null) { ToolStripItem tab = (ToolStripItem)sender; refreshMenu(); tab.ForeColor = Color.FromArgb(0, 0, 0); switch (tab.Name) { case "tabBestel": tab.Image = Bestelapplicatie.Properties.Resources.menu_bestel_focus; scherm = "Bestelscherm"; vulScherm(); break; case "tabBoek": tab.Image = Bestelapplicatie.Properties.Resources.menu_boek_focus; scherm = "Boekscherm"; vulScherm(); break; case "tabLog": tab.Image = Bestelapplicatie.Properties.Resources.menu_log_focus; scherm = "Loggingscherm"; vulScherm(); break; case "tabBedrijf": tab.Image = Bestelapplicatie.Properties.Resources.menu_bedrijf_focus; scherm = "Bedrijfscherm"; bedrijfsinformatie = BedrijfsinformatieDb.ophalen(); BedrijfScherm bedrijfscherm = new BedrijfScherm(bedrijfsinformatie, false); pnlHoofdscherm.Controls.Clear(); pnlHoofdscherm.Visible = true; pnlHoofdscherm.Dock = System.Windows.Forms.DockStyle.Fill; pnlHoofdscherm.Controls.Clear(); pnlSubGegevens.Controls.Clear(); pnlGegevens.Controls.Clear(); pnlGegevens.Visible = true; pnlGegevens.Size = new Size(1540, 765); pnlHoofdscherm.Controls.Add(pnlGegevens); pnlGegevens.Location = new Point(0, 0); pnlGegevens.Controls.Add(bedrijfscherm); break; case "tabLoguit": tab.Image = Bestelapplicatie.Properties.Resources.menu_loguit_focus; Account.uitloggen(); this.Hide(); Inloggen form = new Inloggen(); form.Closed += (s, args) => this.Close(); form.Show(); break; } }