Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Endre og opprett kunde og utleie. Brukermanual, shortcuts hovedmeny

  • Loading branch information...
commit 6cbc4ad553cfde6d6f6b751131364b0e30770797 1 parent c00c047
@kimhist authored
View
14 Program/My Project/Resources.Designer.vb
@@ -73,5 +73,19 @@ Namespace My.Resources
Return CType(obj,System.Drawing.Bitmap)
End Get
End Property
+
+ Friend ReadOnly Property logout() As System.Drawing.Bitmap
+ Get
+ Dim obj As Object = ResourceManager.GetObject("logout", resourceCulture)
+ Return CType(obj,System.Drawing.Bitmap)
+ End Get
+ End Property
+
+ Friend ReadOnly Property support() As System.Drawing.Bitmap
+ Get
+ Dim obj As Object = ResourceManager.GetObject("support", resourceCulture)
+ Return CType(obj,System.Drawing.Bitmap)
+ End Get
+ End Property
End Module
End Namespace
View
6 Program/My Project/Resources.resx
@@ -121,7 +121,13 @@
<data name="confirm" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\ico\confirm.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
+ <data name="logout" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\ico\logout.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ </data>
<data name="cancel" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\ico\cancel.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
+ <data name="support" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\ico\support.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ </data>
</root>
View
6 Program/Program.vbproj
@@ -271,6 +271,12 @@
<ItemGroup>
<None Include="lib\MySql.Data.dll" />
</ItemGroup>
+ <ItemGroup>
+ <None Include="ico\logout.png" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="ico\support.png" />
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
View
2  Program/gui/frmBrukerbehandling.Designer.vb
@@ -257,7 +257,7 @@ Partial Class frmBrukerbehandling
Me.lblPostnr.Name = "lblPostnr"
Me.lblPostnr.Size = New System.Drawing.Size(65, 13)
Me.lblPostnr.TabIndex = 7
- Me.lblPostnr.Text = "Postnummer"
+ Me.lblPostnr.Text = "&Postnummer"
'
'txtPostnr
'
View
28 Program/gui/frmHoved.Designer.vb
@@ -22,29 +22,22 @@ Partial Class frmHoved
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
- Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmHoved))
Me.msMenu = New System.Windows.Forms.MenuStrip()
- Me.tsmiLogout = New System.Windows.Forms.ToolStripMenuItem()
Me.pnHoved = New System.Windows.Forms.Panel()
+ Me.tsmiLogout = New System.Windows.Forms.ToolStripMenuItem()
+ Me.tsmiBrukermanual = New System.Windows.Forms.ToolStripMenuItem()
Me.msMenu.SuspendLayout()
Me.SuspendLayout()
'
'msMenu
'
- Me.msMenu.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.tsmiLogout})
+ Me.msMenu.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.tsmiLogout, Me.tsmiBrukermanual})
Me.msMenu.Location = New System.Drawing.Point(0, 0)
Me.msMenu.Name = "msMenu"
Me.msMenu.Size = New System.Drawing.Size(270, 24)
Me.msMenu.TabIndex = 0
Me.msMenu.Text = "Menu"
'
- 'tsmiLogout
- '
- Me.tsmiLogout.Image = CType(resources.GetObject("tsmiLogout.Image"), System.Drawing.Image)
- Me.tsmiLogout.Name = "tsmiLogout"
- Me.tsmiLogout.Size = New System.Drawing.Size(76, 20)
- Me.tsmiLogout.Text = "&Logg ut"
- '
'pnHoved
'
Me.pnHoved.AutoSize = True
@@ -54,6 +47,20 @@ Partial Class frmHoved
Me.pnHoved.Size = New System.Drawing.Size(270, 119)
Me.pnHoved.TabIndex = 1
'
+ 'tsmiLogout
+ '
+ Me.tsmiLogout.Image = Global.Program.My.Resources.Resources.logout
+ Me.tsmiLogout.Name = "tsmiLogout"
+ Me.tsmiLogout.Size = New System.Drawing.Size(76, 20)
+ Me.tsmiLogout.Text = "&Logg ut"
+ '
+ 'tsmiBrukermanual
+ '
+ Me.tsmiBrukermanual.Image = Global.Program.My.Resources.Resources.support
+ Me.tsmiBrukermanual.Name = "tsmiBrukermanual"
+ Me.tsmiBrukermanual.Size = New System.Drawing.Size(109, 20)
+ Me.tsmiBrukermanual.Text = "&Brukermanual"
+ '
'frmHoved
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
@@ -74,4 +81,5 @@ Partial Class frmHoved
Friend WithEvents msMenu As System.Windows.Forms.MenuStrip
Friend WithEvents tsmiLogout As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents pnHoved As System.Windows.Forms.Panel
+ Friend WithEvents tsmiBrukermanual As System.Windows.Forms.ToolStripMenuItem
End Class
View
35 Program/gui/frmHoved.resx
@@ -120,39 +120,4 @@
<metadata name="msMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
- <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
- <data name="tsmiLogout.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
- <value>
- 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
- +H/hP2h2W50rXP2KAAAAAElFTkSuQmCC
-</value>
- </data>
</root>
View
31 Program/gui/frmHoved.vb
@@ -1,14 +1,15 @@
Imports System.Reflection
Public Class frmHoved
+ Public Shared login As Login
+
Private caller As Form
- Private login As Login
Sub New(ByRef caller As Object, ByVal login As Login)
Me.caller = caller
If (login IsNot Nothing) Then
- Me.login = login
+ frmHoved.login = login
InitializeComponent()
init()
Else
@@ -72,47 +73,47 @@ Public Class frmHoved
End Function
Private Sub addBrukerbehandling()
- createButton(1, "Brukerbehandling", "frmBrukerbehandling")
+ createButton(1, "&Brukerbehandling", "frmBrukerbehandling")
End Sub
Private Sub addEndreBruker()
- createButton(2, "Endre bruker", "frmEndreBruker")
+ createButton(2, "Endre b&ruker", "frmEndreBruker")
End Sub
Private Sub addKunderegistrering()
- createButton(3, "Kunderegistrering", "frmKunderegistrering")
+ createButton(3, "&Kunderegistrering", "frmKunderegistrering")
End Sub
Private Sub addEndreKunde()
- createButton(4, "Endre kunde", "frmEndreKunde")
+ createButton(4, "Endre k&unde", "frmEndreKunde")
End Sub
Private Sub addProduktRegistrering()
- createButton(5, "Produktregistrering", "frmProduktRegistrering")
+ createButton(5, "&Produktregistrering", "frmProduktRegistrering")
End Sub
Private Sub addEndreProdukt()
- createButton(6, "Endre produkt", "frmEndreProdukt")
+ createButton(6, "Endre pr&odukt", "frmEndreProdukt")
End Sub
Private Sub addUtleieRegistrering()
- createButton(7, "Utleieregistrering", "frmUtleieregistrering")
+ createButton(7, "&Utleieregistrering", "frmUtleieregistrering")
End Sub
Private Sub addEndreUtleie()
- createButton(8, "Endre utleie", "frmEndreUtleie")
+ createButton(8, "Endre u&tleie", "frmEndreUtleie")
End Sub
Private Sub addPakkeregistrering()
- createButton(9, "Pakkeregistrering", "frmPakkeregistrering")
+ createButton(9, "P&akkeregistrering", "frmPakkeregistrering")
End Sub
Private Sub addEndrePakke()
- createButton(10, "Endre pakke", "frmEndrePakke")
+ createButton(10, "Endre pa&kke", "frmEndrePakke")
End Sub
Private Sub addStatistikk()
- createButton(11, "Statistikk", "frmStatistikk")
+ createButton(11, "&Statistikk", "frmStatistikk")
End Sub
Private Sub frmHoved_FormClosed(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles MyBase.FormClosed
@@ -123,4 +124,8 @@ Public Class frmHoved
caller.Show()
Me.Dispose()
End Sub
+
+ Private Sub tsmiBrukermanual_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsmiBrukermanual.Click
+ System.Diagnostics.Process.Start("http://sportutleie.wikidot.com/")
+ End Sub
End Class
View
100 Program/gui/frmKunderegistrering.Designer.vb
@@ -28,11 +28,11 @@ Partial Class frmKunderegistrering
Me.txtVekt = New System.Windows.Forms.TextBox()
Me.lblSkonr = New System.Windows.Forms.Label()
Me.lblVekt = New System.Windows.Forms.Label()
- Me.DateTimePicker1 = New System.Windows.Forms.DateTimePicker()
+ Me.dtpFodt = New System.Windows.Forms.DateTimePicker()
Me.lblHoyde = New System.Windows.Forms.Label()
- Me.txtFodt = New System.Windows.Forms.TextBox()
Me.txtTelefon = New System.Windows.Forms.TextBox()
Me.txtAdresse = New System.Windows.Forms.TextBox()
+ Me.txtEtternavn = New System.Windows.Forms.TextBox()
Me.txtFornavn = New System.Windows.Forms.TextBox()
Me.lblFodt = New System.Windows.Forms.Label()
Me.lblTelefonnr = New System.Windows.Forms.Label()
@@ -40,6 +40,8 @@ Partial Class frmKunderegistrering
Me.lblEtternavn = New System.Windows.Forms.Label()
Me.lblFornavn = New System.Windows.Forms.Label()
Me.txtHoyde = New System.Windows.Forms.TextBox()
+ Me.txtPostnr = New System.Windows.Forms.TextBox()
+ Me.lblPostnr = New System.Windows.Forms.Label()
Me.SuspendLayout()
'
'btnAvbryt
@@ -50,7 +52,7 @@ Partial Class frmKunderegistrering
Me.btnAvbryt.Location = New System.Drawing.Point(10, 277)
Me.btnAvbryt.Name = "btnAvbryt"
Me.btnAvbryt.Size = New System.Drawing.Size(59, 23)
- Me.btnAvbryt.TabIndex = 16
+ Me.btnAvbryt.TabIndex = 18
Me.btnAvbryt.Text = "&Avbryt"
Me.btnAvbryt.TextAlign = System.Drawing.ContentAlignment.MiddleRight
Me.btnAvbryt.UseVisualStyleBackColor = True
@@ -63,7 +65,7 @@ Partial Class frmKunderegistrering
Me.btnLagre.Location = New System.Drawing.Point(242, 277)
Me.btnLagre.Name = "btnLagre"
Me.btnLagre.Size = New System.Drawing.Size(58, 23)
- Me.btnLagre.TabIndex = 17
+ Me.btnLagre.TabIndex = 19
Me.btnLagre.Text = "&Lagre"
Me.btnLagre.TextAlign = System.Drawing.ContentAlignment.MiddleRight
Me.btnLagre.UseVisualStyleBackColor = True
@@ -76,7 +78,7 @@ Partial Class frmKunderegistrering
Me.txtSkonummer.Location = New System.Drawing.Point(124, 244)
Me.txtSkonummer.Name = "txtSkonummer"
Me.txtSkonummer.Size = New System.Drawing.Size(176, 20)
- Me.txtSkonummer.TabIndex = 15
+ Me.txtSkonummer.TabIndex = 17
'
'txtVekt
'
@@ -86,7 +88,7 @@ Partial Class frmKunderegistrering
Me.txtVekt.Location = New System.Drawing.Point(124, 218)
Me.txtVekt.Name = "txtVekt"
Me.txtVekt.Size = New System.Drawing.Size(176, 20)
- Me.txtVekt.TabIndex = 13
+ Me.txtVekt.TabIndex = 15
'
'lblSkonr
'
@@ -97,7 +99,7 @@ Partial Class frmKunderegistrering
Me.lblSkonr.Location = New System.Drawing.Point(15, 247)
Me.lblSkonr.Name = "lblSkonr"
Me.lblSkonr.Size = New System.Drawing.Size(63, 13)
- Me.lblSkonr.TabIndex = 14
+ Me.lblSkonr.TabIndex = 16
Me.lblSkonr.Text = "&Skonummer"
'
'lblVekt
@@ -109,18 +111,20 @@ Partial Class frmKunderegistrering
Me.lblVekt.Location = New System.Drawing.Point(15, 221)
Me.lblVekt.Name = "lblVekt"
Me.lblVekt.Size = New System.Drawing.Size(29, 13)
- Me.lblVekt.TabIndex = 12
+ Me.lblVekt.TabIndex = 14
Me.lblVekt.Text = "&Vekt"
'
- 'DateTimePicker1
+ 'dtpFodt
'
- Me.DateTimePicker1.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
+ Me.dtpFodt.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
- Me.DateTimePicker1.Location = New System.Drawing.Point(124, 118)
- Me.DateTimePicker1.Name = "DateTimePicker1"
- Me.DateTimePicker1.Size = New System.Drawing.Size(176, 20)
- Me.DateTimePicker1.TabIndex = 9
+ Me.dtpFodt.CustomFormat = "yyyy-MM-dd"
+ Me.dtpFodt.Format = System.Windows.Forms.DateTimePickerFormat.Custom
+ Me.dtpFodt.Location = New System.Drawing.Point(124, 145)
+ Me.dtpFodt.Name = "dtpFodt"
+ Me.dtpFodt.Size = New System.Drawing.Size(176, 20)
+ Me.dtpFodt.TabIndex = 11
'
'lblHoyde
'
@@ -131,38 +135,38 @@ Partial Class frmKunderegistrering
Me.lblHoyde.Location = New System.Drawing.Point(15, 194)
Me.lblHoyde.Name = "lblHoyde"
Me.lblHoyde.Size = New System.Drawing.Size(38, 13)
- Me.lblHoyde.TabIndex = 10
+ Me.lblHoyde.TabIndex = 12
Me.lblHoyde.Text = "&Høyde"
'
- 'txtFodt
- '
- Me.txtFodt.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
- Or System.Windows.Forms.AnchorStyles.Left) _
- Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
- Me.txtFodt.Location = New System.Drawing.Point(124, 92)
- Me.txtFodt.Name = "txtFodt"
- Me.txtFodt.Size = New System.Drawing.Size(176, 20)
- Me.txtFodt.TabIndex = 7
- '
'txtTelefon
'
Me.txtTelefon.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
- Me.txtTelefon.Location = New System.Drawing.Point(124, 66)
+ Me.txtTelefon.Location = New System.Drawing.Point(124, 119)
Me.txtTelefon.Name = "txtTelefon"
Me.txtTelefon.Size = New System.Drawing.Size(176, 20)
- Me.txtTelefon.TabIndex = 5
+ Me.txtTelefon.TabIndex = 9
'
'txtAdresse
'
Me.txtAdresse.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
- Me.txtAdresse.Location = New System.Drawing.Point(124, 40)
+ Me.txtAdresse.Location = New System.Drawing.Point(124, 66)
Me.txtAdresse.Name = "txtAdresse"
Me.txtAdresse.Size = New System.Drawing.Size(176, 20)
- Me.txtAdresse.TabIndex = 3
+ Me.txtAdresse.TabIndex = 5
+ '
+ 'txtEtternavn
+ '
+ Me.txtEtternavn.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
+ Or System.Windows.Forms.AnchorStyles.Left) _
+ Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
+ Me.txtEtternavn.Location = New System.Drawing.Point(124, 40)
+ Me.txtEtternavn.Name = "txtEtternavn"
+ Me.txtEtternavn.Size = New System.Drawing.Size(176, 20)
+ Me.txtEtternavn.TabIndex = 3
'
'txtFornavn
'
@@ -180,10 +184,10 @@ Partial Class frmKunderegistrering
Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.lblFodt.AutoSize = True
- Me.lblFodt.Location = New System.Drawing.Point(15, 124)
+ Me.lblFodt.Location = New System.Drawing.Point(15, 151)
Me.lblFodt.Name = "lblFodt"
Me.lblFodt.Size = New System.Drawing.Size(28, 13)
- Me.lblFodt.TabIndex = 8
+ Me.lblFodt.TabIndex = 10
Me.lblFodt.Text = "F&ødt"
'
'lblTelefonnr
@@ -192,10 +196,10 @@ Partial Class frmKunderegistrering
Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.lblTelefonnr.AutoSize = True
- Me.lblTelefonnr.Location = New System.Drawing.Point(15, 95)
+ Me.lblTelefonnr.Location = New System.Drawing.Point(15, 122)
Me.lblTelefonnr.Name = "lblTelefonnr"
Me.lblTelefonnr.Size = New System.Drawing.Size(52, 13)
- Me.lblTelefonnr.TabIndex = 6
+ Me.lblTelefonnr.TabIndex = 8
Me.lblTelefonnr.Text = "&Telefonnr"
'
'lblAdresse
@@ -242,13 +246,31 @@ Partial Class frmKunderegistrering
Me.txtHoyde.Location = New System.Drawing.Point(124, 192)
Me.txtHoyde.Name = "txtHoyde"
Me.txtHoyde.Size = New System.Drawing.Size(176, 20)
- Me.txtHoyde.TabIndex = 11
+ Me.txtHoyde.TabIndex = 13
+ '
+ 'txtPostnr
+ '
+ Me.txtPostnr.Location = New System.Drawing.Point(124, 93)
+ Me.txtPostnr.Name = "txtPostnr"
+ Me.txtPostnr.Size = New System.Drawing.Size(176, 20)
+ Me.txtPostnr.TabIndex = 7
+ '
+ 'lblPostnr
+ '
+ Me.lblPostnr.AutoSize = True
+ Me.lblPostnr.Location = New System.Drawing.Point(15, 96)
+ Me.lblPostnr.Name = "lblPostnr"
+ Me.lblPostnr.Size = New System.Drawing.Size(65, 13)
+ Me.lblPostnr.TabIndex = 6
+ Me.lblPostnr.Text = "&Postnummer"
'
'frmKunderegistrering
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(312, 310)
+ Me.Controls.Add(Me.lblPostnr)
+ Me.Controls.Add(Me.txtPostnr)
Me.Controls.Add(Me.txtHoyde)
Me.Controls.Add(Me.btnAvbryt)
Me.Controls.Add(Me.btnLagre)
@@ -256,11 +278,11 @@ Partial Class frmKunderegistrering
Me.Controls.Add(Me.txtVekt)
Me.Controls.Add(Me.lblSkonr)
Me.Controls.Add(Me.lblVekt)
- Me.Controls.Add(Me.DateTimePicker1)
+ Me.Controls.Add(Me.dtpFodt)
Me.Controls.Add(Me.lblHoyde)
- Me.Controls.Add(Me.txtFodt)
Me.Controls.Add(Me.txtTelefon)
Me.Controls.Add(Me.txtAdresse)
+ Me.Controls.Add(Me.txtEtternavn)
Me.Controls.Add(Me.txtFornavn)
Me.Controls.Add(Me.lblFodt)
Me.Controls.Add(Me.lblTelefonnr)
@@ -279,11 +301,11 @@ Partial Class frmKunderegistrering
Friend WithEvents txtVekt As System.Windows.Forms.TextBox
Friend WithEvents lblSkonr As System.Windows.Forms.Label
Friend WithEvents lblVekt As System.Windows.Forms.Label
- Friend WithEvents DateTimePicker1 As System.Windows.Forms.DateTimePicker
+ Friend WithEvents dtpFodt As System.Windows.Forms.DateTimePicker
Friend WithEvents lblHoyde As System.Windows.Forms.Label
- Friend WithEvents txtFodt As System.Windows.Forms.TextBox
Friend WithEvents txtTelefon As System.Windows.Forms.TextBox
Friend WithEvents txtAdresse As System.Windows.Forms.TextBox
+ Friend WithEvents txtEtternavn As System.Windows.Forms.TextBox
Friend WithEvents txtFornavn As System.Windows.Forms.TextBox
Friend WithEvents lblFodt As System.Windows.Forms.Label
Friend WithEvents lblTelefonnr As System.Windows.Forms.Label
@@ -291,4 +313,6 @@ Partial Class frmKunderegistrering
Friend WithEvents lblEtternavn As System.Windows.Forms.Label
Friend WithEvents lblFornavn As System.Windows.Forms.Label
Friend WithEvents txtHoyde As System.Windows.Forms.TextBox
+ Friend WithEvents txtPostnr As System.Windows.Forms.TextBox
+ Friend WithEvents lblPostnr As System.Windows.Forms.Label
End Class
View
88 Program/gui/frmKunderegistrering.vb
@@ -1,5 +1,6 @@
Public Class frmKunderegistrering
- Private id As Integer
+ Public id As Integer
+ Private oppkobling As New Sql()
Private Sub frmKunderegistrering_FormClosed(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles MyBase.FormClosed
Me.Dispose()
@@ -17,10 +18,93 @@
End Sub
Private Sub btnLagre_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLagre.Click
- Me.DialogResult = DialogResult.OK
+ If (valid()) Then
+ Dim updatedId As Integer = id
+
+ If (id <> 0) Then
+ oppkobling.Query("UPDATE person SET fodt = """ & dtpFodt.Text & """, fornavn = """ & txtFornavn.Text & """, etternavn = """ & txtEtternavn.Text & """, adresse = """ & txtAdresse.Text & """, telefonNr = """ & txtTelefon.Text & """, postNr = """ & txtPostnr.Text & """ WHERE person_id = """ & id & """")
+ oppkobling.Query("UPDATE kunde SET hoyde = """ & txtHoyde.Text & """, vekt = """ & txtVekt.Text & """, skoNr = """ & txtSkonummer.Text & """ WHERE person_id = """ & id & """")
+ Me.DialogResult = DialogResult.OK
+ Else
+ updatedId = oppkobling.executeQuery("INSERT INTO person (fodt, fornavn, etternavn, adresse, telefonNr, postnr) VALUES (""" & dtpFodt.Text & """, """ & txtFornavn.Text & """, """ & txtEtternavn.Text & """, """ & txtAdresse.Text & """, """ & txtTelefon.Text & """, """ & txtPostnr.Text & """)")
+
+ If (updatedId = 0) Then
+ MessageBox.Show("Kunne ikke lagre til databasen", "Feilmelding", MessageBoxButtons.OK, MessageBoxIcon.Error)
+ Me.DialogResult = DialogResult.Abort
+ Else
+ oppkobling.executeQuery("INSERT INTO kunde (person_id, hoyde, vekt, skoNr) VALUES (""" & updatedId & """, """ & txtHoyde.Text & """, """ & txtVekt.Text & """, """ & txtSkonummer.Text & """)")
+ id = updatedId
+ Me.DialogResult = DialogResult.OK
+ End If
+ End If
+ End If
End Sub
+ Private Function valid() As Boolean
+ If (IsNumeric(txtFornavn.Text) Or String.Equals(txtFornavn.Text, "")) Then
+ MessageBox.Show("Skriv inn fornavn!", "Feilmelding", MessageBoxButtons.OK, MessageBoxIcon.Error)
+ txtFornavn.Focus()
+ Return False
+ End If
+
+ If (IsNumeric(txtEtternavn.Text) Or String.Equals(txtEtternavn.Text, "")) Then
+ MessageBox.Show("Skriv inn etternavn!", "Feilmelding", MessageBoxButtons.OK, MessageBoxIcon.Error)
+ txtEtternavn.Focus()
+ Return False
+ End If
+
+ If (Not IsNumeric(txtSkonummer.Text) Or Not (Convert.ToInt32(txtSkonummer.Text) > 0 And Convert.ToInt32(txtSkonummer.Text) <= 99)) Then
+ MessageBox.Show("Skriv inn skonummer!", "Feilmelding", MessageBoxButtons.OK, MessageBoxIcon.Error)
+ txtSkonummer.Focus()
+ Return False
+ End If
+
+ If (Not IsNumeric(txtVekt.Text) Or Not (Convert.ToInt32(txtVekt.Text) > 0 And Convert.ToInt32(txtVekt.Text) <= 999)) Then
+ MessageBox.Show("Skriv inn vekt!", "Feilmelding", MessageBoxButtons.OK, MessageBoxIcon.Error)
+ txtVekt.Focus()
+ Return False
+ End If
+
+ If (Not IsNumeric(txtHoyde.Text) Or Not (Convert.ToInt32(txtHoyde.Text) > 0 And Convert.ToInt32(txtHoyde.Text) <= 999)) Then
+ MessageBox.Show("Skriv inn høyde!", "Feilmelding", MessageBoxButtons.OK, MessageBoxIcon.Error)
+ txtHoyde.Focus()
+ Return False
+ End If
+
+ Return True
+ End Function
+
Private Sub btnAvbryt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAvbryt.Click
Me.DialogResult = DialogResult.Cancel
End Sub
+
+ Private Sub init()
+ If (id <> 0) Then
+ Dim myData As New DataTable
+ myData = oppkobling.Query("SELECT * FROM kunde, person WHERE kunde.person_id = person.person_id AND kunde.person_id = """ & id & """")
+ Dim rad As DataRow = myData.Rows.Item(0)
+
+ txtFornavn.Text = rad("fornavn")
+ txtEtternavn.Text = rad("etternavn")
+ txtAdresse.Text = rad("adresse")
+ txtPostnr.Text = rad("postnr")
+ txtTelefon.Text = rad("telefonNr")
+ dtpFodt.Text = rad("fodt")
+
+ txtHoyde.Text = rad("hoyde")
+ txtVekt.Text = rad("vekt")
+ txtSkonummer.Text = rad("skoNr")
+ End If
+ End Sub
+
+ Private Sub frmKunderegistrering_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
+ Try
+ oppkobling.kobleTil()
+ Catch ex As Exception
+ MessageBox.Show("Kunne ikke koble til database", "Feilmelding", MessageBoxButtons.OK, MessageBoxIcon.Error)
+ Me.DialogResult = DialogResult.Abort
+ End Try
+
+ init()
+ End Sub
End Class
View
2  Program/gui/frmProduktRegistrering.vb
@@ -93,7 +93,7 @@
Dim updatedId As Integer = id
If (id <> 0) Then
- oppkobling.Query("UPDATE produkt SET navn = """ & txtNavn.Text & """, beskrivelse = """ & txtBeskrivelse.Text & """, pGruppe_id = """ & gruppeId & """")
+ oppkobling.Query("UPDATE produkt SET navn = """ & txtNavn.Text & """, beskrivelse = """ & txtBeskrivelse.Text & """, pGruppe_id = """ & gruppeId & """ WHERE produkt_id = """ & id & """")
Else
updatedId = oppkobling.executeQuery("INSERT INTO produkt (navn, beskrivelse, pGruppe_id) VALUES (""" & txtNavn.Text & """, """ & txtBeskrivelse.Text & """, """ & gruppeId & """)")
End If
View
116 Program/gui/frmUtleieregistrering.Designer.vb
@@ -23,8 +23,11 @@ Partial Class frmUtleieregistrering
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.scMain = New System.Windows.Forms.SplitContainer()
+ Me.dtpTil = New System.Windows.Forms.DateTimePicker()
+ Me.lblTil = New System.Windows.Forms.Label()
Me.txtMerknader = New System.Windows.Forms.TextBox()
Me.lblMerknader = New System.Windows.Forms.Label()
+ Me.btnAvbryt = New System.Windows.Forms.Button()
Me.gbKunde = New System.Windows.Forms.GroupBox()
Me.txtKundeSkonr = New System.Windows.Forms.TextBox()
Me.scKundeButtons = New System.Windows.Forms.SplitContainer()
@@ -41,13 +44,12 @@ Partial Class frmUtleieregistrering
Me.txtKundeHoyde = New System.Windows.Forms.TextBox()
Me.dtpFra = New System.Windows.Forms.DateTimePicker()
Me.lblFra = New System.Windows.Forms.Label()
+ Me.btnLagre = New System.Windows.Forms.Button()
Me.gbProdukt = New System.Windows.Forms.GroupBox()
Me.lvProdukt = New System.Windows.Forms.ListView()
Me.scProduktButtons = New System.Windows.Forms.SplitContainer()
Me.btnProduktFjern = New System.Windows.Forms.Button()
Me.btnProduktLeggTil = New System.Windows.Forms.Button()
- Me.btnAvbryt = New System.Windows.Forms.Button()
- Me.btnLagre = New System.Windows.Forms.Button()
CType(Me.scMain, System.ComponentModel.ISupportInitialize).BeginInit()
Me.scMain.Panel1.SuspendLayout()
Me.scMain.Panel2.SuspendLayout()
@@ -73,6 +75,8 @@ Partial Class frmUtleieregistrering
'
'scMain.Panel1
'
+ Me.scMain.Panel1.Controls.Add(Me.dtpTil)
+ Me.scMain.Panel1.Controls.Add(Me.lblTil)
Me.scMain.Panel1.Controls.Add(Me.txtMerknader)
Me.scMain.Panel1.Controls.Add(Me.lblMerknader)
Me.scMain.Panel1.Controls.Add(Me.btnAvbryt)
@@ -86,31 +90,66 @@ Partial Class frmUtleieregistrering
Me.scMain.Panel2.Controls.Add(Me.btnLagre)
Me.scMain.Panel2.Controls.Add(Me.gbProdukt)
Me.scMain.Panel2MinSize = 300
- Me.scMain.Size = New System.Drawing.Size(660, 350)
+ Me.scMain.Size = New System.Drawing.Size(660, 386)
Me.scMain.SplitterDistance = 327
Me.scMain.TabIndex = 0
Me.scMain.TabStop = False
'
+ 'dtpTil
+ '
+ Me.dtpTil.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
+ Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
+ Me.dtpTil.CustomFormat = "yyyy-MM-dd HH:mm"
+ Me.dtpTil.Format = System.Windows.Forms.DateTimePickerFormat.Custom
+ Me.dtpTil.Location = New System.Drawing.Point(106, 36)
+ Me.dtpTil.Name = "dtpTil"
+ Me.dtpTil.Size = New System.Drawing.Size(208, 20)
+ Me.dtpTil.TabIndex = 3
+ '
+ 'lblTil
+ '
+ Me.lblTil.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
+ Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
+ Me.lblTil.AutoSize = True
+ Me.lblTil.Location = New System.Drawing.Point(15, 41)
+ Me.lblTil.Name = "lblTil"
+ Me.lblTil.Size = New System.Drawing.Size(18, 13)
+ Me.lblTil.TabIndex = 2
+ Me.lblTil.Text = "&Til"
+ '
'txtMerknader
'
Me.txtMerknader.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
- Me.txtMerknader.Location = New System.Drawing.Point(106, 40)
+ Me.txtMerknader.Location = New System.Drawing.Point(106, 62)
Me.txtMerknader.Name = "txtMerknader"
Me.txtMerknader.Size = New System.Drawing.Size(208, 20)
- Me.txtMerknader.TabIndex = 3
+ Me.txtMerknader.TabIndex = 5
'
'lblMerknader
'
Me.lblMerknader.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.lblMerknader.AutoSize = True
- Me.lblMerknader.Location = New System.Drawing.Point(18, 43)
+ Me.lblMerknader.Location = New System.Drawing.Point(15, 65)
Me.lblMerknader.Name = "lblMerknader"
Me.lblMerknader.Size = New System.Drawing.Size(58, 13)
- Me.lblMerknader.TabIndex = 2
+ Me.lblMerknader.TabIndex = 4
Me.lblMerknader.Text = "&Merknader"
'
+ 'btnAvbryt
+ '
+ Me.btnAvbryt.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
+ Me.btnAvbryt.Image = Global.Program.My.Resources.Resources.cancel
+ Me.btnAvbryt.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
+ Me.btnAvbryt.Location = New System.Drawing.Point(12, 350)
+ Me.btnAvbryt.Name = "btnAvbryt"
+ Me.btnAvbryt.Size = New System.Drawing.Size(59, 23)
+ Me.btnAvbryt.TabIndex = 19
+ Me.btnAvbryt.Text = "A&vbryt"
+ Me.btnAvbryt.TextAlign = System.Drawing.ContentAlignment.MiddleRight
+ Me.btnAvbryt.UseVisualStyleBackColor = True
+ '
'gbKunde
'
Me.gbKunde.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
@@ -126,7 +165,7 @@ Partial Class frmUtleieregistrering
Me.gbKunde.Controls.Add(Me.lblKundeHoyde)
Me.gbKunde.Controls.Add(Me.lblKundeVekt)
Me.gbKunde.Controls.Add(Me.txtKundeHoyde)
- Me.gbKunde.Location = New System.Drawing.Point(12, 82)
+ Me.gbKunde.Location = New System.Drawing.Point(12, 115)
Me.gbKunde.Name = "gbKunde"
Me.gbKunde.Size = New System.Drawing.Size(302, 212)
Me.gbKunde.TabIndex = 8
@@ -167,7 +206,7 @@ Partial Class frmUtleieregistrering
Me.btnKundeEndre.Location = New System.Drawing.Point(0, 0)
Me.btnKundeEndre.Name = "btnKundeEndre"
Me.btnKundeEndre.Size = New System.Drawing.Size(147, 27)
- Me.btnKundeEndre.TabIndex = 14
+ Me.btnKundeEndre.TabIndex = 9
Me.btnKundeEndre.Text = "&Endre"
Me.btnKundeEndre.UseVisualStyleBackColor = True
'
@@ -177,7 +216,7 @@ Partial Class frmUtleieregistrering
Me.btnKundeOpprett.Location = New System.Drawing.Point(0, 0)
Me.btnKundeOpprett.Name = "btnKundeOpprett"
Me.btnKundeOpprett.Size = New System.Drawing.Size(145, 27)
- Me.btnKundeOpprett.TabIndex = 15
+ Me.btnKundeOpprett.TabIndex = 10
Me.btnKundeOpprett.Text = "&Opprett ny"
Me.btnKundeOpprett.UseVisualStyleBackColor = True
'
@@ -189,7 +228,7 @@ Partial Class frmUtleieregistrering
Me.cbKundeNavn.Location = New System.Drawing.Point(94, 19)
Me.cbKundeNavn.Name = "cbKundeNavn"
Me.cbKundeNavn.Size = New System.Drawing.Size(198, 21)
- Me.cbKundeNavn.TabIndex = 5
+ Me.cbKundeNavn.TabIndex = 7
'
'lblKundeSkonr
'
@@ -210,7 +249,7 @@ Partial Class frmUtleieregistrering
Me.lblKundeAdresse.Location = New System.Drawing.Point(21, 49)
Me.lblKundeAdresse.Name = "lblKundeAdresse"
Me.lblKundeAdresse.Size = New System.Drawing.Size(45, 13)
- Me.lblKundeAdresse.TabIndex = 6
+ Me.lblKundeAdresse.TabIndex = 8
Me.lblKundeAdresse.Text = "Adresse"
'
'txtKundeAdresse
@@ -221,7 +260,7 @@ Partial Class frmUtleieregistrering
Me.txtKundeAdresse.Location = New System.Drawing.Point(94, 46)
Me.txtKundeAdresse.Name = "txtKundeAdresse"
Me.txtKundeAdresse.Size = New System.Drawing.Size(198, 20)
- Me.txtKundeAdresse.TabIndex = 7
+ Me.txtKundeAdresse.TabIndex = 9
'
'txtKundeVekt
'
@@ -241,7 +280,7 @@ Partial Class frmUtleieregistrering
Me.lblKundeNavn.Location = New System.Drawing.Point(21, 22)
Me.lblKundeNavn.Name = "lblKundeNavn"
Me.lblKundeNavn.Size = New System.Drawing.Size(33, 13)
- Me.lblKundeNavn.TabIndex = 4
+ Me.lblKundeNavn.TabIndex = 6
Me.lblKundeNavn.Text = "&Navn"
'
'lblKundeHoyde
@@ -298,6 +337,19 @@ Partial Class frmUtleieregistrering
Me.lblFra.TabIndex = 0
Me.lblFra.Text = "&Fra"
'
+ 'btnLagre
+ '
+ Me.btnLagre.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
+ Me.btnLagre.Image = Global.Program.My.Resources.Resources.confirm
+ Me.btnLagre.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
+ Me.btnLagre.Location = New System.Drawing.Point(258, 350)
+ Me.btnLagre.Name = "btnLagre"
+ Me.btnLagre.Size = New System.Drawing.Size(58, 23)
+ Me.btnLagre.TabIndex = 20
+ Me.btnLagre.Text = "&Lagre"
+ Me.btnLagre.TextAlign = System.Drawing.ContentAlignment.MiddleRight
+ Me.btnLagre.UseVisualStyleBackColor = True
+ '
'gbProdukt
'
Me.gbProdukt.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
@@ -307,7 +359,7 @@ Partial Class frmUtleieregistrering
Me.gbProdukt.Controls.Add(Me.scProduktButtons)
Me.gbProdukt.Location = New System.Drawing.Point(12, 6)
Me.gbProdukt.Name = "gbProdukt"
- Me.gbProdukt.Size = New System.Drawing.Size(304, 288)
+ Me.gbProdukt.Size = New System.Drawing.Size(304, 321)
Me.gbProdukt.TabIndex = 6
Me.gbProdukt.TabStop = False
Me.gbProdukt.Text = "Produkt"
@@ -319,7 +371,7 @@ Partial Class frmUtleieregistrering
Me.lvProdukt.GridLines = True
Me.lvProdukt.Location = New System.Drawing.Point(3, 16)
Me.lvProdukt.Name = "lvProdukt"
- Me.lvProdukt.Size = New System.Drawing.Size(298, 242)
+ Me.lvProdukt.Size = New System.Drawing.Size(298, 275)
Me.lvProdukt.TabIndex = 2
Me.lvProdukt.TabStop = False
Me.lvProdukt.UseCompatibleStateImageBehavior = False
@@ -328,7 +380,7 @@ Partial Class frmUtleieregistrering
'scProduktButtons
'
Me.scProduktButtons.Dock = System.Windows.Forms.DockStyle.Bottom
- Me.scProduktButtons.Location = New System.Drawing.Point(3, 258)
+ Me.scProduktButtons.Location = New System.Drawing.Point(3, 291)
Me.scProduktButtons.Name = "scProduktButtons"
'
'scProduktButtons.Panel1
@@ -363,37 +415,11 @@ Partial Class frmUtleieregistrering
Me.btnProduktLeggTil.Text = "&Legg til"
Me.btnProduktLeggTil.UseVisualStyleBackColor = True
'
- 'btnAvbryt
- '
- Me.btnAvbryt.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
- Me.btnAvbryt.Image = Global.Program.My.Resources.Resources.cancel
- Me.btnAvbryt.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
- Me.btnAvbryt.Location = New System.Drawing.Point(12, 314)
- Me.btnAvbryt.Name = "btnAvbryt"
- Me.btnAvbryt.Size = New System.Drawing.Size(59, 23)
- Me.btnAvbryt.TabIndex = 19
- Me.btnAvbryt.Text = "A&vbryt"
- Me.btnAvbryt.TextAlign = System.Drawing.ContentAlignment.MiddleRight
- Me.btnAvbryt.UseVisualStyleBackColor = True
- '
- 'btnLagre
- '
- Me.btnLagre.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
- Me.btnLagre.Image = Global.Program.My.Resources.Resources.confirm
- Me.btnLagre.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
- Me.btnLagre.Location = New System.Drawing.Point(258, 314)
- Me.btnLagre.Name = "btnLagre"
- Me.btnLagre.Size = New System.Drawing.Size(58, 23)
- Me.btnLagre.TabIndex = 20
- Me.btnLagre.Text = "&Lagre"
- Me.btnLagre.TextAlign = System.Drawing.ContentAlignment.MiddleRight
- Me.btnLagre.UseVisualStyleBackColor = True
- '
'frmUtleieregistrering
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
- Me.ClientSize = New System.Drawing.Size(660, 350)
+ Me.ClientSize = New System.Drawing.Size(660, 386)
Me.Controls.Add(Me.scMain)
Me.Name = "frmUtleieregistrering"
Me.Text = "Utleieregistrering"
@@ -442,4 +468,6 @@ Partial Class frmUtleieregistrering
Friend WithEvents txtMerknader As System.Windows.Forms.TextBox
Friend WithEvents lblMerknader As System.Windows.Forms.Label
Friend WithEvents lvProdukt As System.Windows.Forms.ListView
+ Friend WithEvents dtpTil As System.Windows.Forms.DateTimePicker
+ Friend WithEvents lblTil As System.Windows.Forms.Label
End Class
View
80 Program/gui/frmUtleieregistrering.vb
@@ -22,11 +22,12 @@
Sub init()
If (id <> 0) Then
Dim myData As New DataTable
- myData = oppkobling.Query("SELECT datoFra, merknader, kunde FROM bestilling WHERE bestilling_id = """ & id & """")
+ myData = oppkobling.Query("SELECT datoFra, datoTil, merknader, kunde FROM bestilling WHERE bestilling_id = """ & id & """")
Dim rad As DataRow = myData.Rows.Item(0)
txtMerknader.Text = rad("merknader")
dtpFra.Text = rad("datoFra")
+ dtpTil.Text = rad("datoTil")
Dim selected As ComboBoxValue
For Each selected In cbKundeNavn.Items
@@ -38,7 +39,7 @@
End If
Dim myData2 As New DataTable
- myData2 = oppkobling.Query("SELECT bestillingsprodukt.produkt_id, navn, beskrivelse FROM bestillingsprodukt, produkt WHERE bestillingsprodukt.produkt_id = produkt.produkt_id AND bestillingsprodukt.produkt_id = """ & id & """")
+ myData2 = oppkobling.Query("SELECT bestillingsprodukt.produkt_id, navn, beskrivelse FROM bestillingsprodukt, produkt WHERE bestillingsprodukt.produkt_id = produkt.produkt_id AND bestillingsprodukt.bestilling_id = """ & id & """")
Dim rad2 As DataRow
For Each rad2 In myData2.Rows
addProdukt(rad2("produkt_id"), rad2("navn"), rad2("beskrivelse"))
@@ -81,6 +82,7 @@
Dim myData As New DataTable
myData = oppkobling.Query("SELECT kunde.person_id, fornavn, etternavn FROM kunde, person WHERE kunde.person_id = person.person_id")
+ cbKundeNavn.Items.Clear()
Dim rad As DataRow
For Each rad In myData.Rows
cbKundeNavn.Items.Add(New ComboBoxValue(rad("person_id"), rad("etternavn") & ", " & rad("fornavn"), rad("person_id")))
@@ -125,11 +127,21 @@
Dim selected As ComboBoxValue = cbKundeNavn.SelectedItem
If (selected IsNot Nothing) Then
- Dim dialog As New frmKunderegistrering
+ Dim dialog As New frmKunderegistrering(selected.ID)
If (dialog.ShowDialog() = DialogResult.OK) Then
-
+ initKunder()
+
+ Dim item As ComboBoxValue
+ For Each item In cbKundeNavn.Items
+ If (item.ID = selected.ID) Then
+ cbKundeNavn.SelectedItem = item
+ Exit For
+ End If
+ Next item
End If
+ Else
+
End If
End Sub
@@ -137,7 +149,15 @@
Dim dialog As New frmKunderegistrering
If (dialog.ShowDialog() = DialogResult.OK) Then
+ initKunder()
+ Dim item As ComboBoxValue
+ For Each item In cbKundeNavn.Items
+ If (item.ID = dialog.id) Then
+ cbKundeNavn.SelectedItem = item
+ Exit For
+ End If
+ Next item
End If
End Sub
@@ -152,4 +172,56 @@
Private Sub btnAvbryt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAvbryt.Click
Me.DialogResult = DialogResult.Cancel
End Sub
+
+ Private Sub btnLagre_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLagre.Click
+ If (valid()) Then
+ Dim updatedId As Integer = id
+
+ Dim selectedKundeId As ComboBoxValue = cbKundeNavn.SelectedItem
+ Dim kundeId As String = selectedKundeId.ID
+
+ Dim selgerId As String = frmHoved.login.getPersonId
+
+ If (id <> 0) Then
+ oppkobling.Query("UPDATE bestilling SET datoFra = """ & dtpFra.Text & """, datoTil = """ & dtpTil.Text & """, merknader = """ & txtMerknader.Text & """, kunde = """ & kundeId & """ WHERE bestilling_id = """ & updatedId & """")
+ Else
+ updatedId = oppkobling.executeQuery("INSERT INTO bestilling (datoFra, datoTil, merknader, selger, kunde) VALUES (""" & dtpFra.Text & """, """ & dtpTil.Text & """, """ & txtMerknader.Text & """, """ & selgerId & """, """ & kundeId & """)")
+ End If
+
+ If (updatedId = 0) Then
+ MessageBox.Show("Kunne ikke lagre til databasen", "Feilmelding", MessageBoxButtons.OK, MessageBoxIcon.Error)
+ Me.DialogResult = DialogResult.Abort
+ Else
+ oppkobling.executeQuery("DELETE FROM bestillingsprodukt WHERE bestilling_id = """ & updatedId & """")
+
+ Dim item As ListViewItem
+ For Each item In lvProdukt.Items
+ Dim _id As String = item.SubItems.Item(0).Text
+
+ Try
+ oppkobling.executeQuery("INSERT INTO bestillingsprodukt (bestilling_id, produkt_id) VALUES (""" & updatedId & """, """ & _id & """)")
+ Catch ex As Exception
+ End Try
+ Next item
+
+ Me.DialogResult = DialogResult.OK
+ End If
+ End If
+ End Sub
+
+ Private Function valid() As Boolean
+ If (cbKundeNavn.SelectedItem Is Nothing) Then
+ MessageBox.Show("Velg kunde!", "Feilmelding", MessageBoxButtons.OK, MessageBoxIcon.Error)
+ cbKundeNavn.Focus()
+ Return False
+ End If
+
+ If (lvProdukt.Items.Count = 0) Then
+ MessageBox.Show("Legg til minst ett produkt!", "Feilmelding", MessageBoxButtons.OK, MessageBoxIcon.Error)
+ btnProduktLeggTil.Focus()
+ Return False
+ End If
+
+ Return True
+ End Function
End Class
View
BIN  Program/ico/support.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Please sign in to comment.
Something went wrong with that request. Please try again.