此软件绝对未加入任何病毒代码,完全可以放心使用,希望有更新功能的管理用户,非常感谢! 国华网控工作室_访客测温登记系统 V1.0,该系统主要分为访客信息登记和访客测温登记两个模块。
有感于最近疫情严重,有急事预约进入办公场所的人,需要进行访客登记记录,此时需要手动在记录本上,记录访客人员名称等信息,很是麻烦。
利用半天时间,做了一个简洁版的访客测温登记系统,该系统使用ACCESS2003做为数据库,方便部署,不需网络连接,复制过去解压放到虚拟主机即可运行。
默认登录账号:admin,密码:111页脚信息统计信息和域名备案信息可以定制;发送到邮箱的功能需要生成授权密码;需要的可以与作者联系QQ:3409306881 <%@ CodePage="65001" %>
<%
Response.Buffer = EW_RESPONSE_BUFFER
%>
<!--#include file="ontrial_ewcfg15.asp"-->
<!--#include file="ontrial_Temperature_measurement_registrationinfo.asp"-->
<!--#include file="ontrial_Usersinfo.asp"-->
<!--#include file="ontrial_aspfn15.asp"-->
<!--#include file="ontrial_userfn15.asp"-->
<% Call ew_Header(False, EW_CHARSET, False) %>
<% Server.ScriptTimeout = 28800 %>
<%
' Define page object
Dim Temperature_measurement_registration_add
Set Temperature_measurement_registration_add = New cTemperature_measurement_registration_add
Set Page = Temperature_measurement_registration_add
' Page init processing
Call Temperature_measurement_registration_add.Page_Init
' Page main
Call Temperature_measurement_registration_add.Page_Main
' Global Page Rendering event (in userfn*.asp)
Page_Rendering()
' Page Render event
Temperature_measurement_registration_add.Page_Render()
%>
<!--#include file="ontrial_header.asp"-->
<script type="text/javascript">
// Form object
var CurrentPageID = EW_PAGE_ID = "add";
var CurrentForm = fTemperature_measurement_registrationadd = new ew_Form("fTemperature_measurement_registrationadd", "add");
// Validate form
fTemperature_measurement_registrationadd.Validate = function() {
if (!this.ValidateRequired)
return true; // Ignore validation
var $ = jQuery, fobj = this.GetForm(), $fobj = $(fobj);
if ($fobj.find("#a_confirm").val() == "F")
return true;
var elm, felm, uelm, addcnt = 0;
var $k = $fobj.find("#" this.FormKeyCountName); // Get key_count
var rowcnt = ($k[0]) ? parseInt($k.val(), 10) : 1;
var startcnt = (rowcnt == 0) ? 0 : 1; // Check rowcnt == 0 => Inline-Add
var gridinsert = $fobj.find("#a_list").val() == "gridinsert";
for (var i = startcnt; i <= rowcnt; i ) {
var infix = ($k[0]) ? String(i) : "";
$fobj.data("rowindex", infix);
elm = this.GetElements("x" infix "_Date_of_registration");
if (elm && !ew_IsHidden(elm) && !ew_HasValue(elm))
return this.OnError(elm, "<%= ew_JsEncode2(Replace(Temperature_measurement_registration.Date_of_registration.ReqErrMsg, "%s", Temperature_measurement_registration.Date_of_registration.FldCaption)) %>");
elm = this.GetElements("x" infix "_Date_of_registration");
if (elm && !ew_CheckDateDef(elm.value))
return this.OnError(elm, "<%= ew_JsEncode2(Temperature_measurement_registration.Date_of_registration.FldErrMsg) %>");
elm = this.GetElements("x" infix "_User_fullname");
if (elm && !ew_IsHidden(elm) && !ew_HasValue(elm))
return this.OnError(elm, "<%= ew_JsEncode2(Replace(Temperature_measurement_registration.User_fullname.ReqErrMsg, "%s", Temperature_measurement_registration.User_fullname.FldCaption)) %>");
elm = this.GetElements("x" infix "_Place_of_origin_1");
if (elm && !ew_IsHidden(elm) && !ew_HasValue(elm))
return this.OnError(elm, "<%= ew_JsEncode2(Replace(Temperature_measurement_registration.Place_of_origin_1.ReqErrMsg, "%s", Temperature_measurement_registration.Place_of_origin_1.FldCaption)) %>");
elm = this.GetElements("x" infix "_temperature");
if (elm && !ew_CheckNumber(elm.value))
return this.OnError(elm, "<%= ew_JsEncode2(Temperature_measurement_registration.temperature.FldErrMsg) %>");
elm = this.GetElements("x" infix "_Departure_time");
if (elm && !ew_CheckDateDef(elm.value))
return this.OnError(elm, "<%= ew_JsEncode2(Temperature_measurement_registration.Departure_time.FldErrMsg) %>");
// Fire Form_CustomValidate event
if (!this.Form_CustomValidate(fobj))
return false;
}
// Process detail forms
var dfs = $fobj.find("input[name='detailpage']").get();
for (var i = 0; i < dfs.length; i ) {
var df = dfs[i], val = df.value;
if (val && ewForms[val])
if (!ewForms[val].Validate())
return false;
}
return true;
}
// Form_CustomValidate event
fTemperature_measurement_registrationadd.Form_CustomValidate =
function(fobj) { // DO NOT CHANGE THIS LINE!
// Your custom validation code here, return false if invalid.
return true;
}
// Use JavaScript validation or not
<% If EW_CLIENT_VALIDATE Then %>
fTemperature_measurement_registrationadd.ValidateRequired = true; // Use JavaScript validation
<% Else %>
fTemperature_measurement_registrationadd.ValidateRequired = false; // No JavaScript validation
<% End If %>
// Dynamic selection lists
fTemperature_measurement_registrationadd.Lists["x_User_fullname"] = {"LinkField":"x_User_fullname","Ajax":true,"AutoFill":true,"DisplayFields":["x_User_fullname","","",""],"ParentFields":[],"ChildFields":[],"FilterFields":[],"Options":[],"Template":"","LinkTable":"visitor_maillist"};
fTemperature_measurement_registrationadd.Lists["x_User_fullname"].Data = "<%= Temperature_measurement_registration.User_fullname.LookupFilterQuery(False, "add", Temperature_measurement_registration_add) %>";
fTemperature_measurement_registrationadd.Lists["x_Place_of_origin_1"] = {"LinkField":"x_Place_of_origin_1","Ajax":true,"AutoFill":false,"DisplayFields":["x_Place_of_origin_1","","",""],"ParentFields":[],"ChildFields":[],"FilterFields":[],"Options":[],"Template":"","LinkTable":"Place_of_origin"};
fTemperature_measurement_registrationadd.Lists["x_Place_of_origin_1"].Data = "<%= Temperature_measurement_registration.Place_of_origin_1.LookupFilterQuery(False, "add", Temperature_measurement_registration_add) %>";
<% Set arAS = Nothing %>
// Form object for search
</script>
<script type="text/javascript">
// Write your client script here, no need to add script tags.
</script>
<% Call Temperature_measurement_registration_add.ShowPageHeader %>
<% Call Temperature_measurement_registration_add.ShowMessage %>
<form name="fTemperature_measurement_registrationadd" id="fTemperature_measurement_registrationadd" class="<%= Temperature_measurement_registration_add.FormClassName %>" action="<%= ew_CurrentPage() %>" method="post">
<% If Temperature_measurement_registration_add.CheckToken Then %>
<input type="hidden" name="<%= EW_TOKEN_NAME %>" value="<%= Temperature_measurement_registration_add.Token %>">
<% End If %>
<input type="hidden" name="t" value="Temperature_measurement_registration">
<input type="hidden" name="a_add" id="a_add" value="A">
<input type="hidden" name="modal" value="<%= ew_IIf(Temperature_measurement_registration_add.IsModal, "1", "0") %>">
<div class="ewAddDiv"><!-- page* -->
<% If Temperature_measurement_registration.Date_of_registration.Visible Then ' Date_of_registration %>
<div id="r_Date_of_registration" class="form-group">
<label id="elh_Temperature_measurement_registration_Date_of_registration" for="x_Date_of_registration" class="<%= Temperature_measurement_registration.LeftColumnClass %>"><%= Temperature_measurement_registration.Date_of_registration.FldCaption %><%= Language.Phrase("FieldRequiredIndicator") %></label>
<div class="<%= Temperature_measurement_registration.RightColumnClass %>"><div<%= Temperature_measurement_registration.Date_of_registration.CellAttributes %>>
<span id="el_Temperature_measurement_registration_Date_of_registration">
<input type="text" data-table="Temperature_measurement_registration" data-field="x_Date_of_registration" data-format="1" name="x_Date_of_registration" id="x_Date_of_registration" placeholder="<%= Temperature_measurement_registration.Date_of_registration.PlaceHolder %>" value="<%= Temperature_measurement_registration.Date_of_registration.EditValue %>"<%= Temperature_measurement_registration.Date_of_registration.EditAttributes %>>
<% If Not Temperature_measurement_registration.Date_of_registration.ReadOnly And Not Temperature_measurement_registration.Date_of_registration.Disabled And Not IsEmpty(Temperature_measurement_registration.Date_of_registration.EditAttrs.Exists("readonly")) And Not IsEmpty(Temperature_measurement_registration.Date_of_registration.EditAttrs.Exists("disabled")) Then %>
<script type="text/javascript">
ew_CreateDateTimePicker("fTemperature_measurement_registrationadd", "x_Date_of_registration", {"ignoreReadonly":true,"useCurrent":false,"format":1});
</script>
<% End If %>
</span>
<%= Temperature_measurement_registration.Date_of_registration.CustomMsg %></div></div>
</div>
<% End If %>
<% If Temperature_measurement_registration.User_fullname.Visible Then ' User_fullname %>
<div id="r_User_fullname" class="form-group">
<label id="elh_Temperature_measurement_registration_User_fullname" for="x_User_fullname" class="<%= Temperature_measurement_registration.LeftColumnClass %>"><%= Temperature_measurement_registration.User_fullname.FldCaption %><%= Language.Phrase("FieldRequiredIndicator") %></label>
<div class="<%= Temperature_measurement_registration.RightColumnClass %>"><div<%= Temperature_measurement_registration.User_fullname.CellAttributes %>>
<span id="el_Temperature_measurement_registration_User_fullname">
<% Call Temperature_measurement_registration.User_fullname.EditAttrs.UpdateAttribute("onchange", "ew_AutoFill(this);") %>
<select data-table="Temperature_measurement_registration" data-field="x_User_fullname" data-value-separator="<%= Temperature_measurement_registration.User_fullname.DisplayValueSeparatorAttribute %>" id="x_User_fullname" name="x_User_fullname"<%= Temperature_measurement_registration.User_fullname.EditAttributes %>>
<%= Temperature_measurement_registration.User_fullname.SelectOptionListHtml("x_User_fullname", Temperature_measurement_registration) %>
</select>
<% If AllowAdd(CurrentProjectID & "visitor_maillist") And Not Temperature_measurement_registration.User_fullname.ReadOnly Then %>
<button type="button" title="<%= ew_HtmlTitle(Language.Phrase("AddLink")) & " " & Temperature_measurement_registration.User_fullname.FldCaption %>" onclick="ew_AddOptDialogShow({lnk:this,el:'x_User_fullname',url:'ontrial_visitor_maillistaddopt.asp'});" class="ewAddOptBtn btn btn-default btn-sm" id="aol_x_User_fullname"><span class="glyphicon glyphicon-plus ewIcon"></span><span class="hide"><%= Language.Phrase("AddLink") %> <%= Temperature_measurement_registration.User_fullname.FldCaption %></span></button>
<% End If %>
<input type="hidden" name="ln_x_User_fullname" id="ln_x_User_fullname" value="x_ID_number,x_User_phonenumber">
</span>
<%= Temperature_measurement_registration.User_fullname.CustomMsg %></div></div>
</div>
<% End If %>
<% If Temperature_measurement_registration.ID_number.Visible Then ' ID_number %>
<div id="r_ID_number" class="form-group">
<label id="elh_Temperature_measurement_registration_ID_number" for="x_ID_number" class="<%= Temperature_measurement_registration.LeftColumnClass %>"><%= Temperature_measurement_registration.ID_number.FldCaption %></label>
<div class="<%= Temperature_measurement_registration.RightColumnClass %>"><div<%= Temperature_measurement_registration.ID_number.CellAttributes %>>
<span id="el_Temperature_measurement_registration_ID_number">
<input type="text" data-table="Temperature_measurement_registration" data-field="x_ID_number" name="x_ID_number" id="x_ID_number" size="30" maxlength="50" placeholder="<%= Temperature_measurement_registration.ID_number.PlaceHolder %>" value="<%= Temperature_measurement_registration.ID_number.EditValue %>"<%= Temperature_measurement_registration.ID_number.EditAttributes %>>
</span>
<%= Temperature_measurement_registration.ID_number.CustomMsg %></div></div>
</div>
<% End If %>
<% If Temperature_measurement_registration.User_phonenumber.Visible Then ' User_phonenumber %>
<div id="r_User_phonenumber" class="form-group">
<label id="elh_Temperature_measurement_registration_User_phonenumber" for="x_User_phonenumber" class="<%= Temperature_measurement_registration.LeftColumnClass %>"><%= Temperature_measurement_registration.User_phonenumber.FldCaption %></label>
<div class="<%= Temperature_measurement_registration.RightColumnClass %>"><div<%= Temperature_measurement_registration.User_phonenumber.CellAttributes %>>
<span id="el_Temperature_measurement_registration_User_phonenumber">
<input type="text" data-table="Temperature_measurement_registration" data-field="x_User_phonenumber" name="x_User_phonenumber" id="x_User_phonenumber" size="30" maxlength="50" placeholder="<%= Temperature_measurement_registration.User_phonenumber.PlaceHolder %>" value="<%= Temperature_measurement_registration.User_phonenumber.EditValue %>"<%= Temperature_measurement_registration.User_phonenumber.EditAttributes %>>
</span>
<%= Temperature_measurement_registration.User_phonenumber.CustomMsg %></div></div>
</div>
<% End If %>
<% If Temperature_measurement_registration.Place_of_origin_1.Visible Then ' Place_of_origin %>
<div id="r_Place_of_origin_1" class="form-group">
<label id="elh_Temperature_measurement_registration_Place_of_origin_1" for="x_Place_of_origin_1" class="<%= Temperature_measurement_registration.LeftColumnClass %>"><%= Temperature_measurement_registration.Place_of_origin_1.FldCaption %><%= Language.Phrase("FieldRequiredIndicator") %></label>
<div class="<%= Temperature_measurement_registration.RightColumnClass %>"><div<%= Temperature_measurement_registration.Place_of_origin_1.CellAttributes %>>
<span id="el_Temperature_measurement_registration_Place_of_origin_1">
<select data-table="Temperature_measurement_registration" data-field="x_Place_of_origin_1" data-value-separator="<%= Temperature_measurement_registration.Place_of_origin_1.DisplayValueSeparatorAttribute %>" id="x_Place_of_origin_1" name="x_Place_of_origin_1"<%= Temperature_measurement_registration.Place_of_origin_1.EditAttributes %>>
<%= Temperature_measurement_registration.Place_of_origin_1.SelectOptionListHtml("x_Place_of_origin_1", Temperature_measurement_registration) %>
</select>
</span>
<%= Temperature_measurement_registration.Place_of_origin_1.CustomMsg %></div></div>
</div>
<% End If %>
<% If Temperature_measurement_registration.To_which_department.Visible Then ' To_which_department %>
<div id="r_To_which_department" class="form-group">
<label id="elh_Temperature_measurement_registration_To_which_department" for="x_To_which_department" class="<%= Temperature_measurement_registration.LeftColumnClass %>"><%= Temperature_measurement_registration.To_which_department.FldCaption %></label>
<div class="<%= Temperature_measurement_registration.RightColumnClass %>"><div<%= Temperature_measurement_registration.To_which_department.CellAttributes %>>
<span id="el_Temperature_measurement_registration_To_which_department">
<input type="text" data-table="Temperature_measurement_registration" data-field="x_To_which_department" name="x_To_which_department" id="x_To_which_department" size="30" maxlength="50" placeholder="<%= Temperature_measurement_registration.To_which_department.PlaceHolder %>" value="<%= Temperature_measurement_registration.To_which_department.EditValue %>"<%= Temperature_measurement_registration.To_which_department.EditAttributes %>>
</span>
<%= Temperature_measurement_registration.To_which_department.CustomMsg %></div></div>
</div>
<% End If %>
<% If Temperature_measurement_registration.no_matter_what.Visible Then ' no_matter_what %>
<div id="r_no_matter_what" class="form-group">
<label id="elh_Temperature_measurement_registration_no_matter_what" for="x_no_matter_what" class="<%= Temperature_measurement_registration.LeftColumnClass %>"><%= Temperature_measurement_registration.no_matter_what.FldCaption %></label>
<div class="<%= Temperature_measurement_registration.RightColumnClass %>"><div<%= Temperature_measurement_registration.no_matter_what.CellAttributes %>>
<span id="el_Temperature_measurement_registration_no_matter_what">
<textarea data-table="Temperature_measurement_registration" data-field="x_no_matter_what" name="x_no_matter_what" id="x_no_matter_what" cols="35" rows="5" placeholder="<%= Temperature_measurement_registration.no_matter_what.PlaceHolder %>"<%= Temperature_measurement_registration.no_matter_what.EditAttributes %>><%= Temperature_measurement_registration.no_matter_what.EditValue %></textarea>
</span>
<%= Temperature_measurement_registration.no_matter_what.CustomMsg %></div></div>
</div>
<% End If %>
<% If Temperature_measurement_registration.temperature.Visible Then ' temperature %>
<div id="r_temperature" class="form-group">
<label id="elh_Temperature_measurement_registration_temperature" for="x_temperature" class="<%= Temperature_measurement_registration.LeftColumnClass %>"><%= Temperature_measurement_registration.temperature.FldCaption %></label>
<div class="<%= Temperature_measurement_registration.RightColumnClass %>"><div<%= Temperature_measurement_registration.temperature.CellAttributes %>>
<span id="el_Temperature_measurement_registration_temperature">
<input type="text" data-table="Temperature_measurement_registration" data-field="x_temperature" name="x_temperature" id="x_temperature" size="30" placeholder="<%= Temperature_measurement_registration.temperature.PlaceHolder %>" value="<%= Temperature_measurement_registration.temperature.EditValue %>"<%= Temperature_measurement_registration.temperature.EditAttributes %>>
</span>
<%= Temperature_measurement_registration.temperature.CustomMsg %></div></div>
</div>
<% End If %>
<% If Temperature_measurement_registration.Departure_time.Visible Then ' Departure_time %>
<div id="r_Departure_time" class="form-group">
<label id="elh_Temperature_measurement_registration_Departure_time" for="x_Departure_time" class="<%= Temperature_measurement_registration.LeftColumnClass %>"><%= Temperature_measurement_registration.Departure_time.FldCaption %></label>
<div class="<%= Temperature_measurement_registration.RightColumnClass %>"><div<%= Temperature_measurement_registration.Departure_time.CellAttributes %>>
<span id="el_Temperature_measurement_registration_Departure_time">
<input type="text" data-table="Temperature_measurement_registration" data-field="x_Departure_time" data-format="1" name="x_Departure_time" id="x_Departure_time" placeholder="<%= Temperature_measurement_registration.Departure_time.PlaceHolder %>" value="<%= Temperature_measurement_registration.Departure_time.EditValue %>"<%= Temperature_measurement_registration.Departure_time.EditAttributes %>>
<% If Not Temperature_measurement_registration.Departure_time.ReadOnly And Not Temperature_measurement_registration.Departure_time.Disabled And Not IsEmpty(Temperature_measurement_registration.Departure_time.EditAttrs.Exists("readonly")) And Not IsEmpty(Temperature_measurement_registration.Departure_time.EditAttrs.Exists("disabled")) Then %>
<script type="text/javascript">
ew_CreateDateTimePicker("fTemperature_measurement_registrationadd", "x_Departure_time", {"ignoreReadonly":true,"useCurrent":false,"format":1});
</script>
<% End If %>
</span>
<%= Temperature_measurement_registration.Departure_time.CustomMsg %></div></div>
</div>
<% End If %>
</div><!-- /page* -->
<% If Not Temperature_measurement_registration_add.IsModal Then %>
<div class="form-group"><!-- buttons .form-group -->
<div class="<%= Temperature_measurement_registration.OffsetColumnClass %>"><!-- buttons offset -->
<button class="btn btn-primary ewButton" name="btnAction" id="btnAction" type="submit"><%= Language.Phrase("AddBtn") %></button>
<button class="btn btn-default ewButton" name="btnCancel" id="btnCancel" type="button" data-href="<%= Temperature_measurement_registration.ReturnUrl %>"><%= Language.Phrase("CancelBtn") %></button>
</div><!-- /buttons offset -->
</div><!-- /buttons .form-group -->
<% End If %>
</form>
<script type="text/javascript">
fTemperature_measurement_registrationadd.Init();
</script>
<%
Call Temperature_measurement_registration_add.ShowPageFooter
If EW_DEBUG_ENABLED Then Response.Write ew_DebugMsg()
%>
<script type="text/javascript">
// Write your table-specific startup script here
// document.write("page loaded");
</script>
<!--#include file="ontrial_footer.asp"-->
<%
' Clean up and drop page object
Call Temperature_measurement_registration_add.Page_Terminate("")
Set Temperature_measurement_registration_add = Nothing
%>
<%
'
' Page Class
'
Class cTemperature_measurement_registration_add
' Page ID
Public Property Get PageID
PageID = "add"
End Property
' Project ID
Public Property Get ProjectID
ProjectID = "{55F9B3F4-2B0C-42C0-A285-AA04F54570CB}"
End Property
' Table Name
Public Property Get TableName
TableName = "Temperature_measurement_registration"
End Property
' Page Object Name
Public Property Get PageObjName
PageObjName = "Temperature_measurement_registration_add"
End Property
' Field (S_number)
Public Property Get S_number
Set S_number = Temperature_measurement_registration.S_number
End Property
' Field (Date_of_registration)
Public Property Get Date_of_registration
Set Date_of_registration = Temperature_measurement_registration.Date_of_registration
End Property
' Field (User_fullname)
Public Property Get User_fullname
Set User_fullname = Temperature_measurement_registration.User_fullname
End Property
' Field (ID_number)
Public Property Get ID_number
Set ID_number = Temperature_measurement_registration.ID_number
End Property
' Field (User_phonenumber)
Public Property Get User_phonenumber
Set User_phonenumber = Temperature_measurement_registration.User_phonenumber
End Property
' Field (Place_of_origin)
Public Property Get Place_of_origin_1
Set Place_of_origin_1 = Temperature_measurement_registration.Place_of_origin_1
End Property
' Field (To_which_department)
Public Property Get To_which_department
Set To_which_department = Temperature_measurement_registration.To_which_department
End Property
' Field (no_matter_what)
Public Property Get no_matter_what
Set no_matter_what = Temperature_measurement_registration.no_matter_what
End Property
' Field (temperature)
Public Property Get temperature
Set temperature = Temperature_measurement_registration.temperature
End Property
' Field (Departure_time)
Public Property Get Departure_time
Set Departure_time = Temperature_measurement_registration.Departure_time
End Property
' Field (last_update_time)
Public Property Get last_update_time
Set last_update_time = Temperature_measurement_registration.last_update_time
End Property
' Field (update_users)
Public Property Get update_users
Set update_users = Temperature_measurement_registration.update_users
End Property
' Get field object dictionary (ASP)
Public Property Get Fields
Set Fields = Temperature_measurement_registration.Fields
End Property
' Get field object by name (alias of Fields) (ASP)
Public Function GetField(Name)
Set GetField = Fields.Get(Name)
End Function
' Get field object by parm (ASP)
Public Function GetFieldByParm(Parm)
Dim keys, key
keys = Fields.Keys()
For Each key In keys
If Fields.Get(key).FldParm = Parm Then
Set GetFieldByParm = Fields.Get(key)
Exit Function
End If
Next
Set GetFieldByParm = Nothing
End Function
' Export document (ASP)
Dim ExportDoc
' Page headings
Dim Heading
Dim Subheading
' Page heading
Function PageHeading()
PageHeading = ""
If Heading <> "" Then
PageHeading = Heading
ElseIf ew_NotEmpty(Temperature_measurement_registration) Then
PageHeading = Temperature_measurement_registration.TableCaption
End If
End Function
' Page subheading
Function PageSubheading()
If Subheading <> "" Then
PageSubheading = Subheading
Else
PageSubheading = ""
If TableName <> "" Then
PageSubheading = Language.Phrase(PageID)
End If
End If
End Function
' Page Name
Public Property Get PageName
PageName = ew_CurrentPage()
End Property
' Page Url
Public Property Get PageUrl
PageUrl = ew_CurrentPage() & "?"
If Temperature_measurement_registration.UseTokenInUrl Then PageUrl = PageUrl & "t=" & Temperature_measurement_registration.TableVar & "&" ' add page token
End Property
Dim AuditTrailOnAdd
Dim AuditTrailOnEdit
Dim AuditTrailOnDelete
Dim AuditTrailOnView
Dim AuditTrailOnViewData
Dim AuditTrailOnSearch
' Message
Public Property Get Message
Message = Session(EW_SESSION_MESSAGE)
End Property
Public Property Let Message(v)
Dim msg
msg = Session(EW_SESSION_MESSAGE)
Call ew_AddMessage(msg, v)
Session(EW_SESSION_MESSAGE) = msg
End Property
Public Property Get FailureMessage
FailureMessage = Session(EW_SESSION_FAILURE_MESSAGE)
End Property
Public Property Let FailureMessage(v)
Dim msg
msg = Session(EW_SESSION_FAILURE_MESSAGE)
Call ew_AddMessage(msg, v)
Session(EW_SESSION_FAILURE_MESSAGE) = msg
End Property
Public Property Get SuccessMessage
SuccessMessage = Session(EW_SESSION_SUCCESS_MESSAGE)
End Property
Public Property Let SuccessMessage(v)
Dim msg
msg = Session(EW_SESSION_SUCCESS_MESSAGE)
Call ew_AddMessage(msg, v)
Session(EW_SESSION_SUCCESS_MESSAGE) = msg
End Property
Public Property Get WarningMessage
WarningMessage = Session(EW_SESSION_WARNING_MESSAGE)
End Property
Public Property Let WarningMessage(v)
Dim msg
msg = Session(EW_SESSION_WARNING_MESSAGE)
Call ew_AddMessage(msg, v)
Session(EW_SESSION_WARNING_MESSAGE) = msg
End Property
' Methods to clear message
Public Sub ClearMessage()
Session(EW_SESSION_MESSAGE) = ""
End Sub
Public Sub ClearFailureMessage()
Session(EW_SESSION_FAILURE_MESSAGE) = ""
End Sub
Public Sub ClearSuccessMessage()
Session(EW_SESSION_SUCCESS_MESSAGE) = ""
End Sub
Public Sub ClearWarningMessage()
Session(EW_SESSION_WARNING_MESSAGE) = ""
End Sub
Public Sub ClearMessages()
Session(EW_SESSION_MESSAGE) = ""
Session(EW_SESSION_FAILURE_MESSAGE) = ""
Session(EW_SESSION_SUCCESS_MESSAGE) = ""
Session(EW_SESSION_WARNING_MESSAGE) = ""
End Sub
' Show Message
Public Sub ShowMessage()
Dim hidden, html, sMessage
hidden = False
html = ""
' Message
sMessage = Message
Call Message_Showing(sMessage, "")
If sMessage <> "" Then ' Message in Session, display
If Not hidden Then sMessage = "<button type=""button"" class=""close"" data-dismiss=""alert"">×</button>" & sMessage
html = html & "<div class=""alert alert-info ewInfo"">" & sMessage & "</div>"
Session(EW_SESSION_MESSAGE) = "" ' Clear message in Session
End If
' Warning message
Dim sWarningMessage
sWarningMessage = WarningMessage
Call Message_Showing(sWarningMessage, "warning")
If sWarningMessage <> "" Then ' Message in Session, display
If Not hidden Then sWarningMessage = "<button type=""button"" class=""close"" data-dismiss=""alert"">×</button>" & sWarningMessage
html = html & "<div class=""alert alert-warning ewWarning"">" & sWarningMessage & "</div>"
Session(EW_SESSION_WARNING_MESSAGE) = "" ' Clear message in Session
End If
' Success message
Dim sSuccessMessage
sSuccessMessage = SuccessMessage
Call Message_Showing(sSuccessMessage, "success")
If sSuccessMessage <> "" Then ' Message in Session, display
If Not hidden Then sSuccessMessage = "<button type=""button"" class=""close"" data-dismiss=""alert"">×</button>" & sSuccessMessage
html = html & "<div class=""alert alert-success ewSuccess"">" & sSuccessMessage & "</div>"
Session(EW_SESSION_SUCCESS_MESSAGE) = "" ' Clear message in Session
End If
' Failure message
Dim sErrorMessage
sErrorMessage = FailureMessage
Call Message_Showing(sErrorMessage, "failure")
If sErrorMessage <> "" Then ' Message in Session, display
If Not hidden Then sErrorMessage = "<button type=""button"" class=""close"" data-dismiss=""alert"">×</button>" & sErrorMessage
html = html & "<div class=""alert alert-danger ewError"">" & sErrorMessage & "</div>"
Session(EW_SESSION_FAILURE_MESSAGE) = "" ' Clear message in Session
End If
Response.Write "<div class=""ewMessageDialog""" & ew_IIf(hidden, " style=""display: none;""", "") & ">" & html & "</div>"
End Sub
Dim PageHeader
Dim PageFooter
' Show Page Header
Public Sub ShowPageHeader()
Dim sHeader
sHeader = PageHeader
Call Page_DataRendering(sHeader)
If sHeader <> "" Then ' Header exists, display
Response.Write "<p>" & sHeader & "</p>"
End If
End Sub
' Show Page Footer
Public Sub ShowPageFooter()
Dim sFooter
sFooter = PageFooter
Call Page_DataRendered(sFooter)
If sFooter <> "" Then ' Footer exists, display
Response.Write "<p>" & sFooter & "</p>"
End If
End Sub
'
' Validate Page request
'
Public Function IsPageRequest()
If Temperature_measurement_registration.UseTokenInUrl Then
IsPageRequest = False
If ew_NotEmpty(ObjForm) Then
IsPageRequest = (Temperature_measurement_registration.TableVar = ObjForm.GetValue("t"))
End If
If Request.QueryString("t").Count > 0 Then
IsPageRequest = (Temperature_measurement_registration.TableVar = Request.QueryString("t"))
End If
Else
IsPageRequest = True
End If
End Function
Dim Token
Dim CheckToken
Dim TokenTimeout
' Valid Post
Function ValidPost()
If Not CheckToken Or Not ew_IsPost() Then
ValidPost = True
Exit Function
End If
If Request.Form(EW_TOKEN_NAME).Count = 0 Then
ValidPost = False
Exit Function
End If
ValidPost = ew_CheckToken(Request.Form(EW_TOKEN_NAME),TokenTimeout)
End Function
' Create Token
Sub CreateToken()
If CheckToken And Token = "" Then
Token = ew_CreateToken()
gsToken = Token ' Save to global variable
End If
End Sub
'
' Class initialize
'
Private Sub Class_Initialize()
Session.LCID = 1033 ' Always use US locale id
If IsEmpty(StartTimer) Then StartTimer = Timer ' Init start time
' Check Token
Token = ""
CheckToken = EW_CHECK_TOKEN
TokenTimeout = 0
TokenTimeout = ew_SessionTimeoutTime()
' Initialize language object
If IsEmpty(Language) Then
Set Language = New cLanguage
Call Language.LoadPhrases
End If
' Initialize table object
If IsEmpty(Temperature_measurement_registration) Then Set Temperature_measurement_registration = New cTemperature_measurement_registration
Set Table = Temperature_measurement_registration
' Initialize URLs
' Initialize other table object
If IsEmpty(Users) Then Set Users = New cUsers
' Initialize form object
Set ObjForm = Nothing
' Get resize object
Call ew_GetResizeObj
' Intialize page id (for backward compatibility)
EW_PAGE_ID = "add"
' Initialize table name (for backward compatibility)
EW_TABLE_NAME = "Temperature_measurement_registration"
' Debug message
Call ew_LoadDebugMsg
' Open connection to the database
If IsEmpty(Conn) Then
Set Conn = ew_Connect(Temperature_measurement_registration.TableDBID)
End If
' User table object (Users)
If IsEmpty(UserTable) Then
Set UserTable = New cUsers
Set UserTableConn = ew_GetConn(UserTable.TableDBID)
End If
End Sub
'
' Page_Init
'
Sub Page_Init()
' Is modal
IsModal = (Request.QueryString("modal") = "1" Or Request.Form("modal") = "1")
' User profile
Set UserProfile = New cUserProfile
' Security
Set Security = New cAdvancedSecurity
If Not Security.IsLoggedIn() Then Security.AutoLogin()
' Table Permission loading event
If Security.IsLoggedIn() Then Call Security.TablePermission_Loading
Call Security.LoadCurrentUserLevel(ProjectID & TableName)
' Table Permission loaded event
If Security.IsLoggedIn() Then Call Security.TablePermission_Loaded
If Not Security.CanAdd Then
Call Security.SaveLastUrl
If Security.CanList Then
Call Page_Terminate(ew_GetUrl("ontrial_Temperature_measurement_registrationlist.asp"))
Else
Call Page_Terminate(ew_GetUrl("ontrial_login.asp"))
End If
End If
' Create form object
Set ObjForm = New cFormObj
Temperature_measurement_registration.CurrentAction = ew_IIf(Request.QueryString("a").Count > 0, Request.QueryString("a") & "", ObjForm.GetValue("a_list") & "") ' Set up current action
Call Temperature_measurement_registration.Date_of_registration.SetVisibility(Temperature_measurement_registration)
Call Temperature_measurement_registration.User_fullname.SetVisibility(Temperature_measurement_registration)
Call Temperature_measurement_registration.ID_number.SetVisibility(Temperature_measurement_registration)
Call Temperature_measurement_registration.User_phonenumber.SetVisibility(Temperature_measurement_registration)
Call Temperature_measurement_registration.Place_of_origin_1.SetVisibility(Temperature_measurement_registration)
Call Temperature_measurement_registration.To_which_department.SetVisibility(Temperature_measurement_registration)
Call Temperature_measurement_registration.no_matter_what.SetVisibility(Temperature_measurement_registration)
Call Temperature_measurement_registration.temperature.SetVisibility(Temperature_measurement_registration)
Call Temperature_measurement_registration.Departure_time.SetVisibility(Temperature_measurement_registration)
Call Temperature_measurement_registration.last_update_time.SetVisibility(Temperature_measurement_registration)
Call Temperature_measurement_registration.update_users.SetVisibility(Temperature_measurement_registration)
' Global page loading event (in userfn*.asp)
Call Page_Loading
' Page load event, used in current page
Call Page_Load
' Check token
If Not ValidPost() Then
Response.Write Language.Phrase("InvalidPostRequest")
Call Page_Terminate("")
Response.End
End If
' Process auto fill
Dim results
If Request.Form("ajax") = "autofill" Then
results = Temperature_measurement_registration.GetAutoFill(Request.Form("name"), Request.Form("q"))
If results <> "" Then
' Clean output buffer
If Response.Buffer Then Response.Clear
Response.Write results
Call Page_Terminate("")
Response.End
End If
End If
' Create Token
Call CreateToken
End Sub
'
' Page_Terminate
'
Sub Page_Terminate(url)
If Request.Form("customexport")&"" = "" Then
' Page unload event, used in current page
Call Page_Unload
' Global page unloaded event (in userfn*.asp)
Call Page_Unloaded
End If
' Export
If ew_NotEmpty(Temperature_measurement_registration) Then
If Temperature_measurement_registration.Export <> "" And Request.Form("data").Count > 0 Then
Dim sContent
sContent = Request.Form("data")
gsExportFile = Request.Form("filename")
If gsExportFile = "" Then gsExportFile = Temperature_measurement_registration.TableVar
If Temperature_measurement_registration.Export = "pdf" Then
Call ExportPdf(sContent)
ElseIf Temperature_measurement_registration.Export = "email" Then
Response.Write ExportEmail(sContent)
ElseIf Temperature_measurement_registration.Export = "excel" Then
Call ExportExcel(sContent)
ElseIf Temperature_measurement_registration.Export = "word" Then
Call ExportWord(sContent)
End If
End If
End If
Dim sRedirectUrl
sRedirectUrl = url
Call Page_Redirecting(sRedirectUrl)
Call ew_CloseConn ' Close Connection
Set Security = Nothing
Set ObjForm = Nothing
Set gResizeObj = Nothing
' Go to URL if specified
If gsExport & "" = "" Then
If sRedirectUrl <> "" Then
If Response.Buffer Then Response.Clear
' Handle modal response
If IsModal Then ' Show as modal
Dim row, pageName
Set row = Dictionary()
Call row.Add("url", sRedirectURL)
Call row.Add("modal", "1")
pageName = ew_GetPageName(sRedirectURL)
If pageName <> Temperature_measurement_registration.ListUrl Then ' Not List page
Call row.Add("caption", Temperature_measurement_registration.GetModalCaption(pageName))
If pageName = "ontrial_Temperature_measurement_registrationview.asp" Then
Call row.Add("view", "1")
End If
Else 'List page should not be shown as modal => error
Call row.Add("error", FailureMessage)
Call ClearFailureMessage
End If
Call ResponseJson
Response.Write "[" & row.ToJson() & "]"
Set row = Nothing
Response.End
Else
Call ew_SaveDebugMsg
Response.Redirect sRedirectUrl
End If
End If
End If
Set Temperature_measurement_registration = Nothing
Call ew_CleanUp
End Sub
'
' Page_Terminate (End)
'
Dim FormClassName
Dim IsModal
Dim IsMobileOrModal
Dim DbMasterFilter, DbDetailFilter
Dim StartRec
Dim Priv
Dim OldRecordset
Dim CopyRecord
'
' Page main
'
Sub Page_Main()
IsMobileOrModal = False
If IsModal Then gbSkipHeaderFooter = True
FormClassName = "ewForm ewAddForm form-horizontal"
' Set up current action
If ObjForm.GetValue("a_add")&"" <> "" Then
Temperature_measurement_registration.CurrentAction = ObjForm.GetValue("a_add") ' Get form action
' Not post back
Else
' Load key values from QueryString
CopyRecord = True
If Request.QueryString("S_number").Count > 0 Then
Temperature_measurement_registration.S_number.QueryStringValue = Request.QueryString("S_number")
Call Temperature_measurement_registration.SetKey("S_number", Temperature_measurement_registration.S_number.CurrentValue) ' Set up key
Else
Call Temperature_measurement_registration.SetKey("S_number", "") ' Clear key
CopyRecord = False
End If
If CopyRecord Then
Temperature_measurement_registration.CurrentAction = "C" ' Copy Record
Else
Temperature_measurement_registration.CurrentAction = "I" ' Display Blank Record
End If
End If
Dim loaded
loaded = LoadOldRecord() ' Load old recordset
' Load form values
If ObjForm.GetValue("a_add")&"" <> "" Then
Call LoadFormValues ' Load form values
End If
' Validate form if post back
If ObjForm.GetValue("a_add")&"" <> "" Then
If Not ValidateForm() Then
Temperature_measurement_registration.CurrentAction = "I" ' Form error, reset action
Temperature_measurement_registration.EventCancelled = True ' Event cancelled
Call RestoreFormValues ' Restore form values
FailureMessage = gsFormError
End If
End If
' Perform current action
Select Case Temperature_measurement_registration.CurrentAction
Case "I" ' Blank record
Case "C" ' Copy an existing record
If Not loaded Then ' Record not loaded
If FailureMessage = "" Then FailureMessage = Language.Phrase("NoRecord") ' No record found
Call Page_Terminate("ontrial_Temperature_measurement_registrationlist.asp") ' No matching record, return to list
End If
Case "A" ' Add new record
Temperature_measurement_registration.SendEmail = True ' Send email on add success
If AddRow(OldRecordset) Then ' Add successful
If SuccessMessage = "" Then SuccessMessage = Language.Phrase("AddSuccess") ' Set up success message
Dim sReturnUrl
sReturnUrl = Temperature_measurement_registration.ReturnUrl
If ew_GetPageName(sReturnUrl) = "ontrial_Temperature_measurement_registrationlist.asp" Then
sReturnUrl = Temperature_measurement_registration.AddMasterUrl(sReturnUrl) ' List page, return to List page with correct master key if necessary
ElseIf ew_GetPageName(sReturnUrl) = "ontrial_Temperature_measurement_registrationview.asp" Then
sReturnUrl = Temperature_measurement_registration.ViewUrl("") ' View paging, return to View page with keyurl directly
End If
Call Page_Terminate(sReturnUrl) ' Clean up and return
Else
Temperature_measurement_registration.EventCancelled = True ' Event cancelled
Call RestoreFormValues ' Add failed, restore form values
End If
End Select
' Set up Breadcrumb
Call SetupBreadcrumb
' Render row based on row type
Temperature_measurement_registration.RowType = EW_ROWTYPE_ADD ' Render add type
' Render row
Call Temperature_measurement_registration.ResetAttrs
Call RenderRow
End Sub
'
' Get upload files
'
Sub GetUploadFiles()
' Get upload data
End Sub
'
' Load default values
'
Sub LoadDefaultValues()
Temperature_measurement_registration.S_number.CurrentValue = Null
Temperature_measurement_registration.S_number.OldValue = Temperature_measurement_registration.S_number.CurrentValue
Temperature_measurement_registration.Date_of_registration.CurrentValue = Null
Temperature_measurement_registration.Date_of_registration.OldValue = Temperature_measurement_registration.Date_of_registration.CurrentValue
Temperature_measurement_registration.User_fullname.CurrentValue = Null
Temperature_measurement_registration.User_fullname.OldValue = Temperature_measurement_registration.User_fullname.CurrentValue
Temperature_measurement_registration.ID_number.CurrentValue = Null
Temperature_measurement_registration.ID_number.OldValue = Temperature_measurement_registration.ID_number.CurrentValue
Temperature_measurement_registration.User_phonenumber.CurrentValue = Null
Temperature_measurement_registration.User_phonenumber.OldValue = Temperature_measurement_registration.User_phonenumber.CurrentValue
Temperature_measurement_registration.Place_of_origin_1.CurrentValue = Null
Temperature_measurement_registration.Place_of_origin_1.OldValue = Temperature_measurement_registration.Place_of_origin_1.CurrentValue
Temperature_measurement_registration.To_which_department.CurrentValue = Null
Temperature_measurement_registration.To_which_department.OldValue = Temperature_measurement_registration.To_which_department.CurrentValue
Temperature_measurement_registration.no_matter_what.CurrentValue = Null
Temperature_measurement_registration.no_matter_what.OldValue = Temperature_measurement_registration.no_matter_what.CurrentValue
Temperature_measurement_registration.temperature.CurrentValue = 0
Temperature_measurement_registration.Departure_time.CurrentValue = Null
Temperature_measurement_registration.Departure_time.OldValue = Temperature_measurement_registration.Departure_time.CurrentValue
Temperature_measurement_registration.last_update_time.CurrentValue = Null
Temperature_measurement_registration.last_update_time.OldValue = Temperature_measurement_registration.last_update_time.CurrentValue
Temperature_measurement_registration.update_users.CurrentValue = Null
Temperature_measurement_registration.update_users.OldValue = Temperature_measurement_registration.update_users.CurrentValue
End Sub
'
' Load form values
'
Sub LoadFormValues()
' Load values from form
If Not Temperature_measurement_registration.Date_of_registration.FldIsDetailKey Then Temperature_measurement_registration.Date_of_registration.FormValue = ObjForm.GetValue("x_Date_of_registration")
If Not Temperature_measurement_registration.Date_of_registration.FldIsDetailKey Then Temperature_measurement_registration.Date_of_registration.CurrentValue = ew_UnFormatDateTime(Temperature_measurement_registration.Date_of_registration.CurrentValue, 1)
If Not Temperature_measurement_registration.User_fullname.FldIsDetailKey Then Temperature_measurement_registration.User_fullname.FormValue = ObjForm.GetValue("x_User_fullname")
If Not Temperature_measurement_registration.ID_number.FldIsDetailKey Then Temperature_measurement_registration.ID_number.FormValue = ObjForm.GetValue("x_ID_number")
If Not Temperature_measurement_registration.User_phonenumber.FldIsDetailKey Then Temperature_measurement_registration.User_phonenumber.FormValue = ObjForm.GetValue("x_User_phonenumber")
If Not Temperature_measurement_registration.Place_of_origin_1.FldIsDetailKey Then Temperature_measurement_registration.Place_of_origin_1.FormValue = ObjForm.GetValue("x_Place_of_origin_1")
If Not Temperature_measurement_registration.To_which_department.FldIsDetailKey Then Temperature_measurement_registration.To_which_department.FormValue = ObjForm.GetValue("x_To_which_department")
If Not Temperature_measurement_registration.no_matter_what.FldIsDetailKey Then Temperature_measurement_registration.no_matter_what.FormValue = ObjForm.GetValue("x_no_matter_what")
If Not Temperature_measurement_registration.temperature.FldIsDetailKey Then Temperature_measurement_registration.temperature.FormValue = ObjForm.GetValue("x_temperature")
If Not Temperature_measurement_registration.Departure_time.FldIsDetailKey Then Temperature_measurement_registration.Departure_time.FormValue = ObjForm.GetValue("x_Departure_time")
If Not Temperature_measurement_registration.Departure_time.FldIsDetailKey Then Temperature_measurement_registration.Departure_time.CurrentValue = ew_UnFormatDateTime(Temperature_measurement_registration.Departure_time.CurrentValue, 1)
If Not Temperature_measurement_registration.last_update_time.FldIsDetailKey Then Temperature_measurement_registration.last_update_time.FormValue = ObjForm.GetValue("x_last_update_time")
If Not Temperature_measurement_registration.last_update_time.FldIsDetailKey Then Temperature_measurement_registration.last_update_time.CurrentValue = ew_UnFormatDateTime(Temperature_measurement_registration.last_update_time.CurrentValue, 0)
If Not Temperature_measurement_registration.update_users.FldIsDetailKey Then Temperature_measurement_registration.update_users.FormValue = ObjForm.GetValue("x_update_users")
End Sub
'
' Restore form values
'
Sub RestoreFormValues()
Temperature_measurement_registration.Date_of_registration.CurrentValue = Temperature_measurement_registration.Date_of_registration.FormValue
Temperature_measurement_registration.Date_of_registration.CurrentValue = ew_UnFormatDateTime(Temperature_measurement_registration.Date_of_registration.CurrentValue, 1)
Temperature_measurement_registration.User_fullname.CurrentValue = Temperature_measurement_registration.User_fullname.FormValue
Temperature_measurement_registration.ID_number.CurrentValue = Temperature_measurement_registration.ID_number.FormValue
Temperature_measurement_registration.User_phonenumber.CurrentValue = Temperature_measurement_registration.User_phonenumber.FormValue
Temperature_measurement_registration.Place_of_origin_1.CurrentValue = Temperature_measurement_registration.Place_of_origin_1.FormValue
Temperature_measurement_registration.To_which_department.CurrentValue = Temperature_measurement_registration.To_which_department.FormValue
Temperature_measurement_registration.no_matter_what.CurrentValue = Temperature_measurement_registration.no_matter_what.FormValue
Temperature_measurement_registration.temperature.CurrentValue = Temperature_measurement_registration.temperature.FormValue
Temperature_measurement_registration.Departure_time.CurrentValue = Temperature_measurement_registration.Departure_time.FormValue
Temperature_measurement_registration.Departure_time.CurrentValue = ew_UnFormatDateTime(Temperature_measurement_registration.Departure_time.CurrentValue, 1)
Temperature_measurement_registration.last_update_time.CurrentValue = Temperature_measurement_registration.last_update_time.FormValue
Temperature_measurement_registration.last_update_time.CurrentValue = ew_UnFormatDateTime(Temperature_measurement_registration.last_update_time.CurrentValue, 0)
Temperature_measurement_registration.update_users.CurrentValue = Temperature_measurement_registration.update_users.FormValue
End Sub
'
' Load row based on key values
'
Function LoadRow()
Dim RsRow, sSql, sFilter
sFilter = Temperature_measurement_registration.KeyFilter
' Call Row Selecting event
Call Temperature_measurement_registration.Row_Selecting(sFilter)
' Load SQL based on filter
Temperature_measurement_registration.CurrentFilter = sFilter
sSql = Temperature_measurement_registration.SQL
Call ew_SetDebugMsg("LoadRow: " & sSql) ' Show SQL for debugging
Set RsRow = ew_LoadRowByDbid(sSql, Temperature_measurement_registration.TableDBID)
If RsRow.EOF Then
LoadRow = False
Else
LoadRow = True
RsRow.MoveFirst
Call LoadRowValues(RsRow) ' Load row values
End If
RsRow.Close
Set RsRow = Nothing
End Function
'
' Load row values from recordset
'
Sub LoadRowValues(RsRow)
Dim sDetailFilter
If Not EW_DEBUG_ENABLED Then On Error Resume Next
If IsNull(RsRow) Then
Set RsRow = NewRow()
End If
' Call Row Selected event
Call Temperature_measurement_registration.Row_Selected(RsRow)
If ew_Empty(RsRow) Then Exit Sub
If RsRow.EOF Then Exit Sub
Temperature_measurement_registration.S_number.DbValue = RsRow("S_number")
Temperature_measurement_registration.Date_of_registration.DbValue = RsRow("Date_of_registration")
Temperature_measurement_registration.User_fullname.DbValue = RsRow("User_fullname")
If ew_FieldExistInRs(RsRow, "EV__User_fullname") Then
Temperature_measurement_registration.User_fullname.VirtualValue = RsRow("EV__User_fullname") ' Set up virtual field value
Else
Temperature_measurement_registration.User_fullname.VirtualValue = "" ' Clear value
End If
Temperature_measurement_registration.ID_number.DbValue = RsRow("ID_number")
Temperature_measurement_registration.User_phonenumber.DbValue = RsRow("User_phonenumber")
Temperature_measurement_registration.Place_of_origin_1.DbValue = RsRow("Place_of_origin")
Temperature_measurement_registration.To_which_department.DbValue = RsRow("To_which_department")
Temperature_measurement_registration.no_matter_what.DbValue = RsRow("no_matter_what")
Temperature_measurement_registration.temperature.DbValue = RsRow("temperature")
Temperature_measurement_registration.Departure_time.DbValue = RsRow("Departure_time")
Temperature_measurement_registration.last_update_time.DbValue = RsRow("last_update_time")
Temperature_measurement_registration.update_users.DbValue = RsRow("update_users")
End Sub
' Return a row with default values
Function NewRow
Call LoadDefaultValues
Dim cnn, rs, sSql, sFilter
' Clear any previous errors
Err.Clear
Set cnn = Temperature_measurement_registration.TableConnection
sFilter = Temperature_measurement_registration.CurrentFilter
Temperature_measurement_registration.CurrentFilter = "(0 = 1)"
sSql = Temperature_measurement_registration.SQL
Temperature_measurement_registration.CurrentFilter = sFilter
Set rs = Server.CreateObject("ADODB.Recordset")
rs.CursorLocation = 3 ' adUseClient
Call ew_SetDebugMsg("NewRow: " & sSql) ' Show SQL for debugging
rs.Open sSql, cnn, 3, 4 ' adOpenStatic, adLockBatchOptimistic
' Disconnect the Recordset
Set rs.ActiveConnection = Nothing
' Add new record
rs.AddNew
rs("Date_of_registration") = Temperature_measurement_registration.Date_of_registration.CurrentValue
rs("User_fullname") = Temperature_measurement_registration.User_fullname.CurrentValue
rs("ID_number") = Temperature_measurement_registration.ID_number.CurrentValue
rs("User_phonenumber") = Temperature_measurement_registration.User_phonenumber.CurrentValue
rs("Place_of_origin") = Temperature_measurement_registration.Place_of_origin_1.CurrentValue
rs("To_which_department") = Temperature_measurement_registration.To_which_department.CurrentValue
rs("no_matter_what") = Temperature_measurement_registration.no_matter_what.CurrentValue
rs("temperature") = Temperature_measurement_registration.temperature.CurrentValue
rs("Departure_time") = Temperature_measurement_registration.Departure_time.CurrentValue
rs("last_update_time") = Temperature_measurement_registration.last_update_time.CurrentValue
rs("update_users") = Temperature_measurement_registration.update_users.CurrentValue
' Return the recordset
If Err.Number = 0 Then
Set NewRow = rs
Else
Set NewRow = Nothing
End If
End Function
' Load DbValue from recordset
Sub LoadDbValues(Rs)
If Not EW_DEBUG_ENABLED Then On Error Resume Next
If ew_Empty(Rs) Then Exit Sub
If Rs.EOF Then Exit Sub
Temperature_measurement_registration.S_number.m_DbValue = Rs("S_number")
Temperature_measurement_registration.Date_of_registration.m_DbValue = Rs("Date_of_registration")
Temperature_measurement_registration.User_fullname.m_DbValue = Rs("User_fullname")
Temperature_measurement_registration.ID_number.m_DbValue = Rs("ID_number")
Temperature_measurement_registration.User_phonenumber.m_DbValue = Rs("User_phonenumber")
Temperature_measurement_registration.Place_of_origin_1.m_DbValue = Rs("Place_of_origin")
Temperature_measurement_registration.To_which_department.m_DbValue = Rs("To_which_department")
Temperature_measurement_registration.no_matter_what.m_DbValue = Rs("no_matter_what")
Temperature_measurement_registration.temperature.m_DbValue = Rs("temperature")
Temperature_measurement_registration.Departure_time.m_DbValue = Rs("Departure_time")
Temperature_measurement_registration.last_update_time.m_DbValue = Rs("last_update_time")
Temperature_measurement_registration.update_users.m_DbValue = Rs("update_users")
End Sub
' Load old record
Function LoadOldRecord()
' Load key values from Session
Dim bValidKey
bValidKey = True
If Temperature_measurement_registration.GetKey("S_number")&"" <> "" Then
Temperature_measurement_registration.S_number.CurrentValue = Temperature_measurement_registration.GetKey("S_number") ' S_number
Else
bValidKey = False
End If
' Load old record
OldRecordset = Null
If bValidKey Then
Temperature_measurement_registration.CurrentFilter = Temperature_measurement_registration.KeyFilter
Dim sSql
sSql = Temperature_measurement_registration.SQL
Set OldRecordset = ew_LoadRecordsetByDbid(sSql, Temperature_measurement_registration.TableDBID)
End If
Call LoadRowValues(OldRecordset) ' Load row values
LoadOldRecord = bValidKey
End Function
'
' Render row values based on field settings
'
Sub RenderRow()
' Initialize URLs
' Convert decimal values if posted back
If Temperature_measurement_registration.temperature.FormValue = Temperature_measurement_registration.temperature.CurrentValue And IsNumeric(Temperature_measurement_registration.temperature.CurrentValue) Then
Temperature_measurement_registration.temperature.CurrentValue = ew_StrToFloat(Temperature_measurement_registration.temperature.CurrentValue)
End If
' Call Row Rendering event
Call Temperature_measurement_registration.Row_Rendering
'
' Common render codes for all row types
'
' S_number
' Date_of_registration
' User_fullname
' ID_number
' User_phonenumber
' Place_of_origin
' To_which_department
' no_matter_what
' temperature
' Departure_time
' last_update_time
' update_users
'
' View Row
'
If Temperature_measurement_registration.RowType = EW_ROWTYPE_VIEW Then ' View row
' S_number
Temperature_measurement_registration.S_number.ViewValue = Temperature_measurement_registration.S_number.CurrentValue
Temperature_measurement_registration.S_number.ViewCustomAttributes = ""
' Date_of_registration
Temperature_measurement_registration.Date_of_registration.ViewValue = Temperature_measurement_registration.Date_of_registration.CurrentValue
Temperature_measurement_registration.Date_of_registration.ViewValue = ew_FormatDateTime(Temperature_measurement_registration.Date_of_registration.ViewValue, 1)
Temperature_measurement_registration.Date_of_registration.ViewCustomAttributes = ""
' User_fullname
If Temperature_measurement_registration.User_fullname.VirtualValue <> "" Then
Temperature_measurement_registration.User_fullname.ViewValue = Temperature_measurement_registration.User_fullname.VirtualValue
Else
If Temperature_measurement_registration.User_fullname.CurrentValue & "" <> "" Then
sFilterWrk = "[User_fullname]" & ew_SearchString("=", Temperature_measurement_registration.User_fullname.CurrentValue, EW_DATATYPE_STRING, "")
sSqlWrk = "SELECT [User_fullname], [User_fullname] AS [DispFld], '' AS [Disp2Fld], '' AS [Disp3Fld], '' AS [Disp4Fld] FROM [visitor_maillist]"
sWhereWrk = ""
Call ew_AddFilter(sWhereWrk, sFilterWrk)
Call Temperature_measurement_registration.Lookup_Selecting(Temperature_measurement_registration.User_fullname, sWhereWrk) ' Call Lookup Selecting
If sWhereWrk <> "" Then sSqlWrk = sSqlWrk & " WHERE " & sWhereWrk
sSqlWrk = sSqlWrk & " ORDER BY [User_fullname] DESC"
Call ew_SetDebugMsg("Lookup(DB): " & sSqlWrk) ' Show data for debugging
Set RsWrk = ew_GetConn("DB").Execute(sSqlWrk)
If Not RsWrk.Eof Then
Redim arwrk(4,0)
arwrk(1,0)= RsWrk("DispFld")
Temperature_measurement_registration.User_fullname.ViewValue = Temperature_measurement_registration.User_fullname.DisplayValue(arwrk, 0)
Else
Temperature_measurement_registration.User_fullname.ViewValue = Temperature_measurement_registration.User_fullname.CurrentValue
End If
RsWrk.Close
Set RsWrk = Nothing
Else
Temperature_measurement_registration.User_fullname.ViewValue = Null
End If
End If
Temperature_measurement_registration.User_fullname.ViewCustomAttributes = ""
' ID_number
Temperature_measurement_registration.ID_number.ViewValue = Temperature_measurement_registration.ID_number.CurrentValue
Temperature_measurement_registration.ID_number.ViewCustomAttributes = ""
' User_phonenumber
Temperature_measurement_registration.User_phonenumber.ViewValue = Temperature_measurement_registration.User_phonenumber.CurrentValue
Temperature_measurement_registration.User_phonenumber.ViewCustomAttributes = ""
' Place_of_origin
If Temperature_measurement_registration.Place_of_origin_1.CurrentValue & "" <> "" Then
sFilterWrk = "[Place_of_origin]" & ew_SearchString("=", Temperature_measurement_registration.Place_of_origin_1.CurrentValue, EW_DATATYPE_STRING, "")
sSqlWrk = "SELECT [Place_of_origin], [Place_of_origin] AS [DispFld], '' AS [Disp2Fld], '' AS [Disp3Fld], '' AS [Disp4Fld] FROM [Place_of_origin]"
sWhereWrk = ""
Call ew_AddFilter(sWhereWrk, sFilterWrk)
Call Temperature_measurement_registration.Lookup_Selecting(Temperature_measurement_registration.Place_of_origin_1, sWhereWrk) ' Call Lookup Selecting
If sWhereWrk <> "" Then sSqlWrk = sSqlWrk & " WHERE " & sWhereWrk
sSqlWrk = sSqlWrk & " ORDER BY [Place_of_origin] DESC"
Call ew_SetDebugMsg("Lookup(DB): " & sSqlWrk) ' Show data for debugging
Set RsWrk = ew_GetConn("DB").Execute(sSqlWrk)
If Not RsWrk.Eof Then
Redim arwrk(4,0)
arwrk(1,0)= RsWrk("DispFld")
Temperature_measurement_registration.Place_of_origin_1.ViewValue = Temperature_measurement_registration.Place_of_origin_1.DisplayValue(arwrk, 0)
Else
Temperature_measurement_registration.Place_of_origin_1.ViewValue = Temperature_measurement_registration.Place_of_origin_1.CurrentValue
End If
RsWrk.Close
Set RsWrk = Nothing
Else
Temperature_measurement_registration.Place_of_origin_1.ViewValue = Null
End If
Temperature_measurement_registration.Place_of_origin_1.ViewCustomAttributes = ""
' To_which_department
Temperature_measurement_registration.To_which_department.ViewValue = Temperature_measurement_registration.To_which_department.CurrentValue
Temperature_measurement_registration.To_which_department.ViewCustomAttributes = ""
' no_matter_what
Temperature_measurement_registration.no_matter_what.ViewValue = Temperature_measurement_registration.no_matter_what.CurrentValue
Temperature_measurement_registration.no_matter_what.ViewCustomAttributes = ""
' temperature
Temperature_measurement_registration.temperature.ViewValue = Temperature_measurement_registration.temperature.CurrentValue
Temperature_measurement_registration.temperature.ViewCustomAttributes = ""
' Departure_time
Temperature_measurement_registration.Departure_time.ViewValue = Temperature_measurement_registration.Departure_time.CurrentValue
Temperature_measurement_registration.Departure_time.ViewValue = ew_FormatDateTime(Temperature_measurement_registration.Departure_time.ViewValue, 1)
Temperature_measurement_registration.Departure_time.ViewCustomAttributes = ""
' last_update_time
Temperature_measurement_registration.last_update_time.ViewValue = Temperature_measurement_registration.last_update_time.CurrentValue
Temperature_measurement_registration.last_update_time.ViewValue = ew_FormatDateTime(Temperature_measurement_registration.last_update_time.ViewValue, 0)
Temperature_measurement_registration.last_update_time.ViewCustomAttributes = ""
' update_users
Temperature_measurement_registration.update_users.ViewValue = Temperature_measurement_registration.update_users.CurrentValue
Temperature_measurement_registration.update_users.ViewCustomAttributes = ""
' View refer script
' Date_of_registration
Temperature_measurement_registration.Date_of_registration.LinkCustomAttributes = ""
Temperature_measurement_registration.Date_of_registration.HrefValue = ""
Temperature_measurement_registration.Date_of_registration.TooltipValue = ""
' User_fullname
Temperature_measurement_registration.User_fullname.LinkCustomAttributes = ""
Temperature_measurement_registration.User_fullname.HrefValue = ""
Temperature_measurement_registration.User_fullname.TooltipValue = ""
' ID_number
Temperature_measurement_registration.ID_number.LinkCustomAttributes = ""
Temperature_measurement_registration.ID_number.HrefValue = ""
Temperature_measurement_registration.ID_number.TooltipValue = ""
' User_phonenumber
Temperature_measurement_registration.User_phonenumber.LinkCustomAttributes = ""
Temperature_measurement_registration.User_phonenumber.HrefValue = ""
Temperature_measurement_registration.User_phonenumber.TooltipValue = ""
' Place_of_origin
Temperature_measurement_registration.Place_of_origin_1.LinkCustomAttributes = ""
Temperature_measurement_registration.Place_of_origin_1.HrefValue = ""
Temperature_measurement_registration.Place_of_origin_1.TooltipValue = ""
' To_which_department
Temperature_measurement_registration.To_which_department.LinkCustomAttributes = ""
Temperature_measurement_registration.To_which_department.HrefValue = ""
Temperature_measurement_registration.To_which_department.TooltipValue = ""
' no_matter_what
Temperature_measurement_registration.no_matter_what.LinkCustomAttributes = ""
Temperature_measurement_registration.no_matter_what.HrefValue = ""
Temperature_measurement_registration.no_matter_what.TooltipValue = ""
' temperature
Temperature_measurement_registration.temperature.LinkCustomAttributes = ""
Temperature_measurement_registration.temperature.HrefValue = ""
Temperature_measurement_registration.temperature.TooltipValue = ""
' Departure_time
Temperature_measurement_registration.Departure_time.LinkCustomAttributes = ""
Temperature_measurement_registration.Departure_time.HrefValue = ""
Temperature_measurement_registration.Departure_time.TooltipValue = ""
' last_update_time
Temperature_measurement_registration.last_update_time.LinkCustomAttributes = ""
Temperature_measurement_registration.last_update_time.HrefValue = ""
Temperature_measurement_registration.last_update_time.TooltipValue = ""
' update_users
Temperature_measurement_registration.update_users.LinkCustomAttributes = ""
Temperature_measurement_registration.update_users.HrefValue = ""
Temperature_measurement_registration.update_users.TooltipValue = ""
'
' Add Row
'
ElseIf Temperature_measurement_registration.RowType = EW_ROWTYPE_ADD Then ' Add row
' Date_of_registration
Call Temperature_measurement_registration.Date_of_registration.EditAttrs.UpdateAttribute("class", "form-control")
Temperature_measurement_registration.Date_of_registration.EditCustomAttributes = ""
Temperature_measurement_registration.Date_of_registration.EditValue = ew_HtmlEncode(ew_FormatDateTime(Temperature_measurement_registration.Date_of_registration.CurrentValue, 8))
Temperature_measurement_registration.Date_of_registration.PlaceHolder = ew_HtmlEncode(ew_RemoveHtml(Temperature_measurement_registration.Date_of_registration.FldCaption))
' User_fullname
Call Temperature_measurement_registration.User_fullname.EditAttrs.UpdateAttribute("class", "form-control")
Temperature_measurement_registration.User_fullname.EditCustomAttributes = ""
If Temperature_measurement_registration.User_fullname.CurrentValue & "" = "" Then
sFilterWrk = "0=1"
Else
sFilterWrk = "[User_fullname]" & ew_SearchString("=", Temperature_measurement_registration.User_fullname.CurrentValue, EW_DATATYPE_STRING, "")
End If
sSqlWrk = "SELECT [User_fullname], [User_fullname] AS [DispFld], '' AS [Disp2Fld], '' AS [Disp3Fld], '' AS [Disp4Fld], '' AS [SelectFilterFld], '' AS [SelectFilterFld2], '' AS [SelectFilterFld3], '' AS [SelectFilterFld4] FROM [visitor_maillist]"
sWhereWrk = ""
Call ew_AddFilter(sWhereWrk, sFilterWrk)
Call Temperature_measurement_registration.Lookup_Selecting(Temperature_measurement_registration.User_fullname, sWhereWrk) ' Call Lookup Selecting
If sWhereWrk <> "" Then sSqlWrk = sSqlWrk & " WHERE " & sWhereWrk
sSqlWrk = sSqlWrk & " ORDER BY [User_fullname] DESC"
Set RsWrk = Server.CreateObject("ADODB.Recordset")
Call ew_SetDebugMsg("Lookup(DB): " & sSqlWrk) ' Show data for debugging
RsWrk.Open sSqlWrk, ew_GetConn("DB")
If Not RsWrk.Eof Then
arwrk = RsWrk.GetRows
Else
arwrk = Array()
End If
RsWrk.Close
Set RsWrk = Nothing
Temperature_measurement_registration.User_fullname.EditValue = arwrk
' ID_number
Call Temperature_measurement_registration.ID_number.EditAttrs.UpdateAttribute("class", "form-control")
Temperature_measurement_registration.ID_number.EditCustomAttributes = ""
Temperature_measurement_registration.ID_number.EditValue = ew_HtmlEncode(Temperature_measurement_registration.ID_number.CurrentValue)
Temperature_measurement_registration.ID_number.PlaceHolder = ew_HtmlEncode(ew_RemoveHtml(Temperature_measurement_registration.ID_number.FldCaption))
' User_phonenumber
Call Temperature_measurement_registration.User_phonenumber.EditAttrs.UpdateAttribute("class", "form-control")
Temperature_measurement_registration.User_phonenumber.EditCustomAttributes = ""
Temperature_measurement_registration.User_phonenumber.EditValue = ew_HtmlEncode(Temperature_measurement_registration.User_phonenumber.CurrentValue)
Temperature_measurement_registration.User_phonenumber.PlaceHolder = ew_HtmlEncode(ew_RemoveHtml(Temperature_measurement_registration.User_phonenumber.FldCaption))
' Place_of_origin
Call Temperature_measurement_registration.Place_of_origin_1.EditAttrs.UpdateAttribute("class", "form-control")
Temperature_measurement_registration.Place_of_origin_1.EditCustomAttributes = ""
If Temperature_measurement_registration.Place_of_origin_1.CurrentValue & "" = "" Then
sFilterWrk = "0=1"
Else
sFilterWrk = "[Place_of_origin]" & ew_SearchString("=", Temperature_measurement_registration.Place_of_origin_1.CurrentValue, EW_DATATYPE_STRING, "")
End If
sSqlWrk = "SELECT [Place_of_origin], [Place_of_origin] AS [DispFld], '' AS [Disp2Fld], '' AS [Disp3Fld], '' AS [Disp4Fld], '' AS [SelectFilterFld], '' AS [SelectFilterFld2], '' AS [SelectFilterFld3], '' AS [SelectFilterFld4] FROM [Place_of_origin]"
sWhereWrk = ""
Call ew_AddFilter(sWhereWrk, sFilterWrk)
Call Temperature_measurement_registration.Lookup_Selecting(Temperature_measurement_registration.Place_of_origin_1, sWhereWrk) ' Call Lookup Selecting
If sWhereWrk <> "" Then sSqlWrk = sSqlWrk & " WHERE " & sWhereWrk
sSqlWrk = sSqlWrk & " ORDER BY [Place_of_origin] DESC"
Set RsWrk = Server.CreateObject("ADODB.Recordset")
Call ew_SetDebugMsg("Lookup(DB): " & sSqlWrk) ' Show data for debugging
RsWrk.Open sSqlWrk, ew_GetConn("DB")
If Not RsWrk.Eof Then
arwrk = RsWrk.GetRows
Else
arwrk = Array()
End If
RsWrk.Close
Set RsWrk = Nothing
Temperature_measurement_registration.Place_of_origin_1.EditValue = arwrk
' To_which_department
Call Temperature_measurement_registration.To_which_department.EditAttrs.UpdateAttribute("class", "form-control")
Temperature_measurement_registration.To_which_department.EditCustomAttributes = ""
Temperature_measurement_registration.To_which_department.EditValue = ew_HtmlEncode(Temperature_measurement_registration.To_which_department.CurrentValue)
Temperature_measurement_registration.To_which_department.PlaceHolder = ew_HtmlEncode(ew_RemoveHtml(Temperature_measurement_registration.To_which_department.FldCaption))
' no_matter_what
Call Temperature_measurement_registration.no_matter_what.EditAttrs.UpdateAttribute("class", "form-control")
Temperature_measurement_registration.no_matter_what.EditCustomAttributes = ""
Temperature_measurement_registration.no_matter_what.EditValue = ew_HtmlEncode(Temperature_measurement_registration.no_matter_what.CurrentValue)
Temperature_measurement_registration.no_matter_what.PlaceHolder = ew_HtmlEncode(ew_RemoveHtml(Temperature_measurement_registration.no_matter_what.FldCaption))
' temperature
Call Temperature_measurement_registration.temperature.EditAttrs.UpdateAttribute("class", "form-control")
Temperature_measurement_registration.temperature.EditCustomAttributes = ""
Temperature_measurement_registration.temperature.EditValue = ew_HtmlEncode(Temperature_measurement_registration.temperature.CurrentValue)
Temperature_measurement_registration.temperature.PlaceHolder = ew_HtmlEncode(ew_RemoveHtml(Temperature_measurement_registration.temperature.FldCaption))
If Temperature_measurement_registration.temperature.EditValue&"" <> "" And IsNumeric(Temperature_measurement_registration.temperature.EditValue) Then Temperature_measurement_registration.temperature.EditValue = ew_FormatNumber(Temperature_measurement_registration.temperature.EditValue, -2, -2, -2, 0)
' Departure_time
Call Temperature_measurement_registration.Departure_time.EditAttrs.UpdateAttribute("class", "form-control")
Temperature_measurement_registration.Departure_time.EditCustomAttributes = ""
Temperature_measurement_registration.Departure_time.EditValue = ew_HtmlEncode(ew_FormatDateTime(Temperature_measurement_registration.Departure_time.CurrentValue, 8))
Temperature_measurement_registration.Departure_time.PlaceHolder = ew_HtmlEncode(ew_RemoveHtml(Temperature_measurement_registration.Departure_time.FldCaption))
' last_update_time
' update_users
' Add refer script
' Date_of_registration
Temperature_measurement_registration.Date_of_registration.LinkCustomAttributes = ""
Temperature_measurement_registration.Date_of_registration.HrefValue = ""
' User_fullname
Temperature_measurement_registration.User_fullname.LinkCustomAttributes = ""
Temperature_measurement_registration.User_fullname.HrefValue = ""
' ID_number
Temperature_measurement_registration.ID_number.LinkCustomAttributes = ""
Temperature_measurement_registration.ID_number.HrefValue = ""
' User_phonenumber
Temperature_measurement_registration.User_phonenumber.LinkCustomAttributes = ""
Temperature_measurement_registration.User_phonenumber.HrefValue = ""
' Place_of_origin
Temperature_measurement_registration.Place_of_origin_1.LinkCustomAttributes = ""
Temperature_measurement_registration.Place_of_origin_1.HrefValue = ""
' To_which_department
Temperature_measurement_registration.To_which_department.LinkCustomAttributes = ""
Temperature_measurement_registration.To_which_department.HrefValue = ""
' no_matter_what
Temperature_measurement_registration.no_matter_what.LinkCustomAttributes = ""
Temperature_measurement_registration.no_matter_what.HrefValue = ""
' temperature
Temperature_measurement_registration.temperature.LinkCustomAttributes = ""
Temperature_measurement_registration.temperature.HrefValue = ""
' Departure_time
Temperature_measurement_registration.Departure_time.LinkCustomAttributes = ""
Temperature_measurement_registration.Departure_time.HrefValue = ""
' last_update_time
Temperature_measurement_registration.last_update_time.LinkCustomAttributes = ""
Temperature_measurement_registration.last_update_time.HrefValue = ""
' update_users
Temperature_measurement_registration.update_users.LinkCustomAttributes = ""
Temperature_measurement_registration.update_users.HrefValue = ""
End If
If Temperature_measurement_registration.RowType = EW_ROWTYPE_ADD Or Temperature_measurement_registration.RowType = EW_ROWTYPE_EDIT Or Temperature_measurement_registration.RowType = EW_ROWTYPE_SEARCH Then ' Add/Edit/Search row
Call Temperature_measurement_registration.SetupFieldTitles
End If
' Call Row Rendered event
If Temperature_measurement_registration.RowType <> EW_ROWTYPE_AGGREGATEINIT Then
Call Temperature_measurement_registration.Row_Rendered
End If
End Sub
'
' Validate form
'
Function ValidateForm()
' Initialize
gsFormError = ""
' Check if validation required
If Not EW_SERVER_VALIDATE Then
ValidateForm = (gsFormError = "")
Exit Function
End If
If Not Temperature_measurement_registration.Date_of_registration.FldIsDetailKey And Not IsNull(Temperature_measurement_registration.Date_of_registration.FormValue) And Temperature_measurement_registration.Date_of_registration.FormValue&"" = "" Then
Call ew_AddMessage(gsFormError, Replace(Temperature_measurement_registration.Date_of_registration.ReqErrMsg, "%s", Temperature_measurement_registration.Date_of_registration.FldCaption))
End If
If Not ew_CheckDateDef(Temperature_measurement_registration.Date_of_registration.FormValue) Then
Call ew_AddMessage(gsFormError, Temperature_measurement_registration.Date_of_registration.FldErrMsg)
End If
If Not Temperature_measurement_registration.User_fullname.FldIsDetailKey And Not IsNull(Temperature_measurement_registration.User_fullname.FormValue) And Temperature_measurement_registration.User_fullname.FormValue&"" = "" Then
Call ew_AddMessage(gsFormError, Replace(Temperature_measurement_registration.User_fullname.ReqErrMsg, "%s", Temperature_measurement_registration.User_fullname.FldCaption))
End If
If Not Temperature_measurement_registration.Place_of_origin_1.FldIsDetailKey And Not IsNull(Temperature_measurement_registration.Place_of_origin_1.FormValue) And Temperature_measurement_registration.Place_of_origin_1.FormValue&"" = "" Then
Call ew_AddMessage(gsFormError, Replace(Temperature_measurement_registration.Place_of_origin_1.ReqErrMsg, "%s", Temperature_measurement_registration.Place_of_origin_1.FldCaption))
End If
If Not ew_CheckNumber(Temperature_measurement_registration.temperature.FormValue) Then
Call ew_AddMessage(gsFormError, Temperature_measurement_registration.temperature.FldErrMsg)
End If
If Not ew_CheckDateDef(Temperature_measurement_registration.Departure_time.FormValue) Then
Call ew_AddMessage(gsFormError, Temperature_measurement_registration.Departure_time.FldErrMsg)
End If
' Return validate result
ValidateForm = (gsFormError = "")
' Call Form Custom Validate event
Dim sFormCustomError
sFormCustomError = ""
ValidateForm = ValidateForm And Form_CustomValidate(sFormCustomError)
If sFormCustomError <> "" Then
Call ew_AddMessage(gsFormError, sFormCustomError)
End If
End Function
'
' Add record
'
Function AddRow(RsOld)
If Not EW_DEBUG_ENABLED Then On Error Resume Next
Dim cnn, Rs, sSql, sFilter
Dim RsNew
Dim bInsertRow
Dim RsChk
Dim sIdxErrMsg
' Clear any previous errors
Err.Clear
Dim RsMaster, sMasterUserIdMsg, sMasterFilter, bCheckMasterRecord, bValidMasterKey
Set cnn = Temperature_measurement_registration.TableConnection
' Load db values from rsold
Call LoadDbValues(RsOld)
If Not IsNull(RsOld) Then
End If
' Add new record
sFilter = "(0 = 1)"
Temperature_measurement_registration.CurrentFilter = sFilter
sSql = Temperature_measurement_registration.UpdateTableSQL
Set Rs = Server.CreateObject("ADODB.Recordset")
Rs.CursorLocation = Temperature_measurement_registration.TableCursorLocation
Call ew_SetDebugMsg("AddRow: " & sSql) ' Show SQL for debugging
Rs.Open sSql, cnn, 1, Temperature_measurement_registration.TableRecordsetLockType
Rs.AddNew
If Err.Number <> 0 Then
Message = Err.Description
Rs.Close
Set Rs = Nothing
AddRow = False
Exit Function
End If
' Field Date_of_registration
Call Temperature_measurement_registration.Date_of_registration.SetDbValue(Rs, ew_UnFormatDateTime(Temperature_measurement_registration.Date_of_registration.CurrentValue, 1), Null, False)
' Field User_fullname
Call Temperature_measurement_registration.User_fullname.SetDbValue(Rs, Temperature_measurement_registration.User_fullname.CurrentValue, Null, False)
' Field ID_number
Call Temperature_measurement_registration.ID_number.SetDbValue(Rs, Temperature_measurement_registration.ID_number.CurrentValue, Null, False)
' Field User_phonenumber
Call Temperature_measurement_registration.User_phonenumber.SetDbValue(Rs, Temperature_measurement_registration.User_phonenumber.CurrentValue, Null, False)
' Field Place_of_origin
Call Temperature_measurement_registration.Place_of_origin_1.SetDbValue(Rs, Temperature_measurement_registration.Place_of_origin_1.CurrentValue, Null, False)
' Field To_which_department
Call Temperature_measurement_registration.To_which_department.SetDbValue(Rs, Temperature_measurement_registration.To_which_department.CurrentValue, Null, False)
' Field no_matter_what
Call Temperature_measurement_registration.no_matter_what.SetDbValue(Rs, Temperature_measurement_registration.no_matter_what.CurrentValue, Null, False)
' Field temperature
Call Temperature_measurement_registration.temperature.SetDbValue(Rs, Temperature_measurement_registration.temperature.CurrentValue, Null, Temperature_measurement_registration.temperature.CurrentValue&"" = "")
' Field Departure_time
Call Temperature_measurement_registration.Departure_time.SetDbValue(Rs, ew_UnFormatDateTime(Temperature_measurement_registration.Departure_time.CurrentValue, 1), Null, False)
' Field last_update_time
Call Temperature_measurement_registration.last_update_time.SetDbValue(Rs, ew_CurrentDateTime, Null, False)
' Field update_users
Call Temperature_measurement_registration.update_users.SetDbValue(Rs, CurrentUserName, Null, False)
' Check recordset update error
If Err.Number <> 0 Then
FailureMessage = Err.Description
Rs.Close
Set Rs = Nothing
AddRow = False
Exit Function
End If
' Call Row Inserting event
bInsertRow = Temperature_measurement_registration.Row_Inserting(RsOld, Rs)
If bInsertRow Then
' Clone new recordset object
Set RsNew = ew_CloneRs(Rs)
Call ew_SetDebugMsg("Insert: " & ew_HtmlEncode(ew_RecordToJson(RsNew))) ' Show data for debugging
Rs.Update
If Err.Number <> 0 Then
FailureMessage = Err.Description
AddRow = False
Else
AddRow = True
End If
If AddRow Then
Temperature_measurement_registration.S_number.DbValue = RsNew("S_number") ' Get insert id if necessary
End If
Else
Rs.CancelUpdate
' Set up error message
If SuccessMessage <> "" Or FailureMessage <> "" Then
' Use the message, do nothing
ElseIf Temperature_measurement_registration.CancelMessage <> "" Then
FailureMessage = Temperature_measurement_registration.CancelMessage
Temperature_measurement_registration.CancelMessage = ""
Else
FailureMessage = Language.Phrase("InsertCancelled")
End If
AddRow = False
End If
Rs.Close
Set Rs = Nothing
If AddRow Then
' Call Row Inserted event
Call Temperature_measurement_registration.Row_Inserted(RsOld, RsNew)
Call Temperature_measurement_registration.WriteAuditTrailOnAdd(RsNew)
End If
If ew_NotEmpty(RsNew) Then
RsNew.Close
Set RsNew = Nothing
End If
End Function
' Set up Breadcrumb
Sub SetupBreadcrumb()
Dim PageId, url
Set Breadcrumb = New cBreadcrumb
url = Mid(ew_CurrentUrl(), InStrRev(ew_CurrentUrl(), "/") 1)
Call Breadcrumb.Add("list", Temperature_measurement_registration.TableVar, Temperature_measurement_registration.AddMasterUrl("ontrial_Temperature_measurement_registrationlist.asp"), "", Temperature_measurement_registration.TableVar, True)
PageId = ew_IIf(Temperature_measurement_registration.CurrentAction = "C", "Copy", "Add")
Call Breadcrumb.Add("add", PageId, url, "", "", False)
End Sub
' Setup lookup filters of a field
Sub SetupLookupFilters(fld, pageId)
pageId = ew_IIf(ew_EmptyStr(pageId), Temperature_measurement_registration_add.PageID, pageId)
Select Case fld.FldVar
Case "x_User_fullname"
sSqlWrk = ""
If ew_Empty(fld.LookupFilters) Then
Set fld.LookupFilters = Dictionary()
End If
sSqlWrk = "SELECT [User_fullname] AS [LinkFld], [User_fullname] AS [DispFld], '' AS [Disp2Fld], '' AS [Disp3Fld], '' AS [Disp4Fld] FROM [visitor_maillist]"
sWhereWrk = ""
fld.LookupFilters.Add "s", sSqlWrk
fld.LookupFilters.Add "d", ""
fld.LookupFilters.Add "f0", "[User_fullname] IN ({filter_value})"
fld.LookupFilters.Add "t0", "202"
fld.LookupFilters.Add "fn0", ""
sSqlWrk = ""
Call Temperature_measurement_registration.Lookup_Selecting(Temperature_measurement_registration.User_fullname, sWhereWrk) ' Call Lookup Selecting
If sWhereWrk <> "" Then sSqlWrk = sSqlWrk & " WHERE " & sWhereWrk
sSqlWrk = sSqlWrk & " ORDER BY [User_fullname] DESC"
If sSqlWrk <> "" Then
fld.LookupFilters.Set "s", fld.LookupFilters.Get("s") & sSqlWrk
End If
Case "x_Place_of_origin_1"
sSqlWrk = ""
If ew_Empty(fld.LookupFilters) Then
Set fld.LookupFilters = Dictionary()
End If
sSqlWrk = "SELECT [Place_of_origin] AS [LinkFld], [Place_of_origin] AS [DispFld], '' AS [Disp2Fld], '' AS [Disp3Fld], '' AS [Disp4Fld] FROM [Place_of_origin]"
sWhereWrk = ""
fld.LookupFilters.Add "s", sSqlWrk
fld.LookupFilters.Add "d", ""
fld.LookupFilters.Add "f0", "[Place_of_origin] IN ({filter_value})"
fld.LookupFilters.Add "t0", "202"
fld.LookupFilters.Add "fn0", ""
sSqlWrk = ""
Call Temperature_measurement_registration.Lookup_Selecting(Temperature_measurement_registration.Place_of_origin_1, sWhereWrk) ' Call Lookup Selecting
If sWhereWrk <> "" Then sSqlWrk = sSqlWrk & " WHERE " & sWhereWrk
sSqlWrk = sSqlWrk & " ORDER BY [Place_of_origin] DESC"
If sSqlWrk <> "" Then
fld.LookupFilters.Set "s", fld.LookupFilters.Get("s") & sSqlWrk
End If
End Select
End Sub
' Setup AutoSuggest filters of a field
Sub SetupAutoSuggestFilters(fld, pageId)
pageId = ew_IIF(ew_EmptyStr(pageId), Temperature_measurement_registration_add.PageID, pageId)
Select Case fld.FldVar
End Select
End Sub
' Page Load event
Sub Page_Load()
'Response.Write "Page Load"
End Sub
' Page Unload event
Sub Page_Unload()
'Response.Write "Page Unload"
End Sub
' Page Redirecting event
Sub Page_Redirecting(url)
'url = newurl
End Sub
' Message Showing event
' typ = ""|"success"|"failure"|"warning"
Sub Message_Showing(msg, typ)
' Example:
'If typ = "success" Then
' msg = "your success message"
'ElseIf typ = "failure" Then
' msg = "your failure message"
'ElseIf typ = "warning" Then
' msg = "your warning message"
'Else
' msg = "your message"
'End If
End Sub
' Page Render event
Sub Page_Render()
'Response.Write "Page Render"
End Sub
' Page Data Rendering event
Sub Page_DataRendering(header)
' Example:
'header = "your header"
End Sub
' Page Data Rendered event
Sub Page_DataRendered(footer)
' Example:
'footer = "your footer"
End Sub
' Form Custom Validate event
Function Form_CustomValidate(CustomError)
'Return error message in CustomError
Form_CustomValidate = True
End Function
End Class
%>
评论