⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 edit.asp

📁 功能齐全的oa系统
💻 ASP
字号:
<% option explicit%>
<!-- #include virtual="include/MyFunc.asp" -->
<!-- #include virtual="include/DataEnvi.asp" -->
<!-- #include virtual="Include/Page.asp" -->
<!-- #include virtual="include/ShowAttachs.asp" -->
<!-- #include virtual="Include/SelectValue.asp" -->

<%
	Dim ObjDB
	Dim C
	Dim IntID
	Dim ObjRS,rs,sql
	
	IntID = Request.QueryString("ID")
	
	Session("Table_id")=IntID
	Session("TableName")="T_Hrms_Employees_Train_Lesson"
	Set ObjDB = Server.CreateObject("ADODB.Connection")
	OpenDBH ObjDB

	Set C = Server.CreateObject ("CMS2003.DBhandle")
	C.Init(ObjDB)

	If Request.Form.Count > 0 Then
	'----------------------------------------判断开始
 if request("_LesCode")="" then
        call MsgBox("课程代号不能为空!","Back","none")
          response.end  
		  else
		  if Len(request("_LesCode"))>20 then
		   call MsgBox("课程代号超出20个字符了!","Back","none")
          response.end  
		  end if

    
  end if
 
  if request("_LesTime")<>"" then
  if  NOT IsNumeric(request("_LesTime")) then
  
     call MsgBox("时限必须是数字!","Back","none")
    response.end  
	 else
	 if  request("_LesTime")>365 or request("_LesTime")<0 then
	 call MsgBox("时限超出范围,请填写0-365之间的数值!","Back","none")
	 response.end  
	 end if
  end if 
  end if
  
  if request("_LesName")="" then
   call MsgBox("课程名称不能为空!","Back","none")
          response.end  
		  else
		  if Len(request("_LesName"))>20 then
		   call MsgBox("课程名称超出20个字符了!","Back","none")
          response.end  
		  end if
  end if
  
  if request("_FrontDep")<>"" then
   		  if Len(request("_FrontDep"))>20 then
		   call MsgBox("主办单位超出20个字符了!","Back","none")
          response.end  
		  end if
  end if
  if request("_LesObject")<>"" then
   		  if Len(request("_LesObject"))>50 then
		   call MsgBox("培训对象超出50个字符了!","Back","none")
          response.end  
		  end if
  end if
   if request("_LesMode")<>"" then
   		  if Len(request("_LesMode"))>10 then
		   call MsgBox("培训模式超出10个字符了!","Back","none")
          response.end  
		  end if
  end if
'-----------------------------------------------判断结束  
		
Set rs = Server.CreateObject("ADODB.Recordset")
  sql="select *  from T_Hrms_Employees_Train_Lesson Where ID="&IntID
 rs.open sql,ObjDB,3,3
 
 Sql="select Count(*) from T_Hrms_Employees_Train_Lesson where LesCode='" & trim(request("_LesCode"))&"'"
Set ObjRS = ObjDB.Execute(Sql)

   if   trim(rs("LesCode"))<>trim(request("_LesCode")) then
               if ObjRS(0) = 0 Then
                rs("LesCode")=trim(request("_LesCode"))
              else
               call MsgBox("该名称已经存在了!","Back","none")
               response.end  
             end IF
      end if 
 

rs("LesName")=request("_LesName")
rs("TrainType")=request("_TrainType")
rs("FrontDep")=request("_FrontDep")
rs("LesObject")=request("_LesObject")
rs("LesMode")=request("_LesMode")

rs("IsAttestation")=request("_IsAttestation")


if  request("_LesTime")<>"" then
rs("LesTime")=request("_LesTime")
end if

If Request.Form("Attachs")<>"" Then
		rs("Attachs") = Request.Form ("Attachs")
	End If

rs.update

	'添加日志
dim FirstMenu,SecondMenu,Opertion,OTime,OName,OIP,ODesc,OChang
if  isempty(OChang) then
      OChang=""
	  end if
OIP=Request.ServerVariables("REMOTE_ADDR")
OName= Session("AccountName") 

if OName="administrator" then
OName="系统管理员"
end if
call AddLog("员工管理","培训信息","修改",now(),OName ,OIP,"",OChang,ObjDB)

 '添加日志结束

