文件操作 - NewSunday.js
返回文件管理
返回主菜单
删除本文件
文件: E:\HostingSpaces\kimblycr\howell.kimbly.in\wwwroot\js\NewSunday.js
编辑文件内容
var CurrentImage; function AddNewSunday() { $('#dvFrm').show(); $("#dvFrmEdit").hide(); $("#dvGrdReportSunday").hide(); $.ajax({ type: "POST", url: "MySunday.aspx/GetSites", data: "", contentType: "application/json; charset=utf-8", dataType: "json", success: function (data) { if (data.d != null) { var selectSite = document.getElementById('SelSite'); $("#SelSite").empty(); for (i = 0; i < data.d.length; i++) { selectSite.options[selectSite.options.length] = new Option(data.d[i].Name, data.d[i].ID); } } }, error: function (XMLHttpRequest, textStatus, errorThrown) { console.log('error'); } }); } function HideAddForm() { $('#dvFrm').hide(); } function SaveSunday() { var site = document.getElementById("SelSite").value; var sdate = document.getElementById("txtdate").value; var remarks = document.getElementById("txtRemarks").value; remarks = remarks.replace(/'/g, ""); $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: "MySunday.aspx/AddSunday", data: "{'Date':'" + sdate + "','SiteID':'" + site + "','Remarks':'" + remarks + "'}", dataType: "json", success: function (data) { if (data.d != null) { HideAddForm(); // GetNonSubmittedSunday(); ViewNonSubmittedSunday(data.d); } }, error: function (XMLHttpRequest, textStatus, errorThrown) { console.log(XMLHttpRequest.responseText); } }); } function GetNonSubmittedSunday() { var LoggedInEmpID = sessionStorage.getItem("LoggedInEmpID"); $("#dvFrmEdit").hide(); $('#dvFrm').hide(); var collection = "Sunday"; $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: "MySunday.aspx/ViewNonSubmittedSunday", data: "{'ID': '" + LoggedInEmpID + "'}", dataType: "json", success: function (data) { if (data.d != null) { console.log(data.d); $("#grd" + collection).empty(); var str = "<thead><tr><td>ID</td><td>Site</td><td>Date</td><td>Remarks</td></tr></thead><tbody>"; for (i = 0; i < data.d.length; i++) { var hdr = data.d[i].RowData; str += hdr; } $("#grd" + collection).append(str); $("#grd" + collection).append("</tbody>"); $("#grd" + collection).show(); $("#dvGrdReport" + collection).show(); } }, error: function (XMLHttpRequest, textStatus, errorThrown) { console.log(XMLHttpRequest.responseText); } }); } function ViewNonSubmittedSunday(ID) { GetSites(ID); $("#dvFrmEdit").show(); $("#dvGrdReportSunday").hide(); document.getElementById('hdnID').value = ID; } function GetSites(id) { $.ajax({ type: "POST", url: "MySunday.aspx/GetSites", data: "", contentType: "application/json; charset=utf-8", dataType: "json", success: function (data) { if (data.d != null) { var selectSite = document.getElementById('SelSiteEdit'); $("#SelSiteEdit").empty(); for (i = 0; i < data.d.length; i++) { selectSite.options[selectSite.options.length] = new Option(data.d[i].Name, data.d[i].ID); } GetValues(id); } }, error: function (XMLHttpRequest, textStatus, errorThrown) { console.log('error'); } }); } function GetValues(id) { $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: "MySunday.aspx/ViewSundayByID", data: "{'id': '" + id + "'}", dataType: "json", success: function (data) { if (data.d != null) { console.log(data.d); var out = data.d.split(";"); document.getElementById('SelSiteEdit').value = out[0]; document.getElementById('txtRemarksEdit').value = out[1]; document.getElementById('txtdateEdit').value = out[2]; } }, error: function (XMLHttpRequest, textStatus, errorThrown) { console.log(XMLHttpRequest.responseText); } }); } function HideEditForm() { $("#dvFrmEdit").hide(); $("#dvGrdReportSunday").show(); } function SubmitSunday() { var id = document.getElementById('hdnID').value; $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: "MySunday.aspx/SubmitSunday", data: "{'ID':'" + id + "'}", dataType: "json", success: function (data) { if (data.d != null) { } }, error: function (XMLHttpRequest, textStatus, errorThrown) { console.log(XMLHttpRequest.responseText); } }); GetNonSubmittedSunday(); } function UpdateSunday() { var id = document.getElementById('hdnID').value; var site = document.getElementById("SelSiteEdit").value; var date = document.getElementById("txtdateEdit").value; var remarks = document.getElementById("txtRemarksEdit").value; remarks = remarks.replace(/'/g, ""); $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: "MySunday.aspx/UpdateSunday", data: "{'date':'" + date + "','SiteID':'" + site + "','Remarks':'" + remarks + "','ID':'" + id + "'}", dataType: "json", success: function (data) { if (data.d != null) { } }, error: function (XMLHttpRequest, textStatus, errorThrown) { console.log(XMLHttpRequest.responseText); } }); GetNonSubmittedSunday(); } function DeleteSunday() { var id = document.getElementById('hdnID').value; $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: "MySunday.aspx/DeleteSunday", data: "{'ID':'" + id + "'}", dataType: "json", success: function (data) { GetNonSubmittedSunday(); }, error: function (XMLHttpRequest, textStatus, errorThrown) { console.log(XMLHttpRequest.responseText); } }); }
修改文件时间
将文件时间修改为当前时间的前一年
删除文件