Пример #1
0
        /// <summary>
        /// Update an event
        /// </summary>
        /// <param name="eventId">Event id to be updated</param>
        /// <param name="eventSpot">The new values for event</param>
        /// <returns>The updated event</returns>
        public IndividualEvent PutEventSpot(string eventId, IndividualEvent eventSpot)
        {
            if (string.IsNullOrWhiteSpace(eventId))
            {
                throw new IllegalArgumentException(CTCT.Resources.Errors.InvalidId);
            }
            if (eventSpot == null)
            {
                throw new IllegalArgumentException(CTCT.Resources.Errors.ObjectNull);
            }

            string         url      = String.Concat(Settings.Endpoints.Default.BaseUrl, Settings.Endpoints.Default.EventSpots, "/", eventId);
            string         json     = eventSpot.ToJSON();
            RawApiResponse response = RestClient.Put(url, UserServiceContext.AccessToken, UserServiceContext.ApiKey, json);

            try
            {
                var individualEvent = response.Get <IndividualEvent>();
                return(individualEvent);
            }
            catch (Exception ex)
            {
                throw new CtctException(ex.Message, ex);
            }
        }
Пример #2
0
        /// <summary>
        /// Publish an event
        /// </summary>
        /// <param name="accessToken">Constant Contact OAuth2 access token</param>
        /// <param name="apiKey">The API key for the application</param>
        /// <param name="eventSpot">The event to publish</param>
        /// <returns>The published event</returns>
        public IndividualEvent PostEventSpot(string accessToken, string apiKey, IndividualEvent eventSpot)
        {
            string       url      = String.Concat(Config.Endpoints.BaseUrl, Config.Endpoints.EventSpots);
            string       json     = eventSpot.ToJSON();
            CUrlResponse response = RestClient.Post(url, accessToken, apiKey, json);

            if (response.HasData)
            {
                return(response.Get <IndividualEvent>());
            }
            else if (response.IsError)
            {
                throw new CtctException(response.GetErrorMessage());
            }
            return(new IndividualEvent());
        }
Пример #3
0
        private void OnIndividualEventTrig(object sender, IndividualEvent e)
        {
            if (!_inProcess && e.AssetLocationId == _facilityId)
            {
                switch (e.RouteActionType)
                {
                case O3RouteActionTypes.START_O3_PROCESS:
                    Task.Factory.StartNew(StartO3Process);
                    break;

                case O3RouteActionTypes.ABORT:
                    _abort = _inProcess;
                    break;

                case O3RouteActionTypes.OPEN_BACK_DOOR:
                    Task.Factory.StartNew(StartBackdoorOpen);
                    break;
                }
            }
        }
Пример #4
0
        /// <summary>
        /// Publish an event
        /// </summary>
        /// <param name="eventSpot">The event to publish</param>
        /// <returns>The published event</returns>
        public IndividualEvent PostEventSpot(IndividualEvent eventSpot)
        {
            if (eventSpot == null)
            {
                throw new IllegalArgumentException(ConstantContactClient.Resources.Errors.ObjectNull);
            }

            string         url      = String.Concat(Settings.Endpoints.Default.BaseUrl, Settings.Endpoints.Default.EventSpots);
            string         json     = eventSpot.ToJSON();
            RawApiResponse response = RestClient.Post(url, UserServiceContext.AccessToken, UserServiceContext.ApiKey, json);

            try
            {
                var individualEvent = response.Get <IndividualEvent>();
                return(individualEvent);
            }
            catch (Exception ex)
            {
                throw new ConstantContactClientException(ex.Message, ex);
            }
        }
Пример #5
0
        public static void ReadEvent(FamilyTree gedcom, IndividualEvent individualEvent, List <Models.TreeNode> children)
        {
            foreach (var child in children)
            {
                switch (child.Tag)
                {
                case "DATE":
                    if (child.HasValue)
                    {
                        //individualEvent.Date = DateTime.Parse(child.GetTextValue());
                        individualEvent.Date = child.GetTextValue();
                    }
                    break;

                case "PLAC":
                    if (child.HasValue)
                    {
                        individualEvent.Location = child.GetTextValue();
                    }
                    break;
                }
            }
        }
Пример #6
0
        public static void ReadIndividualRecord(FamilyTree gedcom, Individual individual, List <Models.TreeNode> children)
        {
            foreach (var child in children)
            {
                switch (child.Tag)
                {
                case "NAME":
                    if (child.HasValue)
                    {
                        var name = new IndividualName();
                        name.FullName = child.GetTextValue();
                        ReadeName(gedcom, name, child.Children);
                        if (individual.IndividualNames == null)
                        {
                            individual.IndividualNames = new List <IndividualName>();
                        }
                        individual.IndividualNames.Add(name);
                    }
                    break;

                case "SEX":
                    if (child.HasValue)
                    {
                        switch (child.GetTextValue())
                        {
                        case "M":
                            individual.Sex = IndividualSex.M;
                            break;

                        case "F":
                            individual.Sex = IndividualSex.F;
                            break;

                        case "U":
                            individual.Sex = IndividualSex.U;
                            break;
                        }
                    }
                    break;

                case "DEAT":
                case "BIRT":
                    var individualEvent = new IndividualEvent();
                    individualEvent.Type = IndividualEventType.Birth;
                    ReadEvent(gedcom, individualEvent, child.Children);
                    if (individual.Events == null)
                    {
                        individual.Events = new List <IndividualEvent>();
                    }
                    individual.Events.Add(individualEvent);
                    break;

                //case "OCCU":
                //    if (!child.HasValue)
                //        break;
                //    var individualAttribute = new IndividualAttribute();
                //    individualAttribute.Text = child.GetTextValue();
                //    individualAttribute.Type = child.Tag;
                //    ParseAttribute(gedcom, individualAttribute, child.Childs);
                //    individual.Attributes.Add(individualAttribute);
                //    break;

                /*case "ADOP" :
                 *  Console.WriteLine(child.RawLine);
                 *  foreach (var ch in child.Childs) {
                 *      Console.WriteLine("\t{0}",ch.RawLine);
                 *  }
                 *  break; */
                case "FAMC":
                    if (child.HasValue)
                    {
                        var family = gedcom.GetFamily(child.GetTextValue());
                        if (family != null)
                        {
                            if (individual.ChildInFamilies == null)
                            {
                                individual.ChildInFamilies = new List <Family>();
                            }
                            individual.ChildInFamilies.Add(family);
                        }
                    }
                    break;

                case "FAMS":
                    if (child.HasValue)
                    {
                        var family = gedcom.GetFamily(child.GetTextValue());
                        if (family != null)
                        {
                            if (individual.ParentInFamilies == null)
                            {
                                individual.ParentInFamilies = new List <Family>();
                            }
                            individual.ParentInFamilies.Add(family);
                        }
                    }
                    break;     //NMR
                    //case "NCHI":
                    //    if (child.HasValue)
                    //        individual.KnowChilds = child.GetInt32Value();

                    //    break;
                    //case "NMR":
                    //    if (child.HasValue)
                    //        individual.KnowMarriages = child.GetInt32Value();
                    //    break;
                }
            }
        }