VB.NET

Moderators: seancampbell
Number of threads: 4020
Number of posts: 10026

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
VB.net Coding Question Posted by networkadmin on 12 Aug 2005 at 7:16 AM
I have just taken over this project. I am looking over the code for a submit button. On action the following code will be performed and an e-mail will be sent out:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim SQLText As String

'Get Text Values / Strings
Dim Terms As String = Functions.Unapostrophize(txtTerms.Text)
Dim MainDate As String = Functions.Unapostrophize(txtDate.Text)
Dim Shipdate As String = Functions.Unapostrophize(txtShipDate.Text)
Dim InstallDate As String = Functions.Unapostrophize(txtInstallDate.Text)
Dim TargetDate As String = Functions.Unapostrophize(txtTargetDate.Text)
Dim KDDate As String = Functions.Unapostrophize(txtKDDate.Text)
Dim BoothSize As String = Functions.Unapostrophize(txtBoothSize.Text)
Dim BoothNumber As String = Functions.Unapostrophize(txtBoothNumber.Text)
Dim BoothType As String = Functions.Unapostrophize(txtBoothType.Text)
Dim BoothDetails As String = ""
Dim ShowName As String = Functions.Unapostrophize(txtShowName.Text)
Dim ShowDate As String = Functions.Unapostrophize(txtShowDate.Text)
Dim ShowEndDate As String = Functions.Unapostrophize(txtEndDate.Text)
Dim ConventionCenter As String = Functions.Unapostrophize(txtConventionCenter.Text)
Dim City As String = Functions.Unapostrophize(txtCity.Text)
Dim State As String = Functions.Unapostrophize(txtState.Text)
Dim SummaryDates As String = Functions.Unapostrophize(txtSummaryDates.Text)

Dim AVRental As String = Functions.Unapostrophize(txtAVDetail.Text)
Dim CarpetRental As String = Functions.Unapostrophize(txtCarpetDetail.Text)
Dim FurnitureRental As String = Functions.Unapostrophize(txtFurnitureDetail.Text)
Dim Trucking As String = Functions.Unapostrophize(txtTruckingDetail.Text)
Dim ID As String = Functions.Unapostrophize(txtIDDetail.Text)
Dim Floral As String = Functions.Unapostrophize(txtFloralDetail.Text)
Dim LeadRetrieval As String = Functions.Unapostrophize(txtLeadDetails.Text)
Dim Material As String = Functions.Unapostrophize(txtMaterialDetail.Text)
Dim BoothCleaning As String = Functions.Unapostrophize(txtCleanDetail.Text)
Dim Catering As String = Functions.Unapostrophize(txtCaterDetail.Text)

Dim AVPay As String = Trim(drpAVPay.SelectedItem.Text)
Dim CarpetPay As String = Trim(drpCarpetPay.SelectedItem.Text)
Dim FurniturePay As String = Trim(drpFurniturePay.SelectedItem.Text)
Dim TruckingPay As String = Trim(drpTruckingPay.SelectedItem.Text)
Dim IDPay As String = Trim(drpIDPay.SelectedItem.Text)
Dim FloralPay As String = Trim(drpFloralPay.SelectedItem.Text)
Dim Leadpay As String = Trim(drpLeadPay.SelectedItem.Text)
Dim MaterialPay As String = Trim(drpMaterialPay.SelectedItem.Text)
Dim CleanPay As String = Trim(drpCleanPay.SelectedItem.Text)
Dim CaterPay As String = Trim(drpCaterPay.SelectedItem.Text)
Dim PhonePay As String = Trim(drpPhonePay.SelectedItem.Text)
Dim HangPay As String = Trim(drpHangPay.SelectedItem.Text)
Dim RiggingPay As String = Trim(drpRiggingPay.SelectedItem.Text)
Dim PhotoPay As String = Trim(drpPhotoPay.SelectedItem.Text)
Dim ElectricPay As String = Trim(drpElectricPay.SelectedItem.Text)

Dim PhoneInternet As String = Functions.Unapostrophize(txtPhoneDetail.Text)
Dim Hanging As String = Functions.Unapostrophize(txtHangDetail.Text)
Dim Rigging As String = Functions.Unapostrophize(txtRiggingDetail.Text)
Dim Photography As String = Functions.Unapostrophize(txtPhotoDetail.Text)
Dim Electric As String = Functions.Unapostrophize(txtElectricDetail.Text)

