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
| int IDAL_Paie.EMPLOYE_Insert(EMPLOYE dr)
{
using (DbConnection connection = db.CreateConnection())
{
using (DbCommand command = db.GetStoredProcCommand("Employe_insert"))
{
db.AddInParameter(command, "PAY_NAISS", DbType.String, dr.PAY_NAISS);
db.AddInParameter(command, "SER_NOM", DbType.String, dr.SER_NOM);
db.AddInParameter(command, "TPC_LIB", DbType.String, dr.TPC_LIB);
db.AddInParameter(command, "SEX_LIB", DbType.String, dr.SEX_LIB);
db.AddInParameter(command, "DEP_DESIGN", DbType.String, dr.DEP_DESIGN);
db.AddInParameter(command, "PAY_NATION", DbType.String, dr.PAY_NATION);
db.AddInParameter(command, "SFA_LIB", DbType.String, dr.SFA_LIB);
db.AddInParameter(command, "FCT_NOM", DbType.String, dr.FCT_NOM);
db.AddInParameter(command, "CAT_ID", DbType.String, dr.CAT_ID);
db.AddInParameter(command, "ECH_ID", DbType.String, dr.ECH_ID);
db.AddInParameter(command, "PAY_RESID", DbType.String, dr.PAY_RESID);
db.AddInParameter(command, "COL_LIB", DbType.String, dr.COL_LIB);
db.AddInParameter(command, "MDP_LIB", DbType.String, dr.MDP_LIB);
db.AddInParameter(command, "TIT_LIB", DbType.String, dr.TIT_LIB);
db.AddInParameter(command, "PPY_NOM", DbType.String, dr.PPY_NOM);
db.AddInParameter(command, "EMP_MAT", DbType.String, dr.EMP_MAT);
db.AddInParameter(command, "EMP_NOM", DbType.String, dr.EMP_NOM);
db.AddInParameter(command, "EMP_PRENOM", DbType.String, dr.EMP_PRENOM);
db.AddInParameter(command, "EMP_NOM_J_FILLE", DbType.String, dr.EMP_NOM_J_FILLE);
db.AddInParameter(command, "EMP_NE_A", DbType.String, dr.EMP_NE_A);
db.AddInParameter(command, "EMP_NE_LE", DbType.DateTime, dr.EMP_NE_LE);
db.AddInParameter(command, "EMP_NUM_SECUSOC", DbType.String, dr.EMP_NUM_SECUSOC);
db.AddInParameter(command, "EMP_NBRE_ENFANTS", DbType.Int32, dr.EMP_NBRE_ENFANTS);
db.AddInParameter(command, "EMP_ADRESSE1", DbType.String, dr.EMP_ADRESSE1);
db.AddInParameter(command, "EMP_ADRESSE2", DbType.String, dr.EMP_ADRESSE2);
db.AddInParameter(command, "EMP_ADRESSE3", DbType.String, dr.EMP_ADRESSE3);
db.AddInParameter(command, "EMP_QUALIF", DbType.String, dr.EMP_QUALIF);
db.AddInParameter(command, "EMP_DATE_EMBAUCHE", DbType.DateTime, dr.EMP_DATE_EMBAUCHE);
db.AddInParameter(command, "EMP_BANQUE", DbType.String, dr.EMP_BANQUE);
db.AddInParameter(command, "EMP_CODE_BANQUE", DbType.Int32, dr.EMP_CODE_BANQUE);
db.AddInParameter(command, "EMP_CODE_GUICHET", DbType.Int32, dr.EMP_CODE_GUICHET);
db.AddInParameter(command, "EMP_CLERIB", DbType.Int32, dr.EMP_CLERIB);
db.AddInParameter(command, "EMP_PHOTO", DbType.Binary, dr.EMP_PHOTO);
db.AddInParameter(command, "EMP_TEL1", DbType.String, dr.EMP_TEL1);
db.AddInParameter(command, "EMP_TEL2", DbType.String, dr.EMP_TEL2);
db.AddInParameter(command, "EMP_EMAIL", DbType.String, dr.EMP_EMAIL);
db.AddInParameter(command, "EMP_TITULAIRE_COMPTE", DbType.String, dr.EMP_TITULAIRE_COMPTE);
db.AddInParameter(command, "EMP_NUM_CPTE", DbType.Decimal, dr.EMP_NUM_CPTE);
db.AddOutParameter(command, "EMP_ID", DbType.Int32, 32);
try
{
db.ExecuteNonQuery(command);
return (int)db.GetParameterValue(command, "EMP_ID");
}
catch
{
return -1;
}
finally
{
if (connection.State == ConnectionState.Open)
connection.Close();
}
}
}
} |
Partager