private void PostPageChanges() { ServiceRequestsManagerToolBasicInformationGateway serviceRequestsManagerToolBasicInformationGateway = new ServiceRequestsManagerToolBasicInformationGateway(serviceRequestsManagerToolTDS); // basic variables int companyId = Int32.Parse(hdfCompanyId.Value); int serviceId = Int32.Parse(hdfSelectedSRId.Value); int? libraryCategoriesId = null; if (serviceRequestsManagerToolBasicInformationGateway.GetLibraryCategoriesId(serviceId).HasValue) libraryCategoriesId = (int)serviceRequestsManagerToolBasicInformationGateway.GetLibraryCategoriesId(serviceId); // Service state string serviceState = "Assigned"; string checklistState = "In Progress"; if (ckbxAcceptSR.Checked) serviceState = "Accepted"; if (ckbxStartSR.Checked) serviceState = "In Progress"; if (ckbxCompleteSR.Checked) { serviceState = "Completed"; checklistState = "Healthy"; } // Get Assignment information DateTime? assignDeadlineDate = null; bool assignTeamMember = false; int? assignTeamMemberId = null; string assignThirdPartyVendor = ""; DateTime? assignDateTime = null; if (hdfPnlAssignmentInformation.Value == "True") { // If data is modified if (hdfDeadlineDate.Value != "") assignDeadlineDate = DateTime.Parse(hdfDeadlineDate.Value); if ((hdfAssignToMyself.Value == "True") || (hdfAssignToTeamMember.Value == "True")) { assignTeamMember = true; assignTeamMemberId = Int32.Parse(hdfTeamMemberId.Value); } if (hdfThirdPartyVendor.Value != "") { assignThirdPartyVendor = hdfThirdPartyVendor.Value; } assignDateTime = DateTime.Now; } else { // If data is not modified assignTeamMember = serviceRequestsManagerToolBasicInformationGateway.GetAssignTeamMember(serviceId); assignTeamMemberId = serviceRequestsManagerToolBasicInformationGateway.GetAssignTeamMemberId(serviceId); assignThirdPartyVendor = serviceRequestsManagerToolBasicInformationGateway.GetAssignedThirdPartyVendor(serviceId); assignDeadlineDate = serviceRequestsManagerToolBasicInformationGateway.GetAssignedDeadlineDate(serviceId); assignDateTime = serviceRequestsManagerToolBasicInformationGateway.GetAssignmentDateTime(serviceId); } // Get acceptance information DateTime? acceptDateTime = null; DateTime? rejectDateTime = null; string rejectReason = ""; if (hdfPnlAcceptInformation.Value == "True") { // If data is modified if (hdfAcceptSR.Value == "True") { acceptDateTime = DateTime.Now; } } else { // If data is not modified acceptDateTime = serviceRequestsManagerToolBasicInformationGateway.GetAcceptedDateTime(serviceId); rejectDateTime = serviceRequestsManagerToolBasicInformationGateway.GetRejectDateTime(serviceId); rejectReason = serviceRequestsManagerToolBasicInformationGateway.GetRejectReason(serviceId); } // Get start work information DateTime? startWorkDateTime = null; DateTime? unitOutOfServiceDate = null; string unitOutOfServiceTime = ""; string startWorkMileage = ""; if (hdfPnlStartWorkInformation.Value == "True") { // If data is modified if (hdfStartSR.Value == "True") { startWorkDateTime = DateTime.Now; if (hdfUnitOutOfServiceDate.Value != "") unitOutOfServiceDate = DateTime.Parse(hdfUnitOutOfServiceDate.Value); unitOutOfServiceTime = hdfUnitOutOfServiceTime.Value; if (hdfStartMileage.Value != "") startWorkMileage = hdfStartMileage.Value; } } else { // If data is not modified startWorkDateTime = serviceRequestsManagerToolBasicInformationGateway.GetStartWorkDateTime(serviceId); unitOutOfServiceDate = serviceRequestsManagerToolBasicInformationGateway.GetUnitOutOfServiceDate(serviceId); unitOutOfServiceTime = serviceRequestsManagerToolBasicInformationGateway.GetUnitOutOfServiceTime(serviceId); startWorkMileage = serviceRequestsManagerToolBasicInformationGateway.GetStartWorkMileage(serviceId); } // Get complete work information DateTime? completeWorkDateTime = null; DateTime? unitBackInServiceDate = null; string unitBackInServiceTime = ""; string completeWorkDetailDescription = ""; bool completeWorkDetailPreventable = false; Decimal? completeWorkDetailTMLabourHours = null; Decimal? completeWorkDetailTMCost = null; string completeWorkInvoiceNumber = ""; Decimal? completeWorkInvoiceAmount = null; string completeWorkMileage = ""; if (hdfPnlCompleteWorkInformation.Value == "True") { // If data is modified if (ckbxCompleteSR.Checked) { completeWorkDateTime = DateTime.Now; if (hdfUnitBackInServiceDate.Value != "") unitBackInServiceDate = DateTime.Parse(hdfUnitBackInServiceDate.Value); unitBackInServiceTime = hdfUnitBackInServiceTime.Value; completeWorkDetailDescription = hdfCompleteWorkDescription.Value; completeWorkDetailPreventable = Boolean.Parse(hdfCompleteWorkPreventable.Value); if (hdfCompleteWorkLabourHours.Value != "") completeWorkDetailTMLabourHours = decimal.Parse(hdfCompleteWorkLabourHours.Value); if (hdfCompleteWorkCosts.Value != "") completeWorkDetailTMCost = decimal.Parse(hdfCompleteWorkCosts.Value); if (hdfInvoiceNumber.Value != "") completeWorkInvoiceNumber = hdfInvoiceNumber.Value; if (hdfInvoiceAmount.Value != "") completeWorkInvoiceAmount = decimal.Parse(hdfInvoiceAmount.Value); if (hdfCompleteWorkMileage.Value != "") completeWorkMileage = hdfCompleteWorkMileage.Value; } } else { // If data is not modified completeWorkDateTime = serviceRequestsManagerToolBasicInformationGateway.GetCompleteWorkDateTime(serviceId); unitBackInServiceDate = serviceRequestsManagerToolBasicInformationGateway.GetUnitBackInServiceDate(serviceId); unitBackInServiceTime = serviceRequestsManagerToolBasicInformationGateway.GetUnitBackInServiceTime(serviceId); completeWorkDetailDescription = serviceRequestsManagerToolBasicInformationGateway.GetCompleteWorkDetailDescription(serviceId); completeWorkDetailPreventable = serviceRequestsManagerToolBasicInformationGateway.GetCompleteWorkDetailPreventable(serviceId); completeWorkDetailTMLabourHours = serviceRequestsManagerToolBasicInformationGateway.GetCompleteWorkDetailTMLabourHours(serviceId); completeWorkDetailTMCost = serviceRequestsManagerToolBasicInformationGateway.GetCompleteWorkDetailTMCost(serviceId); completeWorkInvoiceNumber = serviceRequestsManagerToolBasicInformationGateway.GetCompleteWorkDetailTPVInvoiceNumber(serviceId); completeWorkInvoiceAmount = serviceRequestsManagerToolBasicInformationGateway.GetCompleteWorkDetailTPVInvoiceAmout(serviceId); completeWorkMileage = serviceRequestsManagerToolBasicInformationGateway.GetCompleteWorkMileage(serviceId); } // Insert to dataset ServiceRequestsManagerToolBasicInformation serviceRequestsManagerToolBasicInformation = new ServiceRequestsManagerToolBasicInformation(serviceRequestsManagerToolTDS); serviceRequestsManagerToolBasicInformation.Update(serviceId, serviceState, assignDateTime, assignDeadlineDate, assignTeamMember, assignTeamMemberId, assignThirdPartyVendor, acceptDateTime, startWorkDateTime, unitOutOfServiceDate, unitOutOfServiceTime, completeWorkDateTime, unitBackInServiceDate, unitBackInServiceTime, completeWorkDetailDescription, completeWorkDetailPreventable, completeWorkDetailTMLabourHours, completeWorkDetailTMCost, completeWorkInvoiceNumber, completeWorkInvoiceAmount, startWorkMileage, completeWorkMileage, checklistState, false, companyId, libraryCategoriesId); // Store session Session["serviceRequestsManagerToolTDS"] = serviceRequestsManagerToolTDS; }