Beispiel #1
0
        //prideda studijuojama grupe
        public studijuojamasdalykas Insertstuddalyk(studijuojamasdalykas studdalyk)
        {
            SqlConnection sqlCon = new SqlConnection(con);

            sqlCon.Open();

            /*SqlCommand cmd = new SqlCommand("SELECT * FROM [dalykas] WHERE username=@username", sqlCon);
             * cmd.Parameters.AddWithValue("@username", student.Username);
             * SqlDataReader dr = cmd.ExecuteReader();
             * if (dr.Read() == true)
             * {
             *  MessageBox.Show("The Username you chosen already exists, please select different username !");
             *  return null;
             * }
             * dr.Close();*/

            SqlCommand sql = new SqlCommand("INSERT INTO [Studijuojamas_dalykas] (studento_ID,dalyko_ID)" +
                                            " VALUES (@studento_ID,@dalyko_ID)", sqlCon);

            sql.Parameters.AddWithValue("@studento_ID", studdalyk.SDstudentoID);
            sql.Parameters.AddWithValue("@dalyko_ID", studdalyk.SDdalykoID);

            sql.ExecuteNonQuery();
            sqlCon.Close();
            return(studdalyk);
        }
Beispiel #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                if (Astudentoid.Text != "" && Adalykoid.Text != "")
                {
                    using (SqlConnection sqlCon = new SqlConnection(con))
                    {
                        sqlCon.Open();
                        studijuojamasdalykas studdalyk = new studijuojamasdalykas();
                        studdalyk.SDstudentoID = Convert.ToInt32(Astudentoid.Text.Trim());
                        studdalyk.SDdalykoID   = Convert.ToInt32(Adalykoid.Text.Trim());
                        //if () {
                        //student.Grupe = Agrupe.Text.Trim();
                        studijuojamasdalykas register = repos.Insertstuddalyk(studdalyk);
                    }

                    Clear();
                }
                else
                {
                    MessageBox.Show("All fields must be written");
                }
                void Clear()
                {
                    Astudentoid.Text = Adalykoid.Text = "";
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message);
            }
        }
Beispiel #3
0
        //ideti egza
        public studijuojamasdalykas Insertegzas(studijuojamasdalykas ivertinimas)
        {
            studijuojamasdalykas ivertis = new studijuojamasdalykas();
            SqlConnection        sqlcon  = new SqlConnection(con);

            sqlcon.Open();
            SqlCommand sql = new SqlCommand("UPDATE Studijuojamas_dalykas SET Egzas = @egzas WHERE studento_ID= @studento_ID AND dalyko_ID= @dalyko_ID ", sqlcon);

            sql.Parameters.AddWithValue("@egzas", ivertinimas.SDegzas);
            sql.Parameters.AddWithValue("@studento_ID", ivertinimas.SDstudentoID);
            sql.Parameters.AddWithValue("@dalyko_ID", ivertinimas.SDdalykoID);
            sql.ExecuteNonQuery();
            sqlcon.Close();

            return(ivertis);
        }
Beispiel #4
0
 //Iveda kontra
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         if (studID.Text != "" && kontras.Text != "" && dalykID.Text != "")
         {
             if (Convert.ToInt32(kontras.Text) >= 1 && Convert.ToInt32(kontras.Text) <= 10)
             {
                 using (SqlConnection sqlCon = new SqlConnection(con))
                 {
                     sqlCon.Open();
                     studijuojamasdalykas ivertinimas = new studijuojamasdalykas();
                     ivertinimas.SDkontras    = Convert.ToInt32(kontras.Text);
                     ivertinimas.SDstudentoID = Convert.ToInt32(studID.Text);
                     ivertinimas.SDdalykoID   = Convert.ToInt32(dalykID.Text);
                     //if () {
                     //pavadinimas.pavadinimas = Agrupe.Text.Trim();
                     studijuojamasdalykas register = repos.Insertkontras(ivertinimas);
                 }
                 Clear();
             }
             else
             {
                 MessageBox.Show("netinka pazymys");
             }
         }
         else
         {
             MessageBox.Show("iveskite id");
         }
         void Clear()
         {
             studID.Text = kontras.Text = dalykID.Text = "";
         }
         showstudijuojamasdalykas();
     }
     catch (Exception exc)
     {
         MessageBox.Show(exc.Message);
     }
 }
Beispiel #5
0
 //iveda egza
 private void ivestiegza_Click(object sender, EventArgs e)
 {
     try
     {
         if (EstudID.Text != "" && egzas.Text != "" && EdalykID.Text != "")
         {
             if (Convert.ToInt32(egzas.Text) >= 0 && Convert.ToInt32(egzas.Text) <= 10)
             {
                 using (SqlConnection sqlCon = new SqlConnection(con))
                 {
                     sqlCon.Open();
                     studijuojamasdalykas ivertinimas = new studijuojamasdalykas();
                     ivertinimas.SDegzas      = Convert.ToInt32(egzas.Text);
                     ivertinimas.SDstudentoID = Convert.ToInt32(EstudID.Text);
                     ivertinimas.SDdalykoID   = Convert.ToInt32(EdalykID.Text);
                     studijuojamasdalykas register = repos.Insertegzas(ivertinimas);
                 }
                 Clear();
             }
             else
             {
                 MessageBox.Show("netinka pazymys");
             }
         }
         else
         {
             MessageBox.Show("iveskite id");
         }
         void Clear()
         {
             EstudID.Text = egzas.Text = EdalykID.Text = "";
         }
         showstudijuojamasdalykas();
     }
     catch (Exception exc)
     {
         MessageBox.Show(exc.Message);
     }
 }