Example #1
0
        public void Generuj()
        {
            text[0]  = richTextBox1;
            text[1]  = richTextBox2;
            text[2]  = richTextBox3;
            text[3]  = richTextBox4;
            text[4]  = richTextBox5;
            text[5]  = richTextBox6;
            text[6]  = richTextBox7;
            text[7]  = richTextBox8;
            text[8]  = richTextBox9;
            text[9]  = richTextBox10;
            text[10] = richTextBox11;
            text[11] = richTextBox12;
            text[12] = richTextBox13;
            text[13] = richTextBox14;
            text[14] = richTextBox15;
            text[15] = richTextBox16;
            text[16] = richTextBox17;
            text[17] = richTextBox18;
            text[18] = richTextBox19;
            text[19] = richTextBox20;
            text[20] = richTextBox21;
            text[21] = richTextBox22;
            text[22] = richTextBox23;
            text[23] = richTextBox24;
            text[24] = richTextBox25;
            text[25] = richTextBox26;
            text[26] = richTextBox27;
            text[27] = richTextBox28;
            text[28] = richTextBox29;
            text[29] = richTextBox30;
            text[30] = richTextBox31;
            text[31] = richTextBox32;
            text[32] = richTextBox33;
            text[33] = richTextBox34;
            text[34] = richTextBox35;
            text[35] = richTextBox36;
            text[36] = richTextBox37;
            text[37] = richTextBox38;
            text[38] = richTextBox39;
            text[39] = richTextBox40;
            text[40] = richTextBox41;
            text[41] = richTextBox42;
            text[42] = richTextBox43;
            text[43] = richTextBox44;
            text[44] = richTextBox45;
            text[45] = richTextBox46;
            text[46] = richTextBox47;
            text[47] = richTextBox48;
            text[48] = richTextBox49;
            text[49] = richTextBox50;
            text[50] = richTextBox51;
            text[51] = richTextBox52;
            text[52] = richTextBox53;
            text[53] = richTextBox54;
            text[54] = richTextBox55;
            text[55] = richTextBox56;
            text[56] = richTextBox57;
            text[57] = richTextBox58;
            text[58] = richTextBox59;
            text[59] = richTextBox60;
            text[60] = richTextBox61;
            text[61] = richTextBox62;
            text[62] = richTextBox63;
            text[63] = richTextBox64;
            text[64] = richTextBox65;
            text[65] = richTextBox66;
            text[66] = richTextBox67;
            text[67] = richTextBox68;
            text[68] = richTextBox69;
            text[69] = richTextBox70; // przypisanie
            FileStream   fs = new FileStream(Application.StartupPath + "\\data\\adres.txt", FileMode.Open, FileAccess.Read);
            StreamReader sr = new StreamReader(fs);

            path = sr.ReadToEnd();
            sr.Close();

            Form1 okno = new Form1();

            okno.ShowInTaskbar = false;
poczatek:
            //czyszczenie list(żeby listy były czyste przy ponownym losowaniu)
            PlanList.Clear();
            KlasaList.Clear();
            PrzedmiotList.Clear();
            NauczycielList.Clear();
            SalaList.Clear();
            CzasyLekcji.Clear();
            DostepnoscSalList.Clear();
            XmlDocument XmlDoc = new XmlDocument();
            XmlNode     Node;

            XmlDoc.Load(path);
            //wczytanie przedmiotów do listy

            int count = XmlDoc.GetElementsByTagName("przedmiot").Count;

            for (int i = 0; i < count; i++)
            {
                Node = XmlDoc.GetElementsByTagName("przedmiot").Item(i);
                PrzedmiotList.Add(new Przedmiot(Node.Attributes.GetNamedItem("nazwa_klasy").InnerText, Node.Attributes.GetNamedItem("nazwa_przedmiotu").InnerText, Node.Attributes.GetNamedItem("nazwa_nauczyciela").InnerText, Convert.ToInt32(Node.Attributes.GetNamedItem("id_nauczyciela").InnerText), Convert.ToInt32(Node.Attributes.GetNamedItem("ilosc_godzin").InnerText), Convert.ToInt32(Node.Attributes.GetNamedItem("max_dziennie").InnerText), Convert.ToBoolean(Node.Attributes.GetNamedItem("trudnosc").InnerText)));
            }

            //wczytanie klas do listy
            count = XmlDoc.GetElementsByTagName("klasa").Count;
            for (int i = 0; i < count; i++)
            {
                Node = XmlDoc.GetElementsByTagName("klasa").Item(i);
                KlasaList.Add(new Klasa(Node.Attributes.GetNamedItem("nazwa_klasy").InnerText, Convert.ToInt32(Node.Attributes.GetNamedItem("ilosc_godzin").InnerText), Convert.ToInt32(Node.Attributes.GetNamedItem("ilosc_przedmiotow").InnerText)));
            }

            //wczytanie nauczycieli do listy
            count = XmlDoc.GetElementsByTagName("nauczyciel").Count;
            for (int i = 0; i < count; i++)
            {
                Node = XmlDoc.GetElementsByTagName("nauczyciel").Item(i);
                NauczycielList.Add(new Nauczyciel(Convert.ToInt32(Node.Attributes.GetNamedItem("id_nauczyciela").InnerText), Node.Attributes.GetNamedItem("nazwa_nauczyciela").InnerText, Node.Attributes.GetNamedItem("nazwa_przedmiotu").InnerText));
            }

            //wczytanie sal do listy
            count = XmlDoc.GetElementsByTagName("sala").Count;
            for (int i = 0; i < count; i++)
            {
                Node = XmlDoc.GetElementsByTagName("sala").Item(i);
                SalaList.Add(new Sala(Node.Attributes.GetNamedItem("nr_sali").InnerText, Node.Attributes.GetNamedItem("nazwa_przedmiotu").InnerText));
            }
            //wczytanie czasu lekcji do listy
            count = XmlDoc.GetElementsByTagName("lekcja").Count;
            for (int i = 0; i < count; i++)
            {
                Node = XmlDoc.GetElementsByTagName("lekcja").Item(i);
                CzasyLekcji.Add(Node.Attributes.GetNamedItem("czas").InnerText);
            }
            for (int k = 0; k < 5; k++)
            {
                for (int j = 0; j < 14; j++)
                {
                    for (int i = 0; i < SalaList.Count; i++)
                    {
                        Sala SalaInfo = SalaList[i];
                        DostepnoscSalList.Add(new DostepnoscSali(k, j, SalaInfo.NrSali, SalaInfo.Przedmiot, true));
                        // MessageBox.Show(k.ToString() + " " + j.ToString() + " " + SalaInfo.Przedmiot + " " + SalaInfo.NrSali);
                    }
                }
            }

            Label[] labelBaza = new Label[50];
            int     xL = 0, yL = 0;

            for (int i = 0; i < KlasaList.Count; i++)
            {
                Klasa KlasaInfo = KlasaList[i];
                labelBaza[i]             = new Label();
                labelBaza[i].Location    = new Point(xL, yL);
                labelBaza[i].Size        = new Size(150, 20);
                labelBaza[i].Text        = KlasaInfo.Nazwa;
                labelBaza[i].Font        = new Font("Segoe UI", 9);
                labelBaza[i].BackColor   = System.Drawing.Color.FromArgb(((int)(((byte)(3)))), ((int)(((byte)(78)))), ((int)(((byte)(171)))));
                labelBaza[i].ForeColor   = Color.White;
                labelBaza[i].MouseHover += new EventHandler(this.labelBaza_MouseHover);
                labelBaza[i].MouseLeave += new EventHandler(this.labelBaza_MouseLeave);
                labelBaza[i].Click      += new EventHandler(this.button1_Click);
                labelBaza[i].Parent      = panel1;
                nazwaKlasy = KlasaInfo.Nazwa;
                yL         = yL + 23;
            }



            Random RandomObj = new Random();

            int wynik = 0;
            int przedmiotRand;
            int licznik = 0;
            int sumaTrudnychPrzedmiotow = 0;

            int[] trudnosc = new int[KlasaList.Count];

            for (int i = 0; i < KlasaList.Count; i++)
            {
                trudnosc[i] = 0;
            }
            //sprawdzanie ile jest godzin "trudnych" w tygodniu
            for (int klasa = 0; klasa < KlasaList.Count; klasa++)
            {
                Klasa KlasaInfo = KlasaList[klasa];
                for (int i = 0; i < KlasaInfo.IloscPrzedmiotow; i++)
                {
                    Przedmiot PrzedmiotD = PrzedmiotList[i + PrzedmiotList.FindIndex(item => item.NazwaKlasy == KlasaInfo.Nazwa)];
                    if (PrzedmiotD.Trudnosc == true)
                    {
                        for (int j = 0; j < PrzedmiotD.IloscGodzin; j++)
                        {
                            trudnosc[klasa]++;
                        }
                    }
                }
                trudnosc[klasa] = trudnosc[klasa] / 5;
            }
            for (int i = 0; i < PrzedmiotList.Count; i++)
            {
                Przedmiot PrzedmiotInfo = PrzedmiotList[i];
                Zerowanie.Add(PrzedmiotInfo.IloscWDniu);
            }

            // sortowanie listy z przedmiotami wg ilości przedmiotu w tygodniu

            /*
             * for (int klasa = 0; klasa < KlasaList.Count; klasa++)
             * {
             *  Klasa KlasaDane = KlasaList[klasa];
             *  for (int i = 0; i < KlasaDane.IloscPrzedmiotow-1; i++)
             *  {
             *      for (int j = 0; j < KlasaDane.IloscPrzedmiotow-1; j++)
             *      {
             *          Przedmiot PrzedmiotDaneJeden = PrzedmiotList[j + PrzedmiotList.FindIndex(item => item.NazwaKlasy == KlasaDane.Nazwa)];
             *          Przedmiot PrzedmiotDaneDwa = PrzedmiotList[j + 1 + PrzedmiotList.FindIndex(item => item.NazwaKlasy == KlasaDane.Nazwa)];
             *
             *          if (PrzedmiotDaneJeden.IloscGodzin < PrzedmiotDaneDwa.IloscGodzin)
             *          {
             *              Buffor.Add(new Przedmiot(PrzedmiotDaneJeden.NazwaKlasy, PrzedmiotDaneJeden.NazwaPrzedmiotu, PrzedmiotDaneJeden.NazwaNauczyciela, PrzedmiotDaneJeden.ID, PrzedmiotDaneJeden.IloscGodzin, PrzedmiotDaneJeden.IloscWDniu, PrzedmiotDaneJeden.Trudnosc));
             *              PrzedmiotDaneJeden.ID = PrzedmiotDaneDwa.ID;
             *              PrzedmiotDaneJeden.IloscGodzin = PrzedmiotDaneDwa.IloscGodzin;
             *              PrzedmiotDaneJeden.IloscWDniu = PrzedmiotDaneDwa.IloscWDniu;
             *              PrzedmiotDaneJeden.NazwaKlasy = PrzedmiotDaneDwa.NazwaKlasy;
             *              PrzedmiotDaneJeden.NazwaNauczyciela = PrzedmiotDaneDwa.NazwaNauczyciela;
             *              PrzedmiotDaneJeden.NazwaPrzedmiotu = PrzedmiotDaneDwa.NazwaPrzedmiotu;
             *              PrzedmiotDaneJeden.Trudnosc = PrzedmiotDaneDwa.Trudnosc;
             *              Przedmiot temp = Buffor[0];
             *              PrzedmiotDaneDwa.ID = temp.ID;
             *              PrzedmiotDaneDwa.IloscGodzin = temp.IloscGodzin;
             *              PrzedmiotDaneDwa.IloscWDniu = temp.IloscWDniu;
             *              PrzedmiotDaneDwa.NazwaKlasy = temp.NazwaKlasy;
             *              PrzedmiotDaneDwa.NazwaNauczyciela = temp.NazwaNauczyciela;
             *              PrzedmiotDaneDwa.NazwaPrzedmiotu = temp.NazwaPrzedmiotu;
             *              PrzedmiotDaneDwa.Trudnosc = temp.Trudnosc;
             *              Buffor.Clear();
             *          }
             *      }
             *  }
             * }
             */

            for (int i = 0; i < 14; i++)
            {
                for (int j = 0; j < NauczycielList.Count; j++)
                {
                    for (int k = 0; k < 5; k++)
                    {
                        Dostepnosc[i, k, j] = true;
                    }
                }
            }

            int y, x, z;

            for (int klasa = 0; klasa < KlasaList.Count; klasa++)
            {
                Klasa KlasaInfo = KlasaList[klasa];
                if (KlasaInfo.IloscGodzin >= 25)
                {
                    x = KlasaInfo.IloscGodzin;
                    for (int dzien = 5; dzien > 1; dzien--)
                    {
                        y = x / dzien;
                        z = (y - 2) + RandomObj.Next(0, 5);
                        GodzinyList.Add(new Godziny(KlasaInfo.Nazwa, z));
                        x = x - z;
                    }
                }
                else
                {
                    x = KlasaInfo.IloscGodzin;
                    for (int dzien = 5; dzien > 1; dzien--)
                    {
                        y = x / dzien;
                        z = (y - 1) + RandomObj.Next(0, 2);
                        GodzinyList.Add(new Godziny(KlasaInfo.Nazwa, z));
                        x = x - z;
                    }
                }
                GodzinyList.Add(new Godziny(KlasaInfo.Nazwa, x));
            }
            //pętla określająca dzień
            for (int day = 0; day < 5; day++)
            {
                //główna pętla określająca, która klasa jest obecnie rozpatrywana
                for (int klasa = 0; klasa < KlasaList.Count; klasa++)
                {
                    IndexNauczyciela.Clear();
                    Klasa KlasaInfo = KlasaList[klasa];
                    sumaTrudnychPrzedmiotow = 0;

                    //przypisywanie ile danego przedmiotu jest w danym dniu
                    for (int i = 0; i < PrzedmiotList.Count; i++)
                    {
                        Przedmiot PrzedmiotInfo = PrzedmiotList[i];
                        PrzedmiotInfo.IloscWDniu = Zerowanie[i];
                    }

                    //tworzenie listy z indexami nauczycieli uczących daną klase
                    for (int i = 0; i < KlasaInfo.IloscPrzedmiotow; i++)
                    {
                        Przedmiot PrzedmiotD = PrzedmiotList[i + PrzedmiotList.FindIndex(item => item.NazwaKlasy == KlasaInfo.Nazwa)];
                        IndexNauczyciela.Add(PrzedmiotD.ID);
                    }

                    //główna pętla dla jednego dnia dla jednej klasy
                    Godziny GodzinyInfo = GodzinyList[GodzinyList.FindIndex(item => item.Nazwa == KlasaInfo.Nazwa) + day];
                    for (int i = 0; i < GodzinyInfo.Ilosc; i++) //ilosc godzin jednego dnia
                    {
                        licznik = 0;
                        bool ustalenie = false;
                        do
                        {
                            wynik++;
                            if (wynik > 500)
                            {
                                goto poczatek;
                            }
                            if (licznik > IndexNauczyciela.Count - 1)
                            {
                                break;
                            }
                            przedmiotRand = IndexNauczyciela[RandomObj.Next(KlasaInfo.IloscPrzedmiotow)];
                            Przedmiot      PrzedmiotInfo = PrzedmiotList[PrzedmiotList.FindIndex(item => item.NazwaKlasy == KlasaInfo.Nazwa && item.ID == przedmiotRand)];
                            DostepnoscSali DostSali      = DostepnoscSalList[DostepnoscSalList.FindIndex(item => item.Przedmiot == PrzedmiotInfo.NazwaPrzedmiotu && item.Dzien == day && item.Godzina == i && item.Dostepnosc == true)];
                            //MessageBox.Show(DostSali.Dostepnosc.ToString() + DostSali.Przedmiot + " " + DostSali.NrSali + " " + DostSali.Godzina.ToString() + " " + DostSali.Dzien.ToString());
                            //"łatwy przedmiot"
                            //MessageBox.Show(Dostepnosc[i, day, przedmiotRand].ToString() + " " + PrzedmiotInfo.IloscGodzin.ToString() + " " + PrzedmiotInfo.IloscWDniu.ToString() + " " + PrzedmiotInfo.Trudnosc.ToString() + " " + DostSali.Dostepnosc.ToString());
                            if (Dostepnosc[i, day, przedmiotRand] == true && PrzedmiotInfo.IloscGodzin > 0 && PrzedmiotInfo.IloscWDniu > 0 && PrzedmiotInfo.Trudnosc == false && DostSali.Dostepnosc == true)
                            {
                                PlanList.Add(new Plan(KlasaInfo.Nazwa, PrzedmiotInfo.ID, PrzedmiotInfo.NazwaPrzedmiotu, PrzedmiotInfo.NazwaNauczyciela, Convert.ToInt32(DostSali.NrSali), i, day)); // wylosowanie przedmiotu
                                PrzedmiotInfo.IloscGodzin--;
                                PrzedmiotInfo.IloscWDniu--;
                                Dostepnosc[i, day, przedmiotRand] = false;
                                ustalenie           = true;
                                DostSali.Dostepnosc = false;
                            }
                            //"trudny przedmiot"
                            if (Dostepnosc[i, day, przedmiotRand] == true && PrzedmiotInfo.IloscGodzin > 0 && PrzedmiotInfo.IloscWDniu > 0 && PrzedmiotInfo.Trudnosc == true && sumaTrudnychPrzedmiotow < trudnosc[klasa] + 5 && DostSali.Dostepnosc == true)
                            {
                                PlanList.Add(new Plan(KlasaInfo.Nazwa, PrzedmiotInfo.ID, PrzedmiotInfo.NazwaPrzedmiotu, PrzedmiotInfo.NazwaNauczyciela, Convert.ToInt32(DostSali.NrSali), i, day)); // wylosowanie przedmiotu
                                PrzedmiotInfo.IloscGodzin--;
                                PrzedmiotInfo.IloscWDniu--;
                                Dostepnosc[i, day, przedmiotRand] = false;
                                ustalenie = true;
                                sumaTrudnychPrzedmiotow++;
                                DostSali.Dostepnosc = false;
                            }
                        }while (ustalenie == false);
                    }
                }
            }
            save_Click(null, null);
        }
