From 95abbfba38a883c8459fa6f1266a8f477fd30859 Mon Sep 17 00:00:00 2001 From: Mayank Vikhona Date: Sat, 6 Aug 2016 16:17:21 +0530 Subject: [PATCH] Add 'Clear Inventory' Form Adding Clear Inventory Form to let refresh existing Inventory at the start of semester by Mess System Managers themselves. Till now they call us to do it from MySql Workbench. I hope it will help. --- .../formClearInventory.Designer.vb | 50 ++++++++ .../formClearInventory.resx | 120 ++++++++++++++++++ .../formClearInventory.vb | 23 ++++ 3 files changed, 193 insertions(+) create mode 100644 Mess%20Management%20System/formClearInventory.Designer.vb create mode 100644 Mess%20Management%20System/formClearInventory.resx create mode 100644 Mess%20Management%20System/formClearInventory.vb diff --git a/Mess%20Management%20System/formClearInventory.Designer.vb b/Mess%20Management%20System/formClearInventory.Designer.vb new file mode 100644 index 0000000..3a2bb01 --- /dev/null +++ b/Mess%20Management%20System/formClearInventory.Designer.vb @@ -0,0 +1,50 @@ + _ +Partial Class formClearInventory + Inherits System.Windows.Forms.Form + + 'Form overrides dispose to clean up the component list. + _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + _ + Private Sub InitializeComponent() + Me.Button1 = New System.Windows.Forms.Button() + Me.SuspendLayout() + ' + 'Button1 + ' + Me.Button1.Font = New System.Drawing.Font("Microsoft Sans Serif", 15.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Button1.Location = New System.Drawing.Point(47, 95) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(185, 55) + Me.Button1.TabIndex = 0 + Me.Button1.Text = "Clear Inventory" + Me.Button1.UseVisualStyleBackColor = True + ' + 'formClearInventory + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(284, 261) + Me.Controls.Add(Me.Button1) + Me.Name = "formClearInventory" + Me.Text = "formClearInventory" + Me.ResumeLayout(False) + + End Sub + Friend WithEvents Button1 As System.Windows.Forms.Button +End Class diff --git a/Mess%20Management%20System/formClearInventory.resx b/Mess%20Management%20System/formClearInventory.resx new file mode 100644 index 0000000..29dcb1b --- /dev/null +++ b/Mess%20Management%20System/formClearInventory.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Mess%20Management%20System/formClearInventory.vb b/Mess%20Management%20System/formClearInventory.vb new file mode 100644 index 0000000..948f996 --- /dev/null +++ b/Mess%20Management%20System/formClearInventory.vb @@ -0,0 +1,23 @@ +Imports MySql.Data.MySqlClient +Public Class formClearInventory + Dim con As New connection 'Mysql Connection used within the Form + Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click + Try + + + + con.connect() + Dim query As String = "set sql_safe_updates = 0 ;update mess_store set QTY = 0;" + Dim comm As New MySqlCommand(query, con.conn) + comm.ExecuteNonQuery() + MsgBox("Inventory Cleared") + + + + Catch ex As Exception + MsgBox("Error Occured ! Please contact SSMS Tech Team !!") + MsgBox(ex.Message.ToString) + + End Try + End Sub +End Class \ No newline at end of file