Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Overview

This artile explain how is working and how to configure the downloading of documents related to parts in order page.

Configuration

The lines to add in profile.config

<DownloadDocumentEnabled>true</DownloadDocumentEnabled>
<DownloadDocumentBarEnabled>true</DownloadDocumentBarEnabled>

First enable "Download all documents" choice in Download dropdown button from summary tab. Second line enable the document selector in the same view.


In clientName.css, the icon colors can be defined. It will be black if checked, grey otherwise. This is what we put in our dometic.css.

/*Icon color if document is checked, dometic green here*/
.icon-checked{color: #00b140!important;}

/*Icon color if document unchecked, grey*/
.document-icon{color: #bdc3c7;}

How It works

View :

The document bar is in the partial view _OrderCartDownloadDocuments.cshtml in WebViewer/Views/Orders. It contains :

  • Two buttons : "Download All documents" and "Download selected documents"
  • A document container. For each document there are : his name, a checkbox and the icon corresponding to the type of document.

Script :

In assert.ordercart.js :

  • a function handling click on document icon : check/uncheck the checkbox and change icon color
  • a function handling click on document checkbox : change icon color
  • a function handling click on "Download Selected Documents" : get checked documents, post them to the controller (PostSelectedDocumentName method) and return their zip (DownloadDocumentZip method)

Model :

ViewModel used in the view : DownloadDocumentViewModel 

Controller :

There are 3 methods used in OrderController :

  • ActionResult DownloadAllDocument() : return a zip of all documents linked to parts
  • ActionResult DownloadSelectedDocumentList(IList<DocumentViewModel> referredDocuments) : return a zip of documents passed in parameters
  • ActionResult PostSelectedDocumentName(string[] docName) : post a list of document name, create a TempData with the zip inside
  • ActionResult DownloadDocumentZip(string fileGuid, string fileName) : Return the zip called filename from the TempData fileGuid 





  • No labels