Example #2
0
        public void WczytajPlan()
        {
            text[0]  = richTextBox1;
            text[1]  = richTextBox2;
            text[2]  = richTextBox3;
            text[3]  = richTextBox4;
            text[4]  = richTextBox5;
            text[5]  = richTextBox6;
            text[6]  = richTextBox7;
            text[7]  = richTextBox8;
            text[8]  = richTextBox9;
            text[9]  = richTextBox10;
            text[10] = richTextBox11;
            text[11] = richTextBox12;
            text[12] = richTextBox13;
            text[13] = richTextBox14;
            text[14] = richTextBox15;
            text[15] = richTextBox16;
            text[16] = richTextBox17;
            text[17] = richTextBox18;
            text[18] = richTextBox19;
            text[19] = richTextBox20;
            text[20] = richTextBox21;
            text[21] = richTextBox22;
            text[22] = richTextBox23;
            text[23] = richTextBox24;
            text[24] = richTextBox25;
            text[25] = richTextBox26;
            text[26] = richTextBox27;
            text[27] = richTextBox28;
            text[28] = richTextBox29;
            text[29] = richTextBox30;
            text[30] = richTextBox31;
            text[31] = richTextBox32;
            text[32] = richTextBox33;
            text[33] = richTextBox34;
            text[34] = richTextBox35;
            text[35] = richTextBox36;
            text[36] = richTextBox37;
            text[37] = richTextBox38;
            text[38] = richTextBox39;
            text[39] = richTextBox40;
            text[40] = richTextBox41;
            text[41] = richTextBox42;
            text[42] = richTextBox43;
            text[43] = richTextBox44;
            text[44] = richTextBox45;
            text[45] = richTextBox46;
            text[46] = richTextBox47;
            text[47] = richTextBox48;
            text[48] = richTextBox49;
            text[49] = richTextBox50;
            text[50] = richTextBox51;
            text[51] = richTextBox52;
            text[52] = richTextBox53;
            text[53] = richTextBox54;
            text[54] = richTextBox55;
            text[55] = richTextBox56;
            text[56] = richTextBox57;
            text[57] = richTextBox58;
            text[58] = richTextBox59;
            text[59] = richTextBox60;
            text[60] = richTextBox61;
            text[61] = richTextBox62;
            text[62] = richTextBox63;
            text[63] = richTextBox64;
            text[64] = richTextBox65;
            text[65] = richTextBox66;
            text[66] = richTextBox67;
            text[67] = richTextBox68;
            text[68] = richTextBox69;
            text[69] = richTextBox70; //przypisanie
            path     = Application.StartupPath + "/data/project/plan.xml";
            XmlDocument XmlDoc = new XmlDocument();
            XmlNode     Node;

            XmlDoc.Load(path);
            //wczytanie przedmiotów do listy
            int count = XmlDoc.GetElementsByTagName("plan").Count;

            for (int i = 0; i < count; i++)
            {
                Node = XmlDoc.GetElementsByTagName("plan").Item(i);
                PlanList.Add(new Plan(Convert.ToString(Node.Attributes.GetNamedItem("klasa").InnerText), Convert.ToInt32(Node.Attributes.GetNamedItem("id").InnerText), Node.Attributes.GetNamedItem("przedmiot").InnerText, Node.Attributes.GetNamedItem("nauczyciel").InnerText, Convert.ToInt32(Node.Attributes.GetNamedItem("sala").InnerText), Convert.ToInt32(Node.Attributes.GetNamedItem("godzina").InnerText), Convert.ToInt32(Node.Attributes.GetNamedItem("dzien").InnerText)));
                Plan PlanInfo = PlanList[i];
                // MessageBox.Show(Convert.ToString(Node.Attributes.GetNamedItem("klasa").InnerText) + " " + Convert.ToString(Node.Attributes.GetNamedItem("id").InnerText) + " " + Node.Attributes.GetNamedItem("przedmiot").InnerText + " " + Node.Attributes.GetNamedItem("nauczyciel").InnerText + " " + Convert.ToString(Node.Attributes.GetNamedItem("sala").InnerText) + " " + Convert.ToString(Node.Attributes.GetNamedItem("godzina").InnerText) + " " + Convert.ToString(Node.Attributes.GetNamedItem("dzien").InnerText));
                if (i > 0)
                {
                    if (KlasaList.Exists(item => item.Nazwa == Node.Attributes.GetNamedItem("klasa").InnerText))
                    {
                    }
                    else
                    {
                        KlasaList.Add(new Klasa(Convert.ToString(Node.Attributes.GetNamedItem("klasa").InnerText), 0, 0));
                    }
                }
                else
                {
                    KlasaList.Add(new Klasa(Convert.ToString(Node.Attributes.GetNamedItem("klasa").InnerText), 0, 0));
                }
            }
            int x = 0;

            for (int i = 0; i < 14; i++)
            {
                for (int j = 0; j < 5; j++)
                {
                    for (int k = 0; k < 50; k++)
                    {
                        Node = XmlDoc.GetElementsByTagName("dostepnosc").Item(x);
                        Dostepnosc[i, j, k] = Convert.ToBoolean(Node.Attributes.GetNamedItem("dost").InnerText);
                        x++;
                    }
                }
            }
            for (int i = 0; i < 14; i++)
            {
                Node = XmlDoc.GetElementsByTagName("lekcja").Item(i);
                CzasyLekcji.Add(Node.Attributes.GetNamedItem("czas").InnerText);
            }

            Label[] labelBaza = new Label[50];
            int     xL = 0, yL = 0;

            for (int i = 0; i < KlasaList.Count; i++)
            {
                Klasa KlasaInfo = KlasaList[i];
                labelBaza[i]             = new Label();
                labelBaza[i].Location    = new Point(xL, yL);
                labelBaza[i].Size        = new Size(150, 20);
                labelBaza[i].Text        = KlasaInfo.Nazwa;
                labelBaza[i].Font        = new Font("Segoe UI", 9);
                labelBaza[i].BackColor   = System.Drawing.Color.FromArgb(((int)(((byte)(3)))), ((int)(((byte)(78)))), ((int)(((byte)(171)))));
                labelBaza[i].ForeColor   = Color.White;
                labelBaza[i].MouseHover += new EventHandler(this.labelBaza_MouseHover);
                labelBaza[i].MouseLeave += new EventHandler(this.labelBaza_MouseLeave);
                labelBaza[i].Click      += new EventHandler(this.button1_Click);
                labelBaza[i].Parent      = panel1;
                nazwaKlasy = KlasaInfo.Nazwa;
                yL         = yL + 23;
            }
            for (int i = 0; i < CzasyLekcji.Count; i++)
            {
                godziny[i].Text = CzasyLekcji[i];
            }
        }