Dim IDCompany As String = Functions.Unapostrophize(txtIDCompany.Text)
Dim OtherVendors As String = Functions.Unapostrophize(txtOtherVendors.Text)
Dim WhoSupervisor As String = Functions.Unapostrophize(txtSupervisionWho.Text)
Dim Notes As String = Functions.Unapostrophize(txtNotes.Text)

'----------- Get drpdown / yes, no values
Dim AVYes As String = drpAV.SelectedItem.ToString
Dim CarpetYes As String = drpCarpet.SelectedItem.ToString
Dim FurnitureYes As String = drpFurniture.SelectedItem.ToString
Dim TruckingYes As String = drpTrucking.SelectedItem.ToString
Dim IDYes As String = drpID.SelectedItem.ToString
Dim FloralYes As String = drpFloral.SelectedItem.ToString
Dim LeadYes As String = drpLead.SelectedItem.ToString
Dim MaterialYes As String = drpMaterial.SelectedItem.ToString
Dim BoothCleaningYes As String = drpBoothCleaning.SelectedItem.ToString
Dim CateringYes As String = drpCatering.SelectedItem.ToString
Dim PhoneYes As String = drpPhone.SelectedItem.ToString
Dim HangingYes As String = drpPhone.SelectedItem.ToString
Dim RiggingYes As String = drpRigging.SelectedItem.ToString
Dim PhotographyYes As String = drpPhotography.SelectedItem.ToString
Dim ElectricYes As String = drpElectric.SelectedItem.ToString
Dim FieldScanners As String = drpFieldScanners.SelectedItem.ToString

'------------ WBD
Dim NCWBD As String = Functions.Unapostrophize(txtNCWBD.Text)
Dim CheckWBD As String = Functions.Unapostrophize(txtCheckWBD.Text)
Dim RentalWBD As String = Functions.Unapostrophize(txtRentalWBD.Text)
Dim GraphicWBD As String = Functions.Unapostrophize(txtGraphicWBD.Text)
Dim RefurbWBD As String = Functions.Unapostrophize(txtRefurbWBD.Text)
Dim FieldWBD As String = Functions.Unapostrophize(txtFieldWBD.Text)
Dim DesignWBD As String = Functions.Unapostrophize(txtDesignWBD.Text)
Dim ShippingWBD As String = Functions.Unapostrophize(txtShippingWBD.Text)
Dim SupervisionWBD As String = Functions.Unapostrophize(txtSupervisionWBD.Text)

'IF NEW - NEW DEFAULT THEN ADD THE Default FIELD
Dim DefaultWorkorderText1 As String
Dim DefaultWorkorderText2 As String
Dim DivisionText As String
Dim DivisionValue As String

If drpRevision.SelectedValue <> 0 Then
'Set Text for the newly inserted workorder
DefaultWorkorderText1 = "DefaultWorkorder, "
DefaultWorkorderText2 = "'default', "
End If

'Ok - no division either
If drpDivision.SelectedValue <> "" Then
DivisionText = "DivisionID, "
DivisionValue = drpDivision.SelectedValue & ", "
End If

