Ejemplo n.º 1
0
        /// <summary>
        /// Checkout di un documento e download del contenuto del file
        /// </summary>
        /// <param name="idDocument"></param>
        /// <param name="documentNumber"></param>
        /// <param name="machineName"></param>
        /// <param name="documentLocation">Percorso di estrazione del file</param>
        /// <param name="downloadFile">Se true, viene effettuato il download del file contestualmente al checkout</param>
        private void CheckOutDocument(string idDocument, string documentNumber, string documentLocation, string machineName, bool downloadFile)
        {
            CheckOutStatus checkOutStatus;

            ValidationResultInfo result = null;

            if (downloadFile)
            {
                byte[] content;

                result = CheckInOutServices.CheckOutDocumentWithFile(documentLocation, machineName, out checkOutStatus, out content);

                if (result.Value)
                {
                    SessionContent = content;
                }
            }
            else
            {
                result = CheckInOutServices.CheckOutDocument(documentLocation, machineName, out checkOutStatus);
            }

            if (!result.Value)
            {
                // Scrittura dei messaggi di errore nel checkout
                Response.Write(this.GetErrorMessage(result));
            }
            else
            {
                System.Web.HttpContext.Current.Session["isCheckinOrOut"] = result.Value;
            }
        }