Example #3
0
        private void nextButton_Click(object sender, EventArgs e)
        {
            string style = "";

            if (wybrany == 1)
            {
                style = "style1.css";
            }

            for (int klasa = 0; klasa < KlasaList.Count; klasa++) //każda klasa - nowy dokument
            {
                Klasa NazwaKlasy = KlasaList[klasa];
                File.Copy(Application.StartupPath + "\\data\\html\\index.html", Application.StartupPath + "\\data\\html\\klasa" + klasa + ".html", true);

                FileStream   fs = new FileStream(Application.StartupPath + "\\data\\html\\klasa" + klasa + ".html", FileMode.Open, FileAccess.Read);
                StreamReader sr = new StreamReader(fs);
                html[0] = sr.ReadToEnd();
                sr.Close();

                StringBuilder Bar = new StringBuilder(html[0]);
                for (int i = KlasaList.Count - 1; i >= 0; i--)
                {
                    Klasa KlasaInfo = KlasaList[i];
                    Bar.Insert(140, KlasaInfo.Nazwa + "</br>\n");
                }
                Bar.Insert(292, NazwaKlasy.Nazwa);
                for (int i = 2; i >= 0; i--)
                {
                    if (i % 2 == 0)
                    {
                        try
                        {
                            Plan Piatek = PlanList[PlanList.FindIndex(item => item.Godzina == i && item.Dzien == 4 && item.Klasa == NazwaKlasy.Nazwa)];
                            Bar.Insert(554, Piatek.Przedmiot + "</div></br>\n");
                            Bar.Insert(554, "<div class=" + "tresc" + ">");
                        }
                        catch
                        {
                            Bar.Insert(554, "<div class=" + "tresc" + "></div></br>\n");
                        }
                        try
                        {
                            Plan Czwartek = PlanList[PlanList.FindIndex(item => item.Godzina == i && item.Dzien == 3 && item.Klasa == NazwaKlasy.Nazwa)];
                            Bar.Insert(554, Czwartek.Przedmiot + "</div>");
                            Bar.Insert(554, "<div class=" + "tresc" + ">");
                        }
                        catch
                        {
                            Bar.Insert(554, "<div class=" + "tresc" + "></div>");
                        }
                        try
                        {
                            Plan Sroda = PlanList[PlanList.FindIndex(item => item.Godzina == i && item.Dzien == 2 && item.Klasa == NazwaKlasy.Nazwa)];
                            Bar.Insert(554, Sroda.Przedmiot + "</div>");
                            Bar.Insert(554, "<div class=" + "tresc" + ">");
                        }
                        catch
                        {
                            Bar.Insert(554, "<div class=" + "tresc" + "></div>");
                        }
                        try
                        {
                            Plan Wtorek = PlanList[PlanList.FindIndex(item => item.Godzina == i && item.Dzien == 1 && item.Klasa == NazwaKlasy.Nazwa)];
                            Bar.Insert(554, Wtorek.Przedmiot + "</div>");
                            Bar.Insert(554, "<div class=" + "tresc" + ">");
                        }
                        catch
                        {
                            Bar.Insert(554, "<div class=" + "tresc" + "></div>");
                        }
                        try
                        {
                            Plan Poniedzialek = PlanList[PlanList.FindIndex(item => item.Godzina == i && item.Dzien == 0 && item.Klasa == NazwaKlasy.Nazwa)];
                            Bar.Insert(554, Poniedzialek.Przedmiot + "</div>");
                            Bar.Insert(554, "<div class=" + "tresc" + ">");
                        }
                        catch
                        {
                            Bar.Insert(554, "<div class=" + "tresc" + "></div>");
                        }

                        try
                        {
                            Bar.Insert(554, CzasyLekcji[i] + "</div>");
                            Bar.Insert(554, "<div class=" + "tytul" + ">");
                        }
                        catch
                        {
                            Bar.Insert(544, "<div class=" + "tytul" + "></div");
                        }
                    }
                    else
                    {
                        try
                        {
                            Plan Piatek = PlanList[PlanList.FindIndex(item => item.Godzina == i && item.Dzien == 4 && item.Klasa == NazwaKlasy.Nazwa)];
                            Bar.Insert(554, Piatek.Przedmiot + "</div></br>");
                            Bar.Insert(554, "<div class=" + "tresc2" + ">");
                        }
                        catch
                        {
                            Bar.Insert(554, "<div class=" + "tresc2" + "></div></br>");
                        }
                        try
                        {
                            Plan Czwartek = PlanList[PlanList.FindIndex(item => item.Godzina == i && item.Dzien == 3 && item.Klasa == NazwaKlasy.Nazwa)];
                            Bar.Insert(554, Czwartek.Przedmiot + "</div>");
                            Bar.Insert(554, "</div><div class=" + "tresc2" + ">");
                        }
                        catch
                        {
                            Bar.Insert(554, "<div class=" + "tresc2" + "></div>");
                        }
                        try
                        {
                            Plan Sroda = PlanList[PlanList.FindIndex(item => item.Godzina == i && item.Dzien == 2 && item.Klasa == NazwaKlasy.Nazwa)];
                            Bar.Insert(554, Sroda.Przedmiot + "</div>");
                            Bar.Insert(554, "</div><div class=" + "tresc2" + ">");
                        }
                        catch
                        {
                            Bar.Insert(554, "<div class=" + "tresc2" + "></div>");
                        }
                        try
                        {
                            Plan Wtorek = PlanList[PlanList.FindIndex(item => item.Godzina == i && item.Dzien == 1 && item.Klasa == NazwaKlasy.Nazwa)];
                            Bar.Insert(554, Wtorek.Przedmiot + "</div>");
                            Bar.Insert(554, "</div><div class=" + "tresc2" + ">");
                        }
                        catch
                        {
                            Bar.Insert(554, "<div class=" + "tresc2" + "></div>");
                        }
                        try
                        {
                            Plan Poniedzialek = PlanList[PlanList.FindIndex(item => item.Godzina == i && item.Dzien == 0 && item.Klasa == NazwaKlasy.Nazwa)];
                            Bar.Insert(554, Poniedzialek.Przedmiot + "</div>");
                            Bar.Insert(554, "<div class=" + "tresc2" + ">");
                        }
                        catch
                        {
                            Bar.Insert(554, "<div class=" + "tresc2" + "></div>");
                        }

                        try
                        {
                            Bar.Insert(554, CzasyLekcji[i] + "</div>");
                            Bar.Insert(554, "<div class=" + "tytul" + ">");
                        }
                        catch
                        {
                            Bar.Insert(544, "<div class=" + "tytul" + "></div");
                        }
                    }
                }

                Bar.ToString().Replace("</div></div>", "</div>");

                StreamWriter sw = new StreamWriter(Application.StartupPath + "\\data\\html\\klasa" + klasa + ".html");
                sw.Write(Bar.ToString());
                sw.Close();



                //przed style

                /*
                 * FileStream fs = new FileStream(Application.StartupPath + "\\data\\html\\1.txt", FileMode.Open, FileAccess.Read);
                 * StreamReader sr = new StreamReader(fs);
                 * html[0] = sr.ReadToEnd();
                 * sr.Close();
                 * html[1] = style;
                 * */
                //po style
                FileStream   fs2 = new FileStream(Application.StartupPath + "\\data\\html\\2.txt", FileMode.Open, FileAccess.Read);
                StreamReader sr2 = new StreamReader(fs2);
                html[2] = sr2.ReadToEnd();
                sr2.Close();
                //klasy
                for (int i = 0; i < KlasaList.Count; i++)
                {
                    Klasa KlasaInfo = KlasaList[i];
                    html[3] = html[3] + KlasaInfo.Nazwa + "</br>";
                }
                //po klasach
                FileStream   fs3 = new FileStream(Application.StartupPath + "\\data\\html\\3.txt", FileMode.Open, FileAccess.Read);
                StreamReader sr3 = new StreamReader(fs3);
                html[4] = sr3.ReadToEnd();
                sr3.Close();
                //nazwa rozpatrywanej klasy
                html[5] = NazwaKlasy.Nazwa;
                //dni tygodnia
                FileStream   fs4 = new FileStream(Application.StartupPath + "\\data\\html\\4.txt", FileMode.Open, FileAccess.Read);
                StreamReader sr4 = new StreamReader(fs4);
                html[6] = sr4.ReadToEnd();
                sr4.Close();
                //PLAN
                for (int i = 0; i < 14; i++)
                {
                    if (i % 2 == 0)
                    {
                        /*
                         * Plan Poniedzialek = PlanList[PlanList.FindIndex(item => item.Godzina == i && item.Dzien == 0 && item.Klasa == NazwaKlasy.Nazwa)];
                         * Plan Wtorek = PlanList[PlanList.FindIndex(item => item.Godzina == i && item.Dzien == 1 && item.Klasa == NazwaKlasy.Nazwa)];
                         * Plan Sroda = PlanList[PlanList.FindIndex(item => item.Godzina == i && item.Dzien == 2 && item.Klasa == NazwaKlasy.Nazwa)];
                         * Plan Czwartek = PlanList[PlanList.FindIndex(item => item.Godzina == i && item.Dzien == 3 && item.Klasa == NazwaKlasy.Nazwa)];
                         * Plan Piatek = PlanList[PlanList.FindIndex(item => item.Godzina == i && item.Dzien == 4 && item.Klasa == NazwaKlasy.Nazwa)];
                         *
                         * htmlPlan[i] = '<div class="tytul">' + CzasyLekcji[i];
                         * htmlPlan[i+1] = '</div><div class="tresc">' +  Poniedzialek.Przedmiot;
                         * htmlPlan[i+2] = '</div><div class="tresc">' + Wtorek.Przedmiot;
                         * htmlPlan[i+3] = '</div><div class="tresc">' + Sroda.Przedmiot;
                         * htmlPlan[i+4] = '</div><div class="tresc">' + Czwartek.Przedmiot + '</div><div class="tresc">' + Piatek.Przedmiot + '</div> <br />';
                         */
                    }
                    else
                    {
                    }
                }
            }
        }