Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 516
  • Last Modified:

classic asp

I have rough convert from classic asp to asp.net/c#.
Basically, all I need is to convert to asp.net/c# so this page will work with other aspx file.
I offer 500pts for completed working codes in asp.net/c#...

Thanks
<%@ language="Vbscript" %>
<html>
<head>
<script type="text/javascript" language ="javascript" >
    function UpdateRow(x) {
        var _total = 0;
        var _totalFt = 0;
        var _totalLm = 0;
        for (var i = 0; i < 18; i++) {
            //===========================================================
            var _v = parseInt(document.getElementById(x + "_" + i).value);
            if (!isNaN(_v)) {
                _total += _v
            }
            //============================================================
            //Lm Calculation
            if (i == 0) {
                var _v2 = parseInt(document.getElementById(x + "_" + i).value * 995);
            }
            else if (i == 1) {
                var _v2 = parseInt(document.getElementById(x + "_" + i).value * 1220);
            }
            else if (i == 2) {
                var _v2 = parseInt(document.getElementById(x + "_" + i).value * 1530);
            }
            else if (i == 3) {
                var _v2 = parseInt(document.getElementById(x + "_" + i).value * 1830);
            }
            else if (i == 4) {
                var _v2 = parseInt(document.getElementById(x + "_" + i).value * 2130);
            }
            else if (i == 5) {
                var _v2 = parseInt(document.getElementById(x + "_" + i).value * 2440);
            }
            else if (i == 6) {
                var _v2 = parseInt(document.getElementById(x + "_" + i).value * 2740);
            }
            else if (i == 7) {
                var _v2 = parseInt(document.getElementById(x + "_" + i).value * 3050);
            }
            else if (i == 8) {
                var _v2 = parseInt(document.getElementById(x + "_" + i).value * 3350);
            }
            else if (i == 9) {
                var _v2 = parseInt(document.getElementById(x + "_" + i).value * 3660);
            }
            else if (i == 10) {
                var _v2 = parseInt(document.getElementById(x + "_" + i).value * 3960);
            }
            else if (i == 11) {
                var _v2 = parseInt(document.getElementById(x + "_" + i).value * 4270);
            }
            else if (i == 12) {
                var _v2 = parseInt(document.getElementById(x + "_" + i).value * 4570);
            }
            else if (i == 13) {
                var _v2 = parseInt(document.getElementById(x + "_" + i).value * 4880);
            }
            else if (i == 14) {
                var _v2 = parseInt(document.getElementById(x + "_" + i).value * 5180);
            }
            else if (i == 15) {
                var _v2 = parseInt(document.getElementById(x + "_" + i).value * 5490);
            }
            else if (i == 16) {
                var _v2 = parseInt(document.getElementById(x + "_" + i).value * 5790);
            }
            else if (i == 17) {
                var _v2 = parseInt(document.getElementById(x + "_" + i).value * 6100);
            }
            else {
                var _v2 = parseInt(document.getElementById(x + "_" + i).value);
            }
            if (!isNaN(_v2)) {
                _totalLm += _v2
            }

            //============================================================
            //Ft Calculation
            if (i == 0) {
                var _v1 = parseInt(document.getElementById(x + "_" + i).value * 3);
            }
            else if (i == 1) {
                var _v1 = parseInt(document.getElementById(x + "_" + i).value * 4);
            }
            else if (i == 2) {
                var _v1 = parseInt(document.getElementById(x + "_" + i).value * 5);
            }
            else if (i == 3) {
                var _v1 = parseInt(document.getElementById(x + "_" + i).value * 6);
            }
            else if (i == 4) {
                var _v1 = parseInt(document.getElementById(x + "_" + i).value * 7);
            }
            else if (i == 5) {
                var _v1 = parseInt(document.getElementById(x + "_" + i).value * 8);
            }
            else if (i == 6) {
                var _v1 = parseInt(document.getElementById(x + "_" + i).value * 9);
            }
            else if (i == 7) {
                var _v1 = parseInt(document.getElementById(x + "_" + i).value * 10);
            }
            else if (i == 8) {
                var _v1 = parseInt(document.getElementById(x + "_" + i).value * 11);
            }
            else if (i == 9) {
                var _v1 = parseInt(document.getElementById(x + "_" + i).value * 12);
            }
            else if (i == 10) {
                var _v1 = parseInt(document.getElementById(x + "_" + i).value * 13);
            }
            else if (i == 11) {
                var _v1 = parseInt(document.getElementById(x + "_" + i).value * 14);
            }
            else if (i == 12) {
                var _v1 = parseInt(document.getElementById(x + "_" + i).value * 15);
            }
            else if (i == 13) {
                var _v1 = parseInt(document.getElementById(x + "_" + i).value * 16);
            }
            else if (i == 14) {
                var _v1 = parseInt(document.getElementById(x + "_" + i).value * 17);
            }
            else if (i == 15) {
                var _v1 = parseInt(document.getElementById(x + "_" + i).value * 18);
            }
            else if (i == 16) {
                var _v1 = parseInt(document.getElementById(x + "_" + i).value * 19);
            }
            else if (i == 17) {
                var _v1 = parseInt(document.getElementById(x + "_" + i).value * 20);
            }
            else {
                var _v1 = parseInt(document.getElementById(x + "_" + i).value);
            }
            if (!isNaN(_v1)) {
                _totalFt += _v1
            }
            //=============================================================
        }
        //========================================================
        //Final Formula:
        document.getElementById("Total_" + x).value = _total;
        document.getElementById("TotalFt_" + x).value = _totalFt;
        document.getElementById("TotalLm_" + x).value = Math.round(_totalLm / 1000);
        //========================================================
        //==Aman Bhullar
        var _vvv = parseInt(document.getElementById("Ddl" + x).value);
        var _vvv1 = (document.getElementById("CbmHidden" + x).value);

        if (!isNaN(_vvv)) 
        {
            document.getElementById("TotalMfbm_" + x).value = parseInt(_totalFt) / document.getElementById("Ddl" + x).value;
        }
        if (!isNaN(_vvv1)) {
            document.getElementById("TotalCbm_" + x).value = document.getElementById("TotalMfbm_" + x).value * document.getElementById("CbmHidden" + x).value;
        }


        //==End of Code
    }    
    </script>
