Example #1
0
        private void PopulateContactMetadata(IEntityMetadata metadata, Contact resultItem)
        {
            var code = new EntityCode(EntityType.Person, GetCodeOrigin(), resultItem.regNumber);

            metadata.EntityType       = EntityType.Person;
            metadata.Name             = resultItem.name.PrintIfAvailable();
            metadata.OriginEntityCode = code;

            metadata.Properties[CompanyHouseVocabulary.Person.Name]         = resultItem.name.PrintIfAvailable();
            metadata.Properties[CompanyHouseVocabulary.Person.Officer_role] = resultItem.officer_role.PrintIfAvailable();
            metadata.Properties[CompanyHouseVocabulary.Person.Appointed_on] = resultItem.appointed_on.PrintIfAvailable();

            if (resultItem.address != null)
            {
                PopulatePersonAddressMetadata(metadata, CompanyHouseVocabulary.Person.Address, resultItem.address);
            }

            if (resultItem.date_of_birth != null)
            {
                metadata.Properties[CompanyHouseVocabulary.Person.Date_of_birth] = $"{resultItem.date_of_birth.year}.{resultItem.date_of_birth.month}.1";
            }

            metadata.Properties[CompanyHouseVocabulary.Person.Country_of_residence] = resultItem.country_of_residence.PrintIfAvailable();
            metadata.Properties[CompanyHouseVocabulary.Person.Occupation]           = resultItem.occupation.PrintIfAvailable();
            metadata.Properties[CompanyHouseVocabulary.Person.Nationality]          = resultItem.nationality.PrintIfAvailable();
            metadata.Properties[CompanyHouseVocabulary.Person.Resigned_on]          = resultItem.resigned_on.PrintIfAvailable();
        }
Example #2
0
        /// <inheritdoc/>
        public override IEnumerable <Clue> BuildClues(ExecutionContext context, IExternalSearchQuery query, IExternalSearchQueryResult result, IExternalSearchRequest request)
        {
            var resultItem = result.As <Result>();

            string id;

            if (request.QueryParameters.ContainsKey(Core.Data.Vocabularies.Vocabularies.CluedInOrganization.CodesCVR))
            {
                id = request.QueryParameters.GetValue(Core.Data.Vocabularies.Vocabularies.CluedInOrganization.CodesCVR).FirstOrDefault();
            }
            else
            {
                id = resultItem.Data.ActualAddress.AccessAddressId;
            }

            var code = new EntityCode(EntityType.Organization, CodeOrigin.CluedIn, id);

            var clue = new Clue(code, context.Organization);

            clue.Data.OriginProviderDefinitionId = Id;

            PopulateMetadata(clue.Data.EntityData, resultItem, request);

            yield return(clue);
        }
        public static FilterExpression BuildFromJson(EntityCode entity, string json)
        {
            if (String.IsNullOrWhiteSpace(json))
            {
                return(null);
            }
            var exp = new FilterExpression(entity);

            var    arr     = JsonConvert.DeserializeObject(json);
            string groupOp = "$and";

            if (arr is JObject)
            {
                if (((JObject)arr).Count > 0)
                {
                    var groupElm = ((JObject)arr).Properties().First();
                    groupOp = groupElm.Name;
                    var filters = (JArray)groupElm.Value;
                    ProcessFilterJson(filters, ref exp);
                }
            }
            else if (arr is JArray)
            {
                ProcessFilterJson((JArray)arr, ref exp);
            }
            exp.FilterGroup = groupOp == "$or"? FilterGroup.OR: FilterGroup.AND;

            return(exp);
        }
Example #4
0
        public Clue Create(MailboxModel value)
        {
            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            Clue clue;

            if (!string.IsNullOrEmpty(value.SmtpAddress))
            {
                clue = this.Create(EntityType.Account, value.SmtpAddress.ToLowerInvariant());

                if (value.Mailbox != null)
                {
                    var code = new EntityCode(EntityType.Account, ExchangeSharedMailboxNameConstants.CodeOrigin, value.Mailbox.Guid);
                    clue.Data.EntityData.Codes.Add(code);
                }
            }
            else if (value.Mailbox != null)
            {
                clue = this.Create(EntityType.Account, value.Mailbox.Guid.ToString().ToLowerInvariant());
            }
            else
            {
                throw new ArgumentException("MailboxModel is missing vital data", nameof(value));
            }

            return(clue);
        }
Example #5
0
        protected void AddEmailAddressEdge(
            Clue clue,
            EmailAddress address,
            EntityEdgeType edgeType)
        {
            if (address?.Id != null)
            {
                // TODO
                var entityCode = new EntityCode(
                    EntityType.Infrastructure.User,
                    ExchangeSharedMailboxNameConstants.CodeOrigin,
                    address.Id.UniqueId);

                var entityEdge = new EntityEdge(
                    EntityReference.CreateByKnownCode(clue.OriginEntityCode),
                    EntityReference.CreateByKnownCode(entityCode, address.Name),
                    edgeType);

                clue.Data.EntityData.OutgoingEdges.Add(entityEdge);
            }
            else if (address?.Address != null)
            {
                var entityCode = new EntityCode(
                    EntityType.Infrastructure.User,
                    ExchangeSharedMailboxNameConstants.CodeOrigin,
                    address.Address);

                var entityEdge = new EntityEdge(
                    EntityReference.CreateByKnownCode(clue.OriginEntityCode),
                    EntityReference.CreateByKnownCode(entityCode, address.Name),
                    edgeType);

                clue.Data.EntityData.OutgoingEdges.Add(entityEdge);
            }
        }
Example #6
0
        //public static void BuildEntity(int entityid, int defaultItemType)
        //{
        //    var dbentities = DB.EntityDBService.GetEntities(entityid);
        //    var dbentitiesScbhemas = DB.EntityDBService.GetEntitySchemas(entityid);
        //    DBEntity dbEntity = null;
        //    foreach (var ent in dbentities)
        //    {
        //        var name = ent.Get("name", "");
        //        dbEntity = BuildEntity(dbentities, dbentitiesScbhemas, ent);
        //        int entid = dbEntity.EntityId.Code;

        //        entities.Remove(entid);
        //        entities.Add(entid, dbEntity);
        //    }

        //    InitEntity(defaultItemType, dbEntity);
        //}
        public static T GetAs <T>(EntityCode id) where T : IDBEntity
        {
            if (entities.Keys.Contains(id.Code))
            {
                return((T)(entities[id.Code] as IDBEntity));
            }

            throw new EntityException($"Requested Entity {id.Code} # {id.Name} not found.");
        }
Example #7
0
 public WorldObject(EntityType objectType, uint objectId, EntityCode objectCode, Point location, EntityState state, byte interactionType)
 {
     Type            = objectType;
     Id              = objectId;
     Code            = objectCode;
     Location        = location;
     State           = state;
     InteractionType = interactionType;
 }
Example #8
0
        public void SetRelationValue(string relationField, EntityCode parentEntity, int parentId)
        {
            var res = this.Entity.GetEntity(parentEntity).Relations.Find(x => x.ChildName.Equals(this.EntityId) && x.ChildRefField.Name.ToLower() == relationField.ToLower());

            if (res != null)
            {
                this.SetValue(res.ChildRefField.Name, parentId);
            }
        }
Example #9
0
        public IActionResult Studio(string id = null)
        {
            if (!string.IsNullOrEmpty(id))
            {
                this.RequestQuery.EntityId = EntityCode.Get(id);
            }

            var page = new StudioPage(WebAppContext);

            return(CreatePageResult(page.GetPage(this.RequestQuery)));
        }
        protected override void Init()
        {
            RelatedEntityId = RequestQuery.EntityId;
            var RefEntity = Core.EntityMetaData.Get(RelatedEntityId);

            EntityField = RefEntity.GetFieldSchema(RequestQuery.RelationField);

            SourceEntityId = EntityField.RefObject;

            base.Init();
        }
Example #11
0
        /// <summary>Builds the clues.</summary>
        /// <param name="context">The context.</param>
        /// <param name="query">The query.</param>
        /// <param name="result">The result.</param>
        /// <param name="request">The request.</param>
        /// <returns>The clues.</returns>
        public override IEnumerable <Clue> BuildClues(ExecutionContext context, IExternalSearchQuery query, IExternalSearchQueryResult result, IExternalSearchRequest request)
        {
            var resultItem = result.As <CompanyNew>();

            var code = new EntityCode(EntityType.Organization, GetCodeOrigin(), resultItem.Data.company_number);

            var clue = new Clue(code, context.Organization);

            clue.Data.OriginProviderDefinitionId = Id;

            PopulateMetadata(clue.Data.EntityData, resultItem.Data);
            yield return(clue);
        }
        private ViewPage BuildRefForm(StackAppContext appContext, EntityCode refEntity)
        {
            var q = new RequestQueryString();

            q.EntityId = refEntity;
            var context = new EditFormContext(appContext, refEntity, q);

            context.Build();

            var builder = new PageBuilder.EntityPageBuilder();
            var page    = builder.CreateNewPage(context);

            return(page);
        }
Example #13
0
        public static EntityListDefinition GetEntityList(EntityCode entityId)
        {
            var entityList = DBService.Query("select * from t_entitylist where entityid=@entityid", new { entityid = entityId.Code });

            if (entityList.Count() > 0)
            {
                var l  = new EntityListDefinition();
                var db = entityList.First();
                l.EntityId      = db.Get("entityid", 0);
                l.Name          = db.Get("name", "");
                l.ItemIdField   = db.Get("idfield", "");
                l.ItemViewField = db.Get("viewfield", "");
                l.PageSize      = db.Get("recordlimit", 0);

                var orderby = db.Get("orderby", "");
                if (!string.IsNullOrEmpty(orderby))
                {
                    l.OrderByField = orderby.Split(',').ToList();
                }

                var additional = db.Get("additional", "");
                if (!string.IsNullOrEmpty(additional))
                {
                    l.AdditionalFields = additional.Split(',').ToList();
                }

                var layoutjson = db.Get("layoutjson", "");
                if (!string.IsNullOrEmpty(layoutjson))
                {
                    var tlist = TList.ParseFromJSON(layoutjson);
                    l.Layout = tlist;
                }

                l.DataSource = new FieldDataSource()
                {
                    Type   = DataSourceType.Entity,
                    Entity = l.EntityId
                };

                var filterpolicy = db.Get("filterpolicy", "");
                if (!string.IsNullOrEmpty(filterpolicy))
                {
                    l.FilterPolicy = FilterExpression.BuildFromJson(l.EntityId, filterpolicy);
                }

                return(l);
            }

            return(null);
        }
Example #14
0
        public IActionResult Desk(string id)
        {
            if (!string.IsNullOrEmpty(id))
            {
                this.RequestQuery.EntityId = EntityCode.Get(id);
            }

            var context = new DeskPageContext(this.WebAppContext, this.RequestQuery.EntityId, this.RequestQuery);

            context.Build();

            var builder = new EntityPageBuilder();
            var page    = builder.CreateDeskPage(context);

            return(CreatePageResult(page));
        }
Example #15
0
        public Clue Create(EmailAddress value)
        {
            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            var clue = this.Create(EntityType.Infrastructure.User, value.GetNormalizedAddress());

            if (!string.IsNullOrEmpty(value.Id?.UniqueId))
            {
                // TODO?
                var code = new EntityCode(EntityType.Infrastructure.User, ExchangeSharedMailboxNameConstants.CodeOrigin, value.Id.UniqueId);
                clue.Data.EntityData.Codes.Add(code);
            }

            return(clue);
        }
Example #16
0
        /// <summary>Populates the metadata.</summary>
        /// <param name="metadata">The metadata.</param>
        /// <param name="resultCompany">The result item.</param>
        private void PopulateMetadata(IEntityMetadata metadata, CompanyNew resultCompany)
        {
            var code = new EntityCode(EntityType.Organization, GetCodeOrigin(), resultCompany.company_number);

            metadata.EntityType = EntityType.Organization;

            metadata.OriginEntityCode = code;
            metadata.Name             = resultCompany.original_query_name.PrintIfAvailable();
            if (!string.IsNullOrEmpty(resultCompany.company_name))
            {
                metadata.Codes.Add(new EntityCode(EntityType.Organization, GetCodeOrigin(), resultCompany.company_name));
            }

            metadata.DisplayName = resultCompany.company_name.PrintIfAvailable();

            metadata.Properties[CompanyHouseVocabulary.Organization.CompanyNumber]                   = resultCompany.company_number.PrintIfAvailable();
            metadata.Properties[CompanyHouseVocabulary.Organization.Charges]                         = resultCompany.has_charges.PrintIfAvailable();
            metadata.Properties[CompanyHouseVocabulary.Organization.CompanyStatus]                   = resultCompany.company_status.PrintIfAvailable();
            metadata.Properties[CompanyHouseVocabulary.Organization.Type]                            = resultCompany.type.PrintIfAvailable();
            metadata.Properties[CompanyHouseVocabulary.Organization.Jurisdiction]                    = resultCompany.jurisdiction.PrintIfAvailable();
            metadata.Properties[CompanyHouseVocabulary.Organization.Has_been_liquidated]             = resultCompany.has_been_liquidated.PrintIfAvailable();
            metadata.Properties[CompanyHouseVocabulary.Organization.Has_insolvency_history]          = resultCompany.has_insolvency_history.PrintIfAvailable();
            metadata.Properties[CompanyHouseVocabulary.Organization.Registered_office_is_in_dispute] = resultCompany.registered_office_is_in_dispute.PrintIfAvailable();

            if (!string.IsNullOrEmpty(resultCompany.date_of_creation))
            {
                DateTimeOffset createdDate;

                if (DateTimeOffset.TryParse(resultCompany.date_of_creation, out createdDate))
                {
                    metadata.CreatedDate = createdDate;
                }

                metadata.Properties[CompanyHouseVocabulary.Organization.DateOfCreation] = resultCompany.date_of_creation;
            }

            if (resultCompany.registered_office_address != null)
            {
                PopulateOrgAddressMetadata(metadata, CompanyHouseVocabulary.Organization.Address, resultCompany);
            }
        }
Example #17
0
        private Clue Create([NotNull] EntityType type, [NotNull] EntityCode code)
        {
            if (type == null)
            {
                throw new ArgumentNullException(nameof(type));
            }
            if (code == null)
            {
                throw new ArgumentNullException(nameof(code));
            }

            var result = new Clue(code, this.organisationID);
            var data   = result.Data;

            data.OriginEntityCode            = code;
            data.EntityData.OriginEntityCode = code;
            data.EntityData.Codes.Add(code);
            data.EntityData.EntityType = type;

            return(result);
        }
Example #18
0
        protected PersonReference AddCreatedBy(
            Clue clue,
            EmailAddress address,
            VocabularyKey vocabularyKey)
        {
            if (address == null)
            {
                return(null);
            }

            PersonReference personReference;

            if (!string.IsNullOrEmpty(address.Address))
            {
                personReference = new PersonReference(address.Name, new EntityCode(EntityType.Infrastructure.User, ExchangeSharedMailboxNameConstants.CodeOrigin, address.Address));
            }
            else
            {
                personReference = new PersonReference(address.Name);
            }

            clue.Data.EntityData.Authors.Add(personReference);
            clue.Data.EntityData.LastChangedBy = personReference;

            this.WriteAddressProperty(clue.Data.EntityData, vocabularyKey, address);

            if (address.Address != null && !clue.Data.EntityData.OutgoingEdges.Any(e => e.EdgeType.Is(EntityEdgeType.CreatedBy)))
            {
                var fromCode = new EntityCode(EntityType.Infrastructure.User, ExchangeSharedMailboxNameConstants.CodeOrigin, address.Address);

                var fromEdge = new EntityEdge(
                    EntityReference.CreateByKnownCode(clue.OriginEntityCode),
                    EntityReference.CreateByKnownCode(fromCode, address.Name),
                    EntityEdgeType.CreatedBy);

                clue.Data.EntityData.OutgoingEdges.Add(fromEdge);
            }

            return(personReference);
        }
Example #19
0
        protected override void Execute(Context context)
        {
            var urlString = UrlString.Get(context);

            if (string.IsNullOrWhiteSpace(urlString))
            {
                return;
            }
            var urlParts   = urlString.Split('?');
            var parameters = HttpUtility.ParseQueryString(urlParts[1]);

            var entityTypeCode = int.Parse(parameters["etc"]);

            EntityCode.Set(context, entityTypeCode);
            IdString.Set(context, parameters["id"]);


            var retrieveMetadataChangesRequest = new RetrieveMetadataChangesRequest
            {
                Query = new EntityQueryExpression
                {
                    Criteria = new MetadataFilterExpression(LogicalOperator.And)
                    {
                        Conditions = { new MetadataConditionExpression("ObjectTypeCode", MetadataConditionOperator.Equals, entityTypeCode) }
                    },
                    Properties = new MetadataPropertiesExpression {
                        AllProperties = false, PropertyNames = { "LogicalName" }
                    }
                }
            };
            var response = (RetrieveMetadataChangesResponse)context.SystemService.Execute(retrieveMetadataChangesRequest);

            if (response.EntityMetadata.Count == 1)
            {
                EntityName.Set(context, response.EntityMetadata[0].LogicalName);
            }
        }
Example #20
0
        protected void PopulateMeetingMessage(Clue clue, IMeetingMessageModel <MeetingMessage> message, ExchangeSharedMailboxMeetingMessageVocabulary vocabulary, ExchangeService service)
        {
            var value = message.Object;
            var data  = clue.Data.EntityData;

            this.PopulateEmailMessage(clue, message, vocabulary, service);

            if (value.ExGetIfAvailable(v => v.ICalUid, null) != null)
            {
                data.Codes.Add(new EntityCode(EntityType.Calendar.Event, CodeOrigin.CluedIn.CreateSpecific("uid"), value.ICalUid));
            }

            message.LoadSchemaProperties(this.state);

            data.Properties[vocabulary.AssociatedAppointmentId] = value.ExPrintIfAvailable(v => v.AssociatedAppointmentId);
            data.Properties[vocabulary.IsDelegated]             = value.ExPrintIfAvailable(v => v.IsDelegated);
            data.Properties[vocabulary.IsOutOfDate]             = value.ExPrintIfAvailable(v => v.IsOutOfDate);
            data.Properties[vocabulary.HasBeenProcessed]        = value.ExPrintIfAvailable(v => v.HasBeenProcessed);
            data.Properties[vocabulary.IsOrganizer]             = value.ExPrintIfAvailable(v => v.IsOrganizer);
            data.Properties[vocabulary.ResponseType]            = value.ExPrintIfAvailable(v => v.ResponseType);
            data.Properties[vocabulary.ICalUid]           = value.ExPrintIfAvailable(v => v.ICalUid);
            data.Properties[vocabulary.ICalRecurrenceId]  = value.ExPrintIfAvailable(v => v.ICalRecurrenceId);
            data.Properties[vocabulary.ICalDateTimeStamp] = value.ExPrintIfAvailable(v => v.ICalDateTimeStamp);

            if (value.ExGetIfAvailable(v => v.AssociatedAppointmentId, null) != null)
            {
                var code = new EntityCode(EntityType.Calendar.Event, ExchangeSharedMailboxNameConstants.CodeOrigin, value.AssociatedAppointmentId.UniqueId);

                var fromEdge = new EntityEdge(
                    EntityReference.CreateByKnownCode(clue.OriginEntityCode),
                    EntityReference.CreateByKnownCode(code),
                    EntityEdgeType.Mentioned);

                clue.Data.EntityData.OutgoingEdges.Add(fromEdge);
            }
        }
Example #21
0
        protected Clue Create([NotNull] string type, [NotNull] string value)
        {
            if (type == null)
            {
                throw new ArgumentNullException(nameof(type));
            }
            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }
            if (string.IsNullOrWhiteSpace(type))
            {
                throw new ArgumentOutOfRangeException(nameof(type));
            }
            if (string.IsNullOrWhiteSpace(value))
            {
                throw new ArgumentOutOfRangeException(nameof(value));
            }

            var origin = (CodeOrigin)ExchangeSharedMailboxNameConstants.CodeOrigin;
            var code   = new EntityCode(type, origin, value);

            return(this.Create(type, code));
        }
 public EntityLayoutService(StackAppContext appContext, EntityCode entityId)
 {
     _EntityId   = entityId;
     _AppContext = appContext;
 }
Example #23
0
        protected override Clue MakeClueImpl(Incident input, Guid id)
        {
            var clue = _factory.Create("/Incident", input.Number, id);
            var data = clue.Data.EntityData;

            var code = new EntityCode("/Incident", "ServiceNow", input.SysId);

            data.Codes.Add(code);

            var vocab = new IncidentVocabulary();

            if (!string.IsNullOrEmpty(input.ShortDescription))
            {
                data.Name = input.ShortDescription;
            }

            if (!string.IsNullOrEmpty(input.Description))
            {
                data.Description = input.Description;
            }

            DateTimeOffset modifiedDate;

            if (DateTimeOffset.TryParse(input.SysUpdatedOn, out modifiedDate))
            {
                data.ModifiedDate = modifiedDate;
            }

            DateTimeOffset createdDate;

            if (DateTimeOffset.TryParse(input.SysCreatedOn, out createdDate))
            {
                data.CreatedDate = createdDate;
            }

            if (!string.IsNullOrEmpty(input.Category))
            {
                data.Tags.Add(new Tag(input.Category));
            }

            data.Properties[vocab.ActionStatus]           = input.ActionStatus.PrintIfAvailable();
            data.Properties[vocab.Active]                 = input.Active.PrintIfAvailable();
            data.Properties[vocab.ActivityDue]            = input.ActivityDue.PrintIfAvailable();
            data.Properties[vocab.AdditionalAssigneeList] = input.AdditionalAssigneeList.PrintIfAvailable();
            data.Properties[vocab.Approval]               = input.Approval.PrintIfAvailable();
            data.Properties[vocab.ApprovalHistory]        = input.ApprovalHistory.PrintIfAvailable();
            data.Properties[vocab.AssignedTo]             = input.AssignedTo.PrintIfAvailable();
            data.Properties[vocab.AssignmentGroup]        = input.AssignmentGroup.PrintIfAvailable();
            data.Properties[vocab.BusinessDuration]       = input.BusinessDuration.PrintIfAvailable();
            data.Properties[vocab.BusinessStc]            = input.BusinessStc.PrintIfAvailable();
            data.Properties[vocab.CalendarDuration]       = input.CalendarDuration.PrintIfAvailable();
            data.Properties[vocab.CalendarStc]            = input.CalendarStc.PrintIfAvailable();

            //Edge
            data.Properties[vocab.CallerId]       = input.CallerId.PrintIfAvailable();
            data.Properties[vocab.Category]       = input.Category.PrintIfAvailable();
            data.Properties[vocab.CausedBy]       = input.CausedBy.PrintIfAvailable();
            data.Properties[vocab.ChildIncidents] = input.ChildIncidents.PrintIfAvailable();
            data.Properties[vocab.CloseCode]      = input.CloseCode.PrintIfAvailable();
            data.Properties[vocab.ClosedAt]       = input.ClosedAt.PrintIfAvailable();

            //Edge
            data.Properties[vocab.ClosedBy]           = input.ClosedBy.PrintIfAvailable();
            data.Properties[vocab.CloseNotes]         = input.CloseNotes.PrintIfAvailable();
            data.Properties[vocab.Comments]           = input.Comments.PrintIfAvailable();
            data.Properties[vocab.ContactType]        = input.ContactType.PrintIfAvailable();
            data.Properties[vocab.Contract]           = input.Contract.PrintIfAvailable();
            data.Properties[vocab.CorrelationDisplay] = input.CorrelationDisplay.PrintIfAvailable();
            data.Properties[vocab.CorrelationId]      = input.CorrelationId.PrintIfAvailable();
            data.Properties[vocab.Description]        = input.Description.PrintIfAvailable();
            data.Properties[vocab.DueDate]            = input.DueDate.PrintIfAvailable();
            data.Properties[vocab.Escalation]         = input.Escalation.PrintIfAvailable();
            data.Properties[vocab.ExpectedStart]      = input.ExpectedStart.PrintIfAvailable();
            data.Properties[vocab.FollowUp]           = input.FollowUp.PrintIfAvailable();
            data.Properties[vocab.GroupList]          = input.GroupList.PrintIfAvailable();
            data.Properties[vocab.HoldReason]         = input.HoldReason.PrintIfAvailable();
            data.Properties[vocab.Impact]             = input.Impact.PrintIfAvailable();
            data.Properties[vocab.IncidentState]      = input.IncidentState.PrintIfAvailable();
            data.Properties[vocab.Knowledge]          = input.Knowledge.PrintIfAvailable();
            data.Properties[vocab.Location]           = input.Location.PrintIfAvailable();
            data.Properties[vocab.MadeSla]            = input.MadeSla.PrintIfAvailable();
            data.Properties[vocab.NeedsAttention]     = input.NeedsAttention.PrintIfAvailable();
            data.Properties[vocab.Notify]             = input.Notify.PrintIfAvailable();
            data.Properties[vocab.Number]             = input.Number.PrintIfAvailable();
            data.Properties[vocab.OpenedAt]           = input.OpenedAt.PrintIfAvailable();
            data.Properties[vocab.OpenedBy]           = input.OpenedBy.PrintIfAvailable();
            data.Properties[vocab.Order]             = input.Order.PrintIfAvailable();
            data.Properties[vocab.Parent]            = input.Parent.PrintIfAvailable();
            data.Properties[vocab.ParentIncident]    = input.ParentIncident.PrintIfAvailable();
            data.Properties[vocab.Priority]          = input.Priority.PrintIfAvailable();
            data.Properties[vocab.ProblemId]         = input.ProblemId.PrintIfAvailable();
            data.Properties[vocab.ReassignmentCount] = input.ReassignmentCount.PrintIfAvailable();
            data.Properties[vocab.ReopenCount]       = input.ReopenCount.PrintIfAvailable();
            data.Properties[vocab.ReopenedBy]        = input.ReopenedBy.PrintIfAvailable();
            data.Properties[vocab.ReopenedTime]      = input.ReopenedTime.PrintIfAvailable();
            data.Properties[vocab.ResolvedAt]        = input.ResolvedAt.PrintIfAvailable();
            data.Properties[vocab.ResolvedBy]        = input.ResolvedBy.PrintIfAvailable();
            data.Properties[vocab.Rfc]              = input.Rfc.PrintIfAvailable();
            data.Properties[vocab.RouteReason]      = input.RouteReason.PrintIfAvailable();
            data.Properties[vocab.Severity]         = input.Severity.PrintIfAvailable();
            data.Properties[vocab.ShortDescription] = input.ShortDescription.PrintIfAvailable();
            data.Properties[vocab.Skills]           = input.Skills.PrintIfAvailable();
            data.Properties[vocab.SlaDue]           = input.SlaDue.PrintIfAvailable();
            data.Properties[vocab.SnEsignDocument]  = input.SnEsignDocument.PrintIfAvailable();
            data.Properties[vocab.SnEsignEsignatureConfiguration] = input.SnEsignEsignatureConfiguration.PrintIfAvailable();
            data.Properties[vocab.State]        = input.State.PrintIfAvailable();
            data.Properties[vocab.Subcategory]  = input.Subcategory.PrintIfAvailable();
            data.Properties[vocab.SysClassName] = input.SysClassName.PrintIfAvailable();
            data.Properties[vocab.SysCreatedBy] = input.SysCreatedBy.PrintIfAvailable();
            data.Properties[vocab.SysCreatedOn] = input.SysCreatedOn.PrintIfAvailable();

            //Edge
            data.Properties[vocab.SysDomain]           = input.SysDomain.PrintIfAvailable();
            data.Properties[vocab.SysDomainPath]       = input.SysDomainPath.PrintIfAvailable();
            data.Properties[vocab.SysId]               = input.SysId.PrintIfAvailable();
            data.Properties[vocab.SysModCount]         = input.SysModCount.PrintIfAvailable();
            data.Properties[vocab.SysTags]             = input.SysTags.PrintIfAvailable();
            data.Properties[vocab.SysUpdatedBy]        = input.SysUpdatedBy.PrintIfAvailable();
            data.Properties[vocab.SysUpdatedOn]        = input.SysUpdatedOn.PrintIfAvailable();
            data.Properties[vocab.TaskEffectiveNumber] = input.TaskEffectiveNumber.PrintIfAvailable();
            data.Properties[vocab.TimeWorked]          = input.TimeWorked.PrintIfAvailable();
            data.Properties[vocab.UniversalRequest]    = input.UniversalRequest.PrintIfAvailable();
            data.Properties[vocab.UponApproval]        = input.UponApproval.PrintIfAvailable();
            data.Properties[vocab.UponReject]          = input.UponReject.PrintIfAvailable();
            data.Properties[vocab.Urgency]             = input.Urgency.PrintIfAvailable();
            data.Properties[vocab.UserInput]           = input.UserInput.PrintIfAvailable();
            data.Properties[vocab.WatchList]           = input.WatchList.PrintIfAvailable();
            data.Properties[vocab.WorkEnd]             = input.WorkEnd.PrintIfAvailable();
            data.Properties[vocab.WorkStart]           = input.WorkStart.PrintIfAvailable();

            if (!data.OutgoingEdges.Any())
            {
                _factory.CreateEntityRootReference(clue, EntityEdgeType.PartOf);
            }


            return(clue);
        }
