Beispiel #1
0
 public static void SaveZilier(om zilier)
 {
     using (IDbConnection cnn = new SQLiteConnection(LoadConnectionString()))
     {
         cnn.Execute("insert into tabel_sezon (nume, prezente) values (@nume, @prezente)", zilier);
         cnn.Close();
     }
 }
Beispiel #2
0
 public static void UpdateTabel_nume(om zilier, string nume_nou)
 {
     using (SQLiteConnection cnn = new SQLiteConnection(LoadConnectionString()))
     {
         string cmnd = "update tabel_sezon set nume ='" + nume_nou + "' where nume ='" + zilier.nume.ToString() + "'";
         cnn.Execute(cmnd, zilier);
         cnn.Close();
     }
 }
Beispiel #3
0
        private void CasetaPrezenta_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                // if (SqliteDataAccess.validZi(this.dateTimePicker.Text))
                //{
                //    CasetaPrezenta.Text = "";
                //    MessageBox.Show("ZIUA NU ESTE VALIDA");
                //}
                //else
                //{
                om Zilier = new om();

                string   aux0 = CasetaPrezenta.Text.ToLower();
                string[] aux  = aux0.Split(' ');
                Zilier.nume = "";

                CasetaPrezenta.Text = "";

                for (int j = 0; j < aux.Length; j++)
                {
                    //MessageBox.Show(aux[j]);

                    aux[j]      = aux[j].First().ToString().ToUpper() + aux[j].Substring(1);
                    Zilier.nume = Zilier.nume + aux[j] + " ";
                }

                Zilier.nume = Zilier.nume.Trim();
                Zilier.nume = Zilier.nume.First().ToString().ToUpper() + Zilier.nume.Substring(1);

                int i  = Indice(Zilier.nume);
                int ok = 1;

                if (i == -1)
                {
                    Zilier.prezente = 1;

                    //S-ar putea sa trebuiasca in afara if-ului
                    SqliteDataAccess.SaveZilier(Zilier);
                }
                else
                {
                    foreach (om Zilier2 in zilieri_zi)
                    {
                        if (Valid(Zilier2.nume, Zilier.nume))
                        {
                            ok = 0;
                        }
                    }

                    if (ok == 1)
                    {
                        zilieri[i].prezente++;
                        SqliteDataAccess.UpdateTabel(zilieri[i]);
                    }
                }

                if (ok == 1)
                {
                    zilieri_zi.Add(Zilier);

                    IncarcaOameni();
                    RefreshSezon();
                    RefreshBonus();
                    RefreshZi();
                }

                ConfirmationBox.Text = "";
                if (i != -1)
                {
                    ConfirmationBox.Text = zilieri[i].nume + " are acum " + zilieri[i].prezente.ToString() + " prezente.";
                }
                else
                {
                    ConfirmationBox.Text = Zilier.nume + " a facut PRIMA prezenta.";
                }
                //}
            }
        }