protected override void List(BusinessContext context)
        {
            base.List(context);

            ListRequest  request  = (ListRequest)context.Request;
            ListResponse response = (ListResponse)context.Response;

            // Check if sorting contains OutlineNumber
            bool bSortByName = request.Sorting.Length == 1 &&
                               request.Sorting[0].Source == DirectoryOrganizationalUnitEntity.FieldOutlineNumber;

            List <EntityObject> items = new List <EntityObject>(response.EntityObjects);

            // Load Name From GlobalResource
            foreach (DirectoryOrganizationalUnitEntity entity in items)
            {
                entity.Name = GlobalResource.GetString(entity.Name);
            }

            if (bSortByName)
            {
                SortEntityObjectTreeByName(items);
            }

            response.EntityObjects = items.ToArray();
        }
Esempio n. 2
0
    public override void _EnterTree()
    {
        Facade.logger = (str) => GD.Print(str);
        Facade.InitStatic();

        facade = new Facade();

        facade.CreateModder(GlobalPath.mod);

        GlobalResource.BuildTileSet(facade.modder.dictTerrainDefs.Values.SelectMany(p => p.Values));

        facade.CreateRunData(new RunInit()
        {
            mapBuildType = Fengj.Map.MapBuildType.MAP_PLAIN, mapSize = (90, 90)
        });
Esempio n. 3
0
        /// <summary>
        /// Exports the specified contact to VCard format.
        /// </summary>
        /// <param name="contactPrimaryKey">The contact primary key.</param>
        /// <returns></returns>
        public static string Export(PrimaryKeyId contactPrimaryKey)
        {
            StringBuilder sb = new StringBuilder(256);

            ContactEntity entity = (ContactEntity)BusinessManager.Load(ContactEntity.GetAssignedMetaClassName(), contactPrimaryKey);

            sb.Append("BEGIN:VCARD\r\n");
            sb.Append("VERSION:2.1\r\n");

            #region Export Name Info
            // Export Name Info
            sb.AppendFormat("N:{0};{1};{2}\r\n",
                            ReturnEmptyIfNull(entity.LastName),
                            ReturnEmptyIfNull(entity.FirstName),
                            ReturnEmptyIfNull(entity.MiddleName));
            #endregion

            #region Export Common Info
            // Export Common Info
            if (!string.IsNullOrEmpty(entity.FullName))
            {
                sb.AppendFormat("FN:{0}\r\n", entity.FullName);
            }

            if (!string.IsNullOrEmpty(entity.NickName))
            {
                sb.AppendFormat("NICKNAME:{0}\r\n", entity.NickName);
            }

            if (entity.BirthDate.HasValue && entity.BirthDate != DateTime.MinValue)
            {
                sb.AppendFormat("BDAY:{0}\r\n", entity.BirthDate.Value.ToString("yyyy-MM-dd"));
            }

            if (entity.Gender.HasValue)
            {
                sb.AppendFormat("X-GENDER:{0}\r\n", GlobalResource.GetString(MetaEnum.GetFriendlyName(DataContext.Current.GetMetaClass(ContactEntity.GetAssignedMetaClassName()).Fields["Gender"].GetMetaType(), entity.Gender.Value)));
            }

            if (!string.IsNullOrEmpty(entity.Role))
            {
                sb.AppendFormat("ROLE:{0}\r\n", entity.Role);
            }

            if (!string.IsNullOrEmpty(entity.JobTitle))
            {
                sb.AppendFormat("TITLE:{0}\r\n", entity.JobTitle);
            }

            if (!string.IsNullOrEmpty(entity.WebSiteUrl))
            {
                sb.AppendFormat("URL:{0}\r\n", entity.WebSiteUrl);
            }

            if (!string.IsNullOrEmpty(entity.Description))
            {
                sb.AppendFormat("NOTE:{0}\r\n", entity.Description);
            }
            #endregion

            #region Export Organization Info
            // Export Organization Info
            if (entity.OrganizationId.HasValue)
            {
                sb.AppendFormat("ORG:{0};{1}\r\n",
                                entity.Organization,
                                entity.OrganizationUnit);
            }
            #endregion

            #region Export EMails
            // Export EMails
            foreach (string emailFieldName in GetEmailFieldNames())
            {
                string email = (string)entity.Properties[emailFieldName].Value;

                if (string.IsNullOrEmpty(email))
                {
                    continue;
                }

                string emailTypeString = string.Empty;

                if (emailFieldName == "EMailAddress1")
                {
                    emailTypeString += ";PREF";
                }

                if (emailFieldName == "EMailAddress1")
                {
                    emailTypeString += ";WORK";
                }
                else if (emailFieldName == "EMailAddress2")
                {
                    emailTypeString += ";HOME";
                }

                emailTypeString += ";INTERNET";

                sb.AppendFormat("EMAIL{1}:{0}\r\n",
                                email,
                                emailTypeString);
            }

            #endregion

            #region Export Phones
            //// Export Phones
            foreach (string phoneFieldName in new string[] { "Fax", "MobilePhone", "Telephone1", "Telephone2", "Telephone3" })
            {
                string phone = (string)entity.Properties[phoneFieldName].Value;
                if (string.IsNullOrEmpty(phone))
                {
                    continue;
                }

                string phoneTypeString = string.Empty;

                if (phoneFieldName == "Telephone1")
                {
                    phoneTypeString += ";PREF";
                }
                else if (phoneFieldName == "Telephone1")
                {
                    phoneTypeString += ";WORK";
                }
                else if (phoneFieldName == "Telephone2")
                {
                    phoneTypeString += ";HOME";
                }
                else if (phoneFieldName == "Fax")
                {
                    phoneTypeString += ";FAX";
                }
                else if (phoneFieldName == "MobilePhone")
                {
                    phoneTypeString += ";CELL";
                }

                sb.AppendFormat("TEL{1}:{0}\r\n",
                                phone,
                                phoneTypeString);
            }

            #endregion

            #region Export Addresses
            // Export Addresses
            foreach (AddressEntity address in BusinessManager.List(AddressEntity.GetAssignedMetaClassName(),
                                                                   new FilterElement[] { FilterElement.EqualElement("ContactId", contactPrimaryKey) }))
            {
                string adrTypeString = string.Empty;

                if (address.IsDefaultContactElement)
                {
                    adrTypeString += ";PREF";
                }

                //if (address.AddressType == Add)
                //    adrTypeString += ";WORK";
                //else if (vCardAdrr.VCardAddressTypeId == (int)VCardTelephoneType.Home)
                //    adrTypeString += ";HOME";

                sb.AppendFormat("ADR{0}:;{1};{2};{3};{4};{5};{6}\r\n",
                                adrTypeString,
                                string.Empty,
                                address.Line1,
                                address.City,
                                address.Region,
                                address.PostalCode,
                                address.Country
                                );
            }

            #endregion

            sb.Append("END:VCARD\r\n");

            return(sb.ToString());
        }