Torna al Thread
Protected Sub RepeaterPagamentiAccettati_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.RepeaterCommandEventArgs) Handles RepeaterPagamentiAccettati.ItemCommand
Try
Select Case e.CommandName.ToString
Case Is = "SelezionaPagamento"
'+++ ricalcolo spesa finale con l'aggiunta di un eventuale sovrattassa per il tipo di spedizione +++
Dim lblCartTotaleProdotti As Label = CType(PanelCarrello.FindControl("lblCartTotaleProdotti"), Label)
Dim lblCartTotale As Label = CType(PanelCarrello.FindControl("lblCartTotale"), Label)
Dim lblSpesaAggiuntivaValue As Label = CType(e.Item.FindControl("lblSpesaAggiuntivaValue"), Label)
Dim lblSpeseSpedizione As Label = CType(PanelCarrello.FindControl("lblCartSpeseSpedizione"), Label)
'+++ estrazione intervallo di spesa per calcolo spedespedizione attribuibili +++
Dim intRange As Integer = 0
Dim clsgen As New ClassGenerali
If lblCartTotaleProdotti.Text <> "" Then
intRange = CInt(lblCartTotaleProdotti.Text)
Else
intRange = 0
End If
'+++ estrazione spese di spedizione da db +++
lblSpeseSpedizione.Text = String.Format("{0:N2}", (clsgen.EstraiSpeseSpedizione(CStr("SELECT SpeseSpedizione FROM SpeseSpedizione WHERE SpeseFrom <=" & intRange & " AND SpeseTo >=" & intRange & ""), "SpeseSpedizione")))
lblSpeseSpedizione.Text = String.Format("{0:c}", lblSpeseSpedizione.Text)
lblCartTotale.Text = ""
'lblCartTotale.DataBind()
'+++ controllo delle spese aggiuntive di spedizione +++
If CDbl(lblSpesaAggiuntivaValue.Text) > 0 Then
lblSpeseSpedizione.Text = String.Format("{0:N2}", (CInt(lblSpeseSpedizione.Text) + CInt(lblSpesaAggiuntivaValue.Text)))
lblSpeseSpedizione.Text = String.Format("{0:c}", lblSpeseSpedizione.Text)
End If
'+++ controllo della valorizzazione dello sconto applicato e calcolo del totale +++
If txtSconto.Text <> "" Then
Dim dmlSconto As Decimal
dmlSconto = clsgen.EstraiCodiceSconto(CStr(txtSconto.Text))
If dmlSconto > 0 Then
lblCartTotale.Text = String.Format("{0:N2}", (CInt(lblCartTotaleProdotti.Text) + CInt(lblSpeseSpedizione.Text) - CInt(dmlSconto)))
Else
lblCartTotale.Text = String.Format("{0:N2}", (CInt(lblCartTotaleProdotti.Text) + CInt(lblSpeseSpedizione.Text)))
End If
Else
lblCartTotale.Text = String.Format("{0:N2}", (CInt(lblCartTotaleProdotti.Text) + CInt(lblSpeseSpedizione.Text)))
End If
lblCartTotale.Text = String.Format("{0:c}", lblCartTotale.Text)
clsgen = Nothing
'UpdatePanelCarrello.Update()
'+++
'+++ associazione immagine servizio scelto +++
Dim imgbtnSelezionaPag As ImageButton = CType(e.Item.FindControl("imgbtnSelezionaPagamento"), ImageButton)
Dim imgPagamentoSelezionatoPag As Image = CType(e.Item.FindControl("imgPagamentoSelezionato"), Image)
imgbtnSelezionaPag.Visible = False
imgPagamentoSelezionatoPag.Visible = True
Dim ElementiPaga As RepeaterItem
For Each ElementiPaga In RepeaterPagamentiAccettati.Items
If Not e.Item.ItemIndex = ElementiPaga.ItemIndex Then
Dim imgbtnSelezionaPag2 As ImageButton = CType(RepeaterPagamentiAccettati.Items.Item(ElementiPaga.ItemIndex).FindControl("imgbtnSelezionaPagamento"), ImageButton)
Dim imgSpedSelezionataPag2 As Image = CType(RepeaterPagamentiAccettati.Items.Item(ElementiPaga.ItemIndex).FindControl("imgPagamentoSelezionato"), Image)
imgbtnSelezionaPag2.Visible = True
imgSpedSelezionataPag2.Visible = False
End If
Next
ElementiPaga = Nothing
imgbtnSelezionaPag = Nothing
imgPagamentoSelezionatoPag = Nothing
End Select
'UpdatePanelCarrello.Update()
Catch ex As Exception
Dim clsGen As New ClassGenerali
If ViewMsgDebug = True Then clsGen.MostraMessaggio(HttpContext.Current.Handler, Resources.ResourceMsg.Errore, ex.Message)
'SEND MAIL CON ERRORE ESTESO
Call clsGen.ScriviLog("Carrello.aspx.vb.RepeaterPagamentiAccettati_ItemCommand", ex.Message)
clsGen.SendMailProblemi(ex.Message & "<br><br>Errore in fase di ItemCommand dei Pagamenti accettati da carrello")
clsGen = Nothing
End Try
End Sub