Beispiel #1
0
        public static string Update(Model_clienti m, string id, Tip_camera tip_vechi)
        {
            Verif_up(m);
            if (m.fail == null)
            {
                //cautare client
                using (MySqlConnection conn = GetConnection())
                {
                    conn.Open();
                    string query;
                    m.id_camera = id;
                    query       = "UPDATE tabel_clienti SET Nume='" + m.Nume + "',Prenume='" + m.Prenume + "',Tip_camera='" + m.tip_camera.ToString() + "'" +
                                  ",Check_IN='" + m.check_in.ToString() + "',Check_OUT='" + m.check_out.ToString() + "',Carte_Credit='" + m.carte_de_credit.ToString() + "'" +
                                  ",Numar_Carte='" + m.numar_carte + "',Data_expirare='" + m.Data_expirarii + "',CCV='" + m.CCV + "',Mentiuni='" + m.Mentiuni + "' WHERE ID='" + m.ID + "';";

                    MySqlCommand    cmd = new MySqlCommand(query, conn);
                    MySqlDataReader myreader;

                    myreader = cmd.ExecuteReader();//EXECUTE QUERY
                    Deactualizare_baza(m, tip_vechi);

                    Actualizare_lista();

                    Verificare.ok = false;
                }
                Repository_camere.Update_camera(m);
            }
            return(null);
        }
Beispiel #2
0
        private static bool First(Model_clienti m)
        {
            Actualizare_lista();
            if (lista_clienti.Count > 0)
            {
                return(false);
            }
            if (Verificare.ok)
            {
                numar_confirmare++;
                using (MySqlConnection conn = GetConnection())
                {
                    conn.Open();
                    string query, query1;
                    m.ID  = numar_confirmare.ToString();
                    query = "INSERT into Tabel_clienti VALUES('" + numar_confirmare.ToString() + "','" + m.Nume + "','" + m.Prenume + "','"
                            + m.tip_camera.ToString() + "','" + m.check_in.ToString() + "','" + m.check_out.ToString() + "','" + m.carte_de_credit.ToString()
                            + "','" + m.numar_carte + "','" + m.Data_expirarii + "','" + m.CCV + "','" + m.Mentiuni + "','Activ');";

                    MySqlCommand    cmd = new MySqlCommand(query, conn);
                    MySqlDataReader myreader;

                    myreader = cmd.ExecuteReader();//EXECUTE QUERY
                    Repository_camere.Update_camera(m);
                    Actualizare_lista();

                    Verificare.ok = false;
                    return(true);
                }
            }
            return(false);
        }
        public static bool Insert(Model_clienti m)
        {
            if (First(m))
            {
                return(true);
            }
            else
            {
                numar_confirmare = maxim() + 1;
                Verif(m);
                if (m.fail == null)
                {
                    using (MySqlConnection conn = GetConnection())
                    {
                        conn.Open();
                        string query;
                        m.ID  = numar_confirmare.ToString();
                        query = "INSERT into Tabel_clienti VALUES('" + numar_confirmare.ToString() + "','" + m.Nume + "','" + m.Prenume + "','"
                                + m.tip_camera.ToString() + "','" + m.check_in.ToString() + "','" + m.check_out.ToString() + "','" + m.carte_de_credit.ToString()
                                + "','" + m.numar_carte + "','" + m.Data_expirarii + "','" + m.CCV + "','" + m.Mentiuni + "','Activ');";

                        MySqlCommand    cmd = new MySqlCommand(query, conn);
                        MySqlDataReader myreader;

                        myreader = cmd.ExecuteReader();//EXECUTE QUERY
                    }
                    Repository_camere.Update_camera(m);
                    Actualizare_lista();

                    Verificare.ok = false;
                    return(true);
                }
            }
            return(false);
        }
Beispiel #4
0
        public static void Actualizare_stare_clienti_o_data_pe_zi()
        {
            Actualizare_lista();
            foreach (Model_clienti m in lista_clienti)
            {
                if (m.check_out == DateTime.Now)
                {
                    using (MySqlConnection conn = GetConnection())
                    {
                        conn.Open();
                        string query;
                        query = "UPDATE tabel_clienti SET Stare='Inactiv' WHERE ID='" + m.ID + "';";

                        MySqlCommand    cmd = new MySqlCommand(query, conn);
                        MySqlDataReader myreader;

                        myreader = cmd.ExecuteReader();//EXECUTE QUERY
                        Repository_camere.Eliberare_o_camera(m.tip_camera);
                    }
                }
            }
        }