コード例 #1
0
        public svMainDoc GetMainDoc(string stGuidConnect, string stGuidCard)
        {
            svMainDoc oMainDoc = new svMainDoc();
            //Controllo se non è stato aperto già un File di Log
            bool newcon = false;

            //istanzio l'oggetto SvAol.Session
            SVAOLLib.Session oSession = new SVAOLLib.Session();
            try
            {
                if (stGuidConnect.Length != 0)
                {
                    //Assegno la stringa di connessione
                    oSession.GUIDconnect = stGuidConnect;

                    // dichiaro l'oggetto SvAol.Card per la Card
                    SVAOLLib.Card oCard = new SVAOLLib.Card();

                    //Imposto la scheda con GUID Card.
                    oCard.GuidCard    = _Logger.FormatID(stGuidCard);
                    oCard.GUIDconnect = stGuidConnect;
                    oCard.LoadFromGuid();
                    SVAOLLib.Document oDocumento = oCard.Document;

                    if (oDocumento.FileSize > 0)
                    {
                        oMainDoc.Filename  = oDocumento.Name + "." + oDocumento.Extension;
                        oMainDoc.Extension = oDocumento.Extension;
                        if (oDocumento.IsSigned == 0 && oDocumento.IsSignedPdf == 0)
                        {
                            oMainDoc.IsSigned = false;

                            oMainDoc.oByte = (byte[])(oDocumento.ViewAsArray(0, 0));
                        }
                        else
                        {
                            oMainDoc.IsSigned = true;
                            oMainDoc.oByte    = (byte[])(oDocumento.GetSignedDocumentAsArray());
                        }
                    }
                }
            }
            catch (Exception e)
            {
                throw new Exception(String.Format("{0}>>{1}>>{2}", "GetMainDoc", e.Source, e.Message), e);
            }
            finally
            {
                if (newcon)
                {
                    oSession.Logout();
                }
            }
            return(oMainDoc);
        }
コード例 #2
0
        public void CopyAttachment(string stGuidConnect, string stGuidCardFrom, string stGuidCardTo)
        {
            //Controllo se non è stato aperto già un File di Log
            bool newcon = false;

            //istanzio l'oggetto SvAol.Session
            SVAOLLib.Session oSession = new SVAOLLib.Session();
            try
            {
                if (stGuidConnect.Length != 0)
                {
                    //Assegno la stringa di connessione
                    oSession.GUIDconnect = stGuidConnect;

                    // dichiaro l'oggetto SvAol.Card per la Card
                    SVAOLLib.Card oCard = new SVAOLLib.Card();

                    //Imposto la scheda con GUID Card.
                    oCard.GuidCard    = _Logger.FormatID(stGuidCardFrom);
                    oCard.GUIDconnect = stGuidConnect;
                    oCard.LoadFromGuid();
                    SVAOLLib.Attachments oAttachments = oCard.Attachments;

                    foreach (SVAOLLib.Attachment oAttachment in oAttachments)
                    {
                        if (oAttachment.IsInternal == 0)
                        {
                            SVAOLLib.Attachment oAttachmentNew = new SVAOLLib.Attachment();
                            oAttachmentNew.GUIDconnect = stGuidConnect;
                            oAttachmentNew.GuidCard    = stGuidCardTo;
                            oAttachmentNew.Name        = oAttachment.Name;
                            oAttachmentNew.Note        = oAttachment.Note;
                            oAttachmentNew.IsInternal  = 0;
                            var oAttach = oAttachment.ViewAsArray();
                            oAttachmentNew.InsertExternal(oAttach, oAttach.GetUpperBound(0) + 1, 0, oAttach.GetUpperBound(0) + 1, 0);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                throw new Exception(String.Format("{0}>>{1}>>{2}", "GetMainDoc", e.Source, e.Message), e);
            }
            finally
            {
                if (newcon)
                {
                    oSession.Logout();
                }
            }
        }