Newsgroup: italia.napoli.discussioni
Titolo: TOM22

Imports System.Data.OleDb
Imports System.Data.SqlClient
Imports System.Diagnostics
Imports System.Configuration
Imports System.Data
Partial Class _Default1
    Inherits 
System.Web.UI.Page
    Public Data As String
    Public Ora As String
    Public CodConcess As Integer
    Public punto1 As Integer
    Public punto2 As Integer
    Public P1 As Integer
    Public P2 As Integer
    Public punto3 As Integer
    Public setparam As Integer
    Public param As String
    Public id_concessionario As Integer
    Public win As String
    Public giorno As String
    Public Function DoQuotes(ByVal pData As String) As String
        Try
            Return pData.Replace("'", "''")
        Catch ex As Exception
            Return String.Empty
        End Try
    End Function
    Public Function DateToNumber(ByVal pData As String) As String
        Try
            ''''''''''''''''
            Return pData.Substring(6, 4) & pData.Substring(3, 2) &
pData.Substring(0, 2)
        Catch ex As Exception
            Return 0
        End Try
    End Function
    Public Function NumberToDate(ByVal pData As Object) As String
        Try
            Return pData.ToString.Substring(6, 2) & "/" &
pData.ToString.Substring(4, 2) & "/" & pData.ToString.Substring(0, 4)
        Catch ex As Exception
            Return String.Empty
        End Try
    End Function
    Public Function TimeToNumber(ByVal pData As String) As String
        Try
            ''''''''''''''''''
            Return pData.Substring(0, 2) & pData.Substring(3, 2) &
pData.Substring(6, 2)
        Catch ex As Exception
            Return 0
        End Try
    End Function
    Public Function NumberToTime(ByVal pData As Object) As String
        Try
            Return pData.ToString.Substring(0, 2) & ":" &
pData.ToString.Substring(2, 2) & ":" & pData.ToString.Substring(4, 2)
        Catch ex As Exception
            Return String.Empty
        End Try
    End Function
    Private Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
        bindata()
        'bindata4()
        'bindata2()
        'bindata3()
        'bindata5()
        ''  Me.TxtDataChiamata.Text = ViewState("giorno")
        If Not Request.Params("TxtCodiceConces") = "" Then
            Me.TxtCodiceConces.Text = Request.Params("TxtCodiceConces")
            Label3.Visible = False
            Me.TxtRagSociCoConc.Text = Request.Params("TxtRagSociCoConc")
        End If
        If TxtDataChiamata.Text = "" Then
            TxtDataChiamata.Text = Date.Now
            Data = TxtDataChiamata.Text
            Format(Data, "yyyy/dd/mm HH:mm:ss").Replace(":", ".")
        End If
        Page.Title = "Gestione WEB TOOL"
        lblRicerca.Visible = False
        If Not IsPostBack Then
            BidCheckBox()
        End If
        BtnRicerca.Visible = True
        If Not IsPostBack Then
            param = Request.QueryString("loginInfo")
            If param = 2 Then
                ViewState("param") = "2"
                id_concessionario = Request.QueryString("id_primo")
                lblRicerca.Visible = False
                lbl_idconcessionario.Visible = False
                caricaCampi()
                SettacheckBox()
            End If
        End If
    End Sub
    Private Sub bindata()
        Dim i As Integer
        Dim DataInizio As String
        Dim DataFine As String
        If (txtStartDate.Text <> "" And txtEndDate.Text = "") Then
            txtEndDate.Text = txtStartDate.Text
        End If
        If (txtStartDate.Text = "" And txtEndDate.Text <> "") Then
            txtStartDate.Text = txtEndDate.Text
        End If
        Dim objCon As OleDbConnection
        Dim connectionstring As String =
System.Configuration.ConfigurationManager.ConnectionStrings("strCon").ConnectionString
        objCon = New OleDbConnection(connectionstring)
        Dim sql2 As OleDbDataAdapter
        'If (txtStartDate.Text = "") And (txtEndDate.Text = "") And
(TxtCodiceConces2.Text = "") Then
        '    lblRicerca.Visible = True
        '    lblRicerca.Text = "Inserire un Parametro per la ricerca"
        '    Exit Sub
        'End If
        If txtStartDate.Text <> "" And txtEndDate.Text <> "" Then
            DataInizio = txtStartDate.Text
            DataFine = txtEndDate.Text
            Format(DataInizio, "dd/MM/yyyy")
            Format(DataFine, "dd/MM/yyyy")
        End If
        Dim TxtCodiceConces As String = Request.QueryString("loginInfoId")
        objCon.Open()
        ''   cod_concessionario like '%" &
Me.TxtCodiceConces.Text.Replace("'", "''") & "%'"
        '
        If (txtStartDate.Text <> "" And txtEndDate.Text <> "" And
TxtCodiceConces2.Text <> "") Then
            sql2 = New OleDbDataAdapter("select
Numerofattura,RagioneSociale,cognomechiamante,Codice,data_chiamata,ora_chiamata,id_primo
from Tbt_primo where Codice=('" & DoQuotes((TxtCodiceConces2.Text)) & "')
and Data_Chiamata >=('" & DateToNumber(DataInizio) & "') and Data_Chiamata
<= ('" & DateToNumber(DataFine) & "') order by Data_Chiamata desc", objCon)
        ElseIf (txtStartDate.Text <> "" And txtEndDate.Text <> "" And
TxtCodiceConces2.Text = "") Then
            sql2 = New OleDbDataAdapter("select
Numerofattura,RagioneSociale,cognomechiamante,Codice,data_chiamata,ora_chiamata,id_primo
from Tbt_primo where  Data_Chiamata >=('" & DateToNumber(DataInizio) & "')
and Data_Chiamata <= ('" & DateToNumber(DataFine) & "')order by
Data_Chiamata desc", objCon)
        ElseIf (txtStartDate.Text = "" And txtEndDate.Text = "" And
TxtCodiceConces2.Text <> "") Then
            sql2 = New OleDbDataAdapter("select
Numerofattura,RagioneSociale,cognomechiamante,Codice,data_chiamata,ora_chiamata,id_primo
from Tbt_primo where Codice=(" & DoQuotes(TxtCodiceConces2.Text) & ")
order by Data_Chiamata desc", objCon)
        ElseIf (txtStartDate.Text = "" And txtEndDate.Text = "" And
TxtCodiceConces2.Text = "") Then
            sql2 = New OleDbDataAdapter("select
Numerofattura,RagioneSociale,cognomechiamante,Codice,data_chiamata,ora_chiamata,id_primo
from Tbt_primo  order by Data_Chiamata desc ", objCon)
        Else
        End If
        Dim querydataset As DataSet = New DataSet()
        Dim a As String
        sql2.Fill(querydataset)
        If querydataset.Tables(0).Rows.Count > 0 Then
            For i = 0 To querydataset.Tables(0).Rows.Count - 1
                querydataset.Tables(0).Rows(i).Item("ora_chiamata") =
NumberToTime(querydataset.Tables(0).Rows(i).Item("ora_chiamata").ToString)
                querydataset.Tables(0).Rows(i).Item("data_chiamata") =
NumberToDate(querydataset.Tables(0).Rows(i).Item("data_chiamata").ToString)
            Next i
            lblRicerca.Text = ""
            GridView1.Visible = True
            GridView1.DataSource = querydataset
            GridView1.DataBind()
        Else
            lblRicerca.Visible = True
            lblRicerca.Text = "Nessuna corrispondenza trovata"
            GridView1.Visible = False
        End If
    End Sub
    'Private Sub bindata4()
    '    Dim i As Integer
    '    Dim DataInizio As String
    '    Dim DataFine As String
    '    If (txtStartDate.Text <> "" And txtEndDate.Text = "") Then
    '        txtEndDate.Text = txtStartDate.Text
    '    End If
    '    If (txtStartDate.Text = "" And txtEndDate.Text <> "") Then
    '        txtStartDate.Text = txtEndDate.Text
    '    End If
    '    Dim objCon As OleDbConnection
    '    Dim connectionstring As String =
System.Configuration.ConfigurationManager.ConnectionStrings("strCon").ConnectionString
    '    objCon = New OleDbConnection(connectionstring)
    '    Dim sql2 As OleDbDataAdapter
    '    'If (txtStartDate.Text = "") And (txtEndDate.Text = "") And
(TxtCodiceConces2.Text = "") Then
    '    '    lblRicerca.Visible = True
    '    '    lblRicerca.Text = "Inserire un Parametro per la ricerca"
    '    '    Exit Sub
    '    'End If
    '    If txtStartDate.Text <> "" And txtEndDate.Text <> "" Then
    '        DataInizio = txtStartDate.Text
    '        DataFine = txtEndDate.Text
    '        Format(DataInizio, "dd/MM/yyyy")
    '        Format(DataFine, "dd/MM/yyyy")
    '    End If
    '    Dim TxtCodiceConces As String = Request.QueryString("loginInfoId")
    '    objCon.Open()
    '    ''   cod_concessionario like '%" &
Me.TxtCodiceConces.Text.Replace("'", "''") & "%'"
    '    '
    '    If (txtStartDate.Text <> "" And txtEndDate.Text <> "" And
TxtCodiceConces2.Text <> "") Then
    '        sql2 = New OleDbDataAdapter("select
Numerofattura,RagioneSociale,cognomechiamante,Codice,data_chiamata,ora_chiamata,id_primo
from Tbt_primo where Codice=('" & DoQuotes((TxtCodiceConces2.Text)) & "')
and Data_Chiamata >=('" & DateToNumber(DataInizio) & "') and Data_Chiamata
<= ('" & DateToNumber(DataFine) & "') order by Data_Chiamata desc", objCon)
    '    ElseIf (txtStartDate.Text <> "" And txtEndDate.Text <> "" And
TxtCodiceConces2.Text = "") Then
    '        sql2 = New OleDbDataAdapter("select
Numerofattura,RagioneSociale,cognomechiamante,Codice,data_chiamata,ora_chiamata,id_primo
from Tbt_primo where  Data_Chiamata >=('" & DateToNumber(DataInizio) & "')
and Data_Chiamata <= ('" & DateToNumber(DataFine) & "')order by
Data_Chiamata desc", objCon)
    '    ElseIf (txtStartDate.Text = "" And txtEndDate.Text = "" And
TxtCodiceConces2.Text <> "") Then
    '        sql2 = New OleDbDataAdapter("select
Numerofattura,RagioneSociale,cognomechiamante,Codice,data_chiamata,ora_chiamata,id_primo
from Tbt_primo where Codice=(" & DoQuotes(TxtCodiceConces2.Text) & ")
order by Data_Chiamata desc", objCon)
    '    ElseIf (txtStartDate.Text = "" And txtEndDate.Text = "" And
TxtCodiceConces2.Text = "") Then
    '        sql2 = New OleDbDataAdapter("select
Numerofattura,RagioneSociale,cognomechiamante,Codice,data_chiamata,ora_chiamata,id_primo
from Tbt_primo4  order by Data_Chiamata desc ", objCon)
    '    Else
    '    End If
    '    Dim querydataset As DataSet = New DataSet()
    '    Dim a As String
    '    sql2.Fill(querydataset)
    '    If querydataset.Tables(0).Rows.Count > 0 Then
    '        For i = 0 To querydataset.Tables(0).Rows.Count - 1
    '            querydataset.Tables(0).Rows(i).Item("ora_chiamata") =
NumberToTime(querydataset.Tables(0).Rows(i).Item("ora_chiamata").ToString)
    '            querydataset.Tables(0).Rows(i).Item("data_chiamata") =
NumberToDate(querydataset.Tables(0).Rows(i).Item("data_chiamata").ToString)
    '        Next i
    '        lblRicerca.Text = ""
    '        GridView4.Visible = True
    '        GridView4.DataSource = querydataset
    '        GridView4.DataBind()
    '    Else
    '        lblRicerca.Visible = True
    '        lblRicerca.Text = "Nessuna corrispondenza trovata"
    '        GridView4.Visible = False
    '    End If
    'End Sub
    'Private Sub bindata2()
    '    Dim i As Integer
    '    Dim DataInizio As String
    '    Dim DataFine As String
    '    If (txtStartDate.Text <> "" And txtEndDate.Text = "") Then
    '        txtEndDate.Text = txtStartDate.Text
    '    End If
    '    If (txtStartDate.Text = "" And txtEndDate.Text <> "") Then
    '        txtStartDate.Text = txtEndDate.Text
    '    End If
    '    Dim objCon As OleDbConnection
    '    Dim connectionstring As String =
System.Configuration.ConfigurationManager.ConnectionStrings("strCon").ConnectionString
    '    objCon = New OleDbConnection(connectionstring)
    '    Dim sql2 As OleDbDataAdapter
    '    'If (txtStartDate.Text = "") And (txtEndDate.Text = "") And
(TxtCodiceConces2.Text = "") Then
    '    '    lblRicerca.Visible = True
    '    '    lblRicerca.Text = "Inserire un Parametro per la ricerca"
    '    '    Exit Sub
    '    'End If
    '    If txtStartDate.Text <> "" And txtEndDate.Text <> "" Then
    '        DataInizio = txtStartDate.Text
    '        DataFine = txtEndDate.Text
    '        Format(DataInizio, "dd/MM/yyyy")
    '        Format(DataFine, "dd/MM/yyyy")
    '    End If
    '    Dim TxtCodiceConces As String = Request.QueryString("loginInfoId")
    '    objCon.Open()
    '    ''   cod_concessionario like '%" &
Me.TxtCodiceConces.Text.Replace("'", "''") & "%'"
    '    '
    '    If (txtStartDate.Text <> "" And txtEndDate.Text <> "" And
TxtCodiceConces2.Text <> "") Then
    '        sql2 = New OleDbDataAdapter("select
Numerofattura,RagioneSociale,cognomechiamante,Codice,data_chiamata,ora_chiamata,id_primo
from Tbt_primo where Codice=('" & DoQuotes((TxtCodiceConces2.Text)) & "')
and Data_Chiamata >=('" & DateToNumber(DataInizio) & "') and Data_Chiamata
<= ('" & DateToNumber(DataFine) & "') order by Data_Chiamata desc", objCon)
    '    ElseIf (txtStartDate.Text <> "" And txtEndDate.Text <> "" And
TxtCodiceConces2.Text = "") Then
    '        sql2 = New OleDbDataAdapter("select
Numerofattura,RagioneSociale,cognomechiamante,Codice,data_chiamata,ora_chiamata,id_primo
from Tbt_primo where  Data_Chiamata >=('" & DateToNumber(DataInizio) & "')
and Data_Chiamata <= ('" & DateToNumber(DataFine) & "')order by
Data_Chiamata desc", objCon)
    '    ElseIf (txtStartDate.Text = "" And txtEndDate.Text = "" And
TxtCodiceConces2.Text <> "") Then
    '        sql2 = New OleDbDataAdapter("select
Numerofattura,RagioneSociale,cognomechiamante,Codice,data_chiamata,ora_chiamata,id_primo
from Tbt_primo where Codice=(" & DoQuotes(TxtCodiceConces2.Text) & ")
order by Data_Chiamata desc", objCon)
    '    ElseIf (txtStartDate.Text = "" And txtEndDate.Text = "" And
TxtCodiceConces2.Text = "") Then
    '        sql2 = New OleDbDataAdapter("select
Numerofattura,RagioneSociale,cognomechiamante,Codice,data_chiamata,ora_chiamata,id_primo
from Tbt_primo2  order by Data_Chiamata desc ", objCon)
    '    Else
    '    End If
    '    Dim querydataset As DataSet = New DataSet()
    '    Dim a As String
    '    sql2.Fill(querydataset)
    '    If querydataset.Tables(0).Rows.Count > 0 Then
    '        For i = 0 To querydataset.Tables(0).Rows.Count - 1
    '            querydataset.Tables(0).Rows(i).Item("ora_chiamata") =
NumberToTime(querydataset.Tables(0).Rows(i).Item("ora_chiamata").ToString)
    '            querydataset.Tables(0).Rows(i).Item("data_chiamata") =
NumberToDate(querydataset.Tables(0).Rows(i).Item("data_chiamata").ToString)
    '        Next i
    '        lblRicerca.Text = ""
    '        GridView2.Visible = True
    '        GridView2.DataSource = querydataset
    '        GridView2.DataBind()
    '    Else
    '        lblRicerca.Visible = True
    '        lblRicerca.Text = "Nessuna corrispondenza trovata"
    '        GridView2.Visible = False
    '    End If
    'End Sub
    'Private Sub bindata3()
    '    Dim i As Integer
    '    Dim DataInizio As String
    '    Dim DataFine As String
    '    If (txtStartDate.Text <> "" And txtEndDate.Text = "") Then
    '        txtEndDate.Text = txtStartDate.Text
    '    End If
    '    If (txtStartDate.Text = "" And txtEndDate.Text <> "") Then
    '        txtStartDate.Text = txtEndDate.Text
    '    End If
    '    Dim objCon As OleDbConnection
    '    Dim connectionstring As String =
System.Configuration.ConfigurationManager.ConnectionStrings("strCon").ConnectionString
    '    objCon = New OleDbConnection(connectionstring)
    '    Dim sql2 As OleDbDataAdapter
    '    'If (txtStartDate.Text = "") And (txtEndDate.Text = "") And
(TxtCodiceConces2.Text = "") Then
    '    '    lblRicerca.Visible = True
    '    '    lblRicerca.Text = "Inserire un Parametro per la ricerca"
    '    '    Exit Sub
    '    'End If
    '    If txtStartDate.Text <> "" And txtEndDate.Text <> "" Then
    '        DataInizio = txtStartDate.Text
    '        DataFine = txtEndDate.Text
    '        Format(DataInizio, "dd/MM/yyyy")
    '        Format(DataFine, "dd/MM/yyyy")
    '    End If
    '    Dim TxtCodiceConces As String = Request.QueryString("loginInfoId")
    '    objCon.Open()
    '    ''   cod_concessionario like '%" &
Me.TxtCodiceConces.Text.Replace("'", "''") & "%'"
    '    '
    '    If (txtStartDate.Text <> "" And txtEndDate.Text <> "" And
TxtCodiceConces2.Text <> "") Then
    '        sql2 = New OleDbDataAdapter("select
Numerofattura,RagioneSociale,cognomechiamante,Codice,data_chiamata,ora_chiamata,id_primo
from Tbt_primo where Codice=('" & DoQuotes((TxtCodiceConces2.Text)) & "')
and Data_Chiamata >=('" & DateToNumber(DataInizio) & "') and Data_Chiamata
<= ('" & DateToNumber(DataFine) & "') order by Data_Chiamata desc", objCon)
    '    ElseIf (txtStartDate.Text <> "" And txtEndDate.Text <> "" And
TxtCodiceConces2.Text = "") Then
    '        sql2 = New OleDbDataAdapter("select
Numerofattura,RagioneSociale,cognomechiamante,Codice,data_chiamata,ora_chiamata,id_primo
from Tbt_primo where  Data_Chiamata >=('" & DateToNumber(DataInizio) & "')
and Data_Chiamata <= ('" & DateToNumber(DataFine) & "')order by
Data_Chiamata desc", objCon)
    '    ElseIf (txtStartDate.Text = "" And txtEndDate.Text = "" And
TxtCodiceConces2.Text <> "") Then
    '        sql2 = New OleDbDataAdapter("select
Numerofattura,RagioneSociale,cognomechiamante,Codice,data_chiamata,ora_chiamata,id_primo
from Tbt_primo where Codice=(" & DoQuotes(TxtCodiceConces2.Text) & ")
order by Data_Chiamata desc", objCon)
    '    ElseIf (txtStartDate.Text = "" And txtEndDate.Text = "" And
TxtCodiceConces2.Text = "") Then
    '        sql2 = New OleDbDataAdapter("select
Numerofattura,RagioneSociale,cognomechiamante,Codice,data_chiamata,ora_chiamata,id_primo
from Tbt_primo3  order by Data_Chiamata desc ", objCon)
    '    Else
    '    End If
    '    Dim querydataset As DataSet = New DataSet()
    '    Dim a As String
    '    sql2.Fill(querydataset)
    '    If querydataset.Tables(0).Rows.Count > 0 Then
    '        For i = 0 To querydataset.Tables(0).Rows.Count - 1
    '            querydataset.Tables(0).Rows(i).Item("ora_chiamata") =
NumberToTime(querydataset.Tables(0).Rows(i).Item("ora_chiamata").ToString)
    '            querydataset.Tables(0).Rows(i).Item("data_chiamata") =
NumberToDate(querydataset.Tables(0).Rows(i).Item("data_chiamata").ToString)
    '        Next i
    '        lblRicerca.Text = ""
    '        GridView3.Visible = True
    '        GridView3.DataSource = querydataset
    '        GridView3.DataBind()
    '    Else
    '        lblRicerca.Visible = True
    '        lblRicerca.Text = "Nessuna corrispondenza trovata"
    '        GridView3.Visible = False
    '    End If
    'End Sub
    'Private Sub bindata5()
    '    Dim i As Integer
    '    Dim DataInizio As String
    '    Dim DataFine As String
    '    If (txtStartDate.Text <> "" And txtEndDate.Text = "") Then
    '        txtEndDate.Text = txtStartDate.Text
    '    End If
    '    If (txtStartDate.Text = "" And txtEndDate.Text <> "") Then
    '        txtStartDate.Text = txtEndDate.Text
    '    End If
    '    Dim objCon As OleDbConnection
    '    Dim connectionstring As String =
System.Configuration.ConfigurationManager.ConnectionStrings("strCon").ConnectionString
    '    objCon = New OleDbConnection(connectionstring)
    '    Dim sql2 As OleDbDataAdapter
    '    'If (txtStartDate.Text = "") And (txtEndDate.Text = "") And
(TxtCodiceConces2.Text = "") Then
    '    '    lblRicerca.Visible = True
    '    '    lblRicerca.Text = "Inserire un Parametro per la ricerca"
    '    '    Exit Sub
    '    'End If
    '    If txtStartDate.Text <> "" And txtEndDate.Text <> "" Then
    '        DataInizio = txtStartDate.Text
    '        DataFine = txtEndDate.Text
    '        Format(DataInizio, "dd/MM/yyyy")
    '        Format(DataFine, "dd/MM/yyyy")
    '    End If
    '    Dim TxtCodiceConces As String = Request.QueryString("loginInfoId")
    '    objCon.Open()
    '    ''   cod_concessionario like '%" &
Me.TxtCodiceConces.Text.Replace("'", "''") & "%'"
    '    '
    '    If (txtStartDate.Text <> "" And txtEndDate.Text <> "" And
TxtCodiceConces2.Text <> "") Then
    '        sql2 = New OleDbDataAdapter("select
Numerofattura,RagioneSociale,cognomechiamante,Codice,data_chiamata,ora_chiamata,id_primo
from Tbt_primo where Codice=('" & DoQuotes((TxtCodiceConces2.Text)) & "')
and Data_Chiamata >=('" & DateToNumber(DataInizio) & "') and Data_Chiamata
<= ('" & DateToNumber(DataFine) & "') order by Data_Chiamata desc", objCon)
    '    ElseIf (txtStartDate.Text <> "" And txtEndDate.Text <> "" And
TxtCodiceConces2.Text = "") Then
    '        sql2 = New OleDbDataAdapter("select
Numerofattura,RagioneSociale,cognomechiamante,Codice,data_chiamata,ora_chiamata,id_primo
from Tbt_primo where  Data_Chiamata >=('" & DateToNumber(DataInizio) & "')
and Data_Chiamata <= ('" & DateToNumber(DataFine) & "')order by
Data_Chiamata desc", objCon)
    '    ElseIf (txtStartDate.Text = "" And txtEndDate.Text = "" And
TxtCodiceConces2.Text <> "") Then
    '        sql2 = New OleDbDataAdapter("select
Numerofattura,RagioneSociale,cognomechiamante,Codice,data_chiamata,ora_chiamata,id_primo
from Tbt_primo where Codice=(" & DoQuotes(TxtCodiceConces2.Text) & ")
order by Data_Chiamata desc", objCon)
    '    ElseIf (txtStartDate.Text = "" And txtEndDate.Text = "" And
TxtCodiceConces2.Text = "") Then
    '        sql2 = New OleDbDataAdapter("select
Numerofattura,RagioneSociale,cognomechiamante,Codice,data_chiamata,ora_chiamata,id_primo
from Tbt_primo5  order by Data_Chiamata desc ", objCon)
    '    Else
    '    End If
    '    Dim querydataset As DataSet = New DataSet()
    '    Dim a As String
    '    sql2.Fill(querydataset)
    '    If querydataset.Tables(0).Rows.Count > 0 Then
    '        For i = 0 To querydataset.Tables(0).Rows.Count - 1
    '            querydataset.Tables(0).Rows(i).Item("ora_chiamata") =
NumberToTime(querydataset.Tables(0).Rows(i).Item("ora_chiamata").ToString)
    '            querydataset.Tables(0).Rows(i).Item("data_chiamata") =
NumberToDate(querydataset.Tables(0).Rows(i).Item("data_chiamata").ToString)
    '        Next i
    '        lblRicerca.Text = ""
    '        GridView5.Visible = True
    '        GridView5.DataSource = querydataset
    '        GridView5.DataBind()
    '    Else
    '        lblRicerca.Visible = True
    '        lblRicerca.Text = "Nessuna corrispondenza trovata"
    '        GridView5.Visible = False
    '    End If
    'End Sub
    'Protected Sub GridView2_PageIndexChanging(ByVal sender As Object,
ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles
GridView2.PageIndexChanging
    '    GridView2.PageIndex = e.NewPageIndex
    '    bindata()
    'End Sub
    Protected Sub BtnSalva_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles BtnSalva.Click
        Dim objCon As OleDbConnection
        Dim connectionstring As String =
System.Configuration.ConfigurationManager.ConnectionStrings("strCon").ConnectionString
        objCon = New OleDbConnection(connectionstring)
        Dim sql2 As OleDbDataAdapter
        ''Dim giorno As String
        Dim ora As String
        giorno = Me.TxtDataChiamata.Text
        ViewState("giorno") = giorno
        ''Date.Now.ToString("dd/MM/yyyy")
        ora = Date.Now.ToString("HH:mm:ss")
        Dim codiceconcess As String
        Dim codiceconcess2 As String
        codiceconcess2 = TxtRagSociCoConc.Text
        codiceconcess = TxtCodiceConces.Text
        lbl_idconcessionario.Visible = False
        objCon.Open()
        Dim trans As OleDbTransaction
        trans = objCon.BeginTransaction
        ValidazioneCampi()
        lbl_idconcessionario.Visible = False
        If setparam = 1 Then
            If (BtnSalva.Text = "Modifica") Then
                win = "2"
                If (win <> ViewState("param")) Then
                    SetIdConcessionario()
                End If
                lbl_idconcessionario.Text =
ViewState("lbl_idconcessionario.Text")
                BtnSalva.Text = "Salva"
                setwrite()
                Label3.Visible = False
                Exit Sub
            End If
            If (BtnSalva.Text = "Salva") And lbl_idconcessionario.Text <>
"" Then
                Label3.Visible = False
                modifica()
                BtnSalva.Text = "Modifica"
                SetReadonly()
                BtnRicerca.Visible = True
                bind()
                lbl_idconcessionario.Text = ""
                Exit Sub
            End If
            If (BtnSalva.Text = "Salva") And lbl_idconcessionario.Text =
"" Then
                Label3.Visible = False
                lbl_idconcessionario.Text = ""
                Try
                    Dim sql1 As String = String.Empty
                    sql1 = "INSERT INTO Tbt_Concessionario "
                    sql1 &= "(DescTelefono1"
                    sql1 &= ",DescTelefono2"
                    sql1 &= ",CognomeChiamante"
                    sql1 &= ",RagioneSociale"
                    sql1 &= ",Relazione"
                    sql1 &= ",CodiceConcessionario"
                    sql1 &= ",NumeroFattura"
                    sql1 &= ",data_chiamata"
                    sql1 &= ",ora_chiamata"
                    sql1 &= ",Nota_descrittiva"
                    sql1 &= ")values"
                    sql1 &= "('" & DoQuotes(TxtTelefono1.Text) & "'"
                    sql1 &= ",'" & DoQuotes(TxtTelefono2.Text) & "'"
                    sql1 &= ",'" & DoQuotes(TxtCoDelchiama.Text) & "'"
                    sql1 &= ",'" & DoQuotes(TxtRagSociCoConc.Text) & "'"
                    sql1 &= ",'" & DoQuotes(TxtRelChiamante.Text) & "'"
                    sql1 &= ",'" & DoQuotes(TxtCodiceConces.Text) & "'"
                    sql1 &= ",'" & DoQuotes(TxtNumFattura.Text) & "'"
                    sql1 &= ",'" & DateToNumber(giorno) & "'"
                    sql1 &= ",'" & TimeToNumber(ora) & "'"
                    '     sql1 &= ",'" & DoQuotes(TxtNotaDescrittiva.Text)
& "'"
                    sql1 &= ")"
                    Dim comm As OleDbCommand = New OleDbCommand
                    comm.Connection = objCon
                    'Inizia la transazione
                    comm.Transaction = trans
                    'prima query
                    comm.CommandText = sql1
                    comm.ExecuteNonQuery()
                    'eseguo la transazione
                    trans.Commit()
                Catch ex As SqlException
                    'se si sono verificati errori faccio il rollback
                    trans.Rollback()
                    Response.Write(ex.ToString())
                Finally
                    objCon.Close()
                End Try
                BtnSalva.Text = "Modifica"
                SetReadonly()
                BtnRicerca.Visible = True
                bind()
                Me.TxtDataChiamata.Text = ViewState("giorno")
            Else
            End If
        Else
            Label3.Visible = True
            Label3.Text = "****"
            lblRicerca.Text = "***"
        End If
    End Sub
    Private Sub ValidazioneCampi()
        setparam = 1
        If TxtCodiceConces.Text = "" Then
            punto3 = 0
            Label3.Text = "****"
            setparam = 0
        Else
            punto3 = 1
        End If
    End Sub
    Sub controllacampi(ByVal TestBox As TextBox, ByVal a As Integer)
        If a = 1 Then
            If IsNumeric(TestBox) Then
                a = "Errore dati nella Casella" + Convert.ToString(TestBox)
                lblRicerca.Text = "Errore dati nella Casella" + a
            End If
        End If
    End Sub
    Private Sub modifica()
        Dim objCon As OleDbConnection
        Dim connectionstring As String =
System.Configuration.ConfigurationManager.ConnectionStrings("strCon").ConnectionString
        objCon = New OleDbConnection(connectionstring)
        Dim sql2 As OleDbDataAdapter
        Dim mm As DateTime
        mm = Date.Now
        objCon.Open()
        Dim trans As OleDbTransaction
        trans = objCon.BeginTransaction()
        Try
            Label3.Visible = False
            DeleteId_concessionario()
            Dim sql1 As String = "UPDATE Tbt_Concessionario SET
DescTelefono1= '" & DoQuotes(TxtTelefono1.Text) & " ' ,DescTelefono2= '" &
DoQuotes(TxtTelefono2.Text) & " ',CognomeChiamante='" &
DoQuotes(TxtCoDelchiama.Text) & "',RagioneSociale='" &
DoQuotes(TxtRagSociCoConc.Text) & "',Relazione='" &
DoQuotes(TxtRelChiamante.Text) & "',CodiceConcessionario=" &
DoQuotes(TxtCodiceConces.Text) & ",NumeroFattura='" &
DoQuotes(TxtNumFattura.Text) & "'  where id_concessionario=(" &
(lbl_idconcessionario.Text) & ")"
            Dim comm As OleDbCommand = New OleDbCommand
            comm.Connection = objCon
            'Inizia la transazione
            comm.Transaction = trans
            'prima query
            comm.CommandText = sql1
            comm.ExecuteNonQuery()
            'eseguo la transazione
            trans.Commit()
        Catch ex As SqlException
            trans.Rollback()
            Response.Write(ex.ToString())
        Finally
            objCon.Close()
            setwrite()
        End Try
        Me.TxtDataChiamata.Text = ViewState("giorno")
        BtnSalva.Text = "Salva"
    End Sub
    Public Function Apici(ByVal s As String) As String
        Apici = Chr(34) & s & Chr(34)
    End Function
    Private Sub DeleteId_concessionario()
        Dim objCon As OleDbConnection
        Dim connectionstring As String =
System.Configuration.ConfigurationManager.ConnectionStrings("strCon").ConnectionString
        objCon = New OleDbConnection(connectionstring)
        Dim sql2 As String
        Dim mm As DateTime
        mm = Date.Now
        objCon.Open()
        Dim trans As OleDbTransaction
        trans = objCon.BeginTransaction()
        win = "2"
        If (win <> ViewState("param")) Then
            SetIdConcessionario()
        End If
        Try
            sql2 = "delete from Tbt_MotivoChiamata where id_primo= " &
lbl_idconcessionario.Text & ""
            Dim comm As OleDbCommand = New OleDbCommand
            comm.Connection = objCon
            'Inizia la transazione
            comm.Transaction = trans
            'prima query
            comm.CommandText = sql2
            comm.ExecuteNonQuery()
            'eseguo la transazione
            trans.Commit()
        Catch ex As SqlException
            'se si sono verificati errori faccio il rollback
            trans.Rollback()
            Response.Write(ex.ToString())
        Finally
            'chiudiamo sempre le connessioni!
            objCon.Close()
        End Try
    End Sub
    Private Sub SetIdConcessionario()
        Dim id_concessionario As String
        Dim objCon As OleDbConnection
        Dim connectionstring As String =
System.Configuration.ConfigurationManager.ConnectionStrings("strCon").ConnectionString
        objCon = New OleDbConnection(connectionstring)
        Dim sql2 As OleDbDataAdapter
        objCon.Open()
        sql2 = New OleDbDataAdapter("SELECT Max(id_primo)  AS id_motivo
from Tbt_Concessionario", objCon)
        Dim querydataset As DataSet = New DataSet()
        sql2.Fill(querydataset)
        If querydataset.Tables(0).Rows.Count > 0 Then
            id_concessionario =
querydataset.Tables(0).Rows(0).Item(0).ToString()
            ViewState("lbl_idconcessionario.Text") = id_concessionario
        Else
            lblRicerca.Visible = True
            lblRicerca.Text = "Nessuna corrispondenza trovata"
            '    GridView1.Visible = False
        End If
    End Sub
    Private Sub InsertcheckBox(ByVal id_motivo As Integer, ByVal
CodiceConcessionario As Integer)
        Dim objCon As OleDbConnection
        Dim connectionstring As String =
System.Configuration.ConfigurationManager.ConnectionStrings("strCon").ConnectionString
        objCon = New OleDbConnection(connectionstring)
        Dim sql2 As String
        Dim mm As DateTime
        mm = Date.Now
        '' mm.Replace(".", ":")
        objCon.Open()
        Dim trans As OleDbTransaction
        trans = objCon.BeginTransaction()
        Try
            sql2 = "INSERT INTO Tbt_MotivoChiamata (id_motivo,
id_primo)values('" & id_motivo & "'," & lbl_idconcessionario.Text & ")"
            Dim comm As OleDbCommand = New OleDbCommand
            comm.Connection = objCon
            'Inizia la transazione
            comm.Transaction = trans
            'prima query
            comm.CommandText = sql2
            comm.ExecuteNonQuery()
            'eseguo la transazione
            trans.Commit()
        Catch ex As SqlException
            'se si sono verificati errori faccio il rollback
            trans.Rollback()
            Response.Write(ex.ToString())
        Finally
            objCon.Close()
        End Try
    End Sub
    Protected Sub BtnModifica_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles BtnRicerca.Click
        Response.Redirect("GestConcRicerca.aspx")
    End Sub
    Protected Sub TxtRelChiamante_TextChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles TxtRelChiamante.TextChanged
    End Sub
    Protected Sub TxtNumFattura_TextChanged(ByVal sender As Object, ByVal
e As System.EventArgs) Handles TxtNumFattura.TextChanged
    End Sub
    Private Sub caricaCampi()
        Dim objCon As OleDbConnection
        Dim connectionstring As String =
System.Configuration.ConfigurationManager.ConnectionStrings("strCon").ConnectionString
        objCon = New OleDbConnection(connectionstring)
        Dim sql2 As OleDbDataAdapter
        objCon.Open()
        sql2 = New OleDbDataAdapter("select desctelefono1,desctelefono2, 
CognomeChiamante,RagioneSociale,Relazione,CodiceConcessionario,NumeroFattura,data_chiamata,ora_chiamata,Nota_descrittiva,id_primo
from Tbt_Concessionario where id_primo=(" & id_concessionario & ")",
objCon)
        Dim querydataset As DataSet = New DataSet()
        sql2.Fill(querydataset)
        If querydataset.Tables(0).Rows.Count > 0 Then
            TxtTelefono1.Text =
querydataset.Tables(0).Rows(0).Item("desctelefono1").ToString()
            TxtTelefono2.Text =
querydataset.Tables(0).Rows(0).Item("desctelefono2").ToString()
            TxtCoDelchiama.Text =
querydataset.Tables(0).Rows(0).Item("CognomeChiamante").ToString()
            TxtRagSociCoConc.Text =
querydataset.Tables(0).Rows(0).Item("RagioneSociale").ToString()
            TxtRelChiamante.Text =
querydataset.Tables(0).Rows(0).Item("Relazione").ToString()
            TxtCodiceConces.Text =
querydataset.Tables(0).Rows(0).Item("CodiceConcessionario").ToString()
            TxtNumFattura.Text =
querydataset.Tables(0).Rows(0).Item("NumeroFattura").ToString()
            TxtDataChiamata.Text =
NumberToDate(querydataset.Tables(0).Rows(0).Item("data_chiamata").ToString())
+ " " +
NumberToTime(querydataset.Tables(0).Rows(0).Item("ora_chiamata").ToString())
            '   TxtNotaDescrittiva.Text =
querydataset.Tables(0).Rows(0).Item("Nota_descrittiva").ToString()
            lbl_idconcessionario.Text =
querydataset.Tables(0).Rows(0).Item("id_primo").ToString()
            ViewState("lbl_idconcessionario.Text") =
lbl_idconcessionario.Text
            ViewState("giorno") = TxtDataChiamata.Text
            SetReadonly()
            BtnSalva.Text = "Modifica"
        Else
            lblRicerca.Text = "Nessuna corrispondenza trovata"
        End If
    End Sub
    Private Sub PulisciMaschera()
        Dim i As Integer
        ' For i = 0 To CheckBoxList1.Items.Count - 1
        'CheckBoxList1.Items.Item(i).Selected = False
        '  CheckBoxList1.Items.Item(i).Enabled = False
        '  Next
        TxtCoDelchiama.Text = ""
        TxtCodiceConces.Text = ""
        TxtDataChiamata.Text = ""
        '  TxtNotaDescrittiva.Text = ""
        TxtNumFattura.Text = ""
        TxtTelefono1.Text = ""
        TxtTelefono2.Text = ""
        TxtRelChiamante.Text = ""
        TxtRagSociCoConc.Text = ""
    End Sub
    Private Sub riempiListacheck()
    End Sub
    Private Sub setwrite()
        Dim i As Integer
        'For i = 0 To CheckBoxList1.Items.Count - 1
        '    CheckBoxList1.Items.Item(i).Enabled = True
        'Next
        TxtCoDelchiama.ReadOnly = False
        'TxtNotaDescrittiva.ReadOnly = False
        TxtNumFattura.ReadOnly = False
        TxtTelefono1.ReadOnly = False
        TxtTelefono2.ReadOnly = False
        TxtRelChiamante.ReadOnly = False
        Me.TxtDataChiamata.Text = ViewState("giorno")
    End Sub
    Private Sub ControlliCampi()
    End Sub
    Private Sub SetReadonly()
        Dim i As Integer
        'For i = 0 To CheckBoxList1.Items.Count - 1
        '    CheckBoxList1.Items.Item(i).Enabled = False
        'Next
        TxtCoDelchiama.ReadOnly = True
        TxtDataChiamata.ReadOnly = True
        'TxtNotaDescrittiva.ReadOnly = True
        TxtNumFattura.ReadOnly = True
        TxtTelefono1.ReadOnly = True
        TxtTelefono2.ReadOnly = True
        TxtRelChiamante.ReadOnly = True
        Me.TxtDataChiamata.Text = ViewState("giorno")
    End Sub
    Private Sub SettacheckBox()
        Dim i As Integer
        Dim conta As Integer
        Dim objCon As OleDbConnection
        Dim connectionstring As String =
System.Configuration.ConfigurationManager.ConnectionStrings("strCon").ConnectionString
        objCon = New OleDbConnection(connectionstring)
        Dim sql2 As OleDbDataAdapter
        objCon.Open()
        sql2 = New OleDbDataAdapter("select id_motivo from
Tbt_MotivoChiamata where id_primo=(" & (lbl_idconcessionario.Text) & ")",
objCon)
        Dim querydataset As DataSet = New DataSet()
        sql2.Fill(querydataset)
        If querydataset.Tables(0).Rows.Count > 0 Then
            conta = querydataset.Tables(0).Rows.Count
            Dim j As Integer = 0
            'For i = 0 To CheckBoxList1.Items.Count - 1
            '    If conta > 0 Then
            '        If CheckBoxList1.Items.Item(i).Value =
querydataset.Tables(0).Rows(j).Item(0).ToString() Then
            '            CheckBoxList1.Items.Item(i).Selected = True
            '            j = j + 1
            '            conta = conta - 1
            '        End If
            '    End If
            'Next
            lbl_idconcessionario.Text = ""
        Else
            lblRicerca.Visible = True
        End If
    End Sub
    Private Sub BidCheckBox()
        Dim objCon As OleDbConnection
        Dim connectionstring As String =
System.Configuration.ConfigurationManager.ConnectionStrings("strCon").ConnectionString
        objCon = New OleDbConnection(connectionstring)
        Dim sql2 As OleDbDataAdapter
        objCon.Open()
        sql2 = New OleDbDataAdapter("select id_motivo,Descrizione from
Tbt_Identificativo", objCon)
        Dim querydataset As DataSet = New DataSet()
        sql2.Fill(querydataset)
        If querydataset.Tables(0).Rows.Count > 0 Then
            'CheckBoxList1.DataSource = querydataset
            'CheckBoxList1.DataValueField = "id_motivo"
            'CheckBoxList1.DataTextField = "Descrizione"
            'CheckBoxList1.DataBind()
        Else
            lblRicerca.Visible = True
        End If
    End Sub
    Private Sub bind()
        Dim i As Integer
        Dim cod As Integer
        win = "2"
        If (win <> ViewState("param")) Then
            SetIdConcessionario()
        End If
        lbl_idconcessionario.Text = ViewState("lbl_idconcessionario.Text")
        'For i = 0 To CheckBoxList1.Items.Count - 1
        '    If CheckBoxList1.Items.Item(i).Selected = True Then
        '        cod = CheckBoxList1.Items.Item(i).Value
        '        InsertcheckBox(cod, lbl_idconcessionario.Text)
        '    End If
        'Next
    End Sub
    Protected Sub BtnLettura_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles BtnPulisci.Click
        ViewState("param") = ""
        lbl_idconcessionario.Visible = False
        PulisciMaschera()
        lbl_idconcessionario.Text = ""
        setwrite()
        BtnRicerca.Visible = True
        BtnSalva.Text = "Salva"
        'If TxtDataChiamata.Text = "" Then
        '    TxtDataChiamata.Text = Date.Now
        'End If
    End Sub
    Protected Sub TxtCodiceConces_TextChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles TxtCodiceConces.TextChanged
        Label3.Text = ""
    End Sub
    Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles GridView1.SelectedIndexChanged
    End Sub
    Protected Sub BtnRicerca0_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles BtnRicerca0.Click
        bindata()
    End Sub
    Protected Sub GridView1_RowCommand(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewCommandEventArgs) Handles
GridView1.RowCommand
        GridView1.Visible = True
        If e.CommandName = "Select" Then
            Dim intRiga As Integer = e.CommandArgument
            id_concessionario = Me.GridView1.DataKeys(intRiga).Value
            caricaCampi()
        End If
        If e.CommandName = "Page" Then
            bindata()
        End If
    End Sub
    Protected Sub BtnPulisci0_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles BtnPulisci0.Click
        TxtCodiceConces2.Text = ""
        txtStartDate.Text = ""
        txtEndDate.Text = ""
        GridView1.Columns.Clear()
        GridView1.Visible = False
    End Sub
    Protected Sub BtnSetta_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles BtnSetta.Click
        Response.Redirect("GestCheck.aspx")
    End Sub
    Protected Sub TxtDataChiamata_TextChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles TxtDataChiamata.TextChanged
    End Sub
    Protected Sub BtnSalva6_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles BtnSalva6.Click
        Response.Redirect("Default2.aspx")
    End Sub
End Class
-- 
questo articolo e` stato inviato via web dal servizio gratuito 
http://www.newsland.it/news
 segnala gli abusi ad 
ab...@newsland.it

TOM22 ha scritto:


TOM22 ha scritto:


TOM22 ha scritto:


TOM22 ha scritto:


TOM22 ha scritto:


COGLIONE VATTI A CURARE PRESSO I SERVIZI PSICHIATRICI DEL TUO PAESE 

 COGLIONE VATTI A CURARE PRESSO I SERVIZI PSICHIATRICI DEL TUO PAESE


E' CODICE SEMPLICE COSI LO VOGLIONO DI TIPO
LEMENTARE...........STRUNZZZZZZZZZZZZZZZZZZZZZZZ TU E SORETTTTTTTTTT


 LEMENTARE...........STRUNZZZZZZZZZZZZZZZZZZZZZZZ TU E SORETTTTTTTTTT
strunz 'ca nocc , scurnacchiato , vatti a curare a Forcella che ti lisciano 
il pelo....( come informatico non vali un cazzo ) .
LOTA!