Ejemplo n.º 1
0
        public SaesonkategoriList()
        {
            SelectUge = 0;
            string        query;
            List <object> selection = new List <object>();

            query = "SELECT * FROM Saesonkategori " +
                    "ORDER BY Ugeid;";

            selection = DB.Select(query);
            foreach (List <object> tupel in selection)
            {
                Uge[SelectUge] = new Saesonkategori(tupel);
                SelectUge++;
            }
            SelectUge = 0;
        }
Ejemplo n.º 2
0
        public SaesonkategoriList(int Xr, int Yr, int Wr, int Hr, ConsoleColor txtColor, ConsoleColor bgColor, ConsoleColor shadowColor, ConsoleColor highlightedColor)
        {
            // Initialize Uge[] from database
            SelectUge = 0;
            string        query;
            List <object> selection = new List <object>();

            query = "SELECT * FROM Saesonkategori " +
                    "ORDER BY Ugeid;";

            selection = DB.Select(query);
            foreach (List <object> tupel in selection)
            {
                Uge[SelectUge] = new Saesonkategori(tupel);
                SelectUge++;
            }
            SelectUge = 0;
            // Initialize Kalender Winduer

            TxtColor         = txtColor;
            BgColor          = bgColor;
            ShadowColor      = shadowColor;
            HighlightedColor = highlightedColor;

            // Windows positioning
            // 52 uger = 13 Collumns * 4 rows.
            //  Dirtribute 13 new windowes within Wrange
            int Wn        = (Wr - 2) / 13;
            int Hn        = (Hr - 2) / 4;
            int spaceLeft = (Wr - 2) % 13;
            //  Initial start (Xrange, Yrange) + (2,2)
            int Xn = Xr + 2 + (spaceLeft / 2);
            int Yn = Yr + 2;
            int x  = Xn;
            int y  = Yn;

            for (SelectUge = 1; SelectUge < 53; SelectUge++)
            {
                // Check if there is a row shift"
                if (SelectUge > 1 && (SelectUge - 1) % 13 == 0)
                {
                    x  = Xn;
                    y += Hn;
                }
                // Make and out put a new window;
                Kalender[SelectUge - 1] = new Window(
                    x,
                    y,
                    Wn - 2,
                    4,// Hn - 2,
                    0,
                    TxtColor,
                    BgColor,
                    ShadowColor,
                    false,
                    $"Uge {String.Format("{0,2}", Uge[SelectUge - 1].Ugeid.ToString())}"
                    );
                Kalender[SelectUge - 1].MarginX = 1;
                Kalender[SelectUge - 1].MarginY = 1;
                // incriment windowd distance
                x += Wn;
            }
            SelectUge = 0;
        }