</head>
<body>
<%
'=================================================================
'Button Is Clicked
If request("Btn_Save") = "Save All" Then
TotalRow=Cint(Request.Form("TotalRow"))
TotalColumn=17
ReDim SubmitTatty(TotalColumn,TotalRow)
For I=0 to UBound(SubmitTatty,2) - 1'read the rows
            HtmlPartNoName = "Ddl" & I
            Response.Write request.Form(HtmlPartNoName) & " " 
            PartNoValue=request.Form(HtmlPartNoName)
            '================================================
            'Run Insert Statment And Get Identity
            '================================================
            For X = 0 To UBound(SubmitTatty,1) 'read the columns
                    HtmlName = "Txt" & I & "_" & X 
                    Response.Write request.Form(HtmlName) & "<br>"
                    NumberValue=request.Form(HtmlName)
                    '=============================================
                    'Capture Identity and run Update Statement
                    '=============================================
            Next
    Next
    With Response
    .Write "Thank you. You successfully created a record!"
    End With
End If
'End Button Clicked
'==================================================================
with response
.Write "<form action=""TattyWizard.asp"" method=""post"" name=""frmPost"">"
.Write "<table>"
.Write "<tr><td><b></b></td></tr>"
.Write "<tr><td>How many PKG#:</td><td><input name=""TxtPkg"" value=" & request.Form("TxtPkg") & ">&nbsp;<input type=""Submit"" name=""Btn_PkgRequest""></td></tr>"
.Write "</table>"
.Write "</form>"
end with
Row=Request.Form("TxtPkg")
 If Row <> "" Then
    Row = cint(Row)
    Column = Cint(17)
    ReDim Tatty(Column,Row) 
 Else
    ReDim Tatty(17,1) '=18 columns, 3 rows 
 End If
