IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

C# Discussion :

Idées d'amélioration d'un Classe Type


Sujet :

C#

  1. #1
    Membre averti
    Profil pro
    Inscrit en
    Mars 2010
    Messages
    19
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2010
    Messages : 19
    Par défaut Idées d'amélioration d'un Classe Type
    Bonjour

    Je développe un logiciel de gestion de prix selon différent pays.
    Afin de mettre en vente sur Amazon.

    Pouvez vous me dire si ma classe Type est correct et si vous voyez des améliorations de possible ?

    Je vous remercie

    Aussi comment gérer le retour d'information d'une forme appeler par plusieurs autres Formes différant ? (exemple confirmation de suppression)
    Sans devoir faire des :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
    public nomform1 Form1
    public nomform2 Form2
    public nomform3 Form3
    Dans la forme de confirmation

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.Data;
    using System.Data.OleDb;
    using Npgsql;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
     
    namespace AmazonManager
    {
        public partial class NewChocCommissionsNomTableCommission : System.Web.UI.Page
        {
            NpgsqlConnection Connection = new NpgsqlConnection("Server=####");
     
            public NewChocAdmin newChocA;
            public string Lieux = "";
            public string NomTable = typeof(NewChocCommissionsNomTableCommission).Name;
     
            public NewChocCommissionsNomTableCommission()
            {
                //Debut creation table NomTableCommission
                if (ExistsTableNomTableCommission() == 0)
                {
                    try
                    {
                        CreateTableNomTableCommission();
                    }
                    catch(exception ex) { MessageBox.Show(" Erreur Impossible de creer la table :" + NomTable + "\n ex : " + ex); }
                }
                //Fin creation table NomTableCommission
            }
     
            public NewChocCommissionsNomTableCommission(NewChocAdmin newchocAS, string LieuxS)
            {
                this.newChocA = newchocAS;
                this.Lieux = LieuxS;
     
                 //Debut creation table NomTableCommission
                 if (ExistsTableNomTableCommission() == 0)
                 {
                     try
                     {
                         CreateTableNomTableCommission();
                     }
                     catch(exception ex) { MessageBox.Show(" Erreur Impossible de creer la table :" + NomTable "\n ex : " + ex); }
                 }
                //Fin creation table NomTableCommission
     
             }
     
            //-------------------------------------------Getteur------------------------------------\\
     
            public string GETNomTABLENomTableCommission()
            {
                return this.NomTable;
            }
     
            public BindingSource GETTABLENomTableCommission()
            {
                string requête = "";
                BindingSource bSource = new BindingSource();
                try
                {
                    //Début Creation Table Si besoin
                    new NewChocCommissionMisEnVentePhotos_Vente();
                    new NewAliChocVente();
     
                    //Debut Verification Si Connection Ouverte
                    if (Connection.State != ConnectionState.Open) { Connection.Open(); }
     
                    string sqlQuery = "SELECT * from " + NomTable + " ORDER BY Position" + NomTable + ", ID" + NomTable + " ";
     
                    requête = sqlQuery;
     
                    using (NpgsqlDataAdapter dAdapter = new NpgsqlDataAdapter(sqlQuery, Connection))
                    {
                        DataTable dTable = new DataTable();
                        dAdapter.Fill(dTable);
                        bSource.DataSource = dTable;
                        return bSource;
                    }
                }
                catch (Exception ex) { MessageBox.Show("Erreur GETTABLENomTableCommission \n requête : " + requête + " " + ex); return bSource; }
                finally
                {
                    Connection.Close();
                }
            }
     
            public DataTable GETSigle_NomTABLENomTableCommission()
            {
                DataTable TableNomPaysNewAliChocGoogles = null;
                string requête = "";
                try
                {
                    //Debut Verification Si Connection Ouverte
                    if (Connection.State != ConnectionState.Open) { Connection.Open(); }
     
                    String sqlQuery = "SELECT ID" + this.NomTable + ", Position" + this.NomTable + " from " + this.NomTable + "  ORDER BY Position" + NomTable + ", Nom" + this.NomTable + " ";
                    requête = sqlQuery;
                    DataSet ds = new DataSet();
                    NpgsqlDataAdapter da = new NpgsqlDataAdapter(sqlQuery, Connection);
                    da.Fill(ds, "ID" + this.NomTable + ", Position" + this.NomTable + "");
                    TableNomPaysNewAliChocGoogles = ds.Tables["ID" + this.NomTable + ", Position" + this.NomTable + ""];
     
                }
                catch(exception ex) { MessageBox.Show("Erreur GETSigle_NomPaysNewAliChocGooglesTable" + this.NomTable + ", requête : " + requête + "\n ex : " + ex); }
                finally
                {
                    Connection.Close();
                }
     
                return TableNomPaysNewAliChocGoogles;
            }
     
            public long GetNewIDNomTableCommission()
            {
                string requête = "";
                long IDNomTableCommission = 0;
                try
                {
     
                    //Debut Verification Si Connection Ouverte
                    if (Connection.State != ConnectionState.Open) { Connection.Open(); }
     
                    string strTemp = "Nom" + this.NomTable + " ";
                    String sqlQuery = "INSERT INTO " + this.NomTable + " (" + strTemp + ") VALUES (@Nom" + this.NomTable + ") RETURNING ID" + NomTable + "";
                    requête = sqlQuery;
                    NpgsqlCommand oCmd = new NpgsqlCommand(sqlQuery, Connection);
     
                    oCmd.Parameters.AddWithValue("@Nom" + this.NomTable + "", "");
     
                    IDNomTableCommission = Convert.ToInt32(oCmd.ExecuteScalar());
                }
                catch(exception ex) { MessageBox.Show("Erreur GetNewIDNomTableCommission" + this.NomTable + "\n requête : " + requête + "\n ex : " + ex); IDNomTableCommission = -1; }
                finally
                {
                    Connection.Close();
                }
     
                return IDNomTableCommission;
            }
     
            public int GetCountTableNomTableCommission()
            {
                int CountTable = 0;
     
                string requête = "";
                try
                {
                    //Debut Verification Si Connection Ouverte
                    if (Connection.State != ConnectionState.Open) { Connection.Open(); }
     
                    String sqlQuery = "SELECT count(*) FROM " + NomTable + " ";
                    requête = sqlQuery;
                    NpgsqlCommand oCmd = new NpgsqlCommand(sqlQuery, Connection);
                    CountTable = System.Convert.ToInt32(oCmd.ExecuteScalar());
     
                }
                catch(exception ex) { MessageBox.Show("Erreur GetCountTableNomTableCommission requête : " + requête + "\n ex : " + ex);}
                finally
                {
                    Connection.Close();
                }
     
                return CountTable;
            }
     
            //-------------------------------------------Setteur------------------------------------\\
            public bool MultiUpdatePositionTableTypeCommission(long IDTableTypeCommissionS, long PositionDepartS, long positionFinalS)
            {
                int idPhoto = 0;
                string requête = "";
                try
                {
                    //Récuperation DataTablePays
                    DataTable MaDatatablePosition = GETSigle_NomTABLENomTableCommission();
                    if (MaDatatablePosition.Rows.Count > 0)
                    {
                        //Debut Verification Si Connection Ouverte
                        if (Connection.State != ConnectionState.Open) { Connection.Open(); }
     
                        String sqlQuery = "WITH new_values (id, Position) as ( values ";
                        bool AjoutValeurok = false;
                        foreach (DataRow row in MaDatatablePosition.Rows) // Loop over the rows.
                        {
                            //Changement IDsouhaité
                            if (Convert.ToInt64(row["ID" + NomTable]) == IDTableTypeCommissionS)
                            {
                                sqlQuery += " (" + row["ID" + NomTable] + ", " + positionFinalS + " ) ";
                                AjoutValeurok = true;
                            }
                            else if (row["Position" + NomTable].ToString() != "")
                            {
                                //Diminution
                                if (PositionDepartS > positionFinalS)
                                {
                                    //Position Final inférieur ou = position en cours
                                    if (positionFinalS <= Convert.ToInt32(row["Position" + NomTable].ToString()))
                                    {
                                        //Position Depart superieur position en cours
                                        if (PositionDepartS > Convert.ToInt32(row["Position" + NomTable].ToString()))
                                        {
                                            sqlQuery += " (" + row["ID" + NomTable] + ", " + (Convert.ToInt32(row["Position" + NomTable].ToString()) + 1) + " ) ";
                                            AjoutValeurok = true;
                                        }
                                    }
                                }
                                //Augmentation
                                else
                                {
                                    //Position Final supérieur ou = position en cours
                                    if (PositionDepartS < Convert.ToInt32(row["Position" + NomTable].ToString()))
                                    {
                                        //Position Final supérieur ou = position en cours
                                        if (positionFinalS >= Convert.ToInt32(row["Position" + NomTable].ToString()))
                                        {
                                            sqlQuery += " (" + row["ID" + NomTable] + ", " + (Convert.ToInt32(row["Position" + NomTable].ToString()) - 1) + " ) ";
                                            AjoutValeurok = true;
                                        }
                                    }
                                }
                            }
     
                            if (AjoutValeurok)
                            {
                                AjoutValeurok = false;
     
                                if (MaDatatablePosition.Rows.Count - 1 != MaDatatablePosition.Rows.IndexOf(row))
                                {
                                    sqlQuery += ",";
                                }
                            }
     
                            if (MaDatatablePosition.Rows.Count - 1 == MaDatatablePosition.Rows.IndexOf(row))
                            {
                                sqlQuery += ")";
                                sqlQuery = sqlQuery.Replace(",)", ")");
                                break;
                            }
                        }
     
                        sqlQuery += " UPDATE " + NomTable + " m";
                        sqlQuery += " set Position" + NomTable + " = nv.Position ";
                        sqlQuery += " FROM new_values nv ";
                        sqlQuery += " WHERE m.ID" + NomTable + " = nv.id ";
     
                        requête = sqlQuery;
                        NpgsqlCommand oCmd = new NpgsqlCommand(sqlQuery, Connection);
                        idPhoto = Convert.ToInt32(oCmd.ExecuteScalar());
                    }
                }
                catch (Exception ex) { MessageBox.Show("Erreur MultiUpdatePositionTableTypeCommission ex : " + ex); }
                finally
                {
                    Connection.Close();
                }
     
                return true;
            }
     
            public bool SetActifAllTableTypeCommission(long IDTableTypeCommissionS, bool valeurS)
            {
                bool resultat = true;
     
                string requête = "";
                try
                {
     
                    //Debut Verification Si Connection Ouverte
                    if (Connection.State != ConnectionState.Open) { Connection.Open(); }
     
                    String sqlQuery = "UPDATE " + NomTable + " SET ActiveAll" + NomTable + "='" + valeurS + "' WHERE (ID" + NomTable + "=" + IDTableTypeCommissionS + ") ";
                    requête = sqlQuery;
                    NpgsqlCommand oCmd = new NpgsqlCommand(sqlQuery, Connection);
                    oCmd.ExecuteNonQuery();
     
                }
                catch(exception ex) { MessageBox.Show("Erreur SetActifAllTableTypeCommission" + NomTable + " requête : " + requête + "\n ex : " + ex); resultat = false; }
                finally
                {
                    Connection.Close();
                }
     
                return resultat;
            }
     
            public bool SetNomNomTableCommission(long IDNomTableCommissionES, string NomES)
            {
                bool resultat = true;
     
                string requête = "";
                try
                {
     
                    //Debut Verification Si Connection Ouverte
                    if (Connection.State != ConnectionState.Open) { Connection.Open(); }
     
                    String sqlQuery = "UPDATE " + NomTable + " SET Nom" + NomTable + "='" + NomES + "' WHERE (ID" + NomTable + "=" + IDNomTableCommissionES + ") ";
                    requête = sqlQuery;
                    NpgsqlCommand oCmd = new NpgsqlCommand(sqlQuery, Connection);
                    oCmd.ExecuteNonQuery();
     
                }
                catch(exception ex) { MessageBox.Show("Erreur SetNomNomTableCommission" + NomTable + " requête : " + requête + "\n ex : " + ex); resultat = false; }
                finally
                {
                    Connection.Close();
                }
     
                return resultat;
            }
     
            //-------------------------------------------Requête------------------------------------\\
     
            public int ExistsTableNomTableCommission()
            {
                int resultat = 0;
     
                try
                {
     
                    //Debut Verification Si Connection Ouverte
                    if (Connection.State != ConnectionState.Open) { Connection.Open(); }
     
                    String sqlQuery = "SELECT count(*) From " + NomTable + " ";
                    NpgsqlCommand oCmd = new NpgsqlCommand(sqlQuery, Connection);
                    if (oCmd.ExecuteNonQuery() == 0) { resultat = 1; }
                    if (oCmd.ExecuteNonQuery() != 0) { resultat = 1; }
     
                }
                catch { resultat = 0; }
                finally
                {
                    Connection.Close();
                }
     
                return resultat;
            }
     
            public void CreateTableNomTableCommission()
            {
                string requête = "";
                try
                {
     
                    //Debut Verification Si Connection Ouverte
                    if (Connection.State != ConnectionState.Open) { Connection.Open(); }
                    String sqlQuery = "";
     
                    sqlQuery += " begin;";
     
                    string strTemp = "ID" + NomTable + " bigserial PRIMARY KEY, Position" + NomTable + " integer, Nom" + NomTable + " VARCHAR(255), Date_Heure" + NomTable + " timestamp with time zone DEFAULT current_timestamp, Date_HeureMAJ" + NomTable + " timestamp with time zone DEFAULT current_timestamp, ActiveAll" + NomTable + " boolean";
                    //string strTemp = "ID" + NomTable + " bigserial, Nom" + NomTable + " VARCHAR(255), Pourc" + NomTable + " double precision, Prix" + NomTable + " double precision, Insert_Final" + NomTable + " smallint, Pays" + NomTable + " smallint, Date_Heure" + NomTable + " timestamp with time zone DEFAULT current_timestamp, Date_HeureMAJ" + NomTable + " timestamp with time zone DEFAULT current_timestamp, Active" + NomTable + " smallint, Pro" + NomTable + " smallint";
                    sqlQuery += " CREATE TABLE " + NomTable + " (" + strTemp + ");";
     
                    //Debut Creation Function
                    sqlQuery += " CREATE OR REPLACE FUNCTION Date_HeureMAJ_" + NomTable + "_modified_column()";
                    sqlQuery += " RETURNS TRIGGER AS $$";
                    sqlQuery += " BEGIN";
                    sqlQuery += " NEW.Date_HeureMAJ" + NomTable + " = now();";
                    sqlQuery += " RETURN NEW;";
                    sqlQuery += " END;";
                    sqlQuery += " $$ language 'plpgsql';";
     
                    //Debut Creation TRIGGER
                    sqlQuery += " CREATE TRIGGER TRIG_date_HeureMAJ_" + NomTable + "_modified_column BEFORE UPDATE";
                    sqlQuery += " ON " + NomTable + " FOR EACH ROW EXECUTE PROCEDURE";
                    sqlQuery += " Date_HeureMAJ_" + NomTable + "_modified_column();";
                    sqlQuery += " commit;";
     
                    requête = sqlQuery;
                    NpgsqlCommand oCmd = new NpgsqlCommand(sqlQuery, Connection);
                    oCmd.ExecuteNonQuery();
     
                }
                catch(Exception ex) { MessageBox.Show("Erreur CreateTable" + NomTable + " requête : " + requête + "\n ex : " + ex); }
                finally
                {
                    Connection.Close();
                }
            }
     
            public bool DeleteLigneNomTableCommission(int IDNomTableCommissionES)
            {
                bool resultat = true;
                string requête = "";
     
                try
                {
     
                    //Debut Verification Si Connection Ouverte
                    if (Connection.State != ConnectionState.Open) { Connection.Open(); }
     
                    String sqlQuery = "DELETE FROM " + NomTable + " WHERE ID" + NomTable + "=" + IDNomTableCommissionES + " ";
                    requête = sqlQuery;
                    NpgsqlCommand oCmd = new NpgsqlCommand(sqlQuery, Connection);
                    oCmd.ExecuteNonQuery();
     
                }
                catch(exception ex) { MessageBox.Show("Erreur DeleteLigneNomTableCommission : " + IDNomTableCommissionES + "\n ex " + ex); resultat = false; }
                finally
                {
                    Connection.Close();
                }
     
                return resultat;
            }
     
            public long InsertTableNomTableCommission(string NomES, double PourcentNomTableCommission, double PrixNomTableCommission, int InsertES, int PaysES)
            {
                long Id_NomTableCommission = -1;
                string requête = "";
     
                try
                {
                    //Debut Verification Si Connection Ouverte
                    if (Connection.State != ConnectionState.Open) { Connection.Open(); }
     
                    string strTemp = "Nom" + NomTable + ",Pourc" + NomTable + ",Prix" + NomTable + ",Insert_Final" + NomTable + ",Pays" + NomTable + ",Active" + NomTable + ",Pro" + NomTable + " ";
                    String sqlQuery = "INSERT INTO " + NomTable + " (" + strTemp + ") VALUES (@Nom" + NomTable + ",@Pourc" + NomTable + ",@Prix" + NomTable + ",@Insert_Final" + NomTable + ",@Pays" + NomTable + ",@Active" + NomTable + ",@Pro" + NomTable + ") RETURNING ID" + NomTable + " ";
     
                    requête = sqlQuery;
                    NpgsqlCommand oCmd = new NpgsqlCommand(sqlQuery, Connection);
     
                    oCmd.Parameters.AddWithValue("@Nom" + NomTable + "", NomES);
                    oCmd.Parameters.AddWithValue("@Pourc" + NomTable + "", PourcentNomTableCommission.ToString().Replace(",", "."));
                    oCmd.Parameters.AddWithValue("@Prix" + NomTable + "", PrixNomTableCommission.ToString().Replace(",", "."));
                    oCmd.Parameters.AddWithValue("@Insert_Final" + NomTable + "", InsertES);
                    oCmd.Parameters.AddWithValue("@Pays" + NomTable + "", PaysES);
                    oCmd.Parameters.AddWithValue("@Active" + NomTable + "", '0');
                    oCmd.Parameters.AddWithValue("@Pro" + NomTable + "", '3');
     
                    Id_NomTableCommission = Convert.ToInt64(oCmd.ExecuteScalar());
                }
                catch(Exception ex) { MessageBox.Show("Erreur InsertTableNomTableCommission : " + NomES + "\n ex : " + ex); }
                finally
                {
                    Connection.Close();
                }
     
                return Id_NomTableCommission;
            }
     
            //-------------------------------------------GETTEUR------------------------------------\\
            public bool ExisteInformationsTableNomTableCommission(string NomES, double PourcentNomTableCommissionS, double PrixNomTableCommissionS, int InsertES, int PaysES)
            {
                bool ExisteInfos = false;
                string requête = "";
                try
                {
     
                    //Debut Verification Si Connection Ouverte
                    if (Connection.State != ConnectionState.Open) { Connection.Open(); }
     
                    String sqlQuery = "SELECT count(*) from " + NomTable + " WHERE (Nom" + NomTable + "='" + NomES + "') AND (Pourc" + NomTable + "='" + PourcentNomTableCommissionS.ToString().Replace(",", ".") + "') AND (Prix" + NomTable + "='" + PrixNomTableCommissionS.ToString().Replace(",", ".") + "') AND (Insert_Final" + NomTable + "='" + InsertES + "') AND (Pays" + NomTable + "='" + PaysES + "') ";
                    requête = sqlQuery;
                    NpgsqlCommand oCmd = new NpgsqlCommand(sqlQuery, Connection);
                    if (System.Convert.ToInt32(oCmd.ExecuteScalar()) > 0) { ExisteInfos = true; }
     
                }
                catch(exception ex) { MessageBox.Show("Erreur verification ExisteInformationsTableNomTableCommission, requête : " + requête + "\n ex : " + ex); ExisteInfos = true; }
                finally
                {
                    Connection.Close();
                }
     
                return ExisteInfos;
            }
            //-------------------------------------------Requête ALTER Table------------------------------------\\
     
            //public bool AlterTableNomTableCommission_ProNomTableCommission()
            //{
            //    bool resultat = true;
            //    string requête = "";
     
            //    try
            //    {
            //        //Debut Verification Si Connection Ouverte
            //        if (Connection.State != ConnectionState.Open) { Connection.Open(); }
     
            //        String sqlQuery = "ALTER TABLE " + NomTable + " ADD COLUMN Pro" + NomTable + " VARCHAR(10)";
            //        requête = sqlQuery;
            //        NpgsqlCommand oCmd = new NpgsqlCommand(sqlQuery, Connection);
            //        oCmd.ExecuteNonQuery();
     
            //    }
            //    catch(exception ex) { MessageBox.Show("Erreur AlterTableNomTableCommission_ProNomTableCommission \n ex : " + ex); resultat = false; }
            //    finally
            //    {
            //        Connection.Close();
            //    }
     
            //    return resultat;
            //}
        }
    }

  2. #2
    Membre chevronné
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2008
    Messages
    231
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : Finance

    Informations forums :
    Inscription : Avril 2008
    Messages : 231
    Par défaut
    Bonjour,

    Bon par où commencer ...

    Dans un premier temps ta class UI fait tout, Connecion à la base de donnée gestion des données entrante et sortante etc.. Il faut que tu structure ton code en Couche. Alors dit comme ça sur cette class on pourrait se dire qu'elle est l'utilité ? Et la réutilisation de tes couches.

    Ensuite un mot, Injection SQL, on ne fait ça :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    String sqlQuery = "UPDATE " + NomTable + " SET ActiveAll" + NomTable + "='" + valeurS + "' WHERE (ID" + NomTable + "=" + IDTableTypeCommissionS + ") ";
    Ou sinon un petit malin un jour va t'exploser ta base

    dans une page Web je pense pas .... System.Windows.Forms.MessageBox.Show ne fait pas partie des namespace utilisable en Web. En tout cas ce n'est pas ton client qui va recevoir la messagebox mais ton server. Et comme c'est bloquant (au niveau de ton thread) tu vas bloquer tout son exécution. En gros le client va faire F5 ce qui va recréer un autre thread .. en gros tu vas avoir plein de thread qui tourne dans le vide sur ton IIS.

    J'ai pas tout regardé.

Discussions similaires

  1. Classe Type et Cast
    Par thibaud dans le forum C#
    Réponses: 1
    Dernier message: 29/07/2008, 11h19
  2. [recherche] idée d'amélioration
    Par franculo_caoulene dans le forum Evolutions du club
    Réponses: 8
    Dernier message: 08/12/2007, 12h33
  3. VBA - ListBox améliorée - modules de classe
    Par House MD dans le forum Macros et VBA Excel
    Réponses: 3
    Dernier message: 01/12/2007, 18h20
  4. amélioration d'une classe
    Par deubelte dans le forum C++
    Réponses: 12
    Dernier message: 19/10/2007, 10h36
  5. Réponses: 3
    Dernier message: 05/09/2006, 18h41

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo