| Current Path : G:/PleskVhosts/mpcdp.in/cmamp.mpcdp.in/cdpp3/ |
Windows NT SG2NWVPWEB022 10.0 build 17763 (Windows Server 2016) i586 |
| Current File : G:/PleskVhosts/mpcdp.in/cmamp.mpcdp.in/cdpp3/Reforms.aspx.vb |
Imports System.Data
Imports System.Data.SqlClient
Partial Class Reforms
Inherits System.Web.UI.Page
' Dim ObjClassDB As New ClassDB
Protected Sub grdCDP_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles grdCDP.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
Dim lc As System.Web.UI.Control = e.Row.Cells(2).Controls(0)
If TypeOf (lc) Is DataBoundLiteralControl Then
If CType(lc, DataBoundLiteralControl).Text.Contains("#") Then
e.Row.Visible = False
End If
ElseIf TypeOf (lc) Is LiteralControl Then
If CType(lc, LiteralControl).Text.Contains("#") Then
e.Row.Visible = False
End If
End If
End If
End Sub
Protected Sub grdCDP_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles grdCDP.RowDeleting
Dim rndx As Int32 = e.RowIndex
Dim a As Integer
a = rndx + 1
Dim str() As String
str = Me.grdCDP.DataKeyNames
Me.sdcIPAddress.DeleteParameters("SNo").DefaultValue = a
End Sub
Protected Sub grdCDP_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles grdCDP.RowUpdating
Dim tsty, tsty1, tsty2, tsty3, tsty4, tsty5 As TextBox
Dim s, s1, s2, s3, s4, s5 As Object
tsty = grdCDP.Rows(e.RowIndex).Cells(8).Controls(1)
tsty1 = grdCDP.Rows(e.RowIndex).Cells(9).Controls(1)
tsty2 = grdCDP.Rows(e.RowIndex).Cells(10).Controls(1)
tsty3 = grdCDP.Rows(e.RowIndex).Cells(11).Controls(1)
tsty4 = grdCDP.Rows(e.RowIndex).Cells(12).Controls(1)
tsty5 = grdCDP.Rows(e.RowIndex).Cells(13).Controls(1)
' tsty6 = grdCDP.Rows(e.RowIndex).Cells(14).Controls(1)
Dim t As TextBox = tsty
s = (t.Text).Trim
If s.ToString.Contains("#") Then
e.Cancel = True
Exit Sub
End If
Dim t1 As TextBox = tsty1
s1 = (t1.Text)
If s1.ToString.Contains("#") Then
e.Cancel = True
Exit Sub
End If
Dim t2 As TextBox = tsty2
s2 = (t2.Text).Trim
If s2.ToString.Contains("#") Then
e.Cancel = True
Exit Sub
End If
Dim t3 As TextBox = tsty3
s3 = (t3.Text).Trim
If s3.ToString.Contains("#") Then
e.Cancel = True
Exit Sub
End If
Dim t4 As TextBox = tsty4
s4 = (t4.Text).Trim
If s4.ToString.Contains("#") Then
e.Cancel = True
Exit Sub
End If
Dim t5 As TextBox = tsty5
s5 = (t5.Text).Trim
If s5.ToString.Contains("#") Then
e.Cancel = True
Exit Sub
End If
'Dim t17 As TextBox = tsty17
's17 = Convert.ToDouble((t17.Text).Trim)
'If s17.ToString.Contains("#") Then
' e.Cancel = True
' Exit Sub
'End If
Me.sdcIPAddress.UpdateParameters("SNo").DefaultValue = grdCDP.DataKeys(e.RowIndex).Value
Me.sdcIPAddress.UpdateParameters("Ia").DefaultValue = s
Me.sdcIPAddress.UpdateParameters("Ia1").DefaultValue = s1
Me.sdcIPAddress.UpdateParameters("Ia2").DefaultValue = s2 'Math.Round(s2)
Me.sdcIPAddress.UpdateParameters("Ia3").DefaultValue = s3 'Math.Round(s3)
Me.sdcIPAddress.UpdateParameters("Ia4").DefaultValue = s4 'Math.Round(s4)
Me.sdcIPAddress.UpdateParameters("Ia5").DefaultValue = s5
Me.sdcIPAddress.Update()
' Else
' Me.LblError.Text = "* " & s & " IP_Address already exists"
' Me.LblError.Visible = True
' e.Cancel = True
' End If
' IPadrs = Nothing
'End If
'IPADD = Nothing
'om = Nothing
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim firstN = ""
If Not Context.User.Identity.IsAuthenticated Then
Session.Clear()
Session("dt") = DBNull.Value
Session.Abandon()
FormsAuthentication.SignOut()
Context.Application.Clear()
LoadCompany_NEW()
Else
Dim sobj = Session("myobj")
Context.Items("CityProfile_New") = "no"
If sobj <> "" Then
Dim userName = Context.Application.AllKeys(0)
Dim pageName = Context.Application.AllKeys(1)
firstN = Context.Application.AllKeys(2) 'Context.Application.Add(contextFirst, True)
' ObjClassDB.ConnectDB()
grdCDP.Columns(0).Visible = True
grdCDP.Columns(1).Visible = True
If Page.IsPostBack = False Then
' Call ObjClassDB.FillDropDownList(DDLULBID, "SPGenericSelect", "Viw_I_GetCityCompanywise", "ULBID", "ULBNameEnglish", "where FirstName='" + firstN + "'", "ORDER BY ULBNameEnglish")
Dim hRow As Integer = LoadCompany(firstN)
If hRow = 1 Then
' Call DataToList(DDLULBID.SelectedValue)
End If
If hRow = 1 Then
LoadCompany_NEW()
' Call ObjClassDB.FillDropDownList(DDLULBID, "SPGenericSelect", "MasterULB", "ULBID", "ULBNameE", "", "ORDER BY ULBNameE")
' Call DataToList(DDLULBID.SelectedValue)
End If
End If
End If
' ObjClassDB.ConnectDB()
If Page.IsPostBack = False And firstN = "" Then
LoadCompany_NEW()
' Call ObjClassDB.FillDropDownList(DDLULBID, "SPGenericSelect", "MasterULB", "ULBID", "ULBNameE", "", "ORDER BY ULBNameE")
' Call DataToList(DDLULBID.SelectedValue)
grdCDP.Columns(0).Visible = False
grdCDP.Columns(1).Visible = False
Me.sdcIPAddress.SelectParameters("F2").DefaultValue = 0
sdcIPAddress.DataBind()
End If
End If
'---------
'ObjClassDB.ConnectDB()
'If Page.IsPostBack = False Then
' Call ObjClassDB.FillDropDownList(DDLULBID, "SPGenericSelect", "MasterULB", "ULBID", "ULBNameE", "", "ORDER BY ULBNameE")
' 'Call DataToList(DDLULBID.SelectedValue)
' ' Me.sdcIPAddress.SelectParameters("ULBID").DefaultValue = 0
' 'sdcIPAddress.DataBind()
' ' Gridedat()
' Me.sdcIPAddress.SelectParameters("F2").DefaultValue = 0
' sdcIPAddress.DataBind()
'End If
End Sub
Function LoadCompany_NEW()
' DD_CompanyName.Items.Clear()
Dim record As Integer
Dim sql = "select ulbid,ULBNameEnglish from dbo.Viw_I_GetCityCompanywise ORDER BY ULBNameEnglish"
Dim command As New Command(sql, False) 'WHERE Login_ID = " & _loginID & " ", False)
Try
command.ExecuteReader(True, False)
If command.Reader.HasRows Then
DDLULBID.Items.Clear()
DDLULBID.DataValueField = "ulbid"
DDLULBID.DataTextField = "ULBNameEnglish"
DDLULBID.DataSource = command.Reader
DDLULBID.DataBind()
If DDLULBID.Items.Count > 0 Then
DDLULBID.Items.Insert(0, New ListItem("Select City", "0"))
' Return record = 1
End If
' Return record = 2
Else
End If
Finally
command.Close()
End Try
End Function
Function LoadCompany(ByVal Parafname As String) As Integer
' DD_CompanyName.Items.Clear()
Dim record As Integer
Dim sql = "select ULBNameEnglish,ulbid from dbo.Viw_I_GetCityCompanywise where FirstName= '" + Parafname + "'"
Dim command As New Command(sql, False) 'WHERE Login_ID = " & _loginID & " ", False)
Try
command.ExecuteReader(True, False)
If command.Reader.HasRows Then
DDLULBID.Items.Clear()
DDLULBID.DataValueField = "ulbid"
DDLULBID.DataTextField = "ULBNameEnglish"
DDLULBID.DataSource = command.Reader
DDLULBID.DataBind()
If DDLULBID.Items.Count > 0 Then
DDLULBID.Items.Insert(0, New ListItem("Select City", "0"))
Return record = 1
End If
Return record = 2
Else
End If
Finally
command.Close()
End Try
End Function
Protected Sub DDLULBID_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DDLULBID.SelectedIndexChanged
Me.sdcIPAddress.SelectParameters("F2").DefaultValue = DDLULBID.SelectedValue
sdcIPAddress.DataBind()
End Sub
End Class