Code:
Protected Sub SubmitProject_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SubmitProject.Click
SaveVendor()
End Sub
Protected Sub SaveVendor()
Try
Using dcn As New SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings("LocalSQLServer").ToString)
Using cmd As New SqlCommand
Dim topd As Boolean = False
Dim popd As Boolean = False
For i As Integer = 1 To 5
Dim lfrom As String = DirectCast(FindCtl("LanguageFrom" & i.ToString), DropDownList).SelectedValue
Dim lto As String = DirectCast(FindCtl("LanguageTo" & i.ToString), DropDownList).SelectedValue
Dim trate As String = DirectCast(FindCtl("TRate" & i.ToString), TextBox).Text
Dim prate As String = DirectCast(FindCtl("PRate" & i.ToString), TextBox).Text
Dim irate As String = DirectCast(FindCtl("IRate" & i.ToString), TextBox).Text
Dim DidSave As Boolean = False
If trate <> "" Then
topd = True
DidSave = True
End If
If prate <> "" Then
popd = True
DidSave = True
End If
If trate <> "" Then
DidSave = True
End If
If Not DidSave Then
If lfrom <> "" Or lto <> "" Then
topd = True
DidSave = True
End If
End If
Next
Session("VendorId") = ""
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "dbo.wspAddVendor_P"
Dim tflag As String = ""
Dim pflag As String = ""
Dim iflag As String = ""
If TranslationChk.Checked Then tflag = "Y"
If ProofreadingChk.Checked Then pflag = "Y"
If InterpretationChk.Checked Then iflag = "Y"
Dim gc As String = GeneralCmnt.Text
If TranslationOutputDay.Text <> "" Then
If Not topd Then
gc = gc & Environment.NewLine & "Translation Output Per Day: " & TranslationOutputDay.Text
End If
End If
If ProofreadingOutputDay.Text <> "" Then
If Not popd Then
gc = gc & Environment.NewLine & "Proofreading Output Per Day: " & ProofreadingOutputDay.Text
End If
End If
cmd.Parameters.AddWithValue("@FName", FName.Text)
cmd.Parameters.AddWithValue("@LName", LName.Text)
cmd.Parameters.AddWithValue("@Company", Company.Text)
cmd.Parameters.AddWithValue("@EMail1", EMail1.Text)
cmd.Parameters.AddWithValue("@MAddress1", MAddress1.Text)
cmd.Parameters.AddWithValue("@MCity", MCity.Text)
cmd.Parameters.AddWithValue("@MState", MState.Text)
cmd.Parameters.AddWithValue("@MZip", MZip.Text)
cmd.Parameters.AddWithValue("@MCountry", MCountry.Text)
cmd.Parameters.AddWithValue("@Phone1", Phone1.Text)
cmd.Parameters.AddWithValue("@Phone2", Phone2.Text)
cmd.Parameters.AddWithValue("@Phone3", Phone3.Text)
cmd.Parameters.AddWithValue("@Fax", Fax.Text)
cmd.Parameters.AddWithValue("@FrmtFlag", FrmtFlag.SelectedValue)
cmd.Parameters.AddWithValue("@HandFlag", HandFlag.SelectedValue)
cmd.Parameters.AddWithValue("@NativeLang", NativeLang.SelectedValue)
cmd.Parameters.AddWithValue("@TranslationFlag", tflag)
cmd.Parameters.AddWithValue("@ProofreadingFlag", pflag)
cmd.Parameters.AddWithValue("@InterpretationFlag", iflag)
cmd.Parameters.AddWithValue("@PatentFlag", PatentFlag.SelectedValue)
cmd.Parameters.AddWithValue("@CertificationsCmnt", CertificationsCmnt.Text)
cmd.Parameters.AddWithValue("@EducationCmnt", EducationCmnt.Text)
cmd.Parameters.AddWithValue("@ReferencesCmnt", ReferencesCmnt.Text)
cmd.Parameters.AddWithValue("@ExperienceCmnt", ExperienceCmnt.Text)
cmd.Parameters.AddWithValue("@WebSiteLink", WebSiteLink.Text)
cmd.Parameters.AddWithValue("@GeneralCmnt", gc)
cmd.Connection = dcn
dcn.Open()
Dim x As String = cmd.ExecuteScalar().ToString
cmd.Dispose()
For i As Integer = 1 To 5
Dim lfrom As String = DirectCast(FindCtl("LanguageFrom" & i.ToString), DropDownList).SelectedValue
Dim lto As String = DirectCast(FindCtl("LanguageTo" & i.ToString), DropDownList).SelectedValue
Dim trate As String = DirectCast(FindCtl("TRate" & i.ToString), TextBox).Text
Dim prate As String = DirectCast(FindCtl("PRate" & i.ToString), TextBox).Text
Dim irate As String = DirectCast(FindCtl("IRate" & i.ToString), TextBox).Text
Dim DidSave As Boolean = False
If trate <> "" Then
SaveVenCap(dcn, x, "Translation", lfrom, lto, trate, TranslationOutputDay.Text)
DidSave = True
End If
If prate <> "" Then
SaveVenCap(dcn, x, "Proofreading", lfrom, lto, prate, ProofreadingOutputDay.Text)
DidSave = True
End If
If trate <> "" Then
SaveVenCap(dcn, x, "Consulting", lfrom, lto, irate, "")
DidSave = True
End If
If Not DidSave Then
If lfrom <> "" Or lto <> "" Then
SaveVenCap(dcn, x, "Translation", lfrom, lto, "* Left Blank", TranslationOutputDay.Text)
DidSave = True
End If
End If
Next
Try
Using cmd2 As New SqlCommand
cmd2.CommandType = CommandType.StoredProcedure
cmd2.CommandText = "dbo.wspAddVenSpec_P"
cmd2.Parameters.AddWithValue("@VendorId", x)
cmd2.Parameters.AddWithValue("@Specialty", "")
cmd2.Connection = dcn
For Each lsi As ListItem In ExpertiseCBL.Items
If lsi.Selected Then
cmd2.Parameters(1).Value = lsi.Text
Dim x2 As String = cmd2.ExecuteScalar.ToString
End If
Next
End Using
Catch ex As Exception
End Try
ClearPage()
Session("VendorId") = x
Response.Redirect("~/Vendors/FinishApp.aspx")
End Using
End Using
Catch ex As Exception
End Try
End Sub