private string CheckOutFilePath() { string retValue = string.Empty; CheckInOutServices.InitializeContext(); if (DocumentManager.getSelectedAttachId() == null) { NttDataWA.DocsPaWR.SchedaDocumento schedaDoc = CheckInOutServices.CurrentSchedaDocumento; if (schedaDoc != null && schedaDoc.checkOutStatus != null) { retValue = schedaDoc.checkOutStatus.DocumentLocation; } } else { NttDataWA.DocsPaWR.CheckOutStatus tempStatus = DocumentManager.GetCheckOutDocumentStatus(DocumentManager.GetSelectedAttachment().docNumber); if (tempStatus != null) { retValue = DocumentManager.GetCheckOutDocumentStatus(DocumentManager.GetSelectedAttachment().docNumber).DocumentLocation; } } return(retValue.Replace(@"\", @"\\")); }
/// <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, idDocument, documentNumber); 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; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { CheckInOutServices.InitializeContext(); if (UIManager.DocumentManager.getSelectedAttachId() == null && CheckInOutServices.CurrentSchedaDocumento != null && CheckInOutServices.CurrentSchedaDocumento.protocollo != null && CheckInOutServices.CurrentSchedaDocumento.protocollo.segnatura != null && !string.IsNullOrEmpty(CheckInOutServices.CurrentSchedaDocumento.protocollo.segnatura)) { file_name = UIManager.UserManager.normalizeStringPropertyValue(CheckInOutServices.CurrentSchedaDocumento.protocollo.segnatura); } else { if (CheckInOutServices.CurrentSchedaDocumento != null && CheckInOutServices.CurrentSchedaDocumento.docNumber != null && !string.IsNullOrEmpty(CheckInOutServices.CurrentSchedaDocumento.docNumber)) { if (UIManager.DocumentManager.getSelectedAttachId() != null) { file_name = UIManager.DocumentManager.GetSelectedAttachment().docNumber; } else { file_name = CheckInOutServices.CurrentSchedaDocumento.docNumber; } } } this.SetParameters(); this.componentType = UIManager.UserManager.getComponentType(Request.UserAgent); this.initForm(); } }
/// <summary> /// Rendering del documento checkedout /// </summary> private void RenderCheckedOutDocument() { byte[] content = null; if (CheckOutPage.SessionContent == null) { // Se il download del file non è stato fatto // contestualmente al CheckOut, viene reperito // il content del file dal server content = CheckInOutServices.GetCheckedOutFileDocument(); } else { // Se il file è già stato scaricato contestualmente al checkout, // viene reperito il content del file dalla sessione content = CheckOutPage.SessionContent; CheckOutPage.SessionContent = null; } if (content != null) { Response.BinaryWrite(content); // Response.Flush(); } }
/// <summary> /// Caricamento dati relativamente allo stato del documento bloccato /// </summary> private void Fetch() { CheckOutStatus status = CheckInOutServices.GetCheckOutDocumentStatus(); if (status != null) { this.DrawTable(status); } }
/// <summary> /// Annullamento del blocco sul documento /// </summary> private void UndoCheckOutDocument() { ValidationResultInfo retValue = CheckInOutServices.UndoCheckOutDocument(); if (!retValue.Value) { // Scrittura dei messaggi di errore nel checkout Response.Write(this.GetErrorMessage(retValue)); } else { System.Web.HttpContext.Current.Session["isCheckinOrOut"] = retValue.Value; } }
private void loadCheckOutData() { string strUser = string.Empty; string strRole = string.Empty; string strData = string.Empty; string strPath = string.Empty; string strComputer = string.Empty; CheckInOutServices.InitializeContext(); NttDataWA.DocsPaWR.SchedaDocumento schedaDoc = CheckInOutServices.CurrentSchedaDocumento; DocsPaWR.CheckOutStatus tempStatus = null; if (UIManager.DocumentManager.getSelectedAttachId() == null) { if (schedaDoc != null) { tempStatus = schedaDoc.checkOutStatus; } } else { if (UIManager.DocumentManager.GetSelectedAttachment() != null) { tempStatus = UIManager.DocumentManager.GetCheckOutDocumentStatus(UIManager.DocumentManager.GetSelectedAttachment().docNumber); } } if (tempStatus != null) { string temp_strUser = tempStatus.UserName; strRole = tempStatus.RoleName; strData = tempStatus.CheckOutDate.ToString(); strPath = tempStatus.DocumentLocation; strComputer = tempStatus.MachineName; if (!string.IsNullOrEmpty(temp_strUser)) { strUser = temp_strUser + " [" + UIManager.AddressBookManager.getCorrispondenteByCodRubrica(temp_strUser, true).descrizione + "]"; } } this.lblUserNAme.Text = strUser; this.lblRoleType.Text = strRole; this.lblDataCheckOut.Text = strData; this.lblLocalFilePath.Text = strPath; this.lblComputerName.Text = strComputer; }
/// <summary> /// CheckIn del documento corrente MTEXT /// </summary> private void CheckInMTextDocument(String file) { // Salvataggio del docNumber del documento in CheckOut CheckOutStatus ckSt = CheckOutAppletContext.Current.Status; if (UIManager.DocumentManager.getSelectedAttachId() != null) { ckSt = UIManager.DocumentManager.GetCheckOutDocumentStatus(UIManager.DocumentManager.GetSelectedAttachment().docNumber); } String docNumber = ckSt.DocumentNumber; // Estrai porzione del path di interesse per M/TEXT file = file.Substring(8); // Accedi a MTEXT per prelevare il PDF MTextModelProvider mtext = models.ModelProviderFactory <MTextModelProvider> .GetInstance(); // Preleva contenuto PDF Byte[] content = mtext.ExportDocument(file, "application/pdf"); // Fai sembrare il file M/TEXT un file FDF ckSt.DocumentLocation = "mtext.pdf"; // Effettua il checkin del documento NttDataWA.DocsPaWR.ValidationResultInfo result = CheckInOutServices.CheckInDocument(content); // Salva l'FQN del file M/TEXT NttDataWA.DocsPaWR.DocsPaWebService ws = new NttDataWA.DocsPaWR.DocsPaWebService(); ws.SetMTextFullQualifiedName(new NttDataWA.DocsPaWR.MTextDocumentInfo() { DocumentDocNumber = docNumber, FullQualifiedName = file }); if (!result.Value) { // Scrittura dei messaggi di errore nel checkin Response.Write(this.GetErrorMessage(result)); } }
/// <summary> /// CheckIn del documento corrente /// </summary> private void CheckInDocument(bool isApplet = false, bool isSocket = false) { byte[] content = null; if (isApplet) { content = System.Convert.FromBase64String(Request.Params["strFile"]); } else if (isSocket) { string JSONfile = Request["strFile"]; //Stream stream=Request.InputStream; JSONfile = JSONfile.Replace(' ', '+'); JSONfile = JSONfile.Trim(); NttDataWA.Utils.FileJSON file = JsonConvert.DeserializeObject <NttDataWA.Utils.FileJSON>(JSONfile); content = System.Convert.FromBase64String(file.content); } else { content = Request.BinaryRead(Request.ContentLength); } NttDataWA.DocsPaWR.ValidationResultInfo result = CheckInOutServices.CheckInDocument(content); if (!result.Value) { // Scrittura dei messaggi di errore nel checkin Response.Write(this.GetErrorMessage(result)); } else { System.Web.HttpContext.Current.Session["isCheckinOrOut"] = result.Value; CheckOutAppletContext.Current = null; } }
/// <summary> /// Aggiornamento pannello checkinout /// </summary> /// <param name="idDocument"></param> /// <param name="documentNumber"></param> public void Refresh(string idDocument, string documentNumber) { // Impostazione parametri relativi al documento corrente this.IDDocument = this.documentId.Value = idDocument; this.DocumentNumber = this.documentNumber.Value = documentNumber; this.hdnFilePath.Value = CheckOutFilePath; this.isSigned.Value = IsSignedFile.ToString(); // Registrazione eventi javascript this.RegisterClientScriptEvents(); //bool fileExist = false; //if (string.IsNullOrEmpty(UIManager.FileManager.getSelectedFile().fileSize)) //fileExist = true; // Verifica se l'utente è abilitato all'utilizzo della funzione // Inizializzazione del contesto di checkout per il documento corrente CheckInOutServices.InitializeContext(); this.ViewState["IsUserEnabled"] = true; this.ViewState["LastAcquiredDocumentExtension"] = null; this.fileExt.Value = LastAcquiredDocumentExtension; this.pnlFileExtValue.Update(); this.CheckInOutController.UpdateCheckOutPath(); }
/// <summary> /// Inizializzazione pannello checkinout /// </summary> /// <param name="idDocument"></param> /// <param name="documentNumber"></param> public void Initialize(string idDocument, string documentNumber) { if (!this.IsPostBack) { // Impostazione parametri relativi al documento corrente this.IDDocument = idDocument; this.DocumentNumber = documentNumber; // Registrazione eventi javascript this.RegisterClientScriptEvents(); bool fileExist = false; if (string.IsNullOrEmpty(UIManager.FileManager.getSelectedFile().fileSize)) { fileExist = true; } // Verifica se l'utente è abilitato all'utilizzo della funzione if (this.UserEnabled && fileExist) { // Inizializzazione del contesto di checkout per il documento corrente CheckInOutServices.InitializeContext(); } } }
/// <summary> /// Aggiornamento abilitazione / disabilitazione funzioni di checkin - checkout /// </summary> private void RefreshButtons() { this.DisableAllButtons(); DocsPaWR.SchedaDocumento currentScheda = this.CurrentSchedaDocumento; if (currentScheda != null) { FileRequest selectedFile = UIManager.FileManager.getSelectedFile(); // Verifica stato consolidamento del documento (solo se non consolidato, si può fare checkout) if (currentScheda.ConsolidationState == null || (currentScheda.ConsolidationState != null && currentScheda.ConsolidationState.State == DocsPaWR.DocumentConsolidationStateEnum.None)) { if (!string.IsNullOrEmpty(currentScheda.systemId) && (currentScheda.tipoProto != "R" && currentScheda.tipoProto != "C")) { // NB: Nei casi in cui l'utente non è abilitato per l'utilizzo della funzione di checkin / checkout, // le uniche funzionalità non disponibili saranno quelle relative al checkin e all'undocheckout. // In ogni caso potrà vedere lo stato del documento e chi l'ha posto in checkout. // Verifica se il documento non è né cestinato né annullato if (!this.IsDocumentoInCestino && !this.IsDocumentoAnnullato) { CheckOutStatus status = CheckInOutServices.GetCheckOutDocumentStatus(); if (status != null) { // Il documento risulta bloccato, reperimento del proprietario del blocco string ownerUser = status.UserName.ToUpper(); bool isOwnerCheckOut = (ownerUser == UIManager.UserManager.GetInfoUser().userId.ToUpper()); if (this.UserEnabled && isOwnerCheckOut && (currentScheda.checkOutStatus == null || currentScheda.checkOutStatus.InConversionePdf)) { // Documento bloccato dall'utente corrente: funzioni di rilascio abilitate this.btnCheckIn.Enabled = true; this.btnOpenCheckedOutFile.Enabled = true; this.btnUndoCheckOut.Enabled = true; if (UIManager.UserManager.isFiltroAooEnabled()) { //DocsPaWR.Registro[] userRegistri = UIManager.UserManager.getListaRegistri(this.Page); DocsPaWR.Registro[] userRegistri = RoleManager.GetRoleInSession().registri; this.btnCheckIn.Enabled = UIManager.UserManager.verifyRegNoAOO(currentScheda, userRegistri); this.btnOpenCheckedOutFile.Enabled = UIManager.UserManager.verifyRegNoAOO(currentScheda, userRegistri); this.btnUndoCheckOut.Enabled = UIManager.UserManager.verifyRegNoAOO(currentScheda, userRegistri); } } string language = UIManager.UserManager.GetUserLanguage(); this.btnShowCheckOutStatus.Enabled = true; this.btnShowCheckOutStatus.Visible = true; this.btnShowCheckOutStatus.ToolTip = Utils.Languages.GetLabelFromCode("DocumentImgLockTooltip", language) + ownerUser; //Verifico che il documento è bloccato per una richiesta di conversione pdf lato server //In caso affermativo disabilito l'apertura del file ed il rilascia sen if (status.InConversionePdf) { this.btnOpenCheckedOutFile.Enabled = false; this.btnCheckIn.Enabled = false; // Se il documento è in stato di conversione pdf, // il pulsante di annullamento è abilitato solo se l'owner // del blocco è l'utente stesso //this.btnUndoCheckOut.Enabled = isOwnerCheckOut; this.btnUndoCheckOut.Enabled = false; } } else { //modifica NttDataWA.DocsPaWR.DocsPaWebService ws = new NttDataWA.DocsPaWR.DocsPaWebService(); //string idAmm = UIManager.UserManager.GetInfoUser().idAmministrazione; ////NttDataWA.DocsPaWR.CacheConfig info = ws.getConfigurazioneCache(idAmm); //if (ws.isActiveCache(idAmm)) //{ // //bool inCache = ws.inCache(currentScheda.docNumber, currentScheda.documenti[currentScheda.documenti.Length - 1].versionId, idAmm); // //if (inCache) // //{ // // string pathComponents = ws.recuperaPathComponents(currentScheda.docNumber, currentScheda.documenti[currentScheda.documenti.Length - 1].versionId); // // if (string.IsNullOrEmpty(pathComponents)) // // this.btnCheckOut.Enabled = false; // // else // this.btnCheckOut.Enabled = true; // //} //} //else //fine mofidica if (Session["docInRisposta"] == null && Session["docInRisposta2"] == null) { if (!this.IsEnabledProfilazioneAllegati && this.IsSelectedTabAllegati && selectedFile.GetType() == typeof(DocsPaWR.Allegato)) { // La funzione di checkout esplicita da tab allegati è disabilitata se la profilazione allegati è disabilitata this.btnCheckOut.Enabled = false; } else { this.btnCheckOut.Enabled = this.UserEnabled; if (UIManager.UserManager.isFiltroAooEnabled()) { if (btnCheckOut.Enabled) { //DocsPaWR.Registro[] userRegistri = UIManager.UserManager.getListaRegistri(this.Page); DocsPaWR.Registro[] userRegistri = RoleManager.GetRoleInSession().registri; btnCheckOut.Enabled = UIManager.UserManager.verifyRegNoAOO(currentScheda, userRegistri); } } } } else { this.btnCheckOut.Enabled = false; if (Session["docInRisposta"] != null) { Session.Remove("docInRisposta"); } else if (Session["docInRisposta2"] != null) { Session.Remove("docInRisposta2"); } } } } } } // Abilitazione / disabilitazione pulsante salva file, // che viene comunque abilitato (se file presente) // indipendentemente dalle regole di abilitazione del checkin / checkout int size; if (selectedFile != null && Int32.TryParse(selectedFile.fileSize, out size)) { this.btnSave.Enabled = (size > 0); this.Refresh(currentScheda.systemId, selectedFile.docNumber); } if (DocumentManager.getSelectedRecord() != null && !string.IsNullOrEmpty(DocumentManager.getSelectedRecord().systemId)) { if (CheckInOutServices.IsCheckedOutDocument(DocumentManager.getSelectedRecord().systemId, DocumentManager.getSelectedRecord().docNumber, UIManager.UserManager.GetInfoUser(), true) || (selectedFile != null && selectedFile.inLibroFirma)) { this.btnCheckOut.Enabled = false; } } } }