public static decimal GetCompanyFee(this ConfigurationTable config, Entity entity)
        {
            switch (entity.GetEntityType())
            {
            case EntityTypeEnum.Citizen:
            {
                return(config.CompanyCitizenFee);
            }

            case EntityTypeEnum.Organisation:
            {
                return(config.CompanyOrganisationFee);
            }

            case EntityTypeEnum.Country:
            {
                return(config.CompanyCountryFee);
            }

            default:
            {
                throw new NotImplementedException();
            }
            }
        }
Beispiel #2
0
        /// <summary>
        /// PrepareObjects
        /// </summary>
        /// <returns>Returns void.</returns>
        public void PrepareObjects()
        {
            ConfigurationManager config = new ConfigurationManager();

            Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();

            foreach (Assembly assembly in assemblies)
            {
                if (!assembly.FullName.StartsWith("Zeron", StringComparison.InvariantCulture))
                {
                    continue;
                }

                foreach (Type assemblyType in assembly.GetTypes())
                {
                    if (assemblyType.GetCustomAttribute <ConfigAttribute>() == null || assemblyType.IsAbstract)
                    {
                        continue;
                    }

                    ConfigurationTable item = Activator.CreateInstance(assemblyType) as ConfigurationTable;

                    item.LoadConfig(config);
                }
            }
        }
        public virtual void Delete()
        {
            if (this.IsNewRecord)
            {
                return;
            }

            KeyValue pkValue = KeyValue.XmlToKey(this.RecordUniqueId);

            ConfigurationTable.DeleteRecord(pkValue);
        }
        public CreateNewspaperViewModel(Entities.Country country, ConfigurationTable configuration)
        {
            CountryName = country.Entity.Name;

            var countryMoney = Persistent.Countries.GetCountryCurrency(country);

            CountryFee = new MoneyViewModel(countryMoney, country.CountryPolicy.NewspaperCreateCost);
            AdminFee   = new MoneyViewModel(GameHelper.Gold, configuration.PartyFoundingFee);

            IsParty = SessionHelper.CurrentEntity.GetEntityType() == Entities.enums.EntityTypeEnum.Party;
        }
 private void LoadPage(IConfigurationPage page)
 {
     if (ConfigurationTable != null)
     {
         Dispatcher.BeginInvoke(new Action(() =>
         {
             if (!page.Loaded)
             {
                 page.LoadConfiguration(ConfigurationTable.Copy());
             }
             page.Loaded = true;
         }), System.Windows.Threading.DispatcherPriority.Background, new object[] { });
     }
 }
        public virtual ConfigurationRecord GetRecord()

        {
            if (this.DataSource != null)
            {
                return(this.DataSource);
            }

            if (this.RecordUniqueId != null)
            {
                return(ConfigurationTable.GetRecord(this.RecordUniqueId, true));
            }

            // Localization.

            throw new Exception(Page.GetResourceValue("Err:RetrieveRec", "OLR"));
        }
Beispiel #7
0
 public static extern NTSTATUS BCryptAddContextFunction(
     ConfigurationTable dwTable,
     string pszContext,
     InterfaceIdentifiers dwInterface,
     string pszFunction,
     uint dwPosition);
        public virtual void LoadData()
        {
            // Load the data from the database into the DataSource DatabaseOLR_db%dbo.Configuration record.
            // It is better to make changes to functions called by LoadData such as
            // CreateWhereClause, rather than making changes here.


            // The RecordUniqueId is set the first time a record is loaded, and is
            // used during a PostBack to load the record.
            if (this.RecordUniqueId != null && this.RecordUniqueId.Length > 0)
            {
                this.DataSource = ConfigurationTable.GetRecord(this.RecordUniqueId, true);

                return;
            }

            // This is the first time a record is being retrieved from the database.
            // So create a Where Clause based on the staic Where clause specified
            // on the Query wizard and the dynamic part specified by the end user
            // on the search and filter controls (if any).

            WhereClause wc = this.CreateWhereClause();

            System.Web.UI.WebControls.Panel Panel = (System.Web.UI.WebControls.Panel)MiscUtils.FindControlRecursively(this, "ConfigurationRecordControlPanel");
            if (Panel != null)
            {
                Panel.Visible = true;
            }

            // If there is no Where clause, then simply create a new, blank record.

            if (wc == null || !(wc.RunQuery))
            {
                this.DataSource = new ConfigurationRecord();

                if (Panel != null)
                {
                    Panel.Visible = false;
                }

                return;
            }

            // Retrieve the record from the database.  It is possible
            ConfigurationRecord[] recList = ConfigurationTable.GetRecords(wc, null, 0, 2);
            if (recList.Length == 0)
            {
                // There is no data for this Where clause.
                wc.RunQuery = false;

                if (Panel != null)
                {
                    Panel.Visible = false;
                }

                return;
            }

            // Set DataSource based on record retrieved from the database.
            this.DataSource = ConfigurationTable.GetRecord(recList[0].GetID().ToXmlString(), true);
        }
 private static extern int BCryptEnumContextFunctions(ConfigurationTable dwTable, string pszContext, CryptographicInterface dwInterface, ref uint pcbBuffer, out IntPtr ppBuffer);
 private static extern int BCryptRemoveContextFunction(ConfigurationTable dwTable, string pszContext, CryptographicInterface dwInterface, string pszFunction);
 private static extern int BCryptAddContextFunction(ConfigurationTable dwTable, string pszContext, CryptographicInterface dwInterface, string pszFunction, FunctionPosition dwPosition);
Beispiel #12
0
 internal static string GetConfigurationValue(string Key)
 {
     return((from myRow in ConfigurationTable.AsEnumerable() where myRow.Field <string>("ConfigurationName") == Key select myRow).FirstOrDefault()["ConfigurationValue"].ToString());
 }
 public static void Init(ConfigurationTable configuration)
 {
     Configuration = configuration;
 }
Beispiel #14
0
 public static extern NTSTATUS BCryptAddContextFunction(
     ConfigurationTable dwTable,
     string pszContext,
     InterfaceIdentifiers dwInterface,
     string pszFunction,
     uint dwPosition);
 public CreateNewspaperViewModel(Entities.Country country, ConfigurationTable config, string prevName) : this(country, config)
 {
     Name = prevName;
 }