Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="TEntity"></typeparam>
        /// <param name="entityId"></param>
        /// <param name="pc"></param>
        /// <param name="queryString"></param>
        /// <returns></returns>
        public TEntity GetDetails <TEntity>(long entityId, ArrayList queryString)
            where TEntity : ParaEntityBaseProperties, new()
        {
            if (typeof(TEntity) != typeof(Folder))
            {
                return(ApiUtils.ApiGetEntity <TEntity>(Credentials, entityId, queryString));
            }

            var folder = new TEntity();
            var ar     = ApiCallFactory.ObjectGetDetail <TEntity>(Credentials, entityId);

            if (ar.HasException == false)
            {
                folder             = ParaEntityParser.EntityFill <TEntity>(ar.XmlReceived);
                folder.FullyLoaded = true;
            }
            else
            {
                folder.FullyLoaded = false;
                folder.Id          = 0;
            }

            folder.ApiCallResponse = ar;
            return(folder);
        }
Esempio n. 2
0
        public static TFolder GetDetails(XmlDocument xml)
        {
            var folder = ParaEntityParser.EntityFill <TFolder>(xml);

            folder.FullyLoaded = true;

            folder.ApiCallResponse.XmlReceived = xml;
            folder.ApiCallResponse.Id          = folder.Id;

            return(folder);
        }
        public static TEntity GetDetails(XmlDocument xml)
        {
            var entity = ParaEntityParser.EntityFill <TEntity>(xml);

            entity.FullyLoaded = true;

            entity.ApiCallResponse.XmlReceived = xml;
            entity.ApiCallResponse.Id          = entity.Id;

            entity.IsDirty = false;
            return(entity);
        }
Esempio n. 4
0
        /// <summary>
        /// Retrieve the transcript for a particualr chat
        /// </summary>
        /// <param name="chatId"></param>
        /// <param name="paraCredentials"></param>
        /// <returns>A list of chat messages</returns>
        public List <ChatMessage> GetChatTranscript(long chatId)
        {
            var ar = ApiCallFactory.ChatTranscriptGetDetail(Credentials, chatId);

            if (ar.HasException == false)
            {
                return(ParaEntityParser.EntityFill <ParaObjects.Chat>(ar.XmlReceived).Transcript);
            }
            else
            {
                throw new Exception(ar.ExceptionDetails);
            }
        }
        public static TEntity Schema(ParaCredentials pc)
        {
            var entity = new TEntity();
            var ar     = ApiCallFactory.ObjectGetSchema <TEntity>(pc);

            if (ar.HasException == false)
            {
                var purgedSchema = ApiUtils.RemoveStaticFieldsNodes(ar.XmlReceived);
                entity = ParaEntityParser.EntityFill <TEntity>(purgedSchema);
            }

            entity.ApiCallResponse = ar;
            return(entity);
        }
Esempio n. 6
0
        /// <summary>
        /// Create a new entity object. This object is not saved to the server until you call Insert with it.
        /// </summary>
        /// <typeparam name="TEntity"></typeparam>
        /// <returns></returns>
        public TEntity Create <TEntity>() where TEntity : ParaEntityBaseProperties, new()
        {
            var entity = new TEntity();
            var ar     = ApiCallFactory.ObjectGetSchema <TEntity>(Credentials);

            if (ar.HasException == false)
            {
                var purgedSchema = ApiUtils.RemoveStaticFieldsNodes(ar.XmlReceived);
                entity = ParaEntityParser.EntityFill <TEntity>(purgedSchema);
            }

            entity.ApiCallResponse = ar;
            return(entity);
        }
Esempio n. 7
0
        /// <summary>
        /// Internal method to attach a file for the Parature entity
        /// </summary>
        /// <typeparam name="TEntity"></typeparam>
        /// <param name="pc"></param>
        /// <param name="attachment"></param>
        /// <returns></returns>
        internal static Attachment UploadFile <TEntity>(ParaCredentials pc, System.Net.Mail.Attachment attachment)
            where TEntity : ParaEntity
        {
            var postUrlR     = ApiCallFactory.FileUploadGetUrl <TEntity>(pc);
            var uploadUrlDoc = postUrlR.XmlReceived;
            var postUrl      = AttachmentGetUrlToPost(uploadUrlDoc);

            var upresp = ApiCallFactory.FilePerformUpload(postUrl, attachment);

            var attaDoc = upresp.XmlReceived;

            var attach = ParaEntityParser.EntityFill <Attachment>(attaDoc);

            return(attach);
        }
