Modal extender Popup does not show when i click on radio button
Imports System.Data
Imports System.Configuration
Imports System.Data.SqlClient
Imports System.Globalization
Public Class Editsubcodes1
Inherits System.Web.UI.Page
Dim constr As String = ConfigurationManager.ConnectionStrings("SLISConnectionString").ConnectionString
Dim hold, holdupdaate As String
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Session("Hold") = "Editbook" Then
If Not Me.IsPostBack Then
Using con As New SqlConnection(constr)
Using cmd As New SqlCommand("SELECT subkey, Subject FROM Subjects")
cmd.CommandType = CommandType.Text
cmd.Connection = con
con.Open()
SubjectData.DataSource = cmd.ExecuteReader()
SubjectData.DataTextField = "Subject"
SubjectData.DataValueField = "subkey"
SubjectData.DataBind()
con.Close()
End Using
End Using
SubjectData.Items.Insert(0, New ListItem("--Select Subject--", "0"))
Using con As New SqlConnection(constr)
Using cmd As New SqlCommand("SELECT claskey, Class FROM Classesub")
cmd.CommandType = CommandType.Text
cmd.Connection = con
con.Open()
Editionsdata.DataSource = cmd.ExecuteReader()
Editionsdata.DataTextField = "Class"
Editionsdata.DataValueField = "claskey"
Editionsdata.DataBind()
con.Close()
End Using
End Using
Editionsdata.Items.Insert(0, New ListItem("--Select Editions--", "0"))
Callno.Text = Session("callno").ToString
BookName.Text = Session("BookName").ToString
Author.Text = Session("Author").ToString
EntryCode.Text = Session("Entrycode").ToString
'Editionsdata.Text = Session("Editions").ToString
Editionsdata.SelectedItem.Text = Session("Editions").ToString
Publisher.Text = Session("Publisher").ToString
YearPublished0.Text = Session("Year").ToString
Dim country As String = Session("Subject").ToString
SubjectData.SelectedItem.Text = country
Dater.Text = Date.Now.ToString("dd/MM/yyyy")
Notes.Text = Session("Notes").ToString
Groupdata.SelectedItem.Text = Session("Group")
Minimum0.Text = Session("retain").ToString
ISBN.Text = Session("ISBN").ToString
ISSN.Text = Session("ISsn").ToString
' CurrentUser.Text = Session("currentuser").ToString
Dim currentdr As System.DateTime = System.DateTime.Now
Dater.Text = currentdr.Date.ToString("dd/MM/yyyy")
Using Con As New SqlConnection(constr)
Con.Open()
Using cmd As New SqlCommand
cmd.Connection = Con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "Currentqty3"
cmd.Parameters.Add("@c", SqlDbType.NVarChar).Value = Callno.Text
cmd.Parameters.Add("@t", SqlDbType.NVarChar).Value = EntryCode.Text
cmd.ExecuteReader()
Con.Close()
End Using
End Using
Using Con As New SqlConnection(constr)
Con.Open()
Using Com As New SqlCommand("Select qty from stores", Con)
Using RDR = Com.ExecuteReader()
If RDR.HasRows Then
RDR.Read()
' Accs.Text = RDR.Item("bcode").ToString + 1
Dim kt As Double = RDR.Item("qty").ToString
Currentqty.Text = kt
' Else
' Qtys.Text = "0"
End If
End Using
End Using
Con.Close()
End Using
Using Con As New SqlConnection(constr)
Con.Open()
Using cmd As New SqlCommand
cmd.Connection = Con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "pushlastcode"
cmd.ExecuteReader()
Con.Close()
End Using
End Using
Using Con As New SqlConnection(constr)
Con.Open()
Using Com2 As New SqlCommand("truncate table cbcode4", Con)
Com2.ExecuteReader()
Con.Close()
End Using
End Using
Using Con As New SqlConnection(constr)
Con.Open()
Using Com2 As New SqlCommand("insert into cbcode4(bcode) select bcode from newcbcode", Con)
Com2.ExecuteReader()
Con.Close()
End Using
End Using
Using Con As New SqlConnection(constr)
Con.Open()
Using Com As New SqlCommand("Select bcode from cbcode4", Con)
Using RDR = Com.ExecuteReader()
If RDR.HasRows Then
RDR.Read()
' Accs.Text = RDR.Item("bcode").ToString + 1
Dim kt As Double = RDR.Item("bcode").ToString
Accs.Text = kt + 1
' Else
' Qtys.Text = "0"
End If
End Using
End Using
Con.Close()
End Using
If Not Code2.Text = "" Then
start.Text = Code2.Text
Else
start.Text = Accs.Text
' start.ReadOnly = False
End If
Session("Hold") = "Loaded"
BindGrid2000()
End If
Else
If Session("Hold") = "Loaded" Then
EntryCode.Text = Session("Entrycode").ToString
Dater.Text = Date.Now.ToString("dd/MM/yyyy")
Try
Session("Subject") = SubjectData.SelectedItem.Text
Catch
End Try
If String.IsNullOrEmpty(Notes.Text) Then
Notes.Text = Session("Notes").ToString
Else
If String.IsNullOrEmpty(YearPublished0.Text) Then
YearPublished0.Text = Session("Year").ToString
Else
If String.IsNullOrEmpty(Publisher.Text) Then
Publisher.Text = Session("Publisher").ToString
Else
If String.IsNullOrEmpty(ISBN.Text) Then
ISBN.Text = Session("ISBN").ToString
Else
If String.IsNullOrEmpty(ISSN.Text) Then
ISSN.Text = Session("ISsn").ToString
Else
If String.IsNullOrEmpty(Minimum0.Text) Then
Minimum0.Text = Session("retain").ToString
Else
If String.IsNullOrEmpty(Callno.Text) Then
Callno.Text = Session("callno").ToString
Else
If String.IsNullOrEmpty(BookName.Text) Then
BookName.Text = Session("BookName").ToString
Else
If String.IsNullOrEmpty(SubjectData.SelectedItem.Text) Then
Session("Subject") = SubjectData.SelectedItem.Text
Else
If String.IsNullOrEmpty(Author.Text) Then
Author.Text = Session("Author").ToString
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
' Groupdata.SelectedItem.Text = Session("Group")
'Now terminate this only today after
'CurrentUser.Text = Session("currentuser").ToString
Dim currentdr As System.DateTime = System.DateTime.Now
Dater.Text = currentdr.Date.ToString("dd/MM/yyyy")
Using con As New SqlConnection(constr)
Using cmd As New SqlCommand("SELECT subkey, Subject FROM Subjects")
cmd.CommandType = CommandType.Text
cmd.Connection = con
con.Open()
SubjectData.DataSource = cmd.ExecuteReader()
SubjectData.DataTextField = "Subject"
SubjectData.DataValueField = "subkey"
SubjectData.DataBind()
con.Close()
End Using
End Using
SubjectData.Items.Insert(0, New ListItem("--Select Subject--", "0"))
Dim country As String = Session("Subject").ToString
SubjectData.SelectedItem.Text = country
Using con As New SqlConnection(constr)
Using cmd As New SqlCommand("SELECT claskey, Class FROM Classesub")
cmd.CommandType = CommandType.Text
cmd.Connection = con
con.Open()
Editionsdata.DataSource = cmd.ExecuteReader()
Editionsdata.DataTextField = "Class"
Editionsdata.DataValueField = "claskey"
Editionsdata.DataBind()
con.Close()
End Using
End Using
Editionsdata.Items.Insert(0, New ListItem("--Select Editions--", "0"))
Dim countryeditions As String = Session("Editions").ToString
Editionsdata.SelectedItem.Text = countryeditions
Using Con As New SqlConnection(constr)
Con.Open()
Using cmd As New SqlCommand
cmd.Connection = Con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "Currentqty3"
cmd.Parameters.Add("@c", SqlDbType.NVarChar).Value = Callno.Text
cmd.Parameters.Add("@t", SqlDbType.NVarChar).Value = EntryCode.Text
cmd.ExecuteReader()
Con.Close()
End Using
End Using
Using Con As New SqlConnection(constr)
Con.Open()
Using Com As New SqlCommand("Select qty from stores", Con)
Using RDR = Com.ExecuteReader()
If RDR.HasRows Then
RDR.Read()
' Accs.Text = RDR.Item("bcode").ToString + 1
Dim kt As Double = RDR.Item("qty").ToString
Currentqty.Text = kt
' Else
' Qtys.Text = "0"
End If
End Using
End Using
Con.Close()
End Using
Using Con As New SqlConnection(constr)
Con.Open()
Using cmd As New SqlCommand
cmd.Connection = Con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "pushlastcode"
' cmd.Parameters.Add("@k", SqlDbType.NVarChar).Value = Callno.Text
' cmd.Parameters.Add("@m", SqlDbType.NVarChar).Value = EntryCode.Text
cmd.ExecuteReader()
Con.Close()
End Using
End Using
Using Con As New SqlConnection(constr)
Con.Open()
Using Com2 As New SqlCommand("truncate table cbcode4", Con)
Com2.ExecuteReader()
End Using
End Using
Using Con As New SqlConnection(constr)
Con.Open()
Using Com2 As New SqlCommand("insert into cbcode4(bcode) select bcode from newcbcode", Con)
Com2.ExecuteReader()
End Using
End Using
Using Con As New SqlConnection(constr)
Con.Open()
Using Com As New SqlCommand("Select bcode from cbcode4", Con)
Using RDR = Com.ExecuteReader()
If RDR.HasRows Then
RDR.Read()
' Accs.Text = RDR.Item("bcode").ToString + 1
Dim kt As Double = RDR.Item("bcode").ToString
Accs.Text = kt + 1
' Else
' Qtys.Text = "0"
BindGrid2000()
' If Not String.IsNullOrEmpty(Code2.Text) Then
'start.Text = Code2.Text
'Else
start.Text = Accs.Text
End If
End Using
End Using
Con.Close()
End Using
' Response.Redirect(Request.RawUrl)
If Not String.IsNullOrEmpty(Code2.Text) Then
start.Text = Code2.Text
Else
start.Text = Accs.Text
' start.ReadOnly = False
End If
BindGrid2000()
Exit Sub
Else
If Session("Hold") = "POSTED" Then
Callno.Text = Session("callno").ToString
BookName.Text = Session("BookName").ToString
Author.Text = Session("Author").ToString
EntryCode.Text = Session("Entrycode").ToString
Publisher.Text = Session("Publisher").ToString
YearPublished0.Text = Session("Year").ToString
Dater.Text = Date.Now.ToString("dd/MM/yyyy")
Notes.Text = Session("Notes").ToString
' Groupdata.SelectedItem.Text = Session("Group")
Minimum0.Text = Session("retain").ToString
ISBN.Text = Session("ISBN").ToString
ISSN.Text = Session("ISsn").ToString
'CurrentUser.Text = Session("currentuser").ToString
Dim currentdr As System.DateTime = System.DateTime.Now
Dater.Text = currentdr.Date.ToString("dd/MM/yyyy")
Using con As New SqlConnection(constr)
Using cmd As New SqlCommand("SELECT subkey, Subject FROM Subjects")
cmd.CommandType = CommandType.Text
cmd.Connection = con
con.Open()
SubjectData.DataSource = cmd.ExecuteReader()
SubjectData.DataTextField = "Subject"
SubjectData.DataValueField = "subkey"
SubjectData.DataBind()
con.Close()
End Using
End Using
SubjectData.Items.Insert(0, New ListItem("--Select Subject--", "0"))
Dim country As String = Session("Subject").ToString
SubjectData.SelectedItem.Text = country
Using con As New SqlConnection(constr)
Using cmd As New SqlCommand("SELECT claskey, Class FROM Classesub")
cmd.CommandType = CommandType.Text
cmd.Connection = con
con.Open()
Editionsdata.DataSource = cmd.ExecuteReader()
Editionsdata.DataTextField = "Class"
Editionsdata.DataValueField = "claskey"
Editionsdata.DataBind()
con.Close()
End Using
End Using
Editionsdata.Items.Insert(0, New ListItem("--Select Editions--", "0"))
Dim countryeditions As String = Session("Editions").ToString
Editionsdata.SelectedItem.Text = countryeditions
Using Con As New SqlConnection(constr)
Con.Open()
Using cmd As New SqlCommand
cmd.Connection = Con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "Currentqty3"
cmd.Parameters.Add("@c", SqlDbType.NVarChar).Value = Callno.Text
cmd.Parameters.Add("@t", SqlDbType.NVarChar).Value = EntryCode.Text
cmd.ExecuteReader()
Con.Close()
End Using
End Using
Using Con As New SqlConnection(constr)
Con.Open()
Using Com As New SqlCommand("Select qty from stores", Con)
Using RDR = Com.ExecuteReader()
If RDR.HasRows Then
RDR.Read()
' Accs.Text = RDR.Item("bcode").ToString + 1
Dim kt As Double = RDR.Item("qty").ToString
Currentqty.Text = kt
' Else
' Qtys.Text = "0"
End If
End Using
End Using
Con.Close()
End Using
Using Con As New SqlConnection(constr)
Con.Open()
Using cmd As New SqlCommand
cmd.Connection = Con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "pushlastcode"
' cmd.Parameters.Add("@k", SqlDbType.NVarChar).Value = Callno.Text
' cmd.Parameters.Add("@m", SqlDbType.NVarChar).Value = EntryCode.Text
cmd.ExecuteReader()
Con.Close()
End Using
End Using
Using Con As New SqlConnection(constr)
Con.Open()
Using Com2 As New SqlCommand("truncate table cbcode4", Con)
Com2.ExecuteReader()
End Using
End Using
Using Con As New SqlConnection(constr)
Con.Open()
Using Com2 As New SqlCommand("insert into cbcode4(bcode) select bcode from newcbcode", Con)
Com2.ExecuteReader()
End Using
End Using
Using Con As New SqlConnection(constr)
Con.Open()
Using Com As New SqlCommand("Select bcode from cbcode4", Con)
Using RDR = Com.ExecuteReader()
If RDR.HasRows Then
RDR.Read()
' Accs.Text = RDR.Item("bcode").ToString + 1
Dim kt As Double = RDR.Item("bcode").ToString
Accs.Text = kt + 1
' Else
' Qtys.Text = "0"
End If
End Using
End Using
Con.Close()
End Using
' Response.Redirect(Request.RawUrl)
If Not Code2.Text = "" Then
start.Text = Code2.Text
Else
start.Text = Accs.Text
' start.ReadOnly = False
End If
BindGrid2000()
Exit Sub
End If
End If
End If
End Sub
Protected Sub currentdata()
Using Con As New SqlConnection(constr)
Con.Open()
Using cmd As New SqlCommand
cmd.Connection = Con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "pushlastcode"
' cmd.Parameters.Add("@k", SqlDbType.NVarChar).Value = Callno.Text
' cmd.Parameters.Add("@m", SqlDbType.NVarChar).Value = EntryCode.Text
cmd.ExecuteReader()
Con.Close()
End Using
End Using
Using Con As New SqlConnection(constr)
Con.Open()
Using Com2 As New SqlCommand("truncate table cbcode4", Con)
Com2.ExecuteReader()
End Using
End Using
Using Con As New SqlConnection(constr)
Con.Open()
Using Com2 As New SqlCommand("insert into cbcode4(bcode) select bcode from newcbcode", Con)
Com2.ExecuteReader()
End Using
End Using
Using Con As New SqlConnection(constr)
Con.Open()
Using Com As New SqlCommand("Select bcode from cbcode4", Con)
Using RDR = Com.ExecuteReader()
If RDR.HasRows Then
RDR.Read()
' Accs.Text = RDR.Item("bcode").ToString + 1
Dim kt As Double = RDR.Item("bcode").ToString
Accs.Text = kt + 1
' Else
' Qtys.Text = "0"
End If
End Using
End Using
Con.Close()
End Using
If Not Code2.Text = "" Then
start.Text = Code2.Text
Else
start.Text = Accs.Text
start.ReadOnly = False
End If
Qty.Text = ""
End Sub
Protected Sub RadioButtonList2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles RadioButtonList2.SelectedIndexChanged
If RadioButtonList2.SelectedItem.Text = "Back To Menu" Then
Response.Redirect("~/Forms/Subcodes.aspx")
Else
If RadioButtonList2.SelectedItem.Text = "Update Data" Then
holdupdaate = "Update Data"
'Session("Notes") = Notes.Text
lblMessage.Text = "Are you Sure You Want to Update Data ?"
ModalPopupExtender1.Show()
Else
If RadioButtonList2.SelectedItem.Text = "Delete Single Book" Then
lblMessage.Text = "Are you Sure You Delete Single Book before Post ?"
ModalPopupExtender1.Show()
Using Con As New SqlConnection(constr)
Con.Open()
Using cmd As New SqlCommand
cmd.Connection = Con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "delsingleentry"
cmd.Parameters.Add("@t", SqlDbType.NVarChar).Value = EntryCode.Text
cmd.ExecuteReader()
Con.Close()
End Using
End Using
ScriptManager.RegisterStartupScript(Me, Me.GetType(), "showalert", "alert('Accession Numbers Deleted Successfully');", True)
Else
If RadioButtonList2.SelectedItem.Text = "Process Accessioning" Then
lblMessage.Text = "Are you Sure You Want to Process Accession Numbers ?"
ModalPopupExtender1.Show()
Else
If RadioButtonList2.SelectedItem.Text = "Post Books" Then
lblMessage.Text = "Are you Sure you want to Post these Books"
ModalPopupExtender1.Show()
Else
If RadioButtonList2.SelectedItem.Text = "View Posted AccNo" Then
lblMessage.Text = "View Posted AccNo"
ModalPopupExtender1.Show()
End If
End If
End If
End If
End If
End If
End Sub
Protected Sub simpledata()
Using Con As New SqlConnection(constr)
Con.Open()
Using Com2 As New SqlCommand("SELECT autofield FROM Rankingclassified2", Con)
Using RDR2 = Com2.ExecuteReader()
If RDR2.HasRows Then
Do While RDR2.Read()
Dim k As String = RDR2.Item("autofield").ToString()
Using Cont As New SqlConnection(constr)
Cont.Open()
Using cmd As New SqlCommand
cmd.Connection = Cont
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "Runclassification2"
cmd.Parameters.Add("@k", SqlDbType.NVarChar).Value = k
cmd.ExecuteReader()
Cont.Close()
End Using
End Using
Loop
End If
Con.Close()
End Using
End Using
End Using
simpledata2()
End Sub
Protected Sub simpledata2()
Using Con As New SqlConnection(constr)
Con.Open()
Using Com2 As New SqlCommand("SELECT autofield FROM Rankingclassified", Con)
Using RDR2 = Com2.ExecuteReader()
If RDR2.HasRows Then
Do While RDR2.Read()
Dim k As String = RDR2.Item("autofield").ToString()
Using Cont As New SqlConnection(constr)
Cont.Open()
Using cmd As New SqlCommand
cmd.Connection = Cont
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "Runclassification"
cmd.Parameters.Add("@k", SqlDbType.NVarChar).Value = k
cmd.ExecuteReader()
Cont.Close()
End Using
End Using
Loop
End If
Con.Close()
End Using
End Using
End Using
End Sub
Private Sub BindGrid2022()
Using con As New SqlConnection(constr)
Using cmd As New SqlCommand()
cmd.CommandText = "SELECT date, Location, BookName, bookcode, qty, category, posttime,users, subjectcode, author, costprice, subcategory, Class, section,Groupcode, autofield, CHECKs, Poststatus, shelve, Donatedby, Types,type2, particulars, scancode, ISBNAISSN, ISSN, Notes, Imprint, Autono,Collation, Main, sub, sub2, Rank, Cds, admno, term, regno, name, cs,stream, Entrytime, changed, automate, automate2, status FROM cateaudit where autono = @autono ORDER BY bookcode"
cmd.Connection = con
cmd.Parameters.AddWithValue("@autono", EntryCode.Text)
Dim dt As New DataTable()
Using sda As New SqlDataAdapter(cmd)
sda.Fill(dt)
If dt.Rows.Count > 0 Then
CateauditGrid0.DataSource = Nothing
CateauditGrid0.DataSource = dt
CateauditGrid0.DataBind()
CateauditGrid0.UseAccessibleHeader = True
CateauditGrid0.FooterRow.TableSection = TableRowSection.TableFooter
CateauditGrid0.HeaderRow.TableSection = TableRowSection.TableHeader
End If
End Using
End Using
End Using
End Sub
Private Sub BindGrid2000()
Using con As New SqlConnection(constr)
Using cmd As New SqlCommand()
' cmd.CommandText = "SELECT date, Location, BookName, bookcode, qty, category, posttime,users, subjectcode, author, costprice, subcategory, Class, section,Groupcode, autofield, CHECKs, Poststatus, shelve, Donatedby, Types,type2, particulars, scancode, ISBNAISSN, ISSN, Notes, Imprint, Autono,Collation, Main, sub, sub2, Rank, Cds, admno, term, regno, name, cs,stream, Entrytime, changed, automate, automate2, status FROM cateaudit where autono = @autono ORDER BY bookcode"
cmd.CommandText = "SELECT Groupcode,date, BookName, bookcode, qty, category,users, author, costprice, Class,types FROM cateaudit where autono = @autono ORDER BY bookcode"
cmd.Connection = con
cmd.Parameters.AddWithValue("@autono", EntryCode.Text)
Dim dt As New DataTable()
Using sda As New SqlDataAdapter(cmd)
sda.Fill(dt)
If dt.Rows.Count > 0 Then
'do stuff
CateauditGrid.DataSource = Nothing
CateauditGrid.DataSource = dt
CateauditGrid.DataBind()
CateauditGrid.UseAccessibleHeader = True
CateauditGrid.FooterRow.TableSection = TableRowSection.TableFooter
CateauditGrid.HeaderRow.TableSection = TableRowSection.TableHeader
Acenos0.Visible = True
Button1.Visible = True
Else
' CateauditGrid.DataSource = Nothing
' CateauditGrid.DataSource = Me.Get_EmptyDataTable()
'
'CateauditGrid.DataBind()
' CateauditGrid.FooterRow.TableSection = TableRowSection.TableFooter
'CateauditGrid.HeaderRow.TableSection = TableRowSection.TableHeader
Acenos0.Visible = True
Button1.Visible = True
Exit Sub
End If
End Using
End Using
End Using
End Sub
'PopulateEmpty data for GridView
Public Function Get_EmptyDataTable() As DataTable
Dim dtEmpty As New DataTable()
'Here ensure that you have added all the column available in your gridview
dtEmpty.Columns.Add("Groupcode", GetType(String))
dtEmpty.Columns.Add("Bookcode", GetType(String))
dtEmpty.Columns.Add("BookName", GetType(String))
dtEmpty.Columns.Add("Author", GetType(String))
dtEmpty.Columns.Add("Category", GetType(String))
dtEmpty.Columns.Add("Date", GetType(String))
dtEmpty.Columns.Add("CostPrice", GetType(String))
dtEmpty.Columns.Add("Qty", GetType(String))
dtEmpty.Columns.Add("Types", GetType(String))
dtEmpty.Columns.Add("Users", GetType(String))
Dim datatRow As DataRow = dtEmpty.NewRow()
'Inserting a new row,datatable .newrow creates a blank row
dtEmpty.Rows.Add(datatRow)
'adding row to the datatable
Return dtEmpty
End Function
Protected Sub SubjectData_SelectedIndexChanged(sender As Object, e As EventArgs) Handles SubjectData.SelectedIndexChanged
Using Con As New SqlConnection(constr)
Con.Open()
Using cmd As New SqlCommand
cmd.Connection = Con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "Changestatus"
cmd.Parameters.Add("@c", SqlDbType.NVarChar).Value = "C"
cmd.Parameters.Add("@CustomerID", SqlDbType.NVarChar).Value = EntryCode.Text
cmd.ExecuteReader()
Con.Close()
End Using
End Using
' Using con As New SqlConnection(constr)
'Using cmd As New SqlCommand("Updatestockkabojja", con)
'cmd.CommandType = CommandType.StoredProcedure
'cmd.Parameters.AddWithValue("@k", Integer.Parse(EntryCode.Text.Trim()))
'cmd.Parameters.AddWithValue("@c", Callno.Text.Trim())
'cmd.Parameters.Add("@b", SqlDbType.NVarChar, 50)
'cmd.Parameters("@b").Direction = ParameterDirection.Output
'con.Open()
'cmd.ExecuteNonQuery()
'con.Close()
' Callno.Text = cmd.Parameters("@b").Value.ToString()
'End Using
' End Using
Using con As New SqlConnection(constr)
Using cmd As New SqlCommand("UpdatestockkabojjaNew", con)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.AddWithValue("@sb", SubjectData.SelectedItem.Text)
cmd.Parameters.AddWithValue("@bk", BookName.Text)
cmd.Parameters.AddWithValue("@u", Author.Text)
cmd.Parameters.Add("@b", SqlDbType.NVarChar, 50)
cmd.Parameters("@b").Direction = ParameterDirection.Output
con.Open()
cmd.ExecuteNonQuery()
con.Close()
Callno.Text = cmd.Parameters("@b").Value.ToString()
End Using
End Using
Using Con As New SqlConnection(constr)
Con.Open()
Using cmd As New SqlCommand
cmd.Connection = Con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "Updatestockkabojja2"
cmd.Parameters.AddWithValue("@c", Callno.Text)
cmd.Parameters.AddWithValue("@sb", SubjectData.SelectedItem.Text)
cmd.Parameters.Add("@CustomerID", SqlDbType.NVarChar).Value = EntryCode.Text
cmd.ExecuteReader()
Con.Close()
End Using
End Using
End Sub
Protected Sub DeleteCustomer(ByVal sender As Object, ByVal e As EventArgs)
Dim lnkRemove As LinkButton = DirectCast(sender, LinkButton)
Using Con As New SqlConnection(constr)
Con.Open()
Using cmd As New SqlCommand
cmd.Connection = Con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "Delsingleentryv2"
cmd.Parameters.Add("@t", SqlDbType.NVarChar).Value = lnkRemove.CommandArgument
cmd.ExecuteReader()
Con.Close()
End Using
End Using
refreshdata()
Response.Redirect(Request.Url.AbsoluteUri)
End Sub
Public Sub refreshdata()
Dim con As New SqlConnection(constr)
'Dim cmd As New SqlCommand("Select class,phrase,sort,maximum,isbn,ISSN FROM stockkabojja WHERE autofield = '" & EntryCode & "'", Cont)
Using Com2 As New SqlCommand("SELECT date, Location, BookName, bookcode, qty, category, posttime,users, subjectcode, author, costprice, subcategory, Class, section,Groupcode, autofield, CHECKs, Poststatus, shelve, Donatedby, Types,type2, particulars, scancode, ISBNAISSN, ISSN, Notes, Imprint, Autono,Collation, Main, sub, sub2, Rank, Cds, admno, term, regno, name, cs,stream, Entrytime, changed, automate, automate2, status FROM cateaudit WHERE autono = '" & EntryCode.Text & "'", con)
'Dim cmd As New SqlCommand("SELECT date, Location, BookName, bookcode, qty, category, posttime,users, subjectcode, author, costprice, subcategory, Class, section,Groupcode, autofield, CHECKs, Poststatus, shelve, Donatedby, Types,type2, particulars, scancode, ISBNAISSN, ISSN, Notes, Imprint, Autono,Collation, Main, sub, sub2, Rank, Cds, admno, term, regno, name, cs,stream, Entrytime, changed, automate, automate2, status FROM cateaudit where autono = @autono ORDER BY bookcode", con)
Dim sda As New SqlDataAdapter(Com2)
Dim dt As New DataTable()
sda.Fill(dt)
If dt.Rows.Count > 0 Then
CateauditGrid.DataSource = Nothing
CateauditGrid.DataSource = dt
CateauditGrid.DataBind()
CateauditGrid.UseAccessibleHeader = True
' CateauditGrid.FooterRow.TableSection = TableRowSection.TableFooter
CateauditGrid.HeaderRow.TableSection = TableRowSection.TableHeader
Else
Acenos0.Visible = True
Button1.Visible = True
Exit Sub
End If
End Using
End Sub
Protected Sub OnYes(ByVal sender As Object, ByVal e As EventArgs)
If RadioButtonList2.SelectedItem.Text = "Update Data" Then
Using Conb As New SqlConnection(constr)
Conb.Open()
Using cmd As New SqlCommand
cmd.Connection = Conb
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "Webstockkabojja"
cmd.Parameters.Add("@CustomerID", SqlDbType.Int).Value = Convert.ToInt32(EntryCode.Text)
cmd.Parameters.Add("@bookName", SqlDbType.VarChar).Value = BookName.Text
cmd.Parameters.Add("@bookcode", SqlDbType.VarChar).Value = Callno.Text
cmd.Parameters.Add("@Author", SqlDbType.VarChar).Value = Author.Text
cmd.Parameters.Add("@subj", SqlDbType.VarChar).Value = SubjectData.SelectedItem.Text
' cmd.Parameters.AddWithValue("@subj", row.Cells(i).Controls.OfType(Of DropDownList)().FirstOrDefault().SelectedItem.Value)
cmd.Parameters.Add("@publi", SqlDbType.VarChar).Value = Publisher.Text
cmd.Parameters.Add("@ypub", SqlDbType.VarChar).Value = YearPublished0.Text
cmd.Parameters.Add("@isb", SqlDbType.VarChar).Value = ISBN.Text
cmd.Parameters.Add("@ed", SqlDbType.VarChar).Value = Editionsdata.SelectedItem.Text
cmd.Parameters.Add("@g", SqlDbType.VarChar).Value = Groupdata.SelectedItem.Text
cmd.Parameters.Add("@r", SqlDbType.VarChar).Value = Minimum0.Text
cmd.Parameters.Add("@note", SqlDbType.VarChar).Value = Notes.Text
cmd.Parameters.Add("@s", SqlDbType.VarChar).Value = Ddlshelves.SelectedItem.Text
cmd.Parameters.Add("@isn", SqlDbType.VarChar).Value = ISSN.Text
cmd.ExecuteReader()
Conb.Close()
End Using
End Using
RadioButtonList2.SelectedIndex = -1
ScriptManager.RegisterStartupScript(Me, Me.GetType(), "showalert", "alert('Book Details Updated to the Database Successfully');", True)
Else
If RadioButtonList2.SelectedItem.Text = "Post Books" Then
Using Con As New SqlConnection(constr)
Con.Open()
Using Com As New SqlCommand("Select * from cateaudit", Con)
Using RDR = Com.ExecuteReader()
If RDR.HasRows Then
RDR.Read()
Using Cont As New SqlConnection(constr)
Cont.Open()
Using cmd As New SqlCommand
cmd.Connection = Cont
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandTimeout = "13600"
cmd.CommandText = "Postbooks"
cmd.ExecuteReader()
Con.Close()
Cont.Close()
End Using
End Using
Session("Hold") = "POSTED"
RadioButtonList2.SelectedIndex = -1
ScriptManager.RegisterStartupScript(Me, Me.[GetType](), "showalert", "alert('ALL BOOKS HAVE BEEN POSTED TO THE STOCK FILE!!.');window.location ='" + Request.Url.AbsoluteUri + "';", True)
currentdata()
refreshdata()
' Response.Redirect(Request.Url.AbsoluteUri)
Exit Sub
Else
RadioButtonList2.SelectedIndex = -1
currentdata()
refreshdata()
Dim time22 As String = "SORRY NO RECORDS TO POST"
ScriptManager.RegisterStartupScript(Me, [GetType](), "showalert", "alert('" & time22 & "');", True)
Exit Sub
End If
End Using
End Using
End Using
Else
'ClientScript.RegisterStartupScript(Me.[GetType](), "alert", "alert('Event Cancealed!')", True)
If RadioButtonList2.SelectedItem.Text = "View Posted AccNo" Then
Session("servername") = "View Posted AccNo"
Session("tfrom") = EntryCode.Text
Response.Redirect(String.Format("~/Displayreport.aspx"))
Else
If RadioButtonList2.SelectedItem.Text = "Process Accessioning" Then
Using Con As New SqlConnection(constr)
Con.Open()
Using cmd As New SqlCommand
cmd.Connection = Con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "pushlastcode"
' cmd.Parameters.Add("@k", SqlDbType.NVarChar).Value = Callno.Text
' cmd.Parameters.Add("@m", SqlDbType.NVarChar).Value = Subjects.Text
cmd.ExecuteReader()
Con.Close()
End Using
End Using
Using Con As New SqlConnection(constr)
Con.Open()
Using cmd As New SqlCommand
cmd.Connection = Con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "pushcodesnew"
cmd.ExecuteReader()
Con.Close()
End Using
End Using
Using Con As New SqlConnection(constr)
Con.Open()
Using Com As New SqlCommand("Select bcode from cbcode4", Con)
Using RDR = Com.ExecuteReader()
If RDR.HasRows Then
RDR.Read()
' Accs.Text = RDR.Item("bcode").ToString + 1
Dim kt As String = RDR.Item("bcode").ToString
Accs.Text = kt + 1
Else
' Using Cong As New SqlConnection(conString)
'Cong.Open()
'Using cmd As New SqlCommand
'cmd.Connection = Cong
'cmd.CommandType = CommandType.StoredProcedure
'cmd.CommandText = "PushMissingcode"
'cmd.Parameters.Add("@m", SqlDbType.NVarChar).Value = Subjects.Text
'cmd.ExecuteReader()
'Cong.Close()
'End Using
'End Using
Using ConY As New SqlConnection(constr)
ConY.Open()
Using ComY As New SqlCommand("Select bcode from cbcode3", ConY)
Using RDRY = ComY.ExecuteReader()
If RDRY.HasRows Then
RDRY.Read()
Accs.Text = RDRY.Item("bcode").ToString
End If
End Using
ConY.Close()
End Using
End Using
End If
Con.Close()
End Using
End Using
End Using
' ConY.Close()
If Not Code2.Text = "" Then
start.Text = Code2.Text
Else
start.Text = Accs.Text
End If
If Qty.Text = "" Then
' Dim time2 As String = "Enter Number of book copies"
' Dim script2 As String = "window.onload = function() { askConfirm('" & time2 & "'); };"
' ClientScript.RegisterStartupScript(Me.GetType(), "askConfirm", script2, True)
ScriptManager.RegisterStartupScript(Me, Me.GetType(), "showalert", "alert('Enter Number of book copies');", True)
Qty.Focus()
End If
Dim B As String
B = IsNumeric(Qty.Text)
If B = False Then
Dim time2 As String = "Strictly Use Numerical Values"
' Dim script2 As String = "window.onload = function() { askConfirm('" & time2 & "'); };"
'ClientScript.RegisterStartupScript(Me.GetType(), "askConfirm", script2, True)
ScriptManager.RegisterStartupScript(Me, [GetType](), "showalert", "alert('" & time2 & "');", True)
Qty.Text = ""
Qty.Focus()
Exit Sub
End If
' Dim response As String
If Callno.Text = "" Or EntryCode.Text = "" Then
' Dim time2 As String = "Please you must enter the call number you are going to breakdown "
' Dim script2 As String = "window.onload = function() { askConfirm('" & time2 & "'); };"
'ClientScript.RegisterStartupScript(Me.GetType(), "askConfirm", script2, True)
ScriptManager.RegisterStartupScript(Me, Me.GetType(), "showalert", "alert('Please you must enter the call number you are going to breakdown');", True)
Callno.Focus()
Using Con As New SqlConnection(constr)
Con.Open()
Using Com2 As New SqlCommand("delete FROM cateaudit WHERE (bookcode IS NULL) AND (NOT (BookName IS NULL))", Con)
Com2.ExecuteReader()
Con.Close()
End Using
End Using
Exit Sub
End If
' Dim time12 As String = "ARE SURE YOU WANT TO AUTOMATICALLY GENERATE ACCESSION NUMBERS?"
' Dim script12 As String = "window.onload = function() { askConfirm('" & time12 & "'); };"
'ClientScript.RegisterStartupScript(Me.GetType(), "askConfirm", script12, True)
' response = script12
'If Qtyprogresss.Text = "" Then
'Qtyprogresss.Text = ""
'Exit Sub
'End If
Using Con As New SqlConnection(constr)
Con.Open()
Using cmd As New SqlCommand
cmd.Connection = Con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "pushlastcode"
' cmd.Parameters.Add("@k", SqlDbType.NVarChar).Value = Callno.Text
' cmd.Parameters.Add("@m", SqlDbType.NVarChar).Value = Subjects.Text
cmd.ExecuteReader()
Con.Close()
End Using
End Using
Using Con As New SqlConnection(constr)
Con.Open()
Using cmd As New SqlCommand
cmd.Connection = Con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "Pushzero"
cmd.Parameters.Add("@c", SqlDbType.NVarChar).Value = Callno.Text
cmd.Parameters.Add("@k", SqlDbType.NVarChar).Value = EntryCode.Text
cmd.ExecuteReader()
Con.Close()
End Using
End Using
Using Con As New SqlConnection(constr)
Con.Open()
Using cmd As New SqlCommand
cmd.Connection = Con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "Prepareautomation2"
cmd.Parameters.Add("@c", SqlDbType.NVarChar).Value = EntryCode.Text
cmd.ExecuteReader()
Con.Close()
End Using
End Using
' Using Con As New SqlConnection(conString)
'Con.Open()
'Using Com As New SqlCommand("Select bcode from cbcode4", Con)
' Using RDR = Com.ExecuteReader()
' If RDR.HasRows Then
'RDR.Read()
' Accs.Text = RDR.Item("bcode").ToString + 1
'Dim kt As Double = RDR.Item("bcode").ToString
'Accs.Text = kt + 1
' Else
' Qtys.Text = "0"
'End If
'End Using
'End Using
' Con.Close()
' End Using
If Not Code2.Text = "" Then
start.Text = Code2.Text
Else
start.Text = Accs.Text
End If
Using Con As New SqlConnection(constr)
Con.Open()
Using cmd As New SqlCommand
cmd.Connection = Con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "pushsample"
cmd.Parameters.Add("@at", SqlDbType.NVarChar).Value = EntryCode.Text
cmd.Parameters.Add("@c", SqlDbType.NVarChar).Value = Callno.Text
cmd.Parameters.Add("@count", SqlDbType.NVarChar).Value = Qty.Text
cmd.Parameters.Add("@t", SqlDbType.DateTime).Value = DateTime.ParseExact(Dater.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture)
cmd.Parameters.Add("@ty", SqlDbType.NVarChar).Value = DdlTypes.SelectedItem.Text
cmd.Parameters.Add("@cp", SqlDbType.NVarChar).Value = CostPrice.Text
cmd.ExecuteReader()
'Dim k As String = DirectCast(form1.FindControl("type"), DropDownList).Text
Con.Close()
End Using
End Using
If CheckBox1.Checked = True Then
If Nt.Text = "" Then
Dim time2 As String = "YOU MUST INDICATE THE PRECEDING NUMBER"
Dim script2 As String = "window.onload = function() { askConfirm('" & time2 & "'); };"
ClientScript.RegisterStartupScript(Me.GetType(), "askConfirm", script2, True)
Nt.Focus()
Exit Sub
End If
Using Con As New SqlConnection(constr)
Con.Open()
Using cmd As New SqlCommand
cmd.Connection = Con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "Processaccessioningzero"
cmd.Parameters.Add("@count", SqlDbType.NVarChar).Value = start.Text
cmd.Parameters.Add("@z", SqlDbType.NVarChar).Value = Nt.Text
cmd.ExecuteReader()
Con.Close()
End Using
End Using
Using Con As New SqlConnection(constr)
Con.Open()
Using cmd As New SqlCommand
cmd.Connection = Con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "specificcode"
cmd.Parameters.Add("@codes", SqlDbType.NVarChar).Value = EntryCode.Text
cmd.ExecuteReader()
Con.Close()
End Using
End Using
Using Con As New SqlConnection(constr)
Con.Open()
Using cmd As New SqlCommand
cmd.Connection = Con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "Deldupsautoacession"
cmd.Parameters.Add("@t", SqlDbType.NVarChar).Value = EntryCode.Text
cmd.ExecuteReader()
Con.Close()
End Using
End Using
Using Con As New SqlConnection(constr)
Con.Open()
Using Com2 As New SqlCommand("update Prepareautomation Set cclass = class,bookname = subject,cauthor=author,csubjectcode=subjectcode,ccategory=category", Con)
Com2.ExecuteReader()
Con.Close()
End Using
End Using
Using Con As New SqlConnection(constr)
Con.Open()
Using cmd As New SqlCommand
cmd.Connection = Con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "runcateaudit"
cmd.Parameters.Add("@c", SqlDbType.NVarChar).Value = Callno.Text
cmd.ExecuteReader()
Con.Close()
End Using
End Using
Using Con As New SqlConnection(constr)
Con.Open()
Using Com As New SqlCommand("Select * from dupsautoaccession2", Con)
Using RDR = Com.ExecuteReader()
If RDR.HasRows Then
RDR.Read()
' Dim time23 As String = "SOME ACCESSION NUMBERS HAVE BEEN DUPLICATED AND THE SYSTEM HAS AUTOMATICALLY DELETED THEM. PLEASE WOULD YOU LIKE TO CHECK THE DELETED NUMBERS?"
'Dim script23 As String = "window.onload = Function() { askConfirm('" & time23 & "'); };"
'ClientScript.RegisterStartupScript(Me.GetType(), "askConfirm", script23, True)
ScriptManager.RegisterStartupScript(Me, Me.GetType(), "showalert", "alert('SOME ACCESSION NUMBERS HAVE BEEN DUPLICATED AND THE SYSTEM HAS AUTOMATICALLY DELETED THEM. PLEASE WOULD YOU LIKE TO CHECK THE DELETED NUMBERS?');", True)
Exit Sub
Else
' Forms!automate2!dupsautoaccession2.Visible = False
CateauditGrid0.Visible = False
' Dim time2 As String = "OPERATION SUCCEEFULL"
' Dim script2 As String = "window.onload = function() { askConfirm('" & time2 & "'); };"
' ClientScript.RegisterStartupScript(Me.GetType(), "askConfirm", script2, True)
RadioButtonList2.SelectedIndex = -1
ScriptManager.RegisterStartupScript(Me, Me.GetType(), "showalert", "alert('Operation Successfull');", True)
currentdata()
' Response.Redirect(Request.Url.AbsoluteUri)
refreshdata()
'Enablalldisplay()
Exit Sub
End If
'Ncopies.Text = RDR.Item("qty").ToString()
'Else
End Using
End Using
Con.Close()
End Using
'Forms!automate2!dupsautoaccession2.Visible = True
CateauditGrid0.Visible = True
Else
Using Con As New SqlConnection(constr)
Con.Open()
Using cmd As New SqlCommand
cmd.Connection = Con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "Processaccessioning"
cmd.Parameters.Add("@count", SqlDbType.NVarChar).Value = start.Text
cmd.ExecuteReader()
Con.Close()
End Using
End Using
Using Con As New SqlConnection(constr)
Con.Open()
Using cmd As New SqlCommand
cmd.Connection = Con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "specificcode"
cmd.Parameters.Add("@codes", SqlDbType.NVarChar).Value = EntryCode.Text
cmd.ExecuteReader()
Con.Close()
End Using
End Using
Using Con As New SqlConnection(constr)
Con.Open()
Using cmd As New SqlCommand
cmd.Connection = Con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "Deldupsautoacession"
cmd.Parameters.Add("@t", SqlDbType.NVarChar).Value = EntryCode.Text
cmd.ExecuteReader()
Con.Close()
End Using
End Using
Using Con As New SqlConnection(constr)
Con.Open()
Using Com2 As New SqlCommand("update Prepareautomation Set cclass = class,bookname = subject,cauthor=author,csubjectcode=subjectcode,ccategory=category", Con)
Com2.ExecuteReader()
Con.Close()
End Using
End Using
Using Con As New SqlConnection(constr)
Con.Open()
Using cmd As New SqlCommand
cmd.Connection = Con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "runcateaudit"
cmd.Parameters.Add("@c", SqlDbType.NVarChar).Value = Callno.Text
cmd.ExecuteReader()
Con.Close()
End Using
End Using
Using Con As New SqlConnection(constr)
Con.Open()
Using Com As New SqlCommand("Select * from dupsautoaccession2", Con)
Using RDR = Com.ExecuteReader()
If RDR.HasRows Then
RDR.Read()
' Dim time23 As String = "SOME ACCESSION NUMBERS HAVE BEEN DUPLICATED AND THE SYSTEM HAS AUTOMATICALLY DELETED THEM. PLEASE WOULD YOU LIKE TO CHECK THE DELETED NUMBERS?"
' Dim script23 As String = "window.onload = Function() { askConfirm('" & time23 & "'); };"
' ClientScript.RegisterStartupScript(Me.GetType(), "askConfirm", script23, True)
ScriptManager.RegisterStartupScript(Me, Me.GetType(), "showalert", "alert('SOME ACCESSION NUMBERS HAVE BEEN DUPLICATED AND THE SYSTEM HAS AUTOMATICALLY DELETED THEM. PLEASE WOULD YOU LIKE TO CHECK THE DELETED NUMBERS?');", True)
BindGrid2022()
Exit Sub
Else
CateauditGrid0.Visible = False
Using Conh As New SqlConnection(constr)
Conh.Open()
Using cmd As New SqlCommand
cmd.Connection = Conh
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "updateuser"
cmd.Parameters.Add("@s", SqlDbType.NVarChar).Value = CurrentUser.Text
cmd.Parameters.Add("@t", SqlDbType.Int).Value = EntryCode.Text
cmd.ExecuteReader()
Conh.Close()
End Using
End Using
RadioButtonList2.SelectedIndex = -1
currentdata()
refreshdata()
ScriptManager.RegisterStartupScript(Me, Me.GetType(), "showalert", "alert('Operation Successfull');", True)
BindGrid2000()
'Enablalldisplay()
Exit Sub
End If
'Ncopies.Text = RDR.Item("qty").ToString()
'Else
' Ncopies.Text = "0"
End Using
End Using
Con.Close()
End Using
Using Con As New SqlConnection(constr)
Con.Open()
Using cmd As New SqlCommand
cmd.Connection = Con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "updateuser"
cmd.Parameters.Add("@s", SqlDbType.NVarChar).Value = CurrentUser.Text
cmd.Parameters.Add("@t", SqlDbType.Int).Value = EntryCode.Text
cmd.ExecuteReader()
Con.Close()
End Using
End Using
RadioButtonList2.SelectedIndex = -1
currentdata()
refreshdata()
ScriptManager.RegisterStartupScript(Me, Me.GetType(), "showalert", "alert('Operation Successfull');", True)
Using Con As New SqlConnection(constr)
Con.Open()
Using cmd As New SqlCommand
cmd.Connection = Con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "Deltickcateaudit"
cmd.ExecuteReader()
Con.Close()
End Using
End Using
End If
Using Con As New SqlConnection(constr)
Con.Open()
Using cmd As New SqlCommand
cmd.Connection = Con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "Dupsdelaudit"
cmd.ExecuteReader()
Con.Close()
End Using
End Using
' simpledata2000()
BindGrid2000()
' Enablalldisplay()
'Qtyprogresss.Text = "Total Number of Copies." & Expected.Rows.Count & ""
End If
End If
End If
End If
End Sub
Public Sub refreshdata2000()
Dim acnosnu As String = DirectCast(CateauditGrid.FooterRow.FindControl("Acenos"), TextBox).Text
Using Con As New SqlConnection(constr)
Con.Open()
Using cmd As New SqlCommand
cmd.Connection = Con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "WebstockkabojjaINSERT"
cmd.Parameters.Add("@bookcode", SqlDbType.NVarChar).Value = acnosnu
cmd.Parameters.Add("@customerid", SqlDbType.NVarChar).Value = EntryCode.Text
cmd.ExecuteReader()
Con.Close()
End Using
End Using
Response.Redirect(Request.Url.AbsoluteUri)
' Response.Redirect(Request.RawUrl)
End Sub
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Acenos0.TextChanged, Button1.Click
simpledatadone2()
If Session("Hold") = "PostedAcno" Then
Acenos0.Text = ""
Exit Sub
Else
simpledatadone2cateaudit()
End If
If Session("Hold") = "PostedAcno" Then
Acenos0.Text = ""
Exit Sub
End If
If Session("Hold") = "Completed" Then
Exit Sub
Else
If String.IsNullOrEmpty(Acenos0.Text) Then
ScriptManager.RegisterStartupScript(Me, Me.GetType(), "showalert", "alert('Enter the Accession Number');", True)
Acenos0.Focus()
Exit Sub
Else
Using Con As New SqlConnection(constr)
Con.Open()
Using cmd As New SqlCommand
cmd.Connection = Con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "WebstockkabojjaINSERT"
cmd.Parameters.Add("@bookcode", SqlDbType.NVarChar).Value = Acenos0.Text
cmd.Parameters.Add("@customerid", SqlDbType.NVarChar).Value = EntryCode.Text
cmd.Parameters.Add("@typ", SqlDbType.NVarChar).Value = DdlTypes.SelectedItem.Text
cmd.Parameters.Add("@u", SqlDbType.NVarChar).Value = CurrentUser.Text
cmd.Parameters.Add("@c", SqlDbType.NVarChar).Value = CostPrice.Text.ToString
cmd.ExecuteReader()
Con.Close()
End Using
End Using
BindGrid2000()
CateauditGrid.UseAccessibleHeader = True
CateauditGrid.FooterRow.TableSection = TableRowSection.TableFooter
CateauditGrid.HeaderRow.TableSection = TableRowSection.TableHeader
'ScriptManager.RegisterStartupScript(Me, Me.GetType(), "showalert", "alert('Accession Number Inserted');", True)
ScriptManager.RegisterStartupScript(Me, Me.[GetType](), "showalert", "alert('Accession Number Inserted');window.location ='" + Request.Url.AbsoluteUri + "';", True)
Session("Hold") = "Loaded"
' Session("Hold") = "Completed"
' Response.Redirect(Request.RawUrl)
Acenos0.Text = ""
Button1.Visible = True
Exit Sub
End If
End If
End Sub
Protected Sub OnNo(ByVal sender As Object, ByVal e As EventArgs)
RadioButtonList2.SelectedIndex = -1
ScriptManager.RegisterStartupScript(Me, Me.GetType(), "showalert", "alert('Operation Cancelled');", True)
End Sub
Protected Sub simpledatadone2()
Dim time2, time3 As String
Dim B As String
B = IsNumeric(Acenos0.Text)
If B = False Then
Dim time23 As String = "Strictly Use Numerical Values"
ScriptManager.RegisterStartupScript(Me, [GetType](), "showalert", "alert('" & time23 & "');", True)
Me.Acenos0.Text = ""
Exit Sub
Else
Using Con As New SqlConnection(constr)
Con.Open()
Using Com2 As New SqlCommand("SELECT bookname, author,category,bookcode,autono FROM categorycodes WHERE bookcode = '" & Acenos0.Text & "'", Con)
Using RDR2 = Com2.ExecuteReader()
If RDR2.HasRows Then
RDR2.Read()
time2 = RDR2.Item("author").ToString()
time3 = RDR2.Item("bookname").ToString()
Author.Text = RDR2.Item("author").ToString()
' BookName.Text = RDR2.Item("bookname").ToString()
' EntryCode.Text = RDR2.Item("autono").ToString()
' Author.Text = time2
' BindGrid()
Dim time23 As String = "Accession Already entered as " & time3 & time2
ScriptManager.RegisterStartupScript(Me, [GetType](), "showalert", "alert('" & time23 & "');", True)
Session("Hold") = "PostedAcno"
Exit Sub
Else
Session("Hold") = ""
End If
Con.Close()
End Using
End Using
End Using
End If
End Sub
Protected Sub OnConfirm(ByVal sender As Object, ByVal e As EventArgs) Handles Button2.Click
Dim confirmValue As String = Request.Form("confirm_value")
If confirmValue = "Yes" Then
' ClientScript.RegisterStartupScript(Me.[GetType](), "alert", "alert('You clicked YES!')", True)
Using Cont As New SqlConnection(constr)
Cont.Open()
Using cmd As New SqlCommand
cmd.Connection = Cont
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandTimeout = "65600"
cmd.CommandText = "Postbooks"
cmd.ExecuteReader()
Cont.Close()
End Using
End Using
Session("Hold") = "POSTED"
ScriptManager.RegisterStartupScript(Me, Me.[GetType](), "showalert", "alert('ALL BOOKS HAVE BEEN POSTED TO THE STOCK FILE!!');window.location ='" + Request.Url.AbsoluteUri + "';", True)
Exit Sub
Else
ScriptManager.RegisterStartupScript(Me, Me.[GetType](), "showalert", "alert('SORRY NO RECORDS TO POST');window.location ='" + Request.Url.AbsoluteUri + "';", True)
Session("Hold") = "POSTED"
Exit Sub
End If
End Sub
Protected Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
End Sub
Protected Sub ImageButton1_Click(sender As Object, e As ImageClickEventArgs) Handles ImageButton1.Click
Response.Redirect("~/FormsV2/Subcodes.aspx")
End Sub
Protected Sub simpledatadone2cateaudit()
Dim time2, time3 As String
Dim B As String
B = IsNumeric(Acenos0.Text)
If B = False Then
Dim time23 As String = "Strictly Use Numerical Values"
ScriptManager.RegisterStartupScript(Me, [GetType](), "showalert", "alert('" & time23 & "');", True)
Me.Acenos0.Text = ""
Exit Sub
Else
Using Con As New SqlConnection(constr)
Con.Open()
Using Com2 As New SqlCommand("SELECT bookname, author,category,bookcode,autono FROM cateaudit WHERE bookcode = '" & Acenos0.Text & "'", Con)
Using RDR2 = Com2.ExecuteReader()
If RDR2.HasRows Then
RDR2.Read()
time2 = RDR2.Item("author").ToString()
time3 = RDR2.Item("bookname").ToString()
Author.Text = RDR2.Item("author").ToString()
' BookName.Text = RDR2.Item("bookname").ToString()
' EntryCode.Text = RDR2.Item("autono").ToString()
' Author.Text = time2
' BindGrid()
Session("Hold") = "PostedAcno"
Dim time23 As String = "Accession Already entered as " & time3 & time2
ScriptManager.RegisterStartupScript(Me, [GetType](), "showalert", "alert('" & time23 & "');", True)
' ScriptManager.RegisterStartupScript(Me, Me.[GetType](), "showalert", "alert('Accesson Number Transfered Succesfully');window.location ='" + Request.Url.AbsoluteUri + "';", True)
Exit Sub
Else
Session("Hold") = ""
End If
Con.Close()
End Using
End Using
End Using
End If
End Sub
End Class
html code
<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site1.Master" CodeBehind="Editsubcodes.aspx.vb" Inherits="SLISWEB2023.Editsubcodes1" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<title> Edit SubCodes Data </title>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<link rel="stylesheet" href="../BootStrap/Css/BootStrap3.3.2.css" />
<script type="text/javascript" src="../BootStrap/Jquery3.4.1.js"></script>
<script type="text/javascript" src="../BootStrap/Bootstrap3.3.2.min.js"></script>
<script type="text/javascript" src="../BootStrap/Jquery.Datatables.1.10.20.js"></script>
<link href="../BootStrap/Css/1.10.20.jquery.dataTables.css" rel="stylesheet" type="text/css" />
<!-- InputMask -->
<script src="../BootStrap/inputmask3.3.4.js"></script>
<script src="../BootStrap/Inputmask3.3.4.date.extension.js"></script>
<script src="../BootStrap/inputmask.extensions.min.js"></script>
<link rel="stylesheet" type="text/css" href="../BootStrap/Css/inputmask.css" />
<script type="text/javascript">
$(function () {
ApplyDataTable();
});
function ApplyDataTable() {
$('[id$=CateauditGrid] tfoot tr').appendTo('[id$=CateauditGrid] thead');
$('[id$=CateauditGrid]').removeAttr('width').DataTable({
bLengthChange: true,
lengthMenu: [[10, 15, -1], [10, 15, "All"]],
bFilter: true,
bSort: true,
scrollCollapse: true,
paging: true,
fixedColumns: false,
orderCellsTop: true
});
};
</script>
<script type = "text/javascript">
function Confirm() {
var confirm_value = document.createElement("INPUT");
confirm_value.type = "hidden";
confirm_value.name = "confirm_value";
if (confirm("ARE SURE YOU WANT TO POST THESE BOOKS NOW?")) {
confirm_value.value = "Yes";
} else {
confirm_value.value = "No";
}
document.forms[0].appendChild(confirm_value);
}
</script>
<script type = "text/javascript">
function askConfirm(msg)
{ alert(msg)
}
</script>
<body>
<div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<table class="auto-style1">
<tr>
<td class="auto-style54">Call No</td>
<td class="auto-style33" colspan="2">
<asp:TextBox ID="Callno" runat="server" Width="95px"></asp:TextBox>
</td>
<td class="auto-style33" colspan="2">
<asp:ImageButton ID="ImageButton1" runat="server" Height="28px" ImageUrl="~/Images/pngegg.png" Width="34px" />
</td>
<td class="auto-style15">
Entry Code</td>
<td class="auto-style70" colspan="2">
<asp:Label ID="EntryCode" runat="server"></asp:Label>
</td>
<td class="auto-style19" colspan="10">Current User</td>
<td class="auto-style15" colspan="12">
<asp:Label ID="CurrentUser" runat="server" Text="CurrentUser"></asp:Label>
</td>
</tr>
<tr>
<td class="auto-style54">Book Name</td>
<td class="auto-style19" colspan="9">
<asp:TextBox ID="BookName" runat="server" Width="581px"></asp:TextBox>
</td>
<td class="auto-style19" colspan="6">Current Qty</td>
<td class="auto-style19" colspan="5"><strong>
<asp:Label ID="Currentqty" runat="server" CssClass="auto-style71"></asp:Label>
</strong></td>
<td class="auto-style19" colspan="9"> </td>
</tr>
<tr>
<td class="auto-style54">Author</td>
<td class="auto-style19" colspan="3">
<asp:TextBox ID="Author" runat="server" Width="204px"></asp:TextBox>
</td>
<td class="auto-style19" colspan="3">Group</td>
<td class="auto-style61" colspan="7">
<asp:DropDownList ID="Groupdata" runat="server" Height="23px" Width="223px">
<asp:ListItem>NONE</asp:ListItem>
<asp:ListItem>Olevel Book</asp:ListItem>
<asp:ListItem>ADVANCED LEVEL</asp:ListItem>
<asp:ListItem>PRIMARY</asp:ListItem>
</asp:DropDownList>
</td>
<td class="auto-style19" colspan="16"> </td>
</tr>
<tr>
<td class="auto-style54">Subject</td>
<td class="auto-style19" colspan="29">
<asp:DropDownList ID="SubjectData" runat="server" Height="26px" Width="584px" AutoPostBack="True">
</asp:DropDownList>
</td>
</tr>
<tr>
<td class="auto-style66">Editions</td>
<td class="auto-style67" colspan="3">
<asp:DropDownList ID="Editionsdata" runat="server" Height="22px" Width="238px">
</asp:DropDownList>
</td>
<td class="auto-style67" colspan="2">Publisher</td>
<td class="auto-style68" colspan="3">
<asp:TextBox ID="Publisher" runat="server" Width="141px"></asp:TextBox>
</td>
<td class="auto-style68" colspan="4"> </td>
<td class="auto-style69" colspan="4">Year Published</td>
<td class="auto-style68" colspan="6">
<asp:TextBox ID="YearPublished0" runat="server" CssClass="auto-style64" Width="119px"></asp:TextBox>
</td>
<td class="auto-style68" colspan="2">
Shelf</td>
<td class="auto-style68" colspan="2">
<asp:DropDownList ID="Ddlshelves" runat="server">
<asp:ListItem>NONE</asp:ListItem>
<asp:ListItem>SHELF TWO</asp:ListItem>
<asp:ListItem>SHELF THREE</asp:ListItem>
<asp:ListItem>SHELF FOUR</asp:ListItem>
<asp:ListItem>SHELF FIVE</asp:ListItem>
<asp:ListItem>SHELF SIX</asp:ListItem>
</asp:DropDownList>
</td>
<td class="auto-style68" colspan="3"></td>
</tr>
<tr>
<td class="auto-style35">
ISBN</td>
<td class="auto-style6" colspan="4">
<asp:TextBox ID="ISBN" runat="server" Width="204px"></asp:TextBox>
</td>
<td class="auto-style25" rowspan="2">Notes</td>
<td colspan="6" rowspan="2">
<asp:TextBox ID="Notes" runat="server" TextMode="MultiLine" Width="217px"></asp:TextBox>
</td>
<td colspan="7"> </td>
<td colspan="4"></td>
</tr>
<tr>
<td class="auto-style36">ISSN</td>
<td class="auto-style37" colspan="4">
<asp:TextBox ID="ISSN" runat="server" Width="204px"></asp:TextBox>
</td>
<td colspan="10">Preceding Zeros:</td>
<td class="auto-style49" colspan="2">
<asp:CheckBox ID="CheckBox1" runat="server" />
</td>
<td colspan="4">
<asp:DropDownList ID="Nt" runat="server" CssClass="auto-style46" Height="23px" Width="56px">
<asp:ListItem>1</asp:ListItem>
<asp:ListItem>2</asp:ListItem>
<asp:ListItem>3</asp:ListItem>
<asp:ListItem>4</asp:ListItem>
<asp:ListItem>5</asp:ListItem>
</asp:DropDownList>
</td>
<td> </td>
<td>
<asp:TextBox ID="Code2" runat="server" Width="23px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style54">Maximum</td>
<td class="auto-style58">
<asp:TextBox ID="Minimum0" runat="server" Width="48px"></asp:TextBox>
</td>
<td class="auto-style60">
<asp:TextBox ID="Accs" runat="server" Visible="False" Width="31px"></asp:TextBox>
</td>
<td class="auto-style19"><strong>Category</strong></td>
<td class="auto-style15" colspan="2">
<asp:DropDownList ID="DdlTypes" runat="server">
<asp:ListItem>BY SCHOOL</asp:ListItem>
<asp:ListItem>DONATED</asp:ListItem>
<asp:ListItem>NOT USED</asp:ListItem>
<asp:ListItem>WISHERS</asp:ListItem>
<asp:ListItem>NONE</asp:ListItem>
</asp:DropDownList>
</td>
<td class="auto-style70" colspan="2">Qty</td>
<td class="auto-style19">
<asp:TextBox ID="Qty" runat="server" Width="49px"></asp:TextBox>
</td>
<td class="auto-style19" colspan="2">Start</td>
<td class="auto-style19" colspan="7">
<asp:TextBox ID="start" runat="server" ReadOnly="true" Width="123px"></asp:TextBox>
</td>
<td class="auto-style50" colspan="2">CostPrice</td>
<td class="auto-style57" colspan="3">
<asp:TextBox ID="CostPrice" runat="server" Width="78px"></asp:TextBox>
</td>
<td class="auto-style55" colspan="3">Date</td>
<td class="auto-style15" colspan="4">
<asp:TextBox ID="Dater" runat="server" Width="96px"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="30"></td>
</tr>
<tr>
<td class="auto-style15" colspan="15">
<asp:RadioButtonList ID="RadioButtonList2" runat="server" AutoPostBack="True" BorderColor="Blue" BorderStyle="Double" RepeatDirection="Horizontal" Width="735px">
<asp:ListItem>None</asp:ListItem>
<asp:ListItem>Back To Menu</asp:ListItem>
<asp:ListItem>Update Data</asp:ListItem>
<asp:ListItem>Process Accessioning</asp:ListItem>
<asp:ListItem>View Posted AccNo</asp:ListItem>
</asp:RadioButtonList>
</td>
<td class="auto-style15" colspan="15">
<asp:Button ID="Button2" runat="server" OnClick="OnConfirm" OnClientClick="Confirm()" Text="Post Books" />
</td>
</tr>
<tr>
<td class="auto-style5" colspan="30">
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<asp:GridView ID="CateauditGrid" runat="server" AutoGenerateColumns="False" Height="129px" ShowFooter="True" ShowHeaderWhenEmpty="True" Width="1201px">
<Columns>
<asp:BoundField DataField="Groupcode" HeaderText="CallNo" />
<asp:TemplateField HeaderText="AccNo.">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Bookcode") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("Bookcode") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="BookName">
<EditItemTemplate>
<asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("BookName") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("BookName") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="author" HeaderText="Author" />
<asp:BoundField DataField="Category" HeaderText="Subject" />
<asp:BoundField DataField="Types" HeaderText="Type" />
<asp:BoundField DataField="CostPrice" HeaderText="CostPrice" />
<asp:BoundField DataField="Date" HeaderText="DateTime" />
<asp:BoundField DataField="Users" HeaderText="User Name" />
<asp:TemplateField HeaderText="Delete">
<ItemTemplate>
<asp:LinkButton ID="lnkRemove" runat="server" CommandArgument='<%# Eval("bookcode")%>' OnClick="DeleteCustomer" OnClientClick="return confirm('Do you want to delete?')" Text="Delete"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Acenos0" EventName="TextChanged" />
</Triggers>
</asp:UpdatePanel>
</td>
</tr>
<tr>
<td class="auto-style5" colspan="2">
<asp:TextBox ID="Acenos0" runat="server" OnTextChanged="Button1_Click"></asp:TextBox>
</td>
<td class="auto-style5" colspan="2">
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Add New" />
</td>
<td class="auto-style5" colspan="26"> </td>
</tr>
<tr>
<td class="auto-style5" colspan="30">
<asp:GridView ID="CateauditGrid0" runat="server" AutoGenerateColumns="False" Height="129px" Width="1201px">
<Columns>
<asp:BoundField DataField="Groupcode" HeaderText="CallNo" />
<asp:BoundField DataField="Bookcode" HeaderText="AccNo." />
<asp:BoundField DataField="BookName" HeaderText="BookName" />
<asp:BoundField DataField="author" HeaderText="Author" />
<asp:BoundField DataField="Category" HeaderText="Subject" />
<asp:BoundField DataField="Types" HeaderText="Type" />
<asp:BoundField DataField="CostPrice" HeaderText="CostPrice" />
<asp:BoundField DataField="Date" HeaderText="DateTime" />
<asp:BoundField DataField="Users" HeaderText="User Name" />
<asp:TemplateField HeaderText="Delete">
<ItemTemplate>
<asp:LinkButton ID="lnkRemove0" runat="server" CommandArgument='<%# Eval("bookcode")%>' OnClick="DeleteCustomer" OnClientClick="return confirm('Do you want to delete?')" Text="Delete"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</td>
</tr>
</table>
<asp:LinkButton ID="lnkDummy" runat="server"></asp:LinkButton>
<cc1:ModalPopupExtender ID="ModalPopupExtender1" BehaviorID="mpe" runat="server"
PopupControlID="pnlPopup" TargetControlID="lnkDummy" BackgroundCssClass="modalBackground"
CancelControlID="btnCancel">
</cc1:ModalPopupExtender>
<asp:Panel ID="pnlPopup" runat="server" CssClass="modalPopup" Style="display: none">
<div class="header">
<asp:Button ID="btnCancel" runat="server" Text="X" Style="float: right;" />
</div>
<div class="body">
<asp:Label ID="lblMessage" runat="server" Text="Do you want to save data?" />
<br />
</div>
<div class="footer" style="text-align: center;">
<asp:Button ID="btnYes" runat="server" Text="Yes" OnClick="OnYes" />
<asp:Button ID="btnNo" runat="server" Text="No" OnClick="OnNo" />
</div>
</asp:Panel>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="btnYes" />
<asp:PostBackTrigger ControlID="btnNo" />
</Triggers>
</asp:UpdatePanel>
</div>
<script type="text/javascript">
//On UpdatePanel Refresh
var prm = Sys.WebForms.PageRequestManager.getInstance();
if (prm != null) {
prm.add_endRequest(function (sender, e) {
if (sender._postBackSettings.panelsToUpdate != null) {
$('[id$=CateauditGrid]').prepend($("<thead></thead>").append($('[id$=CateauditGrid]').find("tr:first"))).DataTable({
"responsive": true
});
}
});
};
</script>
</body>
</html>
</asp:Content>