public T GetByKeys <T>(IEnumerable <string> ids, string select = null, string filter = null, string expand = null, string custom = null)
            where T : Entity
        {
            SOAPLikeEntityAPI <T> api = new SOAPLikeEntityAPI <T>(CurrentConfiguration);

            return(api.GetByKeys(ids, select, filter, expand, custom));
        }
        public T Get <T>(T entity)
            where T : Entity
        {
            string expand             = ComposeExpands(entity);
            SOAPLikeEntityAPI <T> api = new SOAPLikeEntityAPI <T>(CurrentConfiguration);

            if (entity.ID.HasValue)
            {
                T resultByID = api.GetById(entity.ID, expand: expand);
                resultByID.ReturnBehavior = entity.ReturnBehavior;
                return(resultByID);
            }
            string filter = ComposeFilter(entity);
            var    list   = api.GetList(filter: filter);

            if (list.Count > 1)
            {
                throw new Exception("More than one entity satisfies the condition.");
            }
            if (list.Count == 0)
            {
                throw new Exception("No entities satisfy the condition.");
            }
            T result = api.GetById(list[0].ID, expand: expand);

            result.ReturnBehavior = entity.ReturnBehavior;
            return(result);
        }
        /// <summary>
        /// Deletes the record by its keys.
        /// </summary>
        /// <exception cref="ApiException">Thrown when fails to make API call</exception>
        /// <param name="id">The session ID of the record.</param>
        /// <returns></returns>
        public void DeleteByKeys <T>(IEnumerable <string> ids)
            where T : Entity
        {
            SOAPLikeEntityAPI <T> api = new SOAPLikeEntityAPI <T>(CurrentConfiguration);

            api.DeleteByKeys(ids);
        }
        public T GetById <T>(Guid?id, string select = null, string filter = null, string expand = null, string custom = null)
            where T : Entity
        {
            SOAPLikeEntityAPI <T> api = new SOAPLikeEntityAPI <T>(CurrentConfiguration);

            return(api.GetById(id, select, filter, expand, custom));
        }
示例#5
0
        public T Put <T>(T entity)
            where T : Entity
        {
            SOAPLikeEntityAPI <T> api = new SOAPLikeEntityAPI <T>(CurrentConfiguration);

            return(api.PutEntity(entity, expand: ComposeExpands(entity), businessDate: BusinessDate));
        }
示例#6
0
        public File[] GetFiles <T>(T entity)
            where T : Entity
        {
            SOAPLikeEntityAPI <T> api = new SOAPLikeEntityAPI <T>(CurrentConfiguration);

            return(new File[] { });
        }
        public T Put <T>(T entity)
            where T : Entity
        {
            SOAPLikeEntityAPI <T> api = new SOAPLikeEntityAPI <T>(CurrentConfiguration);
            var result = api.PutEntity(entity, expand: ComposeExpands(entity), businessDate: BusinessDate);

            result.ReturnBehavior = entity.ReturnBehavior;
            return(result);
        }
        public T[] GetList <T>(T entity, int?top = null, int?skip = null)
            where T : Entity
        {
            string expand             = ComposeExpands(entity);
            SOAPLikeEntityAPI <T> api = new SOAPLikeEntityAPI <T>(CurrentConfiguration);

            string filter = ComposeFilterForGetList(entity);
            var    result = api.GetList(filter: filter, expand: expand, skip: skip, top: top);

            return(result.ToArray());
        }
        public ProcessResult GetProcessStatus(string invokeResult)
        {
            SOAPLikeEntityAPI <Entity> api = new SOAPLikeEntityAPI <Entity>(CurrentConfiguration);

            return(new ProcessResult()
            {
                Status = (ProcessStatus)api.GetProcessStatus(invokeResult),
                Seconds = GetProcessingSeconds(invokeResult),
                Message = invokeResult
            });
        }
        public void PutFiles <T>(List <string> keys, File[] files)
            where T : Entity
        {
            if (files.Length > 1)
            {
                throw new NotImplementedException("Only one file attachment at a time is supported.");
            }
            SOAPLikeEntityAPI <T> api = new SOAPLikeEntityAPI <T>(CurrentConfiguration);

            api.PutFile(keys, files[0].Name, files[0].Content);
        }
示例#11
0
        public void Delete <T>(T entity)
            where T : Entity
        {
            SOAPLikeEntityAPI <T> api = new SOAPLikeEntityAPI <T>(CurrentConfiguration);

            if (entity.ID != null)
            {
                api.DeleteById(entity.ID);
            }
            else
            {
                api.DeleteById(Get(entity).ID);
            }
        }
        public string Invoke <T>(EntityAction <T> action)
            where T : Entity
        {
            SOAPLikeEntityAPI <T> api = new SOAPLikeEntityAPI <T>(CurrentConfiguration);
            string invokeResult       = api.InvokeAction(action);

            if (ProcessStartTime.ContainsKey(invokeResult))
            {
            }
            else
            {
                ProcessStartTime.Add(invokeResult, DateTime.Now);
            }
            return(invokeResult);
        }
示例#13
0
        public T Get <T>(T entity)
            where T : Entity
        {
            string expand             = ComposeExpands(entity);
            SOAPLikeEntityAPI <T> api = new SOAPLikeEntityAPI <T>(CurrentConfiguration);

            if (entity.ID.HasValue)
            {
                return(api.GetById(entity.ID, expand: expand));
            }
            string filter = ComposeFilter(entity);
            var    result = api.GetList(filter: filter);

            if (result.Count > 1)
            {
                throw new Exception("More than one entity satisfies the condition.");
            }

            return(api.GetById(result.FirstOrDefault().ID, expand: expand));
        }
        /// <summary>
        /// Deletes the record by its session identifier.
        /// </summary>
        /// <exception cref="ApiException">Thrown when fails to make API call</exception>
        /// <param name="id">The session ID of the record.</param>
        /// <returns></returns>
        public void DeleteById <T>(Guid?id) where T : Entity
        {
            SOAPLikeEntityAPI <T> api = new SOAPLikeEntityAPI <T>(CurrentConfiguration);

            api.DeleteById(id);
        }