response.Write "<form action=""TattyWizard.asp"" method=""post"" name=""frmPostData"">"
response.Write "<input type=""hidden"" name=""TotalRow"" value=" & Row & ">"
response.Write "<table>"
Response.Write "<tr><td>Column:</td><td>" & UBound(Tatty,1)+1 & "</td></tr>"
Response.Write "<tr><td>Row:</td><td>" & UBound(Tatty,2) & "</td></tr>"
response.Write "</table>"
response.Write "<table border=""0"">"
response.Write "<tr valign=""bottom""><td colspan=""19"">QuoteId: 1000</td><td><b>TTL PCS</b></td><td><b>TTL FT</b></td><td><b>TTL LM</b></td><td><b>MFBM<br>MFSM</b></td><td><b>CBM</b></td></tr>"
response.Write "<tr align=""right""><td><br></td><td>995</td><td>1220</td><td>1530</td><td>1830</td>"
response.Write "<td>2130</td><td>2440</td><td>2740</td><td>3050</td>"
response.Write "<td>3350</td><td>3660</td><td>3960</td><td>4270</td><td>4570</td>"
response.Write "<td>4880</td><td>5180</td><td>5490</td><td>5790</td><td>6100</td>"
response.Write "</tr>"
response.Write "<tr align=""right"">"
Response.Write "<td align=""left""><b>Product</b>&nbsp;&nbsp;<b>ttl ft/mfbm</b>&nbsp;<b>m3/mfbm</b></td>"
For i = 3 to 20
Response.Write "<td>" & i & "</td>"
Next
response.Write "</tr>"
For I=0 to UBound(Tatty,2) - 1'read the rows
        response.Write "<tr>"
        response.Write "<td>"
        response.Write "<input size=2  name=ProductName" & I & " id=ProductName" & I & ">&nbsp;"
        response.Write "<input size=3  onblur =""UpdateRow(" & I & ")"" name=Ddl" & I & " id=Ddl" & I & ">&nbsp;"
        response.Write "<input size=3  onblur =""UpdateRow(" & I & ")"" name=CbmHidden" & I & " id=CbmHidden" & I & ">"
        response.Write "</td>"
        For X = 0 To UBound(Tatty,1) 'read the columns
        TmpUse = I & X
        Response.Write "<td>"
        Response.Write "<input onkeyup=""this.value=this.value.replace(/\D/gi,'');"" maxlength=""4"" onblur =""UpdateRow(" & I & ")"" name=Txt" & I & "_" & X & " id=" & I & "_" & X & " size=1>"
        Response.Write "</td>" 
        Next
        If Right(TmpUse,2) = 17 Then
                Response.Write "<td><input readonly  size=4 id=Total_" & Left(TmpUse,1) & " name=Total_"   & Left(TmpUse,1) & "></td>"
                Response.Write "<td><input readonly  size=4 id=TotalFt_" & Left(TmpUse,1) & " name=TotalFt_" & Left(TmpUse,1) & "></td>"
                Response.Write "<td><input readonly  size=4 id=TotalLm_" & Left(TmpUse,1) & " name=TotalLm_" & Left(TmpUse,1) & "></td>"
                '======================================================
                'last two begin
                Response.Write "<td><input readonly  size=4 id=TotalMfbm_" & Left(TmpUse,1) & " name=TotalMfbm_" & Left(TmpUse,1) & "></td>"
                Response.Write "<td><input readonly  size=4 id=TotalCbm_" & Left(TmpUse,1) & " name=TotalCbm_" & Left(TmpUse,1) & "></td>"
                'last two end
                '======================================================
        End If
        response.Write "</tr>"
Next
Response.Write "</table>"
Response.Write "<table>"
response.Write "<td><input type=""Submit"" name=""Btn_Save"" Value=""Save All""></td></tr>"
response.Write "</table>"
%>
</body>
</html>

Open in new window

0
Webboy2008
Asked:
Webboy2008
  • 2
1 Solution
 
Wayne BarronCommented:
This seems to be more of something that you would want to hire someone to do.
That is a LOT of code to be converting over to C#.

Wish the best.
Good Luck
Carrzkiss
0
 
Webboy2008Author Commented:
how about just this part:

Row=Request.Form("TxtPkg")
 If Row <> "" Then
    Row = cint(Row)
    Column = Cint(17)
    ReDim Tatty(Column,Row)
 Else
    ReDim Tatty(17,1) '=18 columns, 3 rows
 End If
response.Write "<form action=""TattyWizard.asp"" method=""post"" name=""frmPostData"">"
response.Write "<input type=""hidden"" name=""TotalRow"" value=" & Row & ">"
response.Write "<table>"
Response.Write "<tr><td>Column:</td><td>" & UBound(Tatty,1)+1 & "</td></tr>"
Response.Write "<tr><td>Row:</td><td>" & UBound(Tatty,2) & "</td></tr>"
response.Write "</table>"
response.Write "<table border=""0"">"
response.Write "<tr valign=""bottom""><td colspan=""19"">QuoteId: 1000</td><td><b>TTL PCS</b></td><td><b>TTL FT</b></td><td><b>TTL LM</b></td><td><b>MFBM<br>MFSM</b></td><td><b>CBM</b></td></tr>"
response.Write "<tr align=""right""><td><br></td><td>995</td><td>1220</td><td>1530</td><td>1830</td>"
response.Write "<td>2130</td><td>2440</td><td>2740</td><td>3050</td>"
response.Write "<td>3350</td><td>3660</td><td>3960</td><td>4270</td><td>4570</td>"
response.Write "<td>4880</td><td>5180</td><td>5490</td><td>5790</td><td>6100</td>"
response.Write "</tr>"
response.Write "<tr align=""right"">"
Response.Write "<td align=""left""><b>Product</b>&nbsp;&nbsp;<b>ttl ft/mfbm</b>&nbsp;<b>m3/mfbm</b></td>"
For i = 3 to 20
Response.Write "<td>" & i & "</td>"
Next
response.Write "</tr>"
For I=0 to UBound(Tatty,2) - 1'read the rows
        response.Write "<tr>"
        response.Write "<td>"
        response.Write "<input size=2  name=ProductName" & I & " id=ProductName" & I & ">&nbsp;"
        response.Write "<input size=3  onblur =""UpdateRow(" & I & ")"" name=Ddl" & I & " id=Ddl" & I & ">&nbsp;"
        response.Write "<input size=3  onblur =""UpdateRow(" & I & ")"" name=CbmHidden" & I & " id=CbmHidden" & I & ">"
        response.Write "</td>"
        For X = 0 To UBound(Tatty,1) 'read the columns
        TmpUse = I & X
        Response.Write "<td>"
        Response.Write "<input onkeyup=""this.value=this.value.replace(/\D/gi,'');"" maxlength=""4"" onblur =""UpdateRow(" & I & ")"" name=Txt" & I & "_" & X & " id=" & I & "_" & X & " size=1>"
        Response.Write "</td>"
        Next
        If Right(TmpUse,2) = 17 Then
                Response.Write "<td><input readonly  size=4 id=Total_" & Left(TmpUse,1) & " name=Total_"   & Left(TmpUse,1) & "></td>"
                Response.Write "<td><input readonly  size=4 id=TotalFt_" & Left(TmpUse,1) & " name=TotalFt_" & Left(TmpUse,1) & "></td>"
                Response.Write "<td><input readonly  size=4 id=TotalLm_" & Left(TmpUse,1) & " name=TotalLm_" & Left(TmpUse,1) & "></td>"
                '======================================================
                'last two begin
                Response.Write "<td><input readonly  size=4 id=TotalMfbm_" & Left(TmpUse,1) & " name=TotalMfbm_" & Left(TmpUse,1) & "></td>"
                Response.Write "<td><input readonly  size=4 id=TotalCbm_" & Left(TmpUse,1) & " name=TotalCbm_" & Left(TmpUse,1) & "></td>"
                'last two end
                '======================================================
        End If
        response.Write "</tr>"
Next
Response.Write "</table>"
Response.Write "<table>"
response.Write "<td><input type=""Submit"" name=""Btn_Save"" Value=""Save All""></td></tr>"
response.Write "</table>"
0
 
Wayne BarronCommented:
Why did you award me points for this thread?
I cannot assist in this, that is why I suggested that you might want to hire a C# coder to do it for you.

Good Luck
Carrzkiss
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now