//Insert
Bulk Follow Up Data
self.AddBulkFollowUpData = function () {
var selectedCount = 0;
// Loop
through the Item and Get only the selected items IN BulkArray
ko.utils.arrayForEach(self.FollowUpDataListArray(), function (selectedRecord) {
if (selectedRecord.Selected() == true) {
self.addBulkFollowUpDataArray.push(new AddBulkFollowUpDataDTO({
FollowUpDate:
self.CurrentFollowUpDate(),
strFollowUpDate: self.CurrentFollowUpDate(),
Notes: self.Notes(),
HousingAllowanceId:
selectedRecord.HousingAllowanceId(),
FollowUpTypeId:
self.FollowUpTypeID()
}));
}
else {
selectedCount = selectedCount + 1;
}
});
if (self.FollowUpDataListArray().length == selectedCount) {
alert('Please Select Housing Allowance');
return false;
}
else {
$.ajax({
url: AddBulkFollowUpDataURL,
type: "POST", async:
false,
contentType: "application/json; charset=utf-8",
data:
ko.toJSON(self.addBulkFollowUpDataArray()),
success: function (data, textStatus,
jqXHR) {
if (data == 0) { alert('One or More Records Already Exists Not Saved'); return false;}
//Here get the Totoal number of records Inserted
alert('Records Saved Successfully');
window.location.href =
window.location.href;
},
error: function (jqXHR, textStatus,
errorThrown) {
$("#MessageLabel").html(Cost_Error
+ errorThrown);
$('#NotificationModel').modal('show');
}
});
}
}
self.grandTotal
= ko.computed(function () {
var total = 0;
$.each(self.IndebtednessValues(), function () { total += this.Value() })
return
total;
});
self.ValueTotal(self.grandTotal());
//-------------------------------------------File
UPLOAD function Start ---------------------------------------
self.AllowanceContractFileUploadVM =
ko.observable();
self.ObservationReportFileUploadVM =
ko.observable();
self.FileUploadSettings = function () {
self.AllowanceContractFileUploadVM = new
CommonFileUploadVM(self.AllowanceContractAddFile);
self.AllowanceContractFileUploadVM.ServerFolder("AllowanceContract");
self.ObservationReportFileUploadVM = new
CommonFileUploadVM(self.ObservationReportAddFile);
self.ObservationReportFileUploadVM.DivName("ObservationReportDivUploader");
self.ObservationReportFileUploadVM.DivPreviewName("ObservationReportUploaderPreivew");
self.ObservationReportFileUploadVM.ServerFolder("ObservationReport");
}
self.SetFileUploader = function () {
self.AllowanceContractFileUploadVM.SetFileUploaderDiv();
self.ObservationReportFileUploadVM.SetFileUploaderDiv();
}
self.AllowanceContractAddFile = function () {
var allowanceRequestDocumentDTO = new HousingAllowanceRequestDoc(new Object());
allowanceRequestDocumentDTO.HousingAllowanceRequestId(0);
allowanceRequestDocumentDTO.DocumentName(self.AllowanceContractFileUploadVM.DocumentName());
allowanceRequestDocumentDTO.DocumentPath(self.AllowanceContractFileUploadVM.FileName());
allowanceRequestDocumentDTO.ServerFolder(self.AllowanceContractFileUploadVM.ServerFolder());
allowanceRequestDocumentDTO.ServerRootFolder(self.AllowanceContractFileUploadVM.ServerRootFolder());
self.AllowanceContract.AllowanceContractFileName(allowanceRequestDocumentDTO.DocumentPath());
self.AllowanceContractFileUploadVM.DocumentName('');
self.AllowanceContractFileUploadVM.FileName('');
document.getElementById(self.AllowanceContractFileUploadVM.DivPreviewName()).innerHTML
= '';
}
self.ObservationReportAddFile = function () {
var allowanceRequestDocumentDTO = new HousingAllowanceRequestDoc(new Object());
allowanceRequestDocumentDTO.HousingAllowanceRequestId(0);
allowanceRequestDocumentDTO.DocumentName(self.ObservationReportFileUploadVM.DocumentName());
allowanceRequestDocumentDTO.DocumentPath(self.ObservationReportFileUploadVM.FileName());
allowanceRequestDocumentDTO.ServerFolder(self.ObservationReportFileUploadVM.ServerFolder());
allowanceRequestDocumentDTO.ServerRootFolder(self.ObservationReportFileUploadVM.ServerRootFolder());
self.AllowanceContract.ObservationReportFilename(allowanceRequestDocumentDTO.DocumentPath());
self.ObservationReportFileUploadVM.DocumentName('');
self.ObservationReportFileUploadVM.FileName('');
document.getElementById(self.ObservationReportFileUploadVM.DivPreviewName()).innerHTML
= '';
}
self.FileUploadSettings();
//Preview
File from Upload File
self.PreviewFile = function (type) {
var filePath = "/UPLOADS/";
if (type == 'Contract') {
filePath += 'AllowanceContract/' +
self.AllowanceContract.AllowanceContractFileName();
}
else if (type == 'Observation') {
filePath += 'ObservationReport/' +
self.AllowanceContract.ObservationReportFilename();
}
OpenImageInNewWindow(filePath);
};
//-------------------------------------------File
UPLOAD function End ---------------------------------------
No comments:
Post a Comment