Пример #1
0
        /** Convert
         */
        public static void Convert(ref System.Object a_to_refobject, System.Type a_to_type, JsonItem a_from_jsonitem, WorkPool a_workpool)
        {
            WorkPool t_workpool = a_workpool;

            if (t_workpool == null)
            {
                t_workpool = new WorkPool();
            }

            {
                switch (a_from_jsonitem.GetValueType())
                {
                case ValueType.StringData:
                {
                    FromStringData.Convert(ref a_to_refobject, a_to_type, a_from_jsonitem);
                } break;

                case ValueType.SignedNumber:
                case ValueType.UnsignedNumber:
                case ValueType.FloatingNumber:
                case ValueType.DecimalNumber:
                case ValueType.BoolData:
                {
                    FromNumber.Convert(ref a_to_refobject, a_to_type, a_from_jsonitem);
                } break;

                case ValueType.IndexArray:
                {
                    FromIndexArray.Convert(ref a_to_refobject, a_to_type, a_from_jsonitem, t_workpool);
                } break;

                case ValueType.AssociativeArray:
                {
                    FromAssociativeArray.Convert(ref a_to_refobject, a_to_type, a_from_jsonitem, t_workpool);
                } break;

                case ValueType.Null:
                {
                    //NULL処理。
                } break;

                default:
                {
                                                #if (DEF_BLUEBACK_JSONITEM_ASSERT)
                    DebugTool.Assert(false);
                                                #endif
                } break;
                }
            }

            if (a_workpool == null)
            {
                t_workpool.Main();
            }
        }
        /// <summary>
        /// Returs the Person sending the SMS communication.
        /// Will use the Response Recipient if one exists otherwise the Current Person.
        /// </summary>
        /// <returns></returns>
        public Rock.Model.Person GetSMSFromPerson()
        {
            // Try to get a from person
            Rock.Model.Person person = CurrentPerson;

            // If the response recipient exists use it
            var fromPersonAliasGuid = FromNumber.GetAttributeValue("ResponseRecipient").AsGuidOrNull();

            if (fromPersonAliasGuid.HasValue)
            {
                person = new Rock.Model.PersonAliasService(new Data.RockContext())
                         .Queryable()
                         .AsNoTracking()
                         .Where(p => p.Guid.Equals(fromPersonAliasGuid.Value))
                         .Select(p => p.Person)
                         .FirstOrDefault();
            }

            return(person);
        }