Skip to content

Instantly share code, notes, and snippets.

@kewang
Created May 28, 2020 11:14
Show Gist options
  • Save kewang/7cf569e6da5c7e124b562f04f34de994 to your computer and use it in GitHub Desktop.
Save kewang/7cf569e6da5c7e124b562f04f34de994 to your computer and use it in GitHub Desktop.
Private Sub GridView_add_Load(sender As Object, e As EventArgs) Handles GridView_add.Load
For i = 0 To GridView_add.Rows.Count - 1
Dim animalAmount As TextBox = GridView_add.Rows(i).FindControl("TextBox_animalAmount")
Dim animalUnit As HiddenField = GridView_add.Rows(i).FindControl("HiddenField_animalUnit")
Dim hidStoCoeff As HiddenField = GridView_add.Rows(i).FindControl("HiddenField_stoCoeff") '腸胃甲烷係數
Dim hidStoCoeffN As HiddenField = GridView_add.Rows(i).FindControl("HiddenField_stoCoeffN") '腸胃甲烷係數次方
Dim hidFecesCoeff As HiddenField = GridView_add.Rows(i).FindControl("HiddenField_fecesCoeff") '糞尿甲烷係數
Dim hidFecesCoeffN As HiddenField = GridView_add.Rows(i).FindControl("HiddenField_fecesCoeffN") '糞尿甲烷係數次方
Dim hidN2oCoeff As HiddenField = GridView_add.Rows(i).FindControl("HiddenField_n2oCoeff") '糞尿氧化亞氮係數
Dim hidN2oCoeffN As HiddenField = GridView_add.Rows(i).FindControl("HiddenField_n2oCoeffN") '糞尿氧化亞氮係數次方
Dim stomach As Label = GridView_add.Rows(i).FindControl("Label_stomach")
Dim feces As Label = GridView_add.Rows(i).FindControl("Label_feces")
Dim n2o As Label = GridView_add.Rows(i).FindControl("Label_n2o")
Dim stoPart1 As Double = 0
Dim stoPart2 As Integer = 0
If hidStoCoeff.Value <> "" And hidStoCoeffN.Value <> "" Then
stoPart1 = hidStoCoeff.Value
stoPart2 = hidStoCoeffN.Value
End If
Dim fecesPart1 As Double = 0
Dim fecesPart2 As Integer = 0
If hidFecesCoeff.Value <> "" And hidFecesCoeffN.Value <> "" Then
fecesPart1 = hidFecesCoeff.Value
fecesPart2 = hidFecesCoeffN.Value
End If
Dim n2oPart1 As Double = 0
Dim n2oPart2 As Integer = 0
If hidN2oCoeff.Value <> "" And hidN2oCoeffN.Value <> "" Then
n2oPart1 = hidN2oCoeff.Value
n2oPart2 = hidN2oCoeffN.Value
End If
'If IsNothing(Property_liAmount) = False Then
' For z = 0 To GridView_add.Rows.Count - 1
' 'Dim textAmount As TextBox = GridView_add.Rows(i).FindControl("TextBox_animalAmount")
' animalAmount.Text = Property_liAmount(z)
' MsgBox(Property_liAmount(z))
' Next
'End If
'animalAmount.Text = Property_liAmount(i)
MsgBox(Property_liAmount.Item(i))
If animalAmount.Text.Trim <> "" Then
Dim amount As Integer = animalAmount.Text.Trim * animalUnit.Value
stomach.Text = Format(sysLogic.GetEmissions(amount, stoPart1, stoPart2, Pollute.GHG.Info.Gas.GasType.腸胃發酵排放甲烷), "0.00")
feces.Text = Format(sysLogic.GetEmissions(amount, fecesPart1, fecesPart2, Pollute.GHG.Info.Gas.GasType.糞尿處理之甲烷), "0.00")
n2o.Text = Format(sysLogic.GetEmissions(amount, n2oPart1, n2oPart2, Pollute.GHG.Info.Gas.GasType.糞尿處理之氧化亞氮), "0.00")
End If
Next
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment