Пример #1
0
 private void MenuSyncGoldPatron_Click(object sender, RoutedEventArgs e)
 {
     var gold = sender as MenuItem;
     PersonId person_id = new PersonId();
     person_id.person_id = gold.Tag.ToString();
     ApplicationPresenter.Manager.SyncGoldPatron(person_id);
 }
Пример #2
0
        public PersonEntity Find(PersonId id)
        {
            PersonDto dto = _personDao.Find(id.Value);

            if (dto == null)
            {
                return null;
            }

            PersonProxy person = new PersonProxy(dto);

            return person;
        }
Пример #3
0
 public PersonInfo(PersonId id, Name name)
 {
     Id   = id;
     Name = name;
 }
Пример #4
0
 private static List <Guid> GetRelations(PersonId id, RelationType relationType, TreeRelations treeRelations)
 {
     return(treeRelations.Relations.Where(r => r.From == id && r.RelationType == relationType)
            .Select(t => t.To.Value).ToList());
 }
        protected override GetPersonaNotesResponse InternalExecute()
        {
            GetPersonaNotesResponse getPersonaNotesResponse = new GetPersonaNotesResponse();
            ADObjectId adobjectId = null;
            PersonId   personId   = null;

            if (string.IsNullOrEmpty(this.personaId))
            {
                if (this.emailAddress == null || string.IsNullOrEmpty(this.emailAddress.EmailAddress))
                {
                    this.WriteTrace("Valid PersonaId or EmailAddress needs to be specified.", new object[0]);
                    return(getPersonaNotesResponse);
                }
                string text = this.emailAddress.EmailAddress;
                personId = Person.FindPersonIdByEmailAddress(base.CallContext.SessionCache.GetMailboxIdentityMailboxSession(), new XSOFactory(), text);
                if (personId == null)
                {
                    ProxyAddress proxyAddress = null;
                    if (!ProxyAddress.TryParse(text, out proxyAddress))
                    {
                        this.WriteTrace("EmailAddress is not valid - {0}", new object[]
                        {
                            text
                        });
                        return(getPersonaNotesResponse);
                    }
                    PropertyDefinition[] array = new PropertyDefinition[]
                    {
                        ADObjectSchema.Id
                    };
                    ADRawEntry adrawEntry = this.adRecipientSession.FindByProxyAddress(proxyAddress, array);
                    if (adrawEntry == null)
                    {
                        this.WriteTrace("Contact not found with specified EmailAddress - {0}", new object[]
                        {
                            text
                        });
                        return(getPersonaNotesResponse);
                    }
                    object[] properties = adrawEntry.GetProperties(array);
                    if (properties == null || properties.Length == 0)
                    {
                        this.WriteTrace("Contact not found with specified EmailAddress - {0}", new object[]
                        {
                            text
                        });
                        return(getPersonaNotesResponse);
                    }
                    adobjectId = (ADObjectId)properties[0];
                }
            }
            else if (IdConverter.EwsIdIsActiveDirectoryObject(this.personaId))
            {
                adobjectId = IdConverter.EwsIdToADObjectId(this.personaId);
            }
            else
            {
                personId = IdConverter.EwsIdToPersonId(this.personaId);
            }
            List <BodyContentAttributedValue> list = null;

            if (adobjectId != null)
            {
                list = this.GetNotesFromActiveDirectory(adobjectId);
            }
            else if (personId != null)
            {
                list = this.GetNotesFromStore(personId);
            }
            if (list != null && list.Count > 0)
            {
                getPersonaNotesResponse.PersonaWithNotes = new Persona
                {
                    PersonaId = new ItemId(),
                    PersonaId =
                    {
                        Id = this.personaId
                    },
                    Bodies = list.ToArray()
                };
            }
            return(getPersonaNotesResponse);
        }
Пример #6
0
 public Saying(PersonId personId)
 {
     this.PersonId = personId;
 }
Пример #7
0
 public CreatePerson(PersonId id, Name name)
 {
     Id   = id;
     Name = name;
 }
 public bool Exist(PersonId person)
 {
     return(Database.Persons.Any(a => a.Id == person.SurrogateId.ValueOrFailure()));
 }
Пример #9
0
        static Case parseCase(XElement element)
        {
            // ReSharper disable once UseObjectOrCollectionInitializer
            var result = new Case
            {
                Id = (CaseId)int.Parse(element.Attribute("ixBug").Value)
            };

            result.Parent          = CaseId.FromInt(getInt(element.Element(CaseColumns.Parent)));
            result.Children        = getCaseIds(element.Element(CaseColumns.Children));
            result.Duplicates      = getCaseIds(element.Element(CaseColumns.Duplicates));
            result.Original        = CaseId.FromInt(getInt(element.Element(CaseColumns.Original)));
            result.Related         = getCaseIds(element.Element(CaseColumns.Related));
            result.Tags            = getTags(element); // TODO: Write an integration test for tags.
            result.IsOpen          = getBool(element.Element(CaseColumns.IsOpen));
            result.Title           = getString(element.Element(CaseColumns.Title));
            result.OriginalTitle   = getString(element.Element(CaseColumns.OriginalTitle));
            result.LatestSummary   = getString(element.Element(CaseColumns.LatestSummary));
            result.LatestTextEvent = EventId.FromInt(getInt(element.Element(CaseColumns.LatestTextEvent)));
            result.Project         = getProject(element);
            result.Area            = new Area
            {
                Id   = getInt(element.Element(CaseColumns.AreaId)),
                Name = getString(element.Element(CaseColumns.Area))
            };
            result.AssignedTo = new Person
            {
                Id       = (PersonId)(getInt(element.Element(CaseColumns.AssignedToPersonId))),
                FullName = getString(element.Element(CaseColumns.AssignedTo)),
                Email    = getString(element.Element(CaseColumns.AssignedToEmail))
            };
            result.OpenedBy     = (PersonId)getInt(element.Element(CaseColumns.OpenedByPersonId));
            result.ResolvedBy   = PersonId.FromInt(getInt(element.Element(CaseColumns.ResolvedByPersonId)));
            result.ClosedBy     = PersonId.FromInt(getInt(element.Element(CaseColumns.ClosedByPersonId)));
            result.LastEditedBy = PersonId.FromInt(getInt(element.Element(CaseColumns.LastEditedByPersonId)));
            result.Status       = new Status
            {
                Id   = (StatusId)getInt(element.Element(CaseColumns.StatusId)),
                Name = getString(element.Element(CaseColumns.Status))
            };
            result.Priority = new Priority
            {
                Id   = getInt(element.Element(CaseColumns.PriorityId)),
                Name = getString(element.Element(CaseColumns.Priority))
            };
            result.FixFor = new Milestone
            {
                Id   = (MilestoneId)getInt(element.Element(CaseColumns.FixForMilestoneId)),
                Name = getString(element.Element(CaseColumns.FixFor)),
                Date = getDate(element.Element(CaseColumns.FixForDate))
            };
            result.Version  = getString(element.Element(CaseColumns.Version));
            result.Computer = getString(element.Element(CaseColumns.Computer));
            result.EstimateHoursOriginal = getDecimal(element.Element(CaseColumns.EstimateHoursOriginal));
            result.EstimateHoursCurrent  = getDecimal(element.Element(CaseColumns.EstimateHoursCurrent));
            result.ElapsedHours          = getDecimal(element.Element(CaseColumns.ElapsedHours));
            result.Occurrences           = getInt(element.Element(CaseColumns.Occurrences)) + 1;
            result.CustomerEmail         = getString(element.Element(CaseColumns.CustomerEmail));
            result.Mailbox  = MailboxId.FromInt(getInt(element.Element(CaseColumns.MailboxId)));
            result.Category = new Category
            {
                Id   = getInt(element.Element(CaseColumns.CategoryId)),
                Name = getString(element.Element(CaseColumns.Category))
            };
            result.OpenedDate          = getDate(element.Element(CaseColumns.OpenedDate));
            result.ResolvedDate        = getDate(element.Element(CaseColumns.ResolvedDate));
            result.ClosedDate          = getDate(element.Element(CaseColumns.ClosedDate));
            result.LatestEvent         = EventId.FromInt(getInt(element.Element(CaseColumns.LatestEventId)));
            result.LastUpdatedDate     = getDate(element.Element(CaseColumns.LastUpdatedDate));
            result.Replied             = getBool(element.Element(CaseColumns.Replied));
            result.Forwarded           = getBool(element.Element(CaseColumns.Forwarded));
            result.Ticket              = getString(element.Element(CaseColumns.Ticket));
            result.DiscussionTopic     = DiscussionId.FromInt(getInt(element.Element(CaseColumns.DiscussionTopicId)));
            result.DueDate             = getDate(element.Element(CaseColumns.DueDate));
            result.ReleaseNotes        = getString(element.Element(CaseColumns.ReleaseNotes));
            result.LastViewedEvent     = EventId.FromInt(getInt(element.Element(CaseColumns.LastViewedEventId)));
            result.LastViewedDate      = getDate(element.Element(CaseColumns.LastViewedDate));
            result.ScoutDescription    = getString(element.Element(CaseColumns.ScoutDescription));
            result.ScoutMessage        = getString(element.Element(CaseColumns.ScoutMessage));
            result.ScoutStopReporting  = getBool(element.Element(CaseColumns.ScoutStopReporting));
            result.ScoutLastOccurrence = getDate(element.Element(CaseColumns.ScoutLastOccurrence));
            result.Subscribed          = getBool(element.Element(CaseColumns.Subscribed));

            //var operations = element.Attribute("operations");
            return(result);
        }
