shivaji-classic-asp personal notes
asp code for user add edit delete
faculty_member_master.asp
<%
job_type=Request.QueryString("job_type")
%>
FACULTY MEMBER
<%tm_back_link("tm_welcome.asp")%>
View all Faculty Members
<%
c_institute_cd=session("c_institute_cd")
sql="select * from master_user_account where c_institute_cd='"&c_institute_cd&"' order by faculty,user_name,name"
set objRs=myconn.execute(sql)
if objrs.eof then
is_eof="yes"
else
is_eof="no"
end if
%>
What you can do in this Page?
Create or Edit or Delete a Faculty Member
What you want to do?
--select--
<%
if job_type="ADDNEW" then%>
ADD NEW FACULTY MEMBER
<%
else
%>
ADD NEW FACULTY MEMBER
<%
end if
%>
<%
if job_type="EDIT" then%>
EDIT A FACULTY MEMBER DATA
<%
else
%>
EDIT A FACULTY MEMBER DATA
<%
end if
%>
<%
if job_type="DELETE" then%>
DELETE A FACULTY MEMBER
<%
else
%>
DELETE A FACULTY MEMBER
<%
end if
%>
<%if job_type="ADDNEW" then%>
To Add New Member,pick data from HRP
<%end if%>
<%if job_type="EDIT" or job_type="DELETE" then%>
Select the Faculty Member
¤t_faculty_member_id='+this.value" class="ctms_mand">
--Select the faculty_account--
<%
if is_eof="no" then
current_faculty_member_id=request.QueryString("current_faculty_member_id")
while not objrs.eof
if current_faculty_member_id=""&(objrs("faculty_member_id")) then
%>
">(<%=objRs("faculty")%>)(<%=objRs("user_name")%>)<%=objrs("name")%>
<%
else
%>
">(<%=objRs("faculty")%>)(<%=objRs("user_name")%>)<%=objrs("name")%>
<%
end if
objrs.movenext
wend
else
%>
--List is Empty--
<%
end if
%>
<%
if current_faculty_member_id <>"" then
sqlFAC1="select * from master_user_account where c_institute_cd='"& session("c_institute_cd") &"' and faculty_member_id="& current_faculty_member_id
set objRsFAC1=myconn.execute(sqlFAC1)
if not objRsFAC1.eof then
employee_name=objRsFAC1("name")
user_name=objRsFAC1("user_name")
c_staff_no=objRsFAC1("c_staff_no")
pass_word=objRsFAC1("pass_word")
faculty=objRsFAC1("faculty")
display_order=objRsFAC1("display_order")
designation=objRsFAC1("designation")
dob=objRsFac1("dob")
faculties_authorised=objRsFAC1("faculties_authorised")
post=objRsFAC1("post")
role=objRsFac1("role")
if isNULL(role) then
role=0
end if
output="records_present"
title=objRsFac1("title")
initials=objRsFac1("initials")
rank=objRsFac1("rank")
'to avoid the error : invalid use of NULL
if isNULL(rank) then
rank=0
end if
objRsFAC1.close
set objRsFAC1=nothing
end if
end if
%>
(faculty)(login)Name
<%end if%>
Data
downloaded from HR Package :
1.HR Staff Number
<%
if session("PICKUP_JOB")="faculty_member" and (request("job_type") <>"EDIT" and request("job_type") <>"DELETE" and request("init") <>"yes") then
c_staff_no=session("hr_c_staff_no")
employee_name=session("hr_employee_name")
designation=session("hr_designation")
dob=session("hr_dob")
end if
session("PICKUP_JOB")="faculty_member"
session("NOMINATION_POSTBACK_FILE")="../tm_module/faculty_member_master.asp?job_type=ADDNEW"
session("is_faculty_member_from_hr")=""
%>
2.Name of the Faculty Member
3.Designation
4.Date of Birth (dd-mm-yyyy)
5. login name
6.Faculty
<%set objRsFAC=myconn.execute("select fac_code from master_faculty where c_institute_cd='"&session("c_institute_cd")&"' order by fac_code")%>
<%
if objRsFAC.eof then%>
--List empty. Please inform Administrator--
<%
else
%>
--Select--
<%
while not objRsFAC.eof
if faculty=objRsFAC("fac_code") then
%>
"><%=objRsFAC("fac_code")%>
<%
else
%>
"><%=objRsFAC("fac_code")%>
<%
end if
objRsFAC.MoveNext
Wend
end if
objRsFac.close
set objRsFac=nothing
%>
7. Password
8. Post [
eg
SDE(SWG) ]
9. Initials(for use in Timetable)
10. Role
--select--
<%
if cstr(role)="1" then
%>
FACULTY MEMBER
FACULTY INCHARGE
NON-TEACHING
<%
elseif cstr(role)="2" then
%>
FACULTY MEMBER
FACULTY INCHARGE
NON-TEACHING
<%
elseif cstr(role)="3" then
%>
FACULTY MEMBER
FACULTY INCHARGE
NON-TEACHING
<%
elseif cstr(role)="4" then
%>
FACULTY MEMBER
FACULTY INCHARGE
NON-TEACHING
<%
else
%>
FACULTY MEMBER
FACULTY INCHARGE
NON-TEACHING
<%
end if
%>
11.Only If this staff is
FACULTY-INCHARGE
for more than one Faculty
, then select the
additional
faculties (Hold down CTRL Key for more than one selection)
<%set objRsFAC=myconn.execute("select fac_code from master_faculty where c_institute_cd='"&session("c_institute_cd")&"' order by fac_code")%>
<%
if objRsFAC.eof then%>
--List empty. Please inform Administrator--
<%
else
%>
--Select--
<%
if faculties_authorised<>"" or len(faculties_authorised)>0 then
is_additional_fac="yes"
fac_array=split(faculties_authorised,",")
end if
while not objRsFAC.eof
skip_flag="no"
if is_additional_fac="yes" then
for f=0 to ubound(fac_array)
if trim(fac_array(f))=objRsFAC("fac_code") then
skip_flag="yes"
%>
"><%=objRsFAC("fac_code")%>
<%
end if
next
end if
if skip_flag="no" then%>
"><%=objRsFAC("fac_code")%>
<%
end if
objRsFAC.MoveNext
Wend
end if
%>
12. Rank
--select--
<%
if cstr(rank)="1" then
%>
1 (CGM and above)
2 (GM and above)
3 (DGM and above)
4 (CAO/DE and above)
5 (AO/SDE and above)
6 (JAO/JTO and above)
7 (Faculty Group C&D)
8 (NonFaculty Group C&D)
<%
elseif cstr(rank)="2" then
%>
1 (CGM and above)
2 (GM and above)
3 (DGM and above)
4 (CAO/DE and above)
5 (AO/SDE and above)
6 (JAO/JTO and above)
7 (Faculty Group C&D)
8 (NonFaculty Group C&D)
<%
elseif cstr(rank)="3" then
%>
1 (CGM and above)
2 (GM and above)
3 (DGM and above)
4 (CAO/DE and above)
5 (AO/SDE and above)
6 (JAO/JTO and above)
7 (Faculty Group C&D)
8 (NonFaculty Group C&D)
<%
elseif cstr(rank)="4" then
%>
1 (CGM and above)
2 (GM and above)
3 (DGM and above)
4 (CAO/DE and above)
5 (AO/SDE and above)
6 (JAO/JTO and above)
7 (Faculty Group C&D)
8 (NonFaculty Group C&D)
<%
elseif cstr(rank)="5" then
%>
1 (CGM and above)
2 (GM and above)
3 (DGM and above)
4 (CAO/DE and above)
5 (AO/SDE and above)
6 (JAO/JTO and above)
7 (Faculty Group C&D)
8 (NonFaculty Group C&D)
<%
elseif cstr(rank)="6" then
%>
1 (CGM and above)
2 (GM and above)
3 (DGM and above)
4 (CAO/DE and above)
5 (AO/SDE and above)
6 (JAO/JTO and above)
7 (Faculty Group C&D)
8 (NonFaculty Group C&D)
<%
elseif cstr(rank)="7" then
%>
1 (CGM and above)
2 (GM and above)
3 (DGM and above)
4 (CAO/DE and above)
5 (AO/SDE and above)
6 (JAO/JTO and above)
7 (Faculty Group C&D)
8 (NonFaculty Group C&D)
<%
elseif cstr(rank)="8" then
%>
1 (CGM and above)
2 (GM and above)
3 (DGM and above)
4 (CAO/DE and above)
5 (AO/SDE and above)
6 (JAO/JTO and above)
7 (Faculty Group C&D)
8 (NonFaculty Group C&D)
<%
else
%>
1 (CGM and above)
2 (GM and above)
3 (DGM and above)
4 (CAO/DE and above)
5 (AO/SDE and above)
6 (JAO/JTO and above)
7 (Faculty Group C&D)
8 (NonFaculty Group C&D)
<%
end if
%>
13. Display order in Telephone directory within the same rank
Enter 0 to hide the name from directory
Click here to view the existing Numbers
<%if current_faculty_member_id <>"" and job_type="EDIT" then%>
<%elseif current_faculty_member_id <>"" and job_type="DELETE" then%>
<%elseif current_faculty_member_id="" and job_type="ADDNEW" then%>
<%end if%>
GoBack
debug:
session(nomination_post_back_file)=<%=session("nomination_postback_file")%>
session(is_nomination_job)=<%=session("is_nomination_job")%>
faculty_member_master1.asp
<%
session("hr_c_staff_no")=""
session("hr_employee_name")=""
session("hr_designation")=""
session("hr_dob")=""
session("is_faculty_member_from_hr")=""
%>
<%
current_faculty_member_id=request.Form("current_faculty_member_id")
job_type=Request.Form("job_type")
'''''''''''''''''''''''''''''''''''''''''''
debug_report="no"
if debug_report="yes" then
dr="VALUES PASSED BY THE PREVIOUS PAGE ARE:"
dr="
*submit="
dr=dr & Request.Form("submit")
dr=dr & "
*user_name="
dr=dr & Request.Form("user_name")
dr=dr & "
*job_type="
dr=dr & Request.Form("job_type")
dr=dr & "
*faculty_member_ID (this value nil for addnew)="
dr=dr & Request.Form("current_faculty_member_id")
dr=dr & "
*name="
dr=dr & Request.Form("name")
dr=dr & "
*c_statt_no="
dr=dr & Request.Form("c_staff_no")
dr=dr & "
*pass_word="
dr=dr & Request.Form("pass_word")
dr=dr & "
*c_institute_cd="
dr=dr & session("c_institute_cd")
dr=dr & "
*role="
dr=dr & Request.Form("role")
dr=dr & "
*Faculty="
dr=dr & Request.Form("faculty")
dr=dr & "
Note :"
dr=dr & " Change the value of Debug to NO to comeout of debug mode"
''''''''''''''''''''''''''''''''''''''''
session("debug_report")=dr
response.redirect("../includes/debug_report.asp")
end if
if request.Form("current_faculty_member_id")="" and (job_type ="EDIT" or job_type="DELETE") then
response.redirect("faculty_member_master.asp?result=Sorry! No work done.Check the data again or inform administrator")
end if
''''''''''''''''''''''''''''''''''''''''''''''''''''''''
submit=Request.Form("submit")
if submit="Save Above Changes" then
set objRs=Server.CreateObject("ADODB.Recordset")
objRs.CursorLocation=3
sql="select * from master_user_account where faculty_member_id='"& request.form("current_faculty_member_id")&"'"
objRs.open sql,myconn,1,3
if not objRs.eof then
objRs("name")=Request.Form("name")
objRs("c_staff_no")=Request.Form("c_staff_no")
objRs("designation")=Request.Form("designation")
objRs("dob")=Request.Form("dob")
objRs("post")=Request.Form("post")
objRs("user_name")=Request.Form("user_name")
objRs("pass_word")=Request.Form("pass_word")
objRs("c_institute_cd")=session("c_institute_cd")
objRs("faculty")=Request.Form("faculty")
if cint(Request("role"))<3 then
objRs("faculties_authorised")=""
elseif Request("faculties_authorised")="" then
objRs("faculties_authorised")=NULL
elseif Request("faculties_authorised")<>"" and cint(Request.Form("role"))=4 then
objRs("faculties_authorised")=Request.Form("faculties_authorised")
end if
objRs("role")=cint(Request.Form("role"))
objRs("title")=Request.Form("title")
objRs("initials")=Request.Form("initials")
objRs("rank")=Request.Form("rank")
objRs("display_order")=Request.Form("display_order")
objRs.update
response.redirect("faculty_member_master.asp?current_faculty_member_id=" & Request.Form("current_faculty_member_id") & "&job_type=EDIT&result=Successfully Updated")
end if
end if
if submit="Add The Above Faculty Member" then
set objRsDup=myconn.execute("select * from master_user_account where c_institute_cd='"&session("c_institute_cd")&"' and user_name='"& request.Form("user_name") & "'")
if not objRsDup.eof then
response.redirect("faculty_member_master.asp?current_faculty_member_id=" & Request.Form("current_faculty_member_id") & "&job_type=EDIT&result=Sorry! user name already exists")
end if
''''CALCULATE NEW RECORD ID
set objRsMAXID=myconn.execute("select max(faculty_member_id) as max_id from master_user_account")
if isNull(objRsMAXID("max_id")) then
new_faculty_member_id=1
else
new_faculty_member_id=cint(objRsMAXID("max_id")) +1
end if
current_faculty_member_id=new_faculty_member_id
'''''''''''''''''''''''''''''''''''''''''''''''
set objRs=Server.CreateObject("ADODB.Recordset")
sql="select * from master_user_account"
objRs.CursorLocation=3
objRs.open sql,myconn,1,3
objRs.AddNew
objRs("faculty_member_id")=new_faculty_member_id
''''''''''''''''''''''''''''''''
objRs("name")=Request.Form("name")
objRs("c_staff_no")=Request.Form("c_staff_no")
objRs("designation")=Request.Form("designation")
objRs("post")=Request.Form("post")
objRs("dob")=Request.Form("dob")
objRs("user_name")=Request.Form("user_name")
objRs("pass_word")=Request.Form("pass_word")
objRs("c_institute_cd")=session("c_institute_cd")
objRs("faculty")=Request.Form("faculty")
if Request.Form("faculties_authorised")<>"" and cint(Request.Form("role"))=4 then
objRs("faculties_authorised")=Request.Form("faculties_authorised")
end if
objRs("role")=cint(Request.Form("role"))
objRs("title")=Request.Form("title")
objRs("initials")=Request.Form("initials")
objRs("rank")=Request.Form("rank")
objRs("display_order")=Request.Form("display_order")
objRs.update
response.redirect("faculty_member_master.asp?current_faculty_member_id=" & new_faculty_member_id & "&job_type=EDIT&result=Successfully Added")
end if
if submit="Delete The Above Faculty Member" then
set objRsDEL=myconn.execute("select * from master_user_account where faculty_member_id='"&request.Form("current_faculty_member_id")&"'")
if not objRsDEL.eof then
response.write("
Are you sure you want to delete the Member :" & objRsDEL("name"))
response.write("
YES
" )
response.write("
NO
")
end if
end if
%>
faculty_member_master2.asp
<%
if request.QueryString("current_faculty_member_id") ="" then
response.redirect("faculty_member_master.asp?result=Failed Deletion.Error at line 5 of faculty_member_master2.asp")
else
set objRSIns=myconn.execute("select user_name from master_user_account where faculty_member_id='"&request.QueryString("current_faculty_member_id")&"'")
if objRsIns.eof then
response.redirect("faculty_member_master.asp?result=Failed Deletion.Error at line 9 of faculty_member_master2.asp")
else
name=objRsIns("user_name")
end if
myconn.execute("delete from master_user_account where faculty_member_id='"& request.QueryString("current_faculty_member_id")&"'")
response.redirect("faculty_member_master.asp?result=Successfully Deleted the Faculty Member :" & name)
end if
%>
Newer Post
Older Post
Home