Private Function GetData() As DsetPartner
Dim constring As String = ConfigurationManager.ConnectionStrings("ConnStringDb1").ConnectionString
Dim cmd As SqlCommand = New SqlCommand("USP_DynamicIndicatorsTargetsForPu")
Dim selectedValueQuarter As String = String.Empty
Dim SelectedValueYear As String = String.Empty
Dim SelectedValueDistrict As String = String.Empty
Dim SelectedValueCDF As String = String.Empty
Dim SelectedValueVillages As String = String.Empty
Dim SelecctedValuePo As String = String.Empty
Dim SelectedValueStatus As String = String.Empty
Dim SelectedValueSegrifgation As String = String.Empty
Dim SelectedValueIndicators As String = String.Empty
Dim con As SqlConnection = New SqlConnection(constring)
Dim sda As SqlDataAdapter = New SqlDataAdapter
cmd.Connection = con
cmd.CommandType = CommandType.StoredProcedure
sda.SelectCommand = cmd
sda.SelectCommand.CommandTimeout = 0
If lstQuarter.SelectedIndex = -1 Then
cmd.Parameters.Add("@QuarterStr", SqlDbType.NVarChar).Value = DBNull.Value
Else
For Each li As ListItem In lstQuarter.Items
If li.Selected Then
selectedValueQuarter = (selectedValueQuarter + (li.Value + ","))
End If
Next
selectedValueQuarter = selectedValueQuarter.Substring(0, selectedValueQuarter.Length - 1)
cmd.Parameters.Add("@QuarterStr", SqlDbType.NVarChar).Value = (selectedValueQuarter)
If lstYear.SelectedIndex = -1 Then
cmd.Parameters.Add("@YearStr", SqlDbType.NVarChar).Value = DBNull.Value
For Each li As ListItem In lstYear.Items
SelectedValueYear = (SelectedValueYear + (li.Value + ","))
SelectedValueYear = SelectedValueYear.Substring(0, SelectedValueYear.Length - 1)
cmd.Parameters.Add("@YearStr", SqlDbType.NVarChar).Value = (SelectedValueYear)
If lstPO.SelectedIndex = -1 Then
cmd.Parameters.Add("@PoStr", SqlDbType.NVarChar).Value = DBNull.Value
For Each li As ListItem In lstPO.Items
SelecctedValuePo = (SelecctedValuePo + (li.Value + ","))
SelecctedValuePo = SelecctedValuePo.Substring(0, SelecctedValuePo.Length - 1)
cmd.Parameters.Add("@PoStr", SqlDbType.NVarChar).Value = (SelecctedValuePo)
If ddlDistrict.SelectedIndex = -1 Then
cmd.Parameters.Add("@DistrictStr", SqlDbType.NVarChar).Value = DBNull.Value
For Each li As ListItem In ddlDistrict.Items
SelectedValueDistrict = (SelectedValueDistrict + (li.Value + ","))
SelectedValueDistrict = SelectedValueDistrict.Substring(0, SelectedValueDistrict.Length - 1)
cmd.Parameters.Add("@DistrictStr", SqlDbType.NVarChar).Value = (SelectedValueDistrict)
If ddlCDF.SelectedIndex = -1 Then
cmd.Parameters.Add("@UserStr", SqlDbType.NVarChar).Value = DBNull.Value
For Each li As ListItem In ddlCDF.Items
SelectedValueCDF = (SelectedValueCDF + (li.Value + ","))
SelectedValueCDF = SelectedValueCDF.Substring(0, SelectedValueCDF.Length - 1)
cmd.Parameters.Add("@UserStr", SqlDbType.NVarChar).Value = (SelectedValueCDF)
If lstStatus.SelectedIndex = -1 Then
cmd.Parameters.Add("@StatusStr", SqlDbType.NVarChar).Value = DBNull.Value
For Each li As ListItem In lstStatus.Items
SelectedValueStatus = (SelectedValueStatus + (li.Value + ","))
SelectedValueStatus = SelectedValueStatus.Substring(0, SelectedValueStatus.Length - 1)
cmd.Parameters.Add("@StatusStr", SqlDbType.NVarChar).Value = (SelectedValueStatus)
If ddlVillages.SelectedIndex = -1 Then
cmd.Parameters.Add("@VillageStr", SqlDbType.NVarChar).Value = DBNull.Value
For Each li As ListItem In ddlVillages.Items
SelectedValueVillages = (SelectedValueVillages + (li.Value + ","))
SelectedValueVillages = SelectedValueVillages.Substring(0, SelectedValueVillages.Length - 1)
cmd.Parameters.Add("@VillageStr", SqlDbType.NVarChar).Value = (SelectedValueVillages)
If lstIndicator.SelectedIndex = -1 Then
cmd.Parameters.Add("@QuestionStr", SqlDbType.NVarChar).Value = DBNull.Value
For Each li As ListItem In lstIndicator.Items
SelectedValueIndicators = (SelectedValueIndicators + (li.Value + ","))
SelectedValueIndicators = SelectedValueIndicators.Substring(0, SelectedValueIndicators.Length - 1)
cmd.Parameters.Add("@QuestionStr", SqlDbType.NVarChar).Value = (SelectedValueIndicators)
cmd.Parameters.Add("@Individual", SqlDbType.Bit).Value = chekSegrigation.Checked
Using dsCustomers As New DsetPartner()
sda.Fill(dsCustomers, "DataTable1")
Return dsCustomers
End Using
End Function