Ejemplo n.º 1
0
        /// <summary>
        /// Deletes a subject.
        /// </summary>
        /// <param name="input">The subject to delete.</param>
        public void Targy_Torles(Targy input)
        {
            try
            {
                XDocument keres = XDocument.Load("targyak.xml");
                var talalat = from x in keres.Root.Descendants("targy")
                              where (string)x.Element("torolt") == "false" && (string)x.Element("kod") == input.Kodja.ToString()
                              select x;

                talalat.Single().Element("torolt").Value = "true";
                keres.Save("targyak.xml");
            }
            catch
            {

            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// List the subjects.
        /// </summary>
        /// <param name="input">The input.</param>
        /// <param name="kod">The kod.</param>
        /// <returns>The list of subjects.</returns>
        public Targy[] Targy_Lista(string input, string kod)
        {
            int kulcs = 1;

            switch (input.ToString())
            {
                case "admin_ertekeles_targy_lista":
                    XDocument keres1 = XDocument.Load("targyak.xml");
                    var talalat1 = from x1 in keres1.Root.Descendants("targy")
                                   where (string)x1.Element("torolt") == "false" && (string)x1.Element("felev") == kod.ToString()
                                   select x1;

                    kulcs = talalat1.Count();
                    break;
                case "hallgato_targyfelvetel_lista":
                    XDocument keres2 = XDocument.Load("targyak.xml");
                    var talalat2 = from x2 in keres2.Root.Descendants("targy")
                                   where (string)x2.Element("torolt") == "false" && (string)x2.Element("felev") == kod.ToString()
                                   select x2;

                    kulcs = talalat2.Count();
                    break;
                case "hallgato_targyfelvetel_felvetel":
                    bool volt3 = false;
                    string hallgato3 = "";
                    string targy3 = "";

                    for (int i = 0; i < kod.Length; i++)
                    {
                        if (kod[i].ToString() != "*")
                        {
                            if (volt3 == false)
                            {
                                hallgato3 += kod[i].ToString();
                            }
                            else
                            {
                                targy3 += kod[i].ToString();
                            }
                        }
                        else
                        {
                            volt3 = true;
                        }
                    }
                    XDocument keres3 = XDocument.Load("targyak.xml");
                    var talalat3 = from x3 in keres3.Root.Descendants("targy")
                                   where (string)x3.Element("torolt") == "false" && (string)x3.Element("felev") == hallgato3.ToString() && (string)x3.Element("kod") == targy3.ToString()
                                   select x3;

                    kulcs = talalat3.Count();
                    break;
                case "admin_targykezeles_kijeloles":
                    XDocument keres4 = XDocument.Load("targyak.xml");
                    var talalat4 = from x4 in keres4.Root.Descendants("targy")
                                   where (string)x4.Element("torolt") == "false" && (string)x4.Element("kod") == kod.ToString()
                                   select x4;

                    kulcs = talalat4.Count();
                    break;
                case "admin_targykezeles_betoltes":
                    XDocument keres5 = XDocument.Load("targyak.xml");
                    var talalat5 = from x5 in keres5.Root.Descendants("targy")
                                   where (string)x5.Element("torolt") == "false"
                                   select x5;

                    kulcs = talalat5.Count();
                    break;
                case "admin_targykezeles_torles":
                    XDocument keres6 = XDocument.Load("targyak.xml");
                    var talalat6 = from x6 in keres6.Root.Descendants("targy")
                                   where (string)x6.Element("torolt") == "false" && (string)x6.Element("kod") == kod.ToString()
                                   select x6;

                    kulcs = talalat6.Count();
                    break;
                case "admin_targykezeles_modositas":
                    XDocument keres7 = XDocument.Load("targyak.xml");
                    var talalat7 = from x7 in keres7.Root.Descendants("targy")
                                   where (string)x7.Element("torolt") == "false" && (string)x7.Element("kod") == kod.ToString()
                                   select x7;

                    kulcs = talalat7.Count();
                    break;
                case "admin_targykezeles_modositas_ell":
                    XDocument keres8 = XDocument.Load("targyak.xml");
                    var talalat8 = from x8 in keres8.Root.Descendants("targy")
                                   where (string)x8.Element("torolt") == "false" && (string)x8.Element("kod") == kod.ToString()
                                   select x8;

                    kulcs = talalat8.Count();
                    break;
                case "admin_targykezeles_hozzaadas":
                    XDocument keres9 = XDocument.Load("targyak.xml");
                    var talalat9 = from x9 in keres9.Root.Descendants("targy")
                                   where (string)x9.Element("torolt") == "false" && (string)x9.Element("kod") == kod.ToString()
                                   select x9;

                    kulcs = talalat9.Count();
                    break;
                case "admin_targyfelvetel_hallgato_targyai":
                    XDocument keres10 = XDocument.Load("targyak.xml");
                    var talalat10 = from x10 in keres10.Root.Descendants("targy")
                                    where (string)x10.Element("torolt") == "false" && (string)x10.Element("felev") == kod.ToString()
                                    select x10;

                    kulcs = talalat10.Count();
                    break;
                case "admin_targyfelvetel_felvetel":
                    XDocument keres11 = XDocument.Load("targyak.xml");
                    var talalat11 = from x11 in keres11.Root.Descendants("targy")
                                    where (string)x11.Element("torolt") == "false" && (string)x11.Element("nev") == kod.ToString()
                                    select x11;

                    kulcs = talalat11.Count();
                    break;
            }

            bool kis = false;

            if (kulcs == 0)
            {
                kis = true;
                kulcs = targy_kulcs;
            }

            Targy[] valasz = new Targy[kulcs];

            if (kis == false)
            {
                int szamlalo = 0;

                switch (input.ToString())
                {
                    case "admin_ertekeles_targy_lista":
                        XDocument keres1 = XDocument.Load("targyak.xml");
                        var talalat1 = from x1 in keres1.Root.Descendants("targy")
                                       where (string)x1.Element("torolt") == "false" && (string)x1.Element("felev") == kod.ToString()
                                       select x1;

                        foreach (var q in talalat1)
                        {
                            valasz[szamlalo] = new Targy((string)q.Element("nev"), (string)q.Element("torolt"), (string)q.Element("kod"), (string)q.Element("kredit"), (string)q.Element("ido"), (string)q.Element("oktato"), (string)q.Element("felev"), (string)q.Element("kov"), (string)q.Element("elokov"), (string)q.Attribute("id"));
                            szamlalo++;
                        }
                        break;
                    case "hallgato_targyfelvetel_lista":
                        XDocument keres2 = XDocument.Load("targyak.xml");
                        var talalat2 = from x2 in keres2.Root.Descendants("targy")
                                       where (string)x2.Element("torolt") == "false" && (string)x2.Element("felev") == kod.ToString()
                                       select x2;

                        foreach (var q in talalat2)
                        {
                            valasz[szamlalo] = new Targy((string)q.Element("nev"), (string)q.Element("torolt"), (string)q.Element("kod"), (string)q.Element("kredit"), (string)q.Element("ido"), (string)q.Element("oktato"), (string)q.Element("felev"), (string)q.Element("kov"), (string)q.Element("elokov"), (string)q.Attribute("id"));
                            szamlalo++;
                        }
                        break;
                    case "hallgato_targyfelvetel_felvetel":
                        bool volt3 = false;
                        string hallgato3 = "";
                        string targy3 = "";

                        for (int i = 0; i < kod.Length; i++)
                        {
                            if (kod[i].ToString() != "*")
                            {
                                if (volt3 == false)
                                {
                                    hallgato3 += kod[i].ToString();
                                }
                                else
                                {
                                    targy3 += kod[i].ToString();
                                }
                            }
                            else
                            {
                                volt3 = true;
                            }
                        }
                        XDocument keres3 = XDocument.Load("targyak.xml");
                        var talalat3 = from x3 in keres3.Root.Descendants("targy")
                                       where (string)x3.Element("torolt") == "false" && (string)x3.Element("felev") == hallgato3.ToString() && (string)x3.Element("kod") == targy3.ToString()
                                       select x3;

                        foreach (var q in talalat3)
                        {
                            valasz[szamlalo] = new Targy((string)q.Element("nev"), (string)q.Element("torolt"), (string)q.Element("kod"), (string)q.Element("kredit"), (string)q.Element("ido"), (string)q.Element("oktato"), (string)q.Element("felev"), (string)q.Element("kov"), (string)q.Element("elokov"), (string)q.Attribute("id"));
                            szamlalo++;
                        }
                        break;
                    case "admin_targykezeles_kijeloles":
                        XDocument keres4 = XDocument.Load("targyak.xml");
                        var talalat4 = from x4 in keres4.Root.Descendants("targy")
                                       where (string)x4.Element("torolt") == "false" && (string)x4.Element("kod") == kod.ToString()
                                       select x4;

                        foreach (var q in talalat4)
                        {
                            valasz[szamlalo] = new Targy((string)q.Element("nev"), (string)q.Element("torolt"), (string)q.Element("kod"), (string)q.Element("kredit"), (string)q.Element("ido"), (string)q.Element("oktato"), (string)q.Element("felev"), (string)q.Element("kov"), (string)q.Element("elokov"), (string)q.Attribute("id"));
                            szamlalo++;
                        }
                        break;
                    case "admin_targykezeles_betoltes":
                        XDocument keres5 = XDocument.Load("targyak.xml");
                        var talalat5 = from x5 in keres5.Root.Descendants("targy")
                                       where (string)x5.Element("torolt") == "false"
                                       select x5;

                        foreach (var q in talalat5)
                        {
                            valasz[szamlalo] = new Targy((string)q.Element("nev"), (string)q.Element("torolt"), (string)q.Element("kod"), (string)q.Element("kredit"), (string)q.Element("ido"), (string)q.Element("oktato"), (string)q.Element("felev"), (string)q.Element("kov"), (string)q.Element("elokov"), (string)q.Attribute("id"));
                            szamlalo++;
                        }
                        break;
                    case "admin_targykezeles_torles":
                        XDocument keres6 = XDocument.Load("targyak.xml");
                        var talalat6 = from x6 in keres6.Root.Descendants("targy")
                                       where (string)x6.Element("torolt") == "false" && (string)x6.Element("kod") == kod.ToString()
                                       select x6;

                        foreach (var q in talalat6)
                        {
                            valasz[szamlalo] = new Targy((string)q.Element("nev"), (string)q.Element("torolt"), (string)q.Element("kod"), (string)q.Element("kredit"), (string)q.Element("ido"), (string)q.Element("oktato"), (string)q.Element("felev"), (string)q.Element("kov"), (string)q.Element("elokov"), (string)q.Attribute("id"));
                            szamlalo++;
                        }
                        break;
                    case "admin_targykezeles_modositas":
                        XDocument keres7 = XDocument.Load("targyak.xml");
                        var talalat7 = from x7 in keres7.Root.Descendants("targy")
                                       where (string)x7.Element("torolt") == "false" && (string)x7.Element("kod") == kod.ToString()
                                       select x7;

                        foreach (var q in talalat7)
                        {
                            valasz[szamlalo] = new Targy((string)q.Element("nev"), (string)q.Element("torolt"), (string)q.Element("kod"), (string)q.Element("kredit"), (string)q.Element("ido"), (string)q.Element("oktato"), (string)q.Element("felev"), (string)q.Element("kov"), (string)q.Element("elokov"), (string)q.Attribute("id"));
                            szamlalo++;
                        }
                        break;
                    case "admin_targykezeles_modositas_ell":
                        XDocument keres8 = XDocument.Load("targyak.xml");
                        var talalat8 = from x8 in keres8.Root.Descendants("targy")
                                       where (string)x8.Element("torolt") == "false" && (string)x8.Element("kod") == kod.ToString()
                                       select x8;

                        foreach (var q in talalat8)
                        {
                            valasz[szamlalo] = new Targy((string)q.Element("nev"), (string)q.Element("torolt"), (string)q.Element("kod"), (string)q.Element("kredit"), (string)q.Element("ido"), (string)q.Element("oktato"), (string)q.Element("felev"), (string)q.Element("kov"), (string)q.Element("elokov"), (string)q.Attribute("id"));
                            szamlalo++;
                        }
                        break;
                    case "admin_targykezeles_hozzaadas":
                        XDocument keres9 = XDocument.Load("targyak.xml");
                        var talalat9 = from x9 in keres9.Root.Descendants("targy")
                                       where (string)x9.Element("torolt") == "false" && (string)x9.Element("kod") == kod.ToString()
                                       select x9;

                        foreach (var q in talalat9)
                        {
                            valasz[szamlalo] = new Targy((string)q.Element("nev"), (string)q.Element("torolt"), (string)q.Element("kod"), (string)q.Element("kredit"), (string)q.Element("ido"), (string)q.Element("oktato"), (string)q.Element("felev"), (string)q.Element("kov"), (string)q.Element("elokov"), (string)q.Attribute("id"));
                            szamlalo++;
                        }
                        break;
                    case "admin_targyfelvetel_hallgato_targyai":
                        XDocument keres10 = XDocument.Load("targyak.xml");
                        var talalat10 = from x10 in keres10.Root.Descendants("targy")
                                        where (string)x10.Element("torolt") == "false" && (string)x10.Element("felev") == kod.ToString()
                                        select x10;

                        foreach (var q in talalat10)
                        {
                            valasz[szamlalo] = new Targy((string)q.Element("nev"), (string)q.Element("torolt"), (string)q.Element("kod"), (string)q.Element("kredit"), (string)q.Element("ido"), (string)q.Element("oktato"), (string)q.Element("felev"), (string)q.Element("kov"), (string)q.Element("elokov"), (string)q.Attribute("id"));
                            szamlalo++;
                        }
                        break;
                    case "admin_targyfelvetel_felvetel":
                        XDocument keres11 = XDocument.Load("targyak.xml");
                        var talalat11 = from x11 in keres11.Root.Descendants("targy")
                                        where (string)x11.Element("torolt") == "false" && (string)x11.Element("nev") == kod.ToString()
                                        select x11;

                        foreach (var q in talalat11)
                        {
                            valasz[szamlalo] = new Targy((string)q.Element("nev"), (string)q.Element("torolt"), (string)q.Element("kod"), (string)q.Element("kredit"), (string)q.Element("ido"), (string)q.Element("oktato"), (string)q.Element("felev"), (string)q.Element("kov"), (string)q.Element("elokov"), (string)q.Attribute("id"));
                            szamlalo++;
                        }
                        break;
                }
            }

            return valasz;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Edits a subject.
        /// </summary>
        /// <param name="mit">The old subject.</param>
        /// <param name="mire">The new subject.</param>
        public void Targy_Modosit(Targy mit, Targy mire)
        {
            try
            {
                XDocument keres = XDocument.Load("targyak.xml");
                var talalat = from x in keres.Root.Descendants("targy")
                              where (string)x.Element("kod") == mit.Kodja.ToString()
                              select x;

                if (mit.Neve.ToString() != mire.Neve.ToString())
                {
                    talalat.Single().Element("nev").Value = mire.Neve.ToString();
                }
                if (mit.Kodja.ToString() != mire.Kodja.ToString())
                {
                    talalat.Single().Element("kod").Value = mire.Kodja.ToString();
                }
                if (mit.Kreditje.ToString() != mire.Kreditje.ToString())
                {
                    talalat.Single().Element("kredit").Value = mire.Kreditje.ToString();
                }
                if (mit.Oktatoja.ToString() != mire.Oktatoja.ToString())
                {
                    talalat.Single().Element("oktato").Value = mire.Oktatoja.ToString();
                }
                if (mit.Ideje.ToString() != mire.Ideje.ToString())
                {
                    talalat.Single().Element("ido").Value = mire.Ideje.ToString();
                }
                if (mit.Feleve.ToString() != mire.Feleve.ToString())
                {
                    talalat.Single().Element("felev").Value = mire.Feleve.ToString();
                }
                if (mit.Elokovetelmenye.ToString() != mire.Elokovetelmenye.ToString())
                {
                    talalat.Single().Element("elokov").Value = mire.Elokovetelmenye.ToString();
                }
                if (mit.Kovetelmenye.ToString() != mire.Kovetelmenye.ToString())
                {
                    talalat.Single().Element("kov").Value = mire.Kovetelmenye.ToString();
                }

                keres.Save("targyak.xml");
            }
            catch
            {

            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Adds a subject.
        /// </summary>
        /// <param name="input">The subject to add.</param>
        public void Targy_Hozzaad(Targy input)
        {
            try
            {
                XDocument mentes = XDocument.Load("targyak.xml");
                var talalat = from x in mentes.Root.Descendants("targy")
                              where (string)x.Element("kod") == input.Kodja.ToString()
                              select x;

                if (talalat.Count() == 0)
                {
                    XAttribute idje = new XAttribute("id", input.Idje);
                    targy_kulcs++;
                    XElement torolve = new XElement("torolt", "false");
                    XElement kodja = new XElement("kod", input.Kodja.ToString());
                    XElement neve = new XElement("nev", input.Neve.ToString());
                    XElement kreditje = new XElement("kredit", input.Kreditje.ToString());
                    XElement kovje = new XElement("kov", input.Kovetelmenye.ToString());
                    XElement elokovje = new XElement("elokov", input.Elokovetelmenye.ToString());
                    XElement feleve = new XElement("felev", input.Feleve.ToString());
                    XElement oktatoja = new XElement("oktato", input.Oktatoja.ToString());
                    XElement ideje = new XElement("ido", input.Ideje.ToString());
                    XElement ujtargy = new XElement("targy", idje, torolve, kodja, neve, kreditje, oktatoja, ideje, feleve, elokovje, kovje);
                    mentes.Element("targyak").Add(ujtargy);

                    mentes.Save("targyak.xml");
                }
            }
            catch
            {

            }
        }