public List <dynamic> GetAttachmentExt(string stGuidConnect, SVAOLLib.Card gCard, List <string> idAttachments, Boolean addBinary = true) { //Controllo se non è stato aperto già un File di Log bool newcon = false; //controllo se sono già connesso, in caso contrario mi connetto e ritorno la stringa di connessione SVAOLLib.Session oSession = new SVAOLLib.Session(); oSession.GUIDconnect = stGuidConnect; SVAOLLib.Attachment oAttachmentFrom = new SVAOLLib.Attachment(); oAttachmentFrom.GUIDconnect = stGuidConnect; oAttachmentFrom.GuidCard = gCard.GuidCard; dynamic objAttachment; Object aBinaryData = new Object(); List <dynamic> objAttachments = new List <dynamic>(); try { int iCount; object[,] attachments = (object[, ])gCard.AttachmentsAsArray; for (iCount = 1; iCount < attachments.GetLength(0); iCount++) { if (Convert.ToInt32(attachments[iCount, 3]) == 0) { objAttachment = new DynamicDictionary(); objAttachment.id = attachments[iCount, 1].ToString(); objAttachment.nomefile = attachments[iCount, 4].ToString(); objAttachment.note = attachments[iCount, 2].ToString(); objAttachment.binarycontent = Convert.ToBase64String((byte[])(aBinaryData)); objAttachments.Add(objAttachment); } } return(objAttachments); } catch (Exception e) { _Logger.WriteOnLog(_sLogId, "ERRORE NELL'ESECUZIONE DI : GetAttachmentExt", 1); _Logger.WriteOnLog(_sLogId, e.Source + " " + e.Message, 1); return(null); throw new Exception(String.Format("{0}>>{1}>>{2}", "GetAttachmentExt", e.Source, e.Message), e); } finally { if (newcon) { oSession.Logout(); } } }
public Boolean SetInternalAttach(string stGuidConnect, string stguidCardTo, string sGUIDAttachment, string note, string internalNote, bool bBiunivoc) { //Controllo se non è stato aperto già un File di Log //è la variabile da ritornare Boolean SetCirAtt = false; try { //controllo se sono già connesso, in cvaso contrario mi connetto e ritorno la stringa di connessione if (stGuidConnect.Length != 0) { stguidCardTo = _Logger.FormatID(stguidCardTo); SVAOLLib.Card oCard = new SVAOLLib.Card();; oCard.GUIDconnect = stGuidConnect; oCard.GuidCard = stguidCardTo; oCard.LoadFromGuid(); string sNumProt = this.GetSingleFieldValue(stGuidConnect, sGUIDAttachment, 0).ToString(); SVAOLLib.Attachment oAttachmentTo; // Se la GUIDCard non è formattata lo faccio ora sGUIDAttachment = _Logger.FormatID(sGUIDAttachment); // Imposto l'allegato della scheda oAttachmentTo = new SVAOLLib.Attachment(); oAttachmentTo.Archive = oCard.Archive; oAttachmentTo.GuidCard = stguidCardTo; oAttachmentTo.GUIDconnect = stGuidConnect; oAttachmentTo.GUIDAttachment = sGUIDAttachment; oAttachmentTo.Note = note; oAttachmentTo.InternalNote = internalNote; oAttachmentTo.IsInternal = 1; oAttachmentTo.Name = sNumProt; int iBiunivoc = bBiunivoc ? 1 : 0; oAttachmentTo.InsertInternal(iBiunivoc); SetCirAtt = true; } } catch (Exception e) { throw new Exception(String.Format("{0}>>{1}>>{2}", "ERRORE : SetInternalAttach: " + e.StackTrace, e.Source, e.Message), e); } finally { } return(SetCirAtt); }
public static Boolean SetExternalAttach(string stGuidConnect, string stguidCardTo, string stAttachName, object aBinaryData, string note, string LogId) { //Controllo se non è stato aperto già un File di Log bool newcon = false; //è la variabile da ritornare Boolean SetCirAtt = false; //inizializzo l'oggetto session SVAOLLib.Session oSession = new SVAOLLib.Session(); try { //controllo se sono già connesso, in cvaso contrario mi connetto e ritorno la stringa di connessione if (stGuidConnect.Length != 0) { SVAOLLib.Attachment oAttachmentTo; // Se la GUIDCard non è formattata lo faccio ora stguidCardTo = CardManager.FormatID(stguidCardTo, LogId); // Imposto l'allegato della scheda oAttachmentTo = new SVAOLLib.Attachment(); oAttachmentTo.GuidCard = stguidCardTo; oAttachmentTo.GUIDconnect = stGuidConnect; oAttachmentTo.Note = note; oAttachmentTo.IsInternal = 0; oAttachmentTo.Name = stAttachName; // Inserisco l'allegato esterno della Card FROM nella Card TO. int q = ((byte[])aBinaryData).GetUpperBound(0) + 1; oAttachmentTo.InsertExternal(aBinaryData, q, 0, q, 0, 0); SetCirAtt = true; } } catch (Exception e) { throw new Exception(String.Format("{0}>>{1}>>{2}", "ERRORE : SetCircleAttach", e.Source, e.Message), e); } finally { if (newcon) { oSession.Logout(); } } return(SetCirAtt); }