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/UrbanPoor_new.aspx.vb |
Imports System.Data Imports System.Data.SqlClient Partial Class UrbanPoor_new 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("UP_ID").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, tsty6, tsty7, tsty8, tsty9, tsty10, tsty11, tsty12, tsty13, tsty14, tsty15, tsty16, tsty17 As TextBox Dim s, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, S16, S17 As Object Me.sdcIPAddress.UpdateParameters("UP_ID").DefaultValue = grdCDP.DataKeys(e.RowIndex).Value tsty = grdCDP.Rows(e.RowIndex).Cells(7).Controls(1) tsty1 = grdCDP.Rows(e.RowIndex).Cells(8).Controls(1) tsty2 = grdCDP.Rows(e.RowIndex).Cells(9).Controls(1) tsty3 = grdCDP.Rows(e.RowIndex).Cells(10).Controls(1) tsty4 = grdCDP.Rows(e.RowIndex).Cells(11).Controls(1) tsty5 = grdCDP.Rows(e.RowIndex).Cells(12).Controls(1) tsty6 = grdCDP.Rows(e.RowIndex).Cells(13).Controls(1) tsty7 = grdCDP.Rows(e.RowIndex).Cells(14).Controls(1) tsty8 = grdCDP.Rows(e.RowIndex).Cells(15).Controls(1) tsty9 = grdCDP.Rows(e.RowIndex).Cells(16).Controls(1) tsty10 = grdCDP.Rows(e.RowIndex).Cells(17).Controls(1) tsty11 = grdCDP.Rows(e.RowIndex).Cells(18).Controls(1) tsty12 = grdCDP.Rows(e.RowIndex).Cells(19).Controls(1) tsty13 = grdCDP.Rows(e.RowIndex).Cells(20).Controls(1) tsty14 = grdCDP.Rows(e.RowIndex).Cells(21).Controls(1) tsty15 = grdCDP.Rows(e.RowIndex).Cells(22).Controls(1) tsty16 = grdCDP.Rows(e.RowIndex).Cells(23).Controls(1) tsty17 = grdCDP.Rows(e.RowIndex).Cells(24).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 t6 As TextBox = tsty6 s6 = (t6.Text).Trim If s6.ToString.Contains("#") Then e.Cancel = True Exit Sub End If Dim t7 As TextBox = tsty7 s7 = (t7.Text).Trim If s7.ToString.Contains("#") Then e.Cancel = True Exit Sub End If Dim t8 As TextBox = tsty8 s8 = (t8.Text).Trim If s8.ToString.Contains("#") Then e.Cancel = True Exit Sub End If Dim t9 As TextBox = tsty9 s9 = (t9.Text).Trim If s9.ToString.Contains("#") Then e.Cancel = True Exit Sub End If Dim t10 As TextBox = tsty10 s10 = (t10.Text).Trim If s10.ToString.Contains("#") Then e.Cancel = True Exit Sub End If Dim t11 As TextBox = tsty11 s11 = (t11.Text).Trim If s11.ToString.Contains("#") Then e.Cancel = True Exit Sub End If Dim t12 As TextBox = tsty12 s12 = (t12.Text).Trim If s12.ToString.Contains("#") Then e.Cancel = True Exit Sub End If Dim t13 As TextBox = tsty13 s13 = (t13.Text).Trim If s13.ToString.Contains("#") Then e.Cancel = True Exit Sub End If Dim t14 As TextBox = tsty14 s14 = (t14.Text).Trim If s14.ToString.Contains("#") Then e.Cancel = True Exit Sub End If Dim t15 As TextBox = tsty15 s15 = (t15.Text).Trim If s15.ToString.Contains("#") Then e.Cancel = True Exit Sub End If Dim t16 As TextBox = tsty16 S16 = (t16.Text).Trim If S16.ToString.Contains("#") Then e.Cancel = True Exit Sub End If Dim t17 As TextBox = tsty17 S17 = (t17.Text).Trim If S17.ToString.Contains("#") Then e.Cancel = True Exit Sub End If Me.sdcIPAddress.UpdateParameters("UP_ID").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.UpdateParameters("Ia6").DefaultValue = s6 Me.sdcIPAddress.UpdateParameters("Ia7").DefaultValue = s7 Me.sdcIPAddress.UpdateParameters("Ia8").DefaultValue = s8 Me.sdcIPAddress.UpdateParameters("Ia9").DefaultValue = s9 Me.sdcIPAddress.UpdateParameters("Ia10").DefaultValue = s10 Me.sdcIPAddress.UpdateParameters("Ia11").DefaultValue = s11 Me.sdcIPAddress.UpdateParameters("Ia12").DefaultValue = s12 Me.sdcIPAddress.UpdateParameters("Ia13").DefaultValue = s13 Me.sdcIPAddress.UpdateParameters("Ia14").DefaultValue = s14 Me.sdcIPAddress.UpdateParameters("Ia15").DefaultValue = s15 Me.sdcIPAddress.UpdateParameters("Ia16").DefaultValue = S16 Me.sdcIPAddress.UpdateParameters("Ia17").DefaultValue = S17 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() If Page.IsPostBack = False Then LoadCompany_NEW() grdCDP.Columns(0).Visible = False grdCDP.Columns(1).Visible = False End If Else Dim sobj = Session("myobj") Context.Items("CityProfile_New") = "no" If sobj <> "" Then If Context.Application.AllKeys(0).Length = 0 Then End If 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 LoadCompany_NEW_para(firstN) ' 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 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("ULBID").DefaultValue = DDLULBID.SelectedValue ' sdcIPAddress.DataBind() 'End If End Sub ''' <summary> ''' new change for the population ddlulb droupdown ''' </summary> ''' <param name="Parafname"></param> ''' <returns></returns> ''' <remarks></remarks> ''' Sub LoadCompany_NEW_para(ByVal pr As String) ' DD_CompanyName.Items.Clear() Dim record As Integer Dim sql = "select * from Viw_I_GetCityCompanywise where firstname='" + pr + "'" 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 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("ULBID").DefaultValue = DDLULBID.SelectedValue sdcIPAddress.DataBind() End Sub End Class