Esempio n. 8
0
        private static TFolder FillDetails(Int64 folderId, ParaCredentials creds)
        {
            var folder = new TFolder();
            var ar     = ApiCallFactory.ObjectGetDetail <TFolder>(creds, folderId);

            if (ar.HasException == false)
            {
                folder             = ParaEntityParser.EntityFill <TFolder>(ar.XmlReceived);
                folder.FullyLoaded = true;
            }
            else
            {
                folder.FullyLoaded = false;
                folder.Id          = 0;
            }

            folder.ApiCallResponse = ar;
            return(folder);
        }
Esempio n. 9
0
        /// <summary>
        /// Retrieve the details for a specific Parature module entity with custom query string arguments
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="pc"></param>
        /// <param name="entityId"></param>
        /// <returns></returns>
        internal static T ApiGetEntity <T>(ParaCredentials pc, long entityId, ArrayList arl) where T : ParaEntityBaseProperties, new()
        {
            var entity = new T();
            var req    = ApiCallFactory.ObjectGetDetail <T>(pc, entityId, arl);

            if (req.HasException == false)
            {
                entity             = ParaEntityParser.EntityFill <T>(req.XmlReceived);
                entity.FullyLoaded = true;
            }
            else
            {
                entity.FullyLoaded = false;
                entity.Id          = 0;
            }
            entity.ApiCallResponse = req;
            entity.IsDirty         = false;
            return(entity);
        }
Esempio n. 10
0
        private static ParaObjects.Chat FillTranscriptDetails(Int64 chatid, ParaCredentials paraCredentials)
        {
            //Because chat transcripts return a Chat object with just a list messages, we'll deserialize the transcript into a chat object
            var chat = new ParaObjects.Chat();

            var ar = ApiCallFactory.ChatTranscriptGetDetail(paraCredentials, chatid);

            if (ar.HasException == false)
            {
                chat             = ParaEntityParser.EntityFill <ParaObjects.Chat>(ar.XmlReceived);
                chat.FullyLoaded = true;
            }
            else
            {
                chat.FullyLoaded = false;
                chat.Id          = 0;
            }
            chat.ApiCallResponse = ar;
            chat.IsDirty         = false;
            return(chat);
        }
Esempio n. 11
0
        /// <summary>
        /// Internal method to handle the upload of a file to Parature.
        /// </summary>
        internal static Attachment UploadFile <TEntity>(ParaCredentials pc, Byte[] attachment,
                                                        String contentType, String fileName) where TEntity : ParaEntity
        {
            Attachment attach;
            var        postUrl = "";

            postUrl = AttachmentGetUrlToPost(ApiCallFactory.FileUploadGetUrl <TEntity>(pc).XmlReceived);

            if (String.IsNullOrEmpty(postUrl) == false)
            {
                var uploadResponse =
                    ApiCallFactory.FilePerformUpload(postUrl, attachment, contentType, fileName)
                    .XmlReceived;

                attach = new Attachment();

                var uploadResult = ParaEntityParser.EntityFill <UploadResult>(uploadResponse);

                if (!string.IsNullOrEmpty(uploadResult.Error))
                {
                    //There was an error uploading
                    attach.HasException = true;
                    attach.Error        = uploadResult.Error;
                }
                else
                {
                    attach.Name = uploadResult.Result.File.FileName;
                    attach.Guid = uploadResult.Result.File.Guid;
                }
            }
            else
            {
                attach = new Attachment();
            }
            return(attach);
        }
Esempio n. 12
0
        public static TEntity GetDetails(XmlDocument xml)
        {
            var entity = ParaEntityParser.EntityFill <TEntity>(xml);

            return(entity);
        }