Example #24
0
 public AssociateUserList GetCompanyRegionAndOfficeNameByCode(EntityCode entityCode)
 {
     return(_iProjectRepository.GetCompanyRegionOfficeNameByCode(entityCode));
 }
Example #25
0
 public void SetRelationShipInfo(EntityCode related, string field)
 {
     RefFieldName = field;
 }
Example #26
0
 public EditFormContext(StackAppContext context, EntityCode entity, RequestQueryString requestQuery) : base(context, entity, requestQuery)
 {
     this.Entity           = (IDBEntity)Core.EntityMetaData.Get(entity);
     this.EntityLayoutType = EntityLayoutType.Edit;
 }
Example #27
0
        protected override Clue MakeClueImpl(Employee input, Guid id)
        {
            var clue = _factory.Create("/Employee", input.EmployeeId, id);
            var data = clue.Data.EntityData;

            var vocab = new EmployeeVocabulary();

            //if (!string.IsNullOrEmpty(input.Degree))
            //{
            //    data.Name = input.Degree;
            //}

            if (input.Names != null)
            {
                if (input.Names.Any())
                {
                    data.Name = string.Format("{0} {1}", input.Names.First().FirstName, input.Names.First().LastName);
                    //foreach(var name in input.Names)
                    //{
                    //    data.Aliases.Add(name.);
                    //}
                }
            }

            if (input.EmploymentInfo != null)
            {
                data.Properties[vocab.BusinessTitle]    = input.EmploymentInfo.BusinessTitle.PrintIfAvailable();
                data.Properties[vocab.CustomGroupA]     = input.EmploymentInfo.CustomGroupA.PrintIfAvailable();
                data.Properties[vocab.CustomGroupB]     = input.EmploymentInfo.CustomGroupB.PrintIfAvailable();
                data.Properties[vocab.Department]       = input.EmploymentInfo.Department.PrintIfAvailable();
                data.Properties[vocab.EffectiveDate]    = input.EmploymentInfo.EffectiveDate.PrintIfAvailable();
                data.Properties[vocab.EmployeeClass]    = input.EmploymentInfo.EmployeeClass.PrintIfAvailable();
                data.Properties[vocab.EmployeeType]     = input.EmploymentInfo.EmployeeType.PrintIfAvailable();
                data.Properties[vocab.EmploymentStatus] = input.EmploymentInfo.EmploymentStatus.PrintIfAvailable();
                data.Properties[vocab.EventCode]        = input.EmploymentInfo.EventCode.PrintIfAvailable();
                data.Properties[vocab.EventDesc]        = input.EmploymentInfo.EventDesc.PrintIfAvailable();
                data.Properties[vocab.FlsaCode]         = input.EmploymentInfo.FlsaCode.PrintIfAvailable();
                data.Properties[vocab.JobCode]          = input.EmploymentInfo.JobCode.PrintIfAvailable();
                data.Properties[vocab.Location]         = input.EmploymentInfo.Location.PrintIfAvailable();
                data.Properties[vocab.PayGroup]         = input.EmploymentInfo.PayGroup.PrintIfAvailable();

                data.Properties[vocab.ReasonCode]       = input.EmploymentInfo.ReasonCode.PrintIfAvailable();
                data.Properties[vocab.ReasonDesc]       = input.EmploymentInfo.ReasonDesc.PrintIfAvailable();
                data.Properties[vocab.RegularTemporary] = input.EmploymentInfo.RegularTemporary.PrintIfAvailable();
                data.Properties[vocab.ServiceDate]      = input.EmploymentInfo.ServiceDate.PrintIfAvailable();

                data.Properties[vocab.StandardHours]   = input.EmploymentInfo.StandardHours.PrintIfAvailable();
                data.Properties[vocab.Supervisor]      = input.EmploymentInfo.Supervisor.PrintIfAvailable();
                data.Properties[vocab.TerminationDate] = input.EmploymentInfo.TerminationDate.PrintIfAvailable();

                data.Properties[vocab.WorkEmail] = input.EmploymentInfo.WorkEmail.PrintIfAvailable();
                if (input.EmploymentInfo.WorkEmail != null)
                {
                    var code = new EntityCode("/Employee", "CluedIn", input.EmploymentInfo.WorkEmail);
                    data.Codes.Add(code);
                }

                data.Properties[vocab.WorkersCompCode] = input.EmploymentInfo.WorkersCompCode.PrintIfAvailable();
                data.Properties[vocab.WorkPhone]       = input.EmploymentInfo.WorkPhone.PrintIfAvailable();
            }

            data.Properties[vocab.AlternateId] = input.AlternateId.PrintIfAvailable();
            data.Properties[vocab.EmployeeId]  = input.EmployeeId.PrintIfAvailable();

            if (input.EmployeePhoto != null)
            {
                if (!string.IsNullOrEmpty(input.EmployeePhoto.Uri))
                {
                    RawDataPart rawDataPart = null;

                    try
                    {
                        var download = new RestClient().DownloadData(new RestRequest(input.EmployeePhoto.Uri));

                        rawDataPart = new RawDataPart
                        {
                            Type       = "/RawData/PreviewImage",
                            MimeType   = input.EmployeePhoto.MimeType,
                            FileName   = input.EmployeePhoto.Uri,
                            RawDataMD5 = FileHashUtility.GetMD5Base64String(download),
                            RawData    = Convert.ToBase64String(download)
                        };

                        if (rawDataPart != null)
                        {
                            clue.Details.RawData.Add(rawDataPart);
                            clue.Data.EntityData.PreviewImage = new ImageReferencePart(rawDataPart, 255, 255);
                        }
                    }
                    catch (Exception exception)
                    {
                        _log.LogWarning(exception, "Could not download Trinet Photo Url for Employee");
                    }
                }

                if (!data.OutgoingEdges.Any())
                {
                    _factory.CreateEntityRootReference(clue, EntityEdgeType.PartOf);
                }
            }

            return(clue);
        }
Example #28
0
 public static async Task <List <Point> > GetPathToObjectWithOffset(this IPathingService pathingService, Game game, EntityCode entityCode, short xOffset, short yOffset, MovementMode movementMode)
 {
     return(await pathingService.GetPathToObjectWithOffset(game.MapId, Difficulty.Normal, game.Area, game.Me.Location, entityCode, xOffset, yOffset, movementMode));
 }
Example #29
0
 public RuleEvaluator(StackAppContext appContext, EntityCode entityId)
 {
     this._EntityId = entityId;
 }
Example #30
0
 public DetailFormContext(StackAppContext context, EntityCode entity, RequestQueryString requestQuery) : base(context, entity, requestQuery)
 {
     this.Entity           = (IDBEntity)Core.EntityMetaData.Get(entity);
     IsViewMode            = true;
     this.EntityLayoutType = EntityLayoutType.View;
 }