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

📄 addnew.asp

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

<%  
   Dim ObjDB
   Dim C
  Dim IntID,rs,sql,ObjRS,ObjRSH,StrSQL,ObjDBT
   
   Session("Table_id")=""
   Session("TableName")=""
   
  Set ObjDB= Server.CreateObject("ADODB.Connection")
  OpenDBH ObjDB
  
    Set ObjDBT = Server.CreateObject("ADODB.Connection")
  OpenDB ObjDBT 
  
  StrSQL = "Select Count(*) From T_Hrms_Sys_Train "
 Set ObjRSH = ObjDB.Execute(StrSQL)
  
  IF ObjRSH(0)=0 then 
    call MsgBox("培训为空,请先设置培训类型!","Back","none")
          response.end  
  end if 

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"
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 ObjRS(0) = 0 Then

rs.addnew

rs("LesCode")=trim(request("_LesCode"))
rs("LesName")=request("_LesName")
rs("TrainType")=request("_TrainType")
rs("FrontDep")=request("_FrontDep")
rs("LesObject")=request("_LesObject")
rs("LesMode")=request("_LesMode")
if request("_LesTime")<>""  then
rs("LesTime")=request("_LesTime")
end if

rs("IsAttestation")=request("_IsAttestation")
rs("CreatorID")=AddNewComID(ObjDBT)

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


rs.update

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

if OName="administrator" then
OName="系统管理员"
end if

call AddLog("员工管理","培训信息","新增",now(),OName ,OIP,"","",ObjDB)

'日志结束

rs.close
 ObjDB.Close
  Set ObjDB = Nothing
   ObjDBT.Close
   Set ObjDBT = Nothing
   
  Response.Redirect "List.asp"
  else
       call MsgBox("该名称已经存在了!","Back","none")

    response.end  
  end IF
End If
Sub Main
%>


<script language=javascript>
	var IsHTML = 1
	function setIsHTML(t)
	{
		var f = document.forms[0]
		IsHTML = t
		TBody1.style.display = "none"
		TBody2.style.display = "none"
		
		if(t==0)
		{
			TBody1.style.display = ""
			if(BodyFrame.getText()!="") 
				f.BodyText.value = BodyFrame.getText()
		}
	
		if(t==1)
		{
			TBody2.style.display = ""
			if(f.BodyText.value!="")
				BodyFrame.setHTML(f.BodyText.value)
		}
	}

	function MyCheck(f)
	{
		if(IsHTML==0)
			f.Body.value = f.BodyText.value
		else
			f.Body.value = BodyFrame.getHTML()
		return CheckForm(f)
	}

	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].AttachsShow.value = v[0]
		document.forms[0].Attachs.value = v[1]
	}
</script>

<HTML><HEAD>
  <form action="" method="post" >
  <input type=hidden name=_AccountID value=<%=Session("AccountID")%>>
  <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=""></td>
    </tr>
    <tr class=Ltr> 
      <td align="center">课程名称</td>
      <td><input type="text" class=Input Check=0 Show="课程名称" name="_LesName" value=""></td>
    </tr>
    <tr class=Ltr> 
      <td align="center">培训类型</td>
      <td><select type="text" class=Input Check=0  name="_TrainType"  style="width: 150;" >
	<%=SelectValue(ObjDB,"Select ID,TraName from T_Hrms_Sys_Train")
	%>
	</SELECT></td>
    </tr>
    <tr class=Ltr> 
      <td align="center">主办单位</td>
      <td><input type="text" class=Input Check=0 Show="主办单位" name="_FrontDep" value=""></td>
    </tr>
    <tr class=Ltr> 
      <td align="center">培训对象</td>
      <td><input type="text" class=Input Check=0 Show="培训对象" name="_LesObject" value=""></td>
    </tr>
    <tr class=Ltr> 
      <td align="center">培训方式</td>
      <td><input type="text" class=Input Check=0 Show="培训方式" name="_LesMode" value=""></td>
    </tr>
    <tr class=Ltr> 
      <td align="center">是否认证</td>
      <td>
        <select  class=Input   name="_IsAttestation">
          <option value="0">否</option>
          <option value="1">是</option>
        </select></td>
    </tr>
    <tr class=Ltr>
      <td align="center">培训时限</td>
      <td><input type="text" class=Input check=0 show="培训时限" name="_LesTime" value="">
        天</td>
    </tr>
    <tr class=Ltr> 
      <td align="center">附件</td>
 		<td><input name=AttachsShow class=Input disabled value=""><input name=Attachs type=hidden><input onclick="EditAttach()" type=button class=button value="编辑附件"></td>

    </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 + -