Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            DataComponent data = new DataComponent();

            data.DatabaseType = DatabaseTypes.Oracle;
            data.DataSource   = "uyum_test";
            data.Username     = "******";
            data.Password     = "******";
            data.Open();


            TownCollection townCol = new TownCollection();

            townCol.Load(data);

            dataGridView1.DataSource = townCol;
            //data.GetDataTable();
        }
Beispiel #2
0
        public static Report CompileFactionTownReport()
        {
            Report report = new Report("Faction Towns", "80%");

            report.Columns.Add("20%", "center", "Name");
            report.Columns.Add("20%", "center", "Owner");
            report.Columns.Add("17%", "center", "Sheriff");
            report.Columns.Add("17%", "center", "Finance Minister");
            report.Columns.Add("13%", "center", "Silver");
            report.Columns.Add("13%", "center", "Prices");

            TownCollection towns = Town.Towns;

            for (int i = 0; i < towns.Count; ++i)
            {
                Town town = towns[i];

                string prices = "Normal";

                if (town.Tax < 0)
                {
                    prices = town.Tax.ToString() + "%";
                }
                else if (town.Tax > 0)
                {
                    prices = "+" + town.Tax.ToString() + "%";
                }

                ReportItem item = new ReportItem();

                item.Values.Add(town.Definition.FriendlyName);
                item.Values.Add(town.Owner == null ? "Neutral" : town.Owner.Definition.FriendlyName);
                item.Values.Add(town.Sheriff == null ? "" : town.Sheriff.Name);
                item.Values.Add(town.Finance == null ? "" : town.Finance.Name);
                item.Values.Add(town.Silver.ToString(), "N0");
                item.Values.Add(prices);

                report.Items.Add(item);
            }

            return(report);
        }