Пример #10
0
 /// <summary>
 /// Create a new person
 /// </summary>
 /// <param name="firstName">Person's first name</param>
 /// <param name="lastName">Person's last name</param>
 /// <param name="birthDate">Person's birth date</param>
 /// <subject>person</subject>
 /// <action>create</action>
 public CreatePerson(string firstName, string lastName, DateTime birthDate)
 {
     Id        = PersonId.NewId();
     Name      = new Name(firstName, lastName);
     BirthDate = birthDate;
 }
Пример #11
0
 public string GetPersonId()
 {
     return(PersonId?.ToString());
 }
 public Task <PersonName?> GetNameAsync(PersonId id)
 {
     return(Task.FromResult(_personNames.TryGetValue(id, out var personName) ? personName : default));
Пример #13
0
 public GetPersonQuery(string requesterUserAuthId, TreeId treeId, PersonId personId) : base(requesterUserAuthId, treeId)
 {
     PersonId = personId;
 }
Пример #14
0
        /// <summary>
        /// Renders the <see cref="T:System.Web.UI.HtmlControls.HtmlContainerControl" /> control to the specified <see cref="T:System.Web.UI.HtmlTextWriter" /> object.
        /// </summary>
        /// <param name="writer">The <see cref="T:System.Web.UI.HtmlTextWriter" /> that receives the <see cref="T:System.Web.UI.HtmlControls.HtmlContainerControl" /> content.</param>
        protected override void Render(HtmlTextWriter writer)
        {
            this.AddCssClass("popover-person");

            HRef = Path.Combine(System.Web.VirtualPathUtility.ToAbsolute("~"), string.Format("Person/{0}", PersonId));

            this.Attributes["personId"] = PersonId.ToString();
            base.RenderBeginTag(writer);

            if (PhotoId.HasValue && PhotoId.Value != 0)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "fa fa-circle");
                writer.RenderBeginTag(HtmlTextWriterTag.I);
                writer.RenderEndTag();
            }

            writer.RenderBeginTag(HtmlTextWriterTag.Strong);
            _personName.RenderControl(writer);
            writer.RenderEndTag();

            base.RenderEndTag(writer);

            if (!string.IsNullOrWhiteSpace(Role))
            {
                writer.RenderBeginTag(HtmlTextWriterTag.Small);
                writer.Write(" (");
                writer.Write(Role);
                writer.Write(")");
                writer.RenderEndTag();
            }

            string script = @"
    $('.popover-person').popover({
        placement: 'right', 
        trigger: 'manual',
        delay: 500,
        html: true,
        content: function() {
            var dataUrl = Rock.settings.get('baseUrl') + 'api/People/PopupHtml/' +  $(this).attr('personid');

            var result = $.ajax({ 
                                type: 'GET', 
                                url: dataUrl, 
                                dataType: 'json', 
                                contentType: 'application/json; charset=utf-8',
                                async: false }).responseText;
            
            var resultObject = jQuery.parseJSON(result);

            return resultObject.PickerItemDetailsHtml;

        }
    }).on('mouseenter', function () {
        var _this = this;
        $(this).popover('show');
        $(this).siblings('.popover').on('mouseleave', function () {
            $(_this).popover('hide');
        });
    }).on('mouseleave', function () {
        var _this = this;
        setTimeout(function () {
            if (!$('.popover:hover').length) {
                $(_this).popover('hide')
            }
        }, 100);
    });
";

            ScriptManager.RegisterStartupScript(this, this.GetType(), "person-link-popover", script, true);
        }
Пример #15
0
 public void RemoveRelation(PersonId from, PersonId to)
 {
     _relations.RemoveAll(r => r.From == from && r.To == to);
     _relations.RemoveAll(r => r.From == to && r.To == from);
 }
 public bool IsProspectOnThisAccomodation(PersonId person, AccomodationId accomodation)
 {
     return(Database.Prospects
            .Where(p => p.Person.Id == person.SurrogateId.ValueOrFailure())
            .Any(p => p.Accomodation.Number == accomodation.Number));
 }
Пример #17
0
 public void RemoveAllPersonRelations(PersonId personId)
 {
     _relations.RemoveAll(r => r.From == personId || r.To == personId);
 }
Пример #18
0
 public FriendshipInvitationRejectedDomainEvent(InvitationId invitationId, PersonId senderId, PersonId receiverId, DateTimeOffset createdAt)
 {
     InvitationId = invitationId;
     SenderId     = senderId;
     ReceiverId   = receiverId;
     CreatedAt    = createdAt;
 }
Пример #19
0
 public void RemoveFromPersonRelations(PersonId personId)
 {
     _relations.RemoveAll(r => r.From == personId);
     _relations.RemoveAll(r => r.To == personId && r.RelationType == RelationType.Spouse);
 }
Пример #20
0
 public override string ToString()
 {
     return(PersonId.ToString());
 }
 public RelationType ConvertRelationType(string type, IReadOnlyCollection <Domain.Trees.People.Person> people, PersonId to)
 => type switch
 {
Пример #22
0
        /// <summary>
        /// Execute method to write transaction to the database.
        /// </summary>
        public void Execute()
        {
            string directory = AppDomain.CurrentDomain.BaseDirectory;

            directory = Path.Combine(directory, "Logs");

            // check that directory exists
            if (!Directory.Exists(directory))
            {
                Directory.CreateDirectory(directory);
            }

            // create full path to the fie
            string filePath = Path.Combine(directory, "pageviews.csv");

            // write to the file
            StreamWriter w = new StreamWriter(filePath, true);

            w.Write("{0},{1},{2},{3},{4},{5}\r\n", DateViewed.ToString(), PageId.ToString(), SiteId.ToString(), PersonId.ToString(), IPAddress, UserAgent);
            w.Close();
        }
Пример #23
0
 public Person()
 {
     PersonId = new PersonId();
 }
Пример #24
0
        public void SyncPatronPhoto(PersonId person_id)
        {
            XmlSerializer person_idSerializer = new XmlSerializer(person_id.GetType());
            var serializer = new XmlSerializer(typeof(IdCardError));

            var memoryStream = new MemoryStream();
            var streamWriter = new StreamWriter(memoryStream, System.Text.Encoding.UTF8);

            person_idSerializer.Serialize(streamWriter, person_id);

            byte[] utf8EncodedXml = memoryStream.ToArray();

            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(String.Concat(URI.RESTurl(), "SyncPhoto"));
            request.Method = "POST";
            request.ContentType = "application/xml";
            request.ContentLength = utf8EncodedXml.Length;
            this.authenticationProvider.AuthenticatePostRequest(request, null); //serializedValue);
            request.Accept = "application/xml";

            Stream dataStream = request.GetRequestStream();
            dataStream.Write(utf8EncodedXml, 0, utf8EncodedXml.Length);
            dataStream.Close();

            HttpWebResponse response = null;
            IdCardError status = null;

            try
            {
                using (response = (HttpWebResponse)request.GetResponse())
                {
                    if (response.StatusCode == HttpStatusCode.OK)
                    {
                        Stream ReceiveStream = response.GetResponseStream();
                        StreamReader readStream = new StreamReader(ReceiveStream);
                        string xml = readStream.ReadToEnd();

                        status = (IdCardError)serializer.Deserialize(new StringReader(xml));
                    }
                }
            }
            catch (WebException webEx)
            {
                if (response == null)
                {
                    System.Diagnostics.Debug.WriteLine(webEx.Message);
                }
            }

            if (status.Errors == null)
            {
                MessageBox.Show("Synchronized Photo " + person_id.person_id + ".jpg.\nNOTE: PRO photo will be synced overnight.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                string message = "";
                foreach (Errors error in status.Errors)
                {
                    message += error.Error;
                    message += "\n";
                }
                MessageBox.Show(message, "ERRORS!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Пример #25
0
 public void UpdatePersonId(PersonId personId)
 {
     this.cards            = new List <StudentCard>();
     this.PersonalIdNumber = personId;
 }
Пример #26
0
 private void MenuSyncPatronPhoto_Click(object sender, RoutedEventArgs e)
 {
     var patron = sender as MenuItem;
     PersonId personId = new PersonId();
     personId.person_id = patron.Tag.ToString();
     ApplicationPresenter.Manager.SyncPatronPhoto(personId, Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + @"\Datacard\ID Works\Photos\" + personId.person_id + ".jpg");
 }
Пример #27
0
 public override int GetHashCode()
 {
     return(PersonId.GetHashCode());
 }
 public Task<Person> GetPersonById(PersonId request, ServerCallContext context)
 {
     LogRpc(context);
     Person person = _personRepository.GetById(request.Id);
     return Task.FromResult(person);
 }
        public int Compare(IStorePropertyBag x, IStorePropertyBag y)
        {
            if (object.ReferenceEquals(x, y))
            {
                return(0);
            }
            if (x == null)
            {
                return(-1);
            }
            if (y == null)
            {
                return(1);
            }
            PersonId valueOrDefault  = x.GetValueOrDefault <PersonId>(ContactSchema.PersonId, PersonId.Create(Guid.Empty.ToByteArray()));
            PersonId valueOrDefault2 = y.GetValueOrDefault <PersonId>(ContactSchema.PersonId, PersonId.Create(Guid.Empty.ToByteArray()));

            return(valueOrDefault.ToBase64String().CompareTo(valueOrDefault2.ToBase64String()));
        }