Пример #1
0
        public List <string> GautDalyka(Naudotojas nd)
        {
            try
            {
                List <string> list = new List <string>();
                con.Open();
                MySqlCommand command = con.CreateCommand();
                command.CommandText = "select DISTINCT d.Da_Pav from dalykas d join destytojo_dalykas dd on dd.Da_ID=d.Da_ID where dd.De_ID=@id";
                command.Parameters.AddWithValue("@id", nd.ID);
                using (MySqlDataReader reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        list.Add(reader["Da_Pav"].ToString());
                    }
                }

                con.Close();
                return(list);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Пример #2
0
        public List <string> GautiGrupeDestytojo(Naudotojas nd)
        {
            try
            {
                List <string> list = new List <string>();
                con.Open();
                MySqlCommand command = con.CreateCommand();
                command.CommandText = "select DISTINCT g.G_Pav from grupe g join studentas s on s.Grupe_ID=g.G_ID join paskaitos p on p.S_ID=s.S_ID join destytojo_dalykas dd on p.Da_ID=dd.Da_ID where dd.De_ID=@id";
                command.Parameters.AddWithValue("@id", nd.ID);
                using (MySqlDataReader reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        list.Add(reader["G_Pav"].ToString());
                    }
                }

                con.Close();
                return(list);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Пример #3
0
 public void Prisijungti(string vardas, string slaptazodis)
 {
     try
     {
         con.Open();
         MySqlCommand command = con.CreateCommand();
         command.CommandText = "select * from naudotojas" +
                               " where Vardas=@un and Pavarde=@p;";
         command.Parameters.AddWithValue("@un", vardas);
         command.Parameters.AddWithValue("@p", slaptazodis);
         using (MySqlDataReader reader = command.ExecuteReader())
         {
             while (reader.Read())
             {
                 naudotojas = new Naudotojas(Int32.Parse(reader["N_ID"].ToString()), reader["Vardas"].ToString(), reader["Pavarde"].ToString(), Int32.Parse(reader["NL_ID"].ToString()));
             }
         }
         con.Close();
         if (naudotojas == null)
         {
             throw new Exception("Neteisingi duomenys");
         }
     }
     catch
     {
         throw new Exception("Neteisingi duomenys");
     }
 }
Пример #4
0
        public DestytojoLangas(Naudotojas nd)
        {
            InitializeComponent();
            grupe = MS.GautiGrupeDestytojo(nd);
            foreach (var item in grupe)
            {
                comboBox1.Items.Add(item);
            }

            dalykas = MS.GautDalyka(nd);
            foreach (var item in dalykas)
            {
                comboBox2.Items.Add(item);
            }
        }
Пример #5
0
 public void StudentoDuom(Naudotojas nd)
 {
     try
     {
         con.Open();
         MySqlCommand command = con.CreateCommand();
         command.CommandText = "select * from studentas s join grupe g on g.G_ID=s.Grupe_ID where s.N_ID=@id";
         command.Parameters.AddWithValue("@id", nd.ID);
         using (MySqlDataReader reader = command.ExecuteReader())
         {
             while (reader.Read())
             {
                 st = new Studentas(nd.ID, nd.vardas, nd.pavarde, nd.lygis, Int32.Parse(reader["S_ID"].ToString()), Int32.Parse(reader["Grupe_ID"].ToString()), reader["G_Pav"].ToString());
             }
         }
         con.Close();
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
 public Administratorius(Naudotojas nd)
 {
     InitializeComponent();
     Lenteles();
 }