SQLText = "Insert INTO Workorder (ClientID, " & DivisionText & " JobID, " & DefaultWorkorderText1 & " CreatorID, CreationDate, Terms, Date, ShipDate, InstallDate, TargetDate, KDDate, BoothSize, BoothNumber, BoothType, BoothDetails, ShowName, ShowDate, ShowEndDate, ConventionCenter, City, State, Summarydate, AVBool, AVDetail, CarpetBool, CarpetDetail, FurnitureBool, FurnitureDetail, TruckingBool, TruckingDetail, IDBool, IDDetail, FloralBool, FloralDetail, LeadBool, LeadDetail, MaterialBool, MaterialDetail, CleanBool, CleanDetail, CateringBool, CateringDetail, PhoneBool, PhoneDetail, HangingBool, HangingDetail, RiggingBool, RiggingDetail, PhotographyBool, PhotographyDetail, ElectricBool, ElectricDetail, IDCompany, OtherVendors, SupervisionParty, FieldScanners, Notes, NCWBD, CheckWBD, rentalWBD, GraphicWBD, RefurbWBD, FieldWBD, DesignWBD, ShippingWBD, SupervisionWBD, AVPay, CarpetPay, FurniturePay, TruckingPay, IDPay, FloralPay, LeadPay, MaterialPay, CleanPay, CateringPay, PhonePay, HangingPay, RiggingPay, PhotographyPay, ElectricPay) VALUES "
SQLText = SQLText & "( " & drpClient.SelectedValue & ", " & DivisionValue & Session("JobID") & ", " & DefaultWorkorderText2 & Session("UserID") & ", '" & Now() & "', '" & Terms & "', '" & MainDate & "', '" & Shipdate & "', '" & InstallDate & "', '" & TargetDate & "', '" & KDDate & "', '" & BoothSize & "', '" & BoothNumber & "', '" & BoothType & "', '" & BoothDetails & "', '" & ShowName & "', '" & ShowDate & "', '" & ShowEndDate & "', '" & ConventionCenter & "', '" & City & "', '" & State & "', '" & SummaryDates & "', '" & AVYes & "', '" & AVRental & "', '" & CarpetYes & "', '" & CarpetRental & "', '" & FurnitureYes & "', '" & FurnitureRental & "', '" & TruckingYes & "', '" & Trucking & "', '" & IDYes & "', '" & ID & "', '" & FloralYes & "', '" & Floral & "', '" & LeadYes & "', '" & LeadRetrieval & "', '" & MaterialYes & "', '" & Material & "', '" & BoothCleaningYes & "', '" & BoothCleaning & "', '" & CateringYes & "', '" & Catering & "', '" & PhoneYes & "', '" & PhoneInternet & "', '" & HangingYes & "', '" & Hanging & "', '" & RiggingYes & "', '" & Rigging & "', '" & PhotographyYes & "', '" & Photography & "', '" & ElectricYes & "', '" & Electric & "', '" & IDCompany & "', '" & OtherVendors & "', '" & WhoSupervisor & "', '" & FieldScanners & "', '" & Notes & "', '" & NCWBD & "', '" & CheckWBD & "', '" & RentalWBD & "', '" & GraphicWBD & "', '" & RefurbWBD & "', '" & FieldWBD & "', '" & DesignWBD & "', '" & ShippingWBD & "', '" & SupervisionWBD & "', '" & AVPay & "', '" & CarpetPay & "', '" & FurniturePay & "', '" & TruckingPay & "', '" & IDPay & "', '" & FloralPay & "', '" & Leadpay & "', '" & MaterialPay & "', '" & CleanPay & "', '" & CaterPay & "', '" & PhonePay & "', '" & HangPay & "', '" & RiggingPay & "', '" & PhotoPay & "', '" & ElectricPay & "')"

Functions.UpdateData(SQLText, lblInsert)

'Get Newest WorkorderID
WorkorderID = Functions.GetScalarValue("SELECT Top 1 WorkorderID FROM Workorder ORDER BY WorkorderID Desc")

'----------- Get Department / User values / Insert
'1: Account Executive
'2: Graphics
'3: Supervision
'4: Management
'5: Design/Detail
'6: Refurb
'7 Show Services
'8: Shipping
'9: Check-out
'10 New Construction
'11: Rentals
'12: Project Managers
'13: Field Services

AddDeptListData(lstRep, 1)
AddDeptListData(lstPM, 12)
AddDeptListData(lstConstruction, 10)
AddDeptListData(lstShow, 7)
AddDeptListData(lstShowServices, 13)
AddDeptListData(lstCheckout, 9)
AddDeptListData(lstDesign, 5)
AddDeptListData(lstRentals, 11)
AddDeptListData(lstShipping, 8)
AddDeptListData(lstGraphics, 2)
AddDeptListData(lstRefurb, 6)
AddDeptListData(lstSupervision, 3)

lblResult.Text = drpRevision.SelectedValue


If drpRevision.SelectedValue <> 0 Then
SetDefault(WorkorderID)
Else
Response.Redirect("JobList.aspx")
End If


End Sub
I want to know is where would the code for the email be if it not in the action of the button?
Report
Re: VB.net Coding Question Posted by zorgster on 16 Aug 2005 at 12:52 PM
: I have just taken over this project. I am looking over the code for a submit button. On action the following code will be performed and an e-mail will be sent out:
:
: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
:
<snipped>
:
: Functions.UpdateData(SQLText, lblInsert)

: I want to know is where would the code for the email be if it not in the action of the button?

I would check to see what this does. This looks like it sends the SQL string to your database be it MS SQL Server, Access, SyBase, Oracle, MySQL or even XML...

It's a black hole... who knows what happens. Perhaps it is sent to SQL Server and SQL server is set up to send an email via a Trigger... or perhaps the code in UpdateData sends the email itself... or spawns something that does...

Can you get the code for the above Function?




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.