%@ Page Language="vb" Debug="true" %> <% @Import NameSpace="System.Data" %> <% @Import NameSpace="System.Data.SQLClient" %> <% @Import NameSpace="System.Diagnostics.Debug" %> <% @Import Namespace="System.Web.Mail" %> <% @Import Namespace="System.Text.RegularExpressions" %> <% @Import NameSpace="System.Data.OleDb" %> <%@ Import namespace="System.IO" %> <%@ Import namespace="System.Net" %> <% Messaggio.Text = Messaggio.Text & ("
"& Read_File("inc\Lang\Languages.aspx",14) &"
")
Dim Codice = (Request.QueryString ("Id"))
If Only_Num(Codice) = 0 Then
If Codice <> "" AND Codice < 15 Then
Dim Costo_Mana = 0
Dim Quanti_Soldati = 0
Dim Quale_Soldato = "E_Sold_"& Codice
sqlConn.Open()
sqlComm = New SqlCommand("SELECT "& Quale_Soldato &" FROM Esercito WHERE Id_Paese = '"& Id_Paese &"' ", sqlConn)
r = sqlComm.ExecuteReader()
While r.Read()
Costo_Mana = (100 - (CInt((r("E_Sold_"& Codice) - Int(r("E_Sold_"& Codice)))*100))) * 5
Quanti_Soldati = r("E_Sold_"& Codice)
End While
r.Close()
sqlConn.Close()
If Not Ris_Mana < Costo_Mana AND CInt(Quanti_Soldati) <> Quanti_Soldati Then
Quanti_Soldati = Abs(Int(-Quanti_Soldati))
sqlConn.Open()
Dim sqlComm As New SqlCommand("UPDATE Esercito SET "& Quale_Soldato &" = '"& Quanti_Soldati &"' WHERE Id_Paese = '"& Id_Paese &"' ",sqlConn)
Dim result As Integer = sqlComm.ExecuteNonQuery()
sqlConn.Close()
sqlConn.Open()
sqlComm = New SqlCommand("UPDATE Pianeti SET Ris_Mana = Ris_Mana - '"& Costo_Mana &"' WHERE Id = '"& Id_Paese &"' ",sqlConn)
result = sqlComm.ExecuteNonQuery()
sqlConn.Close()
Messaggio.Text = Messaggio.Text &""& Read_File("inc\Lang\Languages.aspx",813) &"
"
Ris_Mana = Ris_Mana - Costo_Mana
Else
Messaggio.Text = Messaggio.Text &""& Read_File("inc\Lang\Languages.aspx",814) &"
"
End If
End If
End If
Dim Var_Row_Esercito_x = 0
If User_Race = "Human" Then
Var_Row_Esercito_x = 113
Else If User_Race = "Elf" Then
Var_Row_Esercito_x = 131
Else If User_Race = "Orc" Then
Var_Row_Esercito_x = 149
Else If User_Race = "Undead" Then
Var_Row_Esercito_x = 167
End If
sqlConn.Open()
sqlComm = New SqlCommand("SELECT E_Sold_1, E_Sold_2, E_Sold_3, E_Sold_4, E_Sold_5, E_Sold_6, E_Sold_7, E_Sold_8, E_Sold_9, E_Sold_10, E_Sold_11, E_Sold_12, E_Sold_13, E_Sold_14 FROM Esercito WHERE Id_Paese = '"& Id_Paese &"' ", sqlConn)
r = sqlComm.ExecuteReader()
While r.Read()
Messaggio.Text = Messaggio.Text & ("
"& Read_File("inc\Lang\Languages.aspx",815) &"
")
For i = 1 to 14
If CInt(r("E_Sold_"& i)) <> r("E_Sold_"& i) Then
Messaggio.Text = Messaggio.Text &" "& Read_File("inc\Lang\Languages.aspx",812) &": "& (Read_File("inc\Lang\Languages.aspx",Var_Row_Esercito_x - 73 + i) &": "& CInt((r("E_Sold_"& i) - Int(r("E_Sold_"& i)))*100) &" % [Mana: "& (100 - (CInt((r("E_Sold_"& i) - Int(r("E_Sold_"& i)))*100))) * 5 &"].
")
End If
Next
End While
r.Close()
sqlConn.Close()
%>