Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- If IsNothing(cmbProd.SelectedItem) Then
- MessageBox.Show("Select Product Name of Raw Material", "Required", MessageBoxButtons.OK, MessageBoxIcon.Error)
- cmbProd.BackColor = Color.PapayaWhip
- cmbProd.Focus()
- ElseIf IsNothing(txtaddProductName.SelectedItem) Then
- MessageBox.Show("Select Raw Material", "Required", MessageBoxButtons.OK, MessageBoxIcon.Error)
- txtaddProductName.BackColor = Color.PapayaWhip
- txtaddProductName.Focus()
- ElseIf (txtConSolo.Text <> "") And (IsNothing(cmbUnitSolo.SelectedItem)) Then
- MessageBox.Show("Select Unit", "Required", MessageBoxButtons.OK, MessageBoxIcon.Error)
- cmbUnitSolo.BackColor = Color.PapayaWhip
- cmbUnitSolo.Focus()
- txtConSolo.BackColor = Color.White
- ElseIf (txtConSolo.Text = "") And (cmbUnitSolo.Text <> "") Then
- MessageBox.Show("Enter Consume per Product", "Required", MessageBoxButtons.OK, MessageBoxIcon.Error)
- txtConSolo.BackColor = Color.PapayaWhip
- txtConSolo.Focus()
- cmbUnitSolo.BackColor = Color.White
- ElseIf (txtConReg.Text <> "") And (IsNothing(cmbUnitReg.SelectedItem)) Then
- MessageBox.Show("Select Unit", "Required", MessageBoxButtons.OK, MessageBoxIcon.Error)
- cmbUnitReg.BackColor = Color.PapayaWhip
- cmbUnitReg.Focus()
- txtConReg.BackColor = Color.White
- ElseIf (txtConReg.Text = "") And (cmbUnitReg.Text <> "") Then
- MessageBox.Show("Enter Consume per Product", "Required", MessageBoxButtons.OK, MessageBoxIcon.Error)
- txtConReg.BackColor = Color.PapayaWhip
- txtConReg.Focus()
- cmbUnitReg.BackColor = Color.White
- ElseIf (txtConFam.Text <> "") And (IsNothing(cmbUnitFam.SelectedItem)) Then
- MessageBox.Show("Select Unit", "Required", MessageBoxButtons.OK, MessageBoxIcon.Error)
- cmbUnitFam.BackColor = Color.PapayaWhip
- cmbUnitFam.Focus()
- txtConFam.BackColor = Color.White
- ElseIf (txtConFam.Text = "") And (cmbUnitFam.Text <> "") Then
- MessageBox.Show("Enter Consume per Product", "Required", MessageBoxButtons.OK, MessageBoxIcon.Error)
- txtConFam.BackColor = Color.PapayaWhip
- txtConFam.Focus()
- cmbUnitFam.BackColor = Color.White
- ElseIf (txtConSolo.Text <> "") And (cmbUnitSolo.Text <> "") And ((txtConReg.Text = "") And (IsNothing(cmbUnitReg.SelectedItem))) And ((txtConFam.Text = "") And IsNothing(cmbUnitFam.SelectedItem)) Then
- MessageBox.Show("solo may laman", "Required", MessageBoxButtons.OK, MessageBoxIcon.Error)
- txtDisplaySolo.Text = "Solo"
- rawtxt = CStr(txtaddProductName.Text)
- prodtxt = CStr(cmbProd.Text)
- txtsolsize = Val(txtConSolo.Text)
- sizesoltxt = CStr(cmbUnitSolo.Text)
- Try
- objconn.Open()
- objcmd.Connection = objconn
- objcmd.CommandType = CommandType.Text
- objcmd.CommandText = "select * from material_every_product where Product_ID IN (Select Product_ID from product_table where Product_Name ='" & prodtxt & "') " _
- & "AND Raw_ID IN (Select Raw_ID from raw_material_table where Raw_Name ='" & rawtxt & "') " _
- & "AND Unit_ID IN (Select Unit_ID from unit_table where unit_table.Unit_Name IS NOT NULL) " _
- & "AND Size_ID IN (Select Size_ID from product_size where Size_Name ='" & CStr(txtDisplayReg.Text) & "') "
- objdr = objcmd.ExecuteReader
- If objdr.HasRows Then
- MessageBox.Show("The Product Raw Material Already Exists at Solo Size but You Can add Raw Materials at Regular or Family Size if it is considered as a Raw Materials in our Product .You can select also another Raw Materials or a Product.", "Red Cheese Pizza Message", MessageBoxButtons.OK, MessageBoxIcon.Error)
- cmbUnitSolo.BackColor = Color.PapayaWhip
- cmbUnitSolo.Focus()
- txtConSolo.BackColor = Color.PapayaWhip
- txtConSolo.Focus()
- Label3.ForeColor = Color.Red
- Else
- Dim hungaonka As MsgBoxResult
- hungaonka = MsgBox("Your Adding an " & rawtxt & " to " & prodtxt & " Consume every materials " & Environment.NewLine & "" & txtsolsize & " " & sizesoltxt & " at " & txtDisplaySolo.Text & " size, " & Environment.NewLine & "" _
- & ", Do You Want To Continue ?", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Confirmation")
- If hungaonka = MsgBoxResult.Yes Then
- objconn = New MySqlConnection
- objconn.ConnectionString = "server=localhost; username=root; password=; database=red_cheese_pizza_database"
- Try
- objconn.Open()
- With objcmd
- .Connection = objconn
- .CommandText = "Insert into material_every_product (Product_ID,Minus_Material_Every_Product,Raw_ID,unit_ID,Size_ID) values " _
- & " ((SELECT Product_ID FROM product_table WHERE Product_Name ='" & CStr(prodtxt) & "')," & CInt(txtsolsize) & ", " _
- & " (Select Raw_ID from raw_material_table where Raw_Name ='" & CStr(rawtxt) & "'),(Select Unit_ID from unit_table where " _
- & " Unit_Name = '" & CStr(sizesoltxt) & "'),(Select Size_ID from product_size where Size_Name = '" & CStr(txtDisplaySolo.Text) & "')); "
- .ExecuteNonQuery()
- End With
- txtDisplaySolo.Text = ""
- objconn.Close()
- 'Main.FillMainDbase()
- 'Main.fillProdukto()
- txtDisplaySolo.Text = ""
- Clearform3()
- MsgBox("Data Added!", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "SUCCESS")
- Catch ex As Exception
- MsgBox(ex.Message, MsgBoxStyle.Critical, "Red Cheese Pizza Error Program, Contact Programmer about this. Thank You.")
- End Try
- ElseIf hungaonka = MsgBoxResult.No Then
- ' objconn.Close()
- Exit Sub
- End If
- End If
- objconn.Close()
- Catch ex As Exception
- MessageBox.Show(ex.Message)
- End Try
- ElseIf (txtConReg.Text <> "") And (cmbUnitReg.Text <> "") And ((txtConSolo.Text = "") And IsNothing(cmbUnitSolo.SelectedItem)) And ((txtConFam.Text = "" And IsNothing(cmbUnitFam.SelectedItem))) Then
- MessageBox.Show("reg may laman", "Required", MessageBoxButtons.OK, MessageBoxIcon.Error)
- txtDisplayReg.Text = "Regular"
- rawtxt = CStr(txtaddProductName.Text)
- prodtxt = CStr(cmbProd.Text)
- txtregsize = Val(txtConReg.Text)
- sizeregtxt = CStr(cmbUnitReg.Text)
- Try
- objconn.Open()
- objcmd.Connection = objconn
- objcmd.CommandType = CommandType.Text
- objcmd.CommandText = "select * from material_every_product where Product_ID IN (Select Product_ID from product_table where Product_Name ='" & prodtxt & "') " _
- & "AND Raw_ID IN (Select Raw_ID from raw_material_table where Raw_Name ='" & rawtxt & "') " _
- & "AND Unit_ID IN (Select Unit_ID from unit_table where unit_table.Unit_Name IS NOT NULL) " _
- & "AND Size_ID IN (Select Size_ID from product_size where Size_Name ='" & CStr(txtDisplayReg.Text) & "') "
- objdr = objcmd.ExecuteReader
- If objdr.HasRows Then
- MessageBox.Show("The Product Raw Material Already Exists at Regular Size but You Can add Raw Materials at Solo or Family Size if it is considered as a Raw Materials in our Product .You can select also another Raw Materials or a Product.", "Red Cheese Pizza Message", MessageBoxButtons.OK, MessageBoxIcon.Error)
- cmbUnitReg.BackColor = Color.PapayaWhip
- cmbUnitReg.Focus()
- txtConReg.BackColor = Color.PapayaWhip
- txtConReg.Focus()
- Label2.ForeColor = Color.Red
- Else
- Dim hungaonka As MsgBoxResult
- hungaonka = MsgBox("Your Adding an " & rawtxt & " to " & prodtxt & " Consume every materials " & Environment.NewLine & "" & txtregsize & " " & sizeregtxt & " at " & txtDisplayReg.Text & " size, " & Environment.NewLine & "" _
- & ", Do You Want To Continue ?", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Confirmation")
- If hungaonka = MsgBoxResult.Yes Then
- objconn = New MySqlConnection
- objconn.ConnectionString = "server=localhost; username=root; password=; database=red_cheese_pizza_database"
- Try
- objconn.Open()
- With objcmd
- .Connection = objconn
- .CommandText = "Insert into material_every_product (Product_ID,Minus_Material_Every_Product,Raw_ID,unit_ID,Size_ID) values " _
- & " ((SELECT Product_ID FROM product_table WHERE Product_Name ='" & CStr(prodtxt) & "')," & CInt(txtregsize) & ", " _
- & " (Select Raw_ID from raw_material_table where Raw_Name ='" & CStr(rawtxt) & "'),(Select Unit_ID from unit_table where " _
- & " Unit_Name = '" & CStr(sizeregtxt) & "'),(Select Size_ID from product_size where Size_Name = '" & CStr(txtDisplayReg.Text) & "')); "
- .ExecuteNonQuery()
- End With
- txtDisplayReg.Text = ""
- objconn.Close()
- 'Main.FillMainDbase()
- 'Main.fillProdukto()
- txtDisplayReg.Text = ""
- Clearform3()
- MsgBox("Data Added!", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "SUCCESS")
- Catch ex As Exception
- MsgBox(ex.Message, MsgBoxStyle.Critical, "Red Cheese Pizza Error Program, Contact Programmer about this. Thank You.")
- End Try
- ElseIf hungaonka = MsgBoxResult.No Then
- ' objconn.Close()
- Exit Sub
- End If
- End If
- objconn.Close()
- Catch ex As Exception
- MessageBox.Show(ex.Message)
- End Try
- ElseIf (txtConFam.Text <> "" And cmbUnitFam.Text <> "") And (txtConSolo.Text = "" And IsNothing(cmbUnitSolo.SelectedItem)) And (txtConReg.Text = "" And IsNothing(cmbUnitReg.SelectedItem)) Then
- MessageBox.Show("fam may laman", "Required", MessageBoxButtons.OK, MessageBoxIcon.Error)
- txtDisplayFam.Text = "Family"
- rawtxt = CStr(txtaddProductName.Text)
- prodtxt = CStr(cmbProd.Text)
- txtfamsize = Val(txtConFam.Text)
- sizefamtxt = CStr(cmbUnitFam.Text)
- Try
- objconn.Open()
- objcmd.Connection = objconn
- objcmd.CommandType = CommandType.Text
- objcmd.CommandText = "select * from material_every_product where Product_ID IN (Select Product_ID from product_table where Product_Name ='" & prodtxt & "') " _
- & "AND Raw_ID IN (Select Raw_ID from raw_material_table where Raw_Name ='" & rawtxt & "') " _
- & "AND Unit_ID IN (Select Unit_ID from unit_table where unit_table.Unit_Name IS NOT NULL) " _
- & "AND Size_ID IN (Select Size_ID from product_size where Size_Name ='" & CStr(txtDisplayFam.Text) & "') "
- objdr = objcmd.ExecuteReader
- If objdr.HasRows Then
- MessageBox.Show("The Product Raw Material Already Exists at Family Size but You Can add Raw Materials at Solo or Regular Size if it is considered as a Raw Materials in our Product .You can select also another Raw Materials or a Product.", "Red Cheese Pizza Message", MessageBoxButtons.OK, MessageBoxIcon.Error)
- cmbUnitFam.BackColor = Color.PapayaWhip
- cmbUnitFam.Focus()
- txtConFam.BackColor = Color.PapayaWhip
- txtConFam.Focus()
- Label4.ForeColor = Color.Red
- Else
- Dim hungaonka As MsgBoxResult
- hungaonka = MsgBox("Your Adding an " & rawtxt & " to " & prodtxt & " Consume every materials " & Environment.NewLine & "" & txtfamsize & " " & sizefamtxt & " at " & txtDisplayFam.Text & " size, " & Environment.NewLine & "" _
- & ", Do You Want To Continue ?", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Confirmation")
- If hungaonka = MsgBoxResult.Yes Then
- objconn = New MySqlConnection
- objconn.ConnectionString = "server=localhost; username=root; password=; database=red_cheese_pizza_database"
- Try
- objconn.Open()
- With objcmd
- .Connection = objconn
- .CommandText = "Insert into material_every_product (Product_ID,Minus_Material_Every_Product,Raw_ID,unit_ID,Size_ID) values " _
- & " ((SELECT Product_ID FROM product_table WHERE Product_Name ='" & CStr(prodtxt) & "')," & CInt(txtfamsize) & ", " _
- & " (Select Raw_ID from raw_material_table where Raw_Name ='" & CStr(rawtxt) & "'),(Select Unit_ID from unit_table where " _
- & " Unit_Name = '" & CStr(sizefamtxt) & "'),(Select Size_ID from product_size where Size_Name = '" & CStr(txtDisplayFam.Text) & "')); "
- .ExecuteNonQuery()
- End With
- txtDisplayFam.Text = ""
- objconn.Close()
- 'Main.FillMainDbase()
- 'Main.fillProdukto()
- txtDisplayFam.Text = ""
- Clearform3()
- MsgBox("Data Added!", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "SUCCESS")
- Catch ex As Exception
- MsgBox(ex.Message, MsgBoxStyle.Critical, "Red Cheese Pizza Error Program, Contact Programmer about this. Thank You.")
- End Try
- ElseIf hungaonka = MsgBoxResult.No Then
- ' objconn.Close()
- Exit Sub
- End If
- End If
- objconn.Close()
- Catch ex As Exception
- MessageBox.Show(ex.Message)
- End Try
- ElseIf txtConSolo.Text <> "" And cmbUnitSolo.Text <> "" And txtConReg.Text <> "" And cmbUnitReg.Text <> "" And txtConFam.Text = "" And IsNothing(cmbUnitFam.SelectedItem) Then
- MessageBox.Show("solo and reg may laman", "Required", MessageBoxButtons.OK, MessageBoxIcon.Error)
- txtDisplaySolo.Text = "Solo"
- txtDisplayReg.Text = "Regular"
- ElseIf txtConSolo.Text <> "" And cmbUnitSolo.Text <> "" And txtConReg.Text <> "" And cmbUnitReg.Text <> "" And txtConFam.Text <> "" And cmbUnitFam.Text <> "" Then
- MessageBox.Show("solo and reg and fam may laman", "Required", MessageBoxButtons.OK, MessageBoxIcon.Error)
- txtDisplaySolo.Text = "Solo"
- txtDisplayReg.Text = "Regular"
- txtDisplayFam.Text = "Family"
- rawtxt = CStr(txtaddProductName.Text)
- prodtxt = CStr(cmbProd.Text)
- txtsolsize = Val(txtConSolo.Text)
- sizesoltxt = CStr(cmbUnitSolo.Text)
- txtregsize = Val(txtConReg.Text)
- sizeregtxt = CStr(cmbUnitReg.Text)
- txtfamsize = Val(txtConFam.Text)
- sizefamtxt = CStr(cmbUnitFam.Text)
- Try
- objconn.Open()
- objcmd.Connection = objconn
- objcmd.CommandType = CommandType.Text
- objcmd.CommandText = "select * from material_every_product where Product_ID IN (Select Product_ID from product_table where Product_Name ='" & prodtxt & "') " _
- & "AND Raw_ID IN (Select Raw_ID from raw_material_table where Raw_Name ='" & rawtxt & "') " _
- & "AND Unit_ID IN (Select Unit_ID from unit_table where unit_table.Unit_Name IS NOT NULL) " _
- & "AND Size_ID IN (Select Size_ID from product_size where Size_Name ='" & CStr(txtDisplaySolo.Text) & "' OR Size_Name ='" & CStr(txtDisplayReg.Text) & "' OR Size_Name ='" & CStr(txtDisplayFam.Text) & "') "
- objdr = objcmd.ExecuteReader
- If objdr.HasRows Then
- MessageBox.Show("The Product Raw Material Already Exists at Regular or,Solo,or FamilySize but You Can add Raw Materials at Solo or Family Size if it is considered as a Raw Materials in our Product .You can select also another Raw Materials or a Product.", "Red Cheese Pizza Message", MessageBoxButtons.OK, MessageBoxIcon.Error)
- cmbUnitSolo.BackColor = Color.PapayaWhip
- cmbUnitSolo.Focus()
- txtConSolo.BackColor = Color.PapayaWhip
- txtConSolo.Focus()
- Label3.ForeColor = Color.Red
- cmbUnitReg.BackColor = Color.PapayaWhip
- cmbUnitReg.Focus()
- txtConReg.BackColor = Color.PapayaWhip
- txtConReg.Focus()
- Label2.ForeColor = Color.Red
- cmbUnitFam.BackColor = Color.PapayaWhip
- cmbUnitFam.Focus()
- txtConFam.BackColor = Color.PapayaWhip
- txtConFam.Focus()
- Label4.ForeColor = Color.Red
- Else
- Dim hungaonka As MsgBoxResult
- hungaonka = MsgBox("Your Adding an " & rawtxt & " to " & prodtxt & " Consume every materials " & Environment.NewLine & "" & txtsolsize & " " & sizesoltxt & " at " & txtDisplaySolo.Text & " size, " & Environment.NewLine & "" _
- & " " & txtregsize & " " & sizeregtxt & " at " & txtDisplayReg.Text & " size, " & Environment.NewLine & "" _
- & " " & txtfamsize & " " & sizefamtxt & " at " & txtDisplayFam.Text & " size, " & Environment.NewLine & "" _
- & ", Do You Want To Continue ?", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Confirmation")
- If hungaonka = MsgBoxResult.Yes Then
- objconn = New MySqlConnection
- objconn.ConnectionString = "server=localhost; username=root; password=; database=red_cheese_pizza_database"
- Try
- objconn.Open()
- With objcmd
- .Connection = objconn
- .CommandText = "Insert into material_every_product (Product_ID,Minus_Material_Every_Product,Raw_ID,unit_ID,Size_ID) values((SELECT Product_ID FROM product_table WHERE Product_Name ='" & CStr(prodtxt) & "')," & CInt(txtsolsize) & ",(Select Raw_ID from raw_material_table where Raw_Name ='" & CStr(rawtxt) & "'),(Select Unit_ID from unit_table where Unit_Name = '" & CStr(sizesoltxt) & "'),(Select Size_ID from product_size where Size_Name = '" & CStr(txtDisplaySolo.Text) & "')); " _
- & "Insert into material_every_product (Product_ID,Minus_Material_Every_Product,Raw_ID,unit_ID,Size_ID) values((SELECT Product_ID FROM product_table WHERE Product_Name ='" & CStr(prodtxt) & "')," & CInt(txtregsize) & ",(Select Raw_ID from raw_material_table where Raw_Name ='" & CStr(rawtxt) & "'),(Select Unit_ID from unit_table where Unit_Name = '" & CStr(sizeregtxt) & "'),(Select Size_ID from product_size where Size_Name = '" & CStr(txtDisplayReg.Text) & "')); " _
- & "Insert into material_every_product (Product_ID,Minus_Material_Every_Product,Raw_ID,unit_ID,Size_ID) values((SELECT Product_ID FROM product_table WHERE Product_Name ='" & CStr(prodtxt) & "')," & CInt(txtfamsize) & ",(Select Raw_ID from raw_material_table where Raw_Name ='" & CStr(rawtxt) & "'),(Select Unit_ID from unit_table where Unit_Name = '" & CStr(sizefamtxt) & "'),(Select Size_ID from product_size where Size_Name = '" & CStr(txtDisplayFam.Text) & "')); "
- .ExecuteNonQuery()
- End With
- txtDisplaySolo.Text = ""
- txtDisplayReg.Text = ""
- txtDisplayFam.Text = ""
- objconn.Close()
- 'Main.FillMainDbase()
- 'Main.fillProdukto()
- txtDisplaySolo.Text = ""
- txtDisplayReg.Text = ""
- txtDisplayFam.Text = ""
- Clearform3()
- MsgBox("Data Added!", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "SUCCESS")
- Catch ex As Exception
- MsgBox(ex.Message, MsgBoxStyle.Critical, "Red Cheese Pizza Error Program, Contact Programmer about this. Thank You.")
- End Try
- ElseIf hungaonka = MsgBoxResult.No Then
- ' objconn.Close()
- Exit Sub
- End If
- End If
- objconn.Close()
- Catch ex As Exception
- MessageBox.Show(ex.Message)
- End Try
- ElseIf txtConSolo.Text = "" And IsNothing(cmbUnitSolo.SelectedItem) And txtConReg.Text = "" And IsNothing(cmbUnitReg.SelectedItem) And txtConFam.Text = "" And IsNothing(cmbUnitFam.SelectedItem) Then
- MessageBox.Show("Please Input at least 1 Item", "Required", MessageBoxButtons.OK, MessageBoxIcon.Error)
- cmbUnitSolo.BackColor = Color.PapayaWhip
- txtConSolo.BackColor = Color.PapayaWhip
- cmbUnitReg.BackColor = Color.PapayaWhip
- txtConReg.BackColor = Color.PapayaWhip
- cmbUnitFam.BackColor = Color.PapayaWhip
- txtConFam.BackColor = Color.PapayaWhip
- End If
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement