Guest User

Untitled

a guest
Jun 25th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.76 KB | None | 0 0
  1. Sub FillgridFileExpenses()
  2. If txtInvFileNo.Text = String.Empty Then
  3. objinvoiceT.intfileID = 0
  4. Else
  5. objinvoiceT.intfileID = Convert.ToInt32(txtInvFileNo.Text)
  6. End If
  7. temptab1 = objinvoiceT.selFileExpensesView()
  8. temptab1.Columns.Add("AllInRate")
  9. If (temptab1.Rows.Count > 0) Then
  10. GridViewInvoiceT.DataSource = temptab1
  11. dtInvoice = temptab1
  12. 'dtInvoice.Columns.Add("AllInRate")
  13. GridViewInvoiceT.DataBind()
  14. GridViewInvoiceT.Columns.Item(10).Visible = True
  15. Else
  16. temptab1.Rows.Add(temptab1.NewRow())
  17. GridViewInvoiceT.DataSource = temptab1
  18. dtInvoice = temptab1
  19. GridViewInvoiceT.DataBind()
  20. Dim TotalColumns As Integer
  21. TotalColumns = GridViewInvoiceT.Rows(0).Cells.Count
  22. GridViewInvoiceT.Rows(0).Cells.Clear()
  23. GridViewInvoiceT.Rows(0).Cells.Add(New TableCell())
  24. GridViewInvoiceT.Rows(0).Cells(0).ColumnSpan = TotalColumns
  25. If txtInvFileNo.Text = String.Empty Then
  26. GridViewInvoiceT.Rows(0).Cells(0).Text = "No Record Found, Must Select a File Number "
  27. Else
  28. GridViewInvoiceT.Rows(0).Cells(0).Text = "No Record Found For File Number : " + " " + txtInvFileNo.Text
  29. End If
  30. End If
  31. End Sub
  32.  
  33. Protected Sub GridViewInvoiceT_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GridViewInvoiceT.RowUpdating
  34. cmbChargeName = CType(GridViewInvoiceT.Rows(e.RowIndex).FindControl("cmbChargeName"), DropDownList)
  35. cmbInvCurency = CType(GridViewInvoiceT.Rows(e.RowIndex).FindControl("cmbInvCurency"), DropDownList)
  36. txtInvoiceNo1 = CType(GridViewInvoiceT.Rows(e.RowIndex).FindControl("txtInvoiceNo1"), TextBox)
  37. txtInvoiceDate1 = CType(GridViewInvoiceT.Rows(e.RowIndex).FindControl("txtInvoiceDate1"), TextBox)
  38. txtInvAmount1 = CType(GridViewInvoiceT.Rows(e.RowIndex).FindControl("txtInvAmount1"), TextBox)
  39. txtInvExRate1 = CType(GridViewInvoiceT.Rows(e.RowIndex).FindControl("txtInvExRate1"), TextBox)
  40. txtInvRemarks1 = CType(GridViewInvoiceT.Rows(e.RowIndex).FindControl("txtInvRemarks1"), TextBox)
  41. cmbAllinRight = CType(GridViewInvoiceT.Rows(e.RowIndex).FindControl("ddAllInRate"), DropDownList)
  42. Dim lblAllInRate As Label = CType(GridViewInvoiceT.Rows(e.RowIndex).FindControl("lblAllInRate"), Label)
  43. objinvoiceT.intfileID = Convert.ToInt32(txtInvFileNo.Text)
  44. dtInvoice.Rows(e.RowIndex).Item("AllInRate") = cmbAllinRight.SelectedItem
  45. dtInvoice.Rows(e.RowIndex).Item("ChargeName") = cmbChargeName.SelectedItem
  46. dtInvoice.Rows(e.RowIndex).Item("InvoiceNo") = txtInvoiceNo1.Text
  47. If txtInvoiceDate1.Text = String.Empty Then
  48. dtInvoice.Rows(e.RowIndex).Item("InvoiceDate") = Convert.ToDateTime("1/1/1800")
  49. Else
  50. dtInvoice.Rows(e.RowIndex).Item("InvoiceDate") = Convert.ToDateTime(txtInvoiceDate1.Text)
  51. End If
  52. dtInvoice.Rows(e.RowIndex).Item("Currency") = cmbInvCurency.SelectedItem
  53. dtInvoice.Rows(e.RowIndex).Item("InvAmount") = txtInvAmount1.Text
  54. dtInvoice.Rows(e.RowIndex).Item("InvExRate") = txtInvExRate1.Text
  55. dtInvoice.Rows(e.RowIndex).Item("InvRemarks") = txtInvRemarks1.Text
  56. GridViewInvoiceT.EditIndex = -1
  57. GridViewInvoiceT.DataSource = dtInvoice
  58. GridViewInvoiceT.DataBind()
  59. FillInvoice()
  60.  
  61. End Sub
  62.  
  63. Protected Sub GridViewInvoiceT_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GridViewInvoiceT.RowDeleting
  64. dtInvoice.Rows.Remove(GridViewInvoiceT.DataKeys(e.RowIndex).Value)
  65. GridViewInvoiceT.DataSource = dtInvoice
  66. GridViewInvoiceT.DataBind()
  67. End Sub
  68.  
  69. GridViewInvoiceT.DataSource = dtInvoice
  70. GridViewInvoiceT.DataBind()
  71. End Sub
  72.  
  73. dtInvoice.Rows.Remove(GridViewInvoiceT.DataKeys(e.RowIndex).Value)
Add Comment
Please, Sign In to add comment