set rs=nothing
ObjDB.Close
Set ObjDB = Nothing
Response.Redirect "list.asp"   
End If
   
	Set ObjRS = C.View("Select * From T_Hrms_Employees_Train_Lesson Where ID = " & IntID)
		
	

	
%>

<Script language=javascript>  
	function EditAttach()
	{
	  	var r =window.showModalDialog("../../Attach/Index.asp?IDs=" + document.forms[0]._Attachs.value + "&BasePath=TrainAttach&R=" + Math.random(),"AttachWin","dialogHeight=240px,dialogWidth=420px,resizable=No,status=1,scrollbars=1");
  	if(r!=null)
  	{
  		ReturnAttachs(r)
  	}
	}

	function ReturnAttachs(v)
	{
  
  	document.forms[0]._Attachs.value = v[1]
	
	}
</Script>

<%'==================================================================%>
<%Sub Main%>
<%'------------------------------------------------------------------%>

	
	<form action="" method="post"  id=form1 name=form1>
	<input type=hidden name=ID value="<%=Request.QueryString("ID")%>">
	
  <table class=Ltable cellspacing=1 cellpadding=3>
    <tr class=LHtr align="middle"> 
      <td width="15%">查看培训课程</td>
      <td width="85%"> </td>
    </tr>
    <tr class=Ltr> 
      <td align="center">培训代号</td>
      <td><input type="text" class=Input Check=0 Show="培训代号" name="_LesCode" value="<%=ObjRS("LesCode")%>"></td>
    </tr>
    <tr class=Ltr> 
      <td align="center">课程名称</td>
      <td><input type="text" class=Input Check=0 Show="课程名称" name="_LesName" value="<%=ObjRS("LesName")%>"></td>
    </tr>
    <tr class=Ltr> 
      <td align="center">培训类型</td>
      <td><select type="text" class=Input Check=0  name="_TrainType"  style="width: 150;" >
	<%=SelectValueSingle(ObjDB,"Select ID,TraName from T_Hrms_Sys_Train",CStr(ObjRS("TrainType")))%>
	</SELECT></td>
    </tr>
    <tr class=Ltr> 
      <td align="center">主办单位</td>
      <td><input type="text" class=Input Check=0 Show="主办单位" name="_FrontDep" value="<%=ObjRS("FrontDep")%>"></td>
    </tr>
    <tr class=Ltr> 
      <td align="center">培训对象</td>
      <td><input type="text" class=Input Check=0 Show="培训对象" name="_LesObject" value="<%=ObjRS("LesObject")%>"></td>
    </tr>
    <tr class=Ltr> 
      <td align="center">培训方式</td>
      <td><input type="text" class=Input Check=0 Show="培训方式" name="_LesMode" value="<%=ObjRS("LesMode")%>"></td>
    </tr>
    <tr class=Ltr> 
      <td align="center">是否认证</td>
      <td><select name="_IsAttestation"  >
	  <%=SelectValueTwo(ObjRS("IsAttestation"))%>
        </select>
     </td>
    </tr>
    <tr class=Ltr> 
      <td align="center">培训时限</td>
      <td><input type="text" class=Input Check=0 Show="培训时限" name="_LesTime" value="<%=ObjRS("LesTime")%>">
        天</td>
    </tr>
    <tr class=Ltr>
      <td align="center">编辑附件</td>
        <td><%=ShowAttachsH(ObjDB,ObjRS("Attachs"))%><input name=_Attachs type=hidden class=Input value="<%=ObjRS("Attachs")%>"><input type=button value="编辑附件" class=button onclick="EditAttach()" id=button3 name=button3>

    </tr>
  </table>
	<table cellspacing=1 cellpadding=3>
	<tr>
		<td>
		<input type="submit"  name="Submit" class=Button value="修改"><input type="button" class=Button value="取 消" onclick="doList()" id=button1 name=button1></td>
		<td></td>
	</tr>
	</table>
	</FORM>
	


<%'------------------------------------------------------------------%>
<%End Sub%>
<%'==================================================================%>

<!-- #include virtual="templet\templet.asp" -->

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -