Beispiel #1
0
        public List <CsAdmRoles> GetAssocitedToMenuByMenuID(int menuId)
        {
            cn              = new SqlConnection(ConnectionString);
            cmd             = new SqlCommand();
            cmd.Connection  = cn;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "spx_AdmRoles_GetAssocitedToMenuByMenuID";
            cmd.Parameters.Clear();
            cmd.Parameters.Add("@MenuID", SqlDbType.VarChar).Value = menuId;

            DBBase.SetDBNullParametre(cmd.Parameters);

            SqlDataReader reader = null;

            List <CsAdmRoles> rows = new List <CsAdmRoles>();

            try
            {
                reader = cmd.ExecuteReader();
                Fill(reader, rows, 0, int.MaxValue);
                reader.Close();

                return(rows);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                cmd.Dispose();
            }
        }
Beispiel #2
0
        //public bool Update(CsUtilisateur admUsers)
        //{
        //    cn = new SqlConnection(ConnectionString);
        //    cmd = new SqlCommand();
        //    cmd.Connection = cn;
        //    //SqlCommand cmd = new SqlCommand("spx_AdmUsers_Update", this.ConnectionString);
        //    cmd.CommandType = CommandType.StoredProcedure;
        //    cmd.CommandText = "spx_Adm_Uers_Update";
        //    //cmd.CommandText = "spx_AdmUsers_Update";
        //    cmd.Parameters.Clear();
        //    //cmd.Parameters.AddWithValue("@IdUser", admUsers.IdUser);
        //    cmd.Parameters.Add("@LoginName", SqlDbType.VarChar).Value = admUsers.LoginName;
        //    cmd.Parameters.Add("@DateCreation", SqlDbType.DateTime).Value = admUsers.DateCreation;
        //    cmd.Parameters.Add("@DateDerniereModification", SqlDbType.DateTime).Value = admUsers.DateDerniereModification;
        //    cmd.Parameters.Add("@DateDebutValidite", SqlDbType.DateTime).Value = admUsers.DateDebutValidite;
        //    cmd.Parameters.Add("@DateFinValidite", SqlDbType.DateTime).Value = admUsers.DateFinValidite;
        //    cmd.Parameters.Add("@IdStatusCompte", SqlDbType.VarChar).Value = admUsers.IdStatusCompte;
        //    cmd.Parameters.Add("@RoleID", SqlDbType.VarChar).Value = admUsers.RoleID;
        //    cmd.Parameters.Add("@DateDerniereModificationPassword", SqlDbType.DateTime).Value = admUsers.DateDerniereModificationPassword;
        //    cmd.Parameters.Add("@InitUserPassword", SqlDbType.VarChar).Value = admUsers.InitUserPassword;
        //    cmd.Parameters.Add("@NombreEchecsOuvertureSession", SqlDbType.Int).Value = admUsers.NombreEchecsOuvertureSession;
        //    cmd.Parameters.Add("@DateDerniereConnexion", SqlDbType.DateTime).Value = admUsers.DateDerniereConnexion;
        //    cmd.Parameters.Add("@DerniereConnexionReussie", SqlDbType.DateTime).Value = admUsers.DerniereConnexionReussie;
        //    cmd.Parameters.Add("@DateDernierVerrouillage", SqlDbType.DateTime).Value = admUsers.DateDernierVerrouillage;
        //    cmd.Parameters.Add("@Centre", SqlDbType.VarChar).Value = admUsers.Centre;
        //    cmd.Parameters.Add("@Matricule", SqlDbType.VarChar).Value = admUsers.Matricule;
        //    cmd.Parameters.Add("@DisplayName", SqlDbType.VarChar).Value = admUsers.DisplayName;
        //    cmd.Parameters.Add("@fonction", SqlDbType.VarChar).Value = admUsers.Fonction;
        //    cmd.Parameters.Add("@NumCaisse", SqlDbType.VarChar).Value = admUsers.NumCaisse;
        //    cmd.Parameters.Add("@branche", SqlDbType.VarChar).Value = admUsers.Branche;
        //    //cmd.Parameters.AddWithValue("@DisplayName",  admUsers.DisplayName);
        //   // cmd.Parameters.AddWithValue("@Nom",  admUsers.Nom);
        //   // cmd.Parameters.AddWithValue("@Prenoms",  admUsers.Prenoms);
        //   // cmd.Parameters.AddWithValue("@Agent_ID", admUsers.Agent_ID);

        //   // cmd.Parameters.AddWithValue("@EstMutiSociete", admUsers.EstMutiSociete);

        //    /*Adaptation Galatee - Par OLA*/
        //    //cmd.Parameters.AddWithValue("@Centre", admUsers.Centre);
        //    //cmd.Parameters.AddWithValue("@Matricule", admUsers.Matricule);
        //    //cmd.Parameters.AddWithValue("@NomPrenoms", admUsers.DisplayName);
        //    //cmd.Parameters.AddWithValue("@fonction", admUsers.Fonction);
        //    //cmd.Parameters.AddWithValue("@NumCaisse", admUsers.NumCaisse);
        //    //cmd.Parameters.AddWithValue("@branche", admUsers.Branche);
        //    /*Fin - le 14/10/2009*/

        //    DBBase.SetDBNullParametre(cmd.Parameters);

        //    try
        //    {

        //        if (cn.State == ConnectionState.Closed)
        //            cn.Open();
        //        cmd.ExecuteNonQuery();
        //        return true;
        //    }
        //    catch(Exception ex)
        //    {

        //        string error= ex.Message;
        //        return false;

        //    }
        //    finally
        //    {
        //        if (cn.State == ConnectionState.Open)
        //            cn.Close(); // Fermeture de la connection
        //        cmd.Dispose();
        //    }
        //}

        //public void Insert(CsUtilisateur admUsers)
        //{
        //    cn = new SqlConnection(ConnectionString);
        //    cmd = new SqlCommand();
        //    cmd.Connection = cn;
        //    cmd.CommandType = CommandType.StoredProcedure;
        //    cmd.CommandText = "spx_AdmUsers_Insert";
        //    cmd.Parameters.Clear();
        //    //cmd.Parameters.AddWithValue("@IdUser", admUsers.IdUser);
        //    //cmd.Parameters.AddWithValue("@LoginName", admUsers.LoginName);
        //    //cmd.Parameters.AddWithValue("@DisplayName", admUsers.DisplayName);
        //    //cmd.Parameters.AddWithValue("@Nom", admUsers.Nom);
        //    //cmd.Parameters.AddWithValue("@Prenoms", admUsers.Prenoms);
        //    //cmd.Parameters.AddWithValue("@Agent_ID", admUsers.Agent_ID);
        //    cmd.Parameters.Add("@LoginName", SqlDbType.VarChar).Value = admUsers.LoginName;
        //    cmd.Parameters.Add("@DateCreation", SqlDbType.DateTime).Value = admUsers.DateCreation;
        //    cmd.Parameters.Add("@DateDerniereModification", SqlDbType.DateTime).Value = admUsers.DateDerniereModification;
        //    cmd.Parameters.Add("@DateDebutValidite", SqlDbType.DateTime).Value = admUsers.DateDebutValidite;
        //    cmd.Parameters.Add("@DateFinValidite", SqlDbType.DateTime).Value = admUsers.DateFinValidite;
        //    cmd.Parameters.Add("@IdStatusCompte", SqlDbType.TinyInt).Value =Convert.ToInt16(admUsers.IdStatusCompte);
        //    cmd.Parameters.Add("@Password", SqlDbType.VarChar).Value = admUsers.Password;

        //    //cmd.Parameters.Add("@RoleID", SqlDbType.VarChar).Value = admUsers.RoleID;
        //    cmd.Parameters.Add("@DateDerniereModificationPassword", SqlDbType.DateTime).Value = admUsers.DateDerniereModificationPassword;
        //    cmd.Parameters.Add("@InitUserPassword", SqlDbType.Bit).Value = admUsers.InitUserPassword==true ? 0:1;
        //    cmd.Parameters.Add("@NombreEchecsOuvertureSession", SqlDbType.TinyInt).Value = admUsers.NombreEchecsOuvertureSession;
        //    cmd.Parameters.Add("@DateDerniereConnexion", SqlDbType.DateTime).Value = admUsers.DateDerniereConnexion;
        //    cmd.Parameters.Add("@DerniereConnexionReussie", SqlDbType.Bit).Value = admUsers.DerniereConnexionReussie == true? 0:1;
        //    cmd.Parameters.Add("@DateDernierVerrouillage", SqlDbType.DateTime).Value = admUsers.DateDernierVerrouillage;
        //    cmd.Parameters.Add("@Centre", SqlDbType.VarChar).Value = admUsers.Centre;
        //    cmd.Parameters.Add("@Matricule", SqlDbType.VarChar).Value = admUsers.Matricule;
        //    cmd.Parameters.Add("@NomPrenoms", SqlDbType.VarChar).Value = admUsers.DisplayName;
        //    cmd.Parameters.Add("@fonction", SqlDbType.VarChar).Value = admUsers.Fonction;
        //    cmd.Parameters.Add("@NumCaisse", SqlDbType.VarChar).Value = admUsers.NumCaisse;
        //    cmd.Parameters.Add("@branche", SqlDbType.VarChar).Value = admUsers.Branche;
        //    cmd.Parameters.Add("@PerimetreAction", SqlDbType.SmallInt).Value =Convert.ToInt16(admUsers.PerimetreAction);

        //    /*Adaptation Galatee - Par OLA*/
        //    //cmd.Parameters.AddWithValue("@Centre", admUsers.Centre);
        //    //cmd.Parameters.AddWithValue("@Matricule", admUsers.Matricule);
        //    //cmd.Parameters.AddWithValue("@NomPrenoms", admUsers.DisplayName);
        //    //cmd.Parameters.AddWithValue("@fonction", admUsers.Fonction);
        //    //cmd.Parameters.AddWithValue("@NumCaisse", admUsers.NumCaisse);
        //    //cmd.Parameters.AddWithValue("@branche", admUsers.Branche);
        //    /*Fin - le 14/10/2009*/

        //    DBBase.SetDBNullParametre(cmd.Parameters);

        //    try
        //    {

        //        if (cn.State == ConnectionState.Closed)
        //            cn.Open();
        //        cmd.ExecuteNonQuery();
        //    }
        //    catch (Exception ex)
        //    {
        //        throw new Exception(ex.Message);

        //    }
        //    finally
        //    {
        //        if (cn.State == ConnectionState.Open)
        //            cn.Close(); // Fermeture de la connection
        //        cmd.Dispose();
        //    }
        //}

        //public bool Delete(Guid IdUser)
        //{
        //    cn = new SqlConnection(ConnectionString);
        //    cmd = new SqlCommand();
        //    cmd.Connection = cn;
        //    cmd.CommandType = CommandType.StoredProcedure;
        //    cmd.CommandText = "spx_AdmUsers_Delete";
        //    cmd.Parameters.Clear();
        //    cmd.Parameters.Add("@IdUser", SqlDbType.VarChar).Value = IdUser;


        //    DBBase.SetDBNullParametre(cmd.Parameters);

        //    try
        //    {

        //        if (cn.State == ConnectionState.Closed)
        //            cn.Open();
        //        cmd.ExecuteNonQuery();
        //        return true;
        //    }
        //    catch (Exception ex)
        //    {
        //        string error = ex.Message;
        //        return false;

        //    }
        //    finally
        //    {
        //        if (cn.State == ConnectionState.Open)
        //            cn.Close(); // Fermeture de la connection
        //        cmd.Dispose();
        //    }
        //}

        /*Adaptation Galatee - Par HGB*/
        public bool Delete(string Matricule)
        {
            cn              = new SqlConnection(ConnectionString);
            cmd             = new SqlCommand();
            cmd.Connection  = cn;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "spx_AdmUsers_DeleteByMatricule";
            cmd.Parameters.Clear();
            cmd.Parameters.Add("@Matricule", SqlDbType.VarChar).Value = Matricule;

            DBBase.SetDBNullParametre(cmd.Parameters);

            try
            {
                if (cn.State == ConnectionState.Closed)
                {
                    cn.Open();
                }
                cmd.ExecuteNonQuery();
                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (cn.State == ConnectionState.Open)
                {
                    cn.Close(); // Fermeture de la connection
                }
                cmd.Dispose();
            }
        }
        public List <CsRegCli> RetourneRegroupementGestionnaires(int IdGestionnaire)
        {
            cn                 = new SqlConnection(ConnectionString);
            cmd                = new SqlCommand();
            cmd.Connection     = cn;
            cmd.CommandTimeout = 18000;
            cmd.CommandType    = CommandType.StoredProcedure;
            cmd.CommandText    = "SPX_RECOUV_REGROUPEMENTGESTIONNAIRE";
            cmd.Parameters.Add("@IDGESTIONNAIRE", SqlDbType.Int).Value = IdGestionnaire;

            DBBase.SetDBNullParametre(cmd.Parameters);
            try
            {
                if (cn.State == ConnectionState.Closed)
                {
                    cn.Open();
                }
                SqlDataReader reader = cmd.ExecuteReader();
                DataTable     dt     = new DataTable();
                dt.Load(reader);
                return(Entities.GetEntityListFromQuery <CsRegCli>(dt));
            }
            catch (Exception ex)
            {
                throw new Exception(cmd.CommandText + ":" + ex.Message);
            }
            finally
            {
                if (cn.State == ConnectionState.Open)
                {
                    cn.Close();     // Fermeture de la connection
                }
                cmd.Dispose();
            }
        }
Beispiel #4
0
        public List <CsComptable> RetourneComptaDuMoisComptable(string pMoisCompta, string pTypeEnc)
        {
            CsComptable        _ta;
            List <CsComptable> ListeTA = new List <CsComptable>();

            ConnectionString = Session.GetSqlConnexionStringAbo07();
            cn              = new SqlConnection(ConnectionString);
            cmd             = new SqlCommand();
            cmd.Connection  = cn;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = EnumProcedureStockee.RetourneComptaParMoisCompta;
            cmd.Parameters.Clear();
            cmd.Parameters.Add("@MOISCOMPTA", SqlDbType.VarChar).Value = pMoisCompta;
            cmd.Parameters.Add("@TYPEENC", SqlDbType.VarChar).Value    = pTypeEnc;

            DBBase.SetDBNullParametre(cmd.Parameters);
            try
            {
                if (this.cn.State == ConnectionState.Closed)
                {
                    this.cn.Open();
                }

                SqlDataReader reader = cmd.ExecuteReader();
                if (!reader.HasRows)
                {
                    reader.Close();
                    // throw new Exception("Erreur survenue.");
                }
                while (reader.Read())
                {
                    _ta            = new CsComptable();
                    _ta.MOISCOMPTA = string.IsNullOrEmpty(reader.GetValue(0).ToString()) ? string.Empty : reader.GetValue(0).ToString().Trim();
                    _ta.CENTRE     = string.IsNullOrEmpty(reader.GetValue(1).ToString()) ? string.Empty : reader.GetValue(1).ToString().Trim();
                    _ta.NATURE     = string.IsNullOrEmpty(reader.GetValue(2).ToString()) ? string.Empty : reader.GetValue(2).ToString().Trim();
                    _ta.COMMUNE    = string.IsNullOrEmpty(reader.GetValue(3).ToString()) ? string.Empty : reader.GetValue(3).ToString().Trim();
                    _ta.PRODUIT    = string.IsNullOrEmpty(reader.GetValue(4).ToString()) ? string.Empty : reader.GetValue(4).ToString().Trim();
                    _ta.REDEVANCE  = string.IsNullOrEmpty(reader.GetValue(5).ToString()) ? string.Empty : reader.GetValue(5).ToString().Trim();
                    _ta.REDHT      = string.IsNullOrEmpty(reader.GetValue(6).ToString()) ? 0 : Convert.ToDecimal(reader.GetValue(6).ToString().Trim());
                    _ta.REDTAXE    = string.IsNullOrEmpty(reader.GetValue(7).ToString()) ? 0 : Convert.ToDecimal(reader.GetValue(7).ToString().Trim());
                    ListeTA.Add(_ta);
                }
                //Fermeture reader
                reader.Close();
                return(ListeTA);
            }
            catch (Exception ex)
            {
                throw new Exception(EnumProcedureStockee.SelectARRETE + ":" + ex.Message);
            }
            finally
            {
                if (this.cn.State == ConnectionState.Open)
                {
                    this.cn.Close(); // Fermeture de la connection
                }
                cmd.Dispose();
            }
        }
        public List <CsHabilitationProgram> ProgramSelectById(int id)
        {
            CsHabilitationProgram line;

            List <CsHabilitationProgram> programmes = new List <CsHabilitationProgram>();

            cn              = new SqlConnection(ConnectionString);
            cmd             = new SqlCommand();
            cmd.Connection  = cn;
            cmd.CommandText = "spx_Program_SelectById";

            cmd.Parameters.Add("@Id", SqlDbType.Int).Value = id;
            DBBase.SetDBNullParametre(cmd.Parameters);

            try
            {
                List <CsHabilitationProgram> rows = new List <CsHabilitationProgram>();
                if (this.cn.State == ConnectionState.Closed)
                {
                    this.cn.Open();
                }
                SqlDataReader reader = cmd.ExecuteReader();

                if (!reader.HasRows)
                {
                    reader.Close();

                    return(null);
                }
                while (reader.Read())
                {
                    //line = new CsHabilitationProgram();
                    //if (reader.GetValue(0).ToString().Trim() != string.Empty)
                    //    line.Id = reader.GetValue(0).ToString().Trim();
                    ////if (reader.GetValue(1).ToString().Trim() != string.Empty)
                    //    //line.IdGroupProgram =reader.GetValue(1).ToString().Trim();
                    //line.Code = reader.GetValue(2).ToString().Trim();
                    //line.Libelle = reader.GetValue(3).ToString().Trim();
                    //rows.Add(line);
                }
                //Fermeture reader
                reader.Close();
                return(rows);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
                if (this.cn.State == ConnectionState.Open)
                {
                    this.cn.Close(); // Fermeture de la connection
                }
                cmd.Dispose();
            }
        }
Beispiel #6
0
        public List <CsReclamationRcl> ListDesReclamationSpx(DateTime dateDebut, DateTime dateFin, List <int> lstidcentre, List <int> EtatReclamant)
        {
            try
            {
                string listeTypeReclamation = DBBase.RetourneStringListeObject(EtatReclamant);;
                //foreach (var item in EtatReclamant)
                //   {
                //       listeTypeReclamation=item+","+ listeTypeReclamation;
                //   }
                cn = new SqlConnection(ConnectionString);
                string lesCentres = DBBase.RetourneStringListeObject(lstidcentre);
                cmd                = new SqlCommand();
                cmd.Connection     = cn;
                cmd.CommandTimeout = 3000;
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandText    = "SPX_RECLAMATION_LISTERECLAMATION";
                cmd.Parameters.Add("@dateDebut", SqlDbType.DateTime).Value = dateDebut;
                //cmd.Parameters.Add("@TypeReclamantion", SqlDbType.Int).Value = EtatReclamant;
                cmd.Parameters.Add("@TypeReclamantion", SqlDbType.VarChar).Value           = listeTypeReclamation;
                cmd.Parameters.Add("@dateFin", SqlDbType.DateTime).Value                   = dateFin;
                cmd.Parameters.Add("@IDCENTRELIST", SqlDbType.VarChar, int.MaxValue).Value = lesCentres;

                DBBase.SetDBNullParametre(cmd.Parameters);
                try
                {
                    if (cn.State == ConnectionState.Closed)
                    {
                        cn.Open();
                    }
                    SqlDataReader reader = cmd.ExecuteReader();
                    DataTable     dt     = new DataTable();
                    dt.Load(reader);
                    return(Entities.GetEntityListFromQuery <CsReclamationRcl>(dt));
                }
                catch (Exception ex)
                {
                    return(null);

                    throw new Exception(cmd.CommandText + ":" + ex.Message);
                }
                finally
                {
                    if (cn.State == ConnectionState.Open)
                    {
                        cn.Close();  // Fermeture de la connection
                    }
                    cmd.Dispose();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public void Delete_REGROU(string Centre, string CodeRegroupement, string CodeProduit)
        {
            cn              = new SqlConnection(ConnectionString);
            cmd             = new SqlCommand();
            cmd.Connection  = cn;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = EnumProcedureStockee.DeleteREGROU;
            cmd.Parameters.Clear();

            SqlParameter paramCentre = cmd.Parameters.Add("@Centre", SqlDbType.VarChar);

            paramCentre.Direction = ParameterDirection.Input;

            SqlParameter paramRegrou = cmd.Parameters.Add("@Regrou", SqlDbType.VarChar);

            paramRegrou.Direction = ParameterDirection.Input;

            SqlParameter paramProduit = cmd.Parameters.Add("@Produit", SqlDbType.VarChar);

            paramProduit.Direction = ParameterDirection.Input;

            // recuperer les informations de la ligne selectionnée
            paramCentre.Value  = Centre;
            paramRegrou.Value  = CodeRegroupement;
            paramProduit.Value = CodeProduit;

            DBBase.SetDBNullParametre(cmd.Parameters);

            try
            {
                if (cn.State == ConnectionState.Closed)
                {
                    cn.Open();
                }
                StartTransaction(cn);
                cmd.ExecuteNonQuery();

                CommitTransaction(cmd.Transaction);
            }
            catch (Exception ex)
            {
                RollBackTransaction(cmd.Transaction);
                throw new Exception(EnumProcedureStockee.DeleteREGROU + ":" + ex.Message);
            }
            finally
            {
                if (cn.State == ConnectionState.Open)
                {
                    cn.Close();
                }
                cmd.Dispose();
            }
        }
Beispiel #8
0
        public void Update(List <CsInit> row)
        {
            foreach (CsInit ta in row)
            {
                int rowsAffected = -1;
                cn              = new SqlConnection(ConnectionString);
                cmd             = new SqlCommand();
                cmd.Connection  = cn;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = EnumProcedureStockee.UpdateINIT;
                cmd.Parameters.Clear();

                try
                {
                    cmd.Parameters.Add("@CENTRE", SqlDbType.VarChar).Value   = ta.CENTRE;
                    cmd.Parameters.Add("@PRODUIT", SqlDbType.VarChar).Value  = ta.PRODUIT;
                    cmd.Parameters.Add("@NTABLE", SqlDbType.SmallInt).Value  = int.Parse(ta.NTABLE);
                    cmd.Parameters.Add("@ZONE", SqlDbType.SmallInt).Value    = int.Parse(ta.ZONE);
                    cmd.Parameters.Add("@CONTENU", SqlDbType.SmallInt).Value = ta.CONTENU;
                    cmd.Parameters.Add("@OBLIG", SqlDbType.VarChar).Value    = ta.OBLIG;
                    cmd.Parameters.Add("@DMAJ", SqlDbType.DateTime).Value    = ta.DMAJ;
                    cmd.Parameters.Add("@TRANS", SqlDbType.VarChar).Value    = ta.TRANS;
                    cmd.Parameters.Add("@ROWID", SqlDbType.Timestamp).Value  = ta.ROWID;

                    DBBase.SetDBNullParametre(cmd.Parameters);

                    if (cn.State == ConnectionState.Closed)
                    {
                        cn.Open();
                    }
                    StartTransaction(cn);

                    rowsAffected = cmd.ExecuteNonQuery();
                    //cmd.ExecuteNonQuery(); // Exécution de la procédure stockée
                    CommitTransaction(cmd.Transaction);
                }

                catch (Exception ex)
                {
                    RollBackTransaction(cmd.Transaction);
                    throw ex;
                }
                finally
                {
                    if (cn.State == ConnectionState.Open)
                    {
                        cn.Close(); // Fermeture de la connection
                    }
                    cmd.Dispose();
                }
            }
        }
        public void MiseAJour_REGROU(List <CsRegrou> rows)
        {
            cn              = new SqlConnection(ConnectionString);
            cmd             = new SqlCommand();
            cmd.Connection  = cn;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = EnumProcedureStockee.UpdateREGROU.Trim();



            try
            {
                foreach (CsRegrou row in rows)
                {
                    cmd.Parameters.Clear();

                    cmd.Parameters.Add("@CENTRE", SqlDbType.VarChar).Value  = row.CENTRE;
                    cmd.Parameters.Add("@REGROU", SqlDbType.VarChar).Value  = row.REGROU;
                    cmd.Parameters.Add("@PRODUIT", SqlDbType.VarChar).Value = row.PRODUIT;
                    cmd.Parameters.Add("@NOM", SqlDbType.VarChar).Value     = row.NOM;
                    cmd.Parameters.Add("@CUBGEN", SqlDbType.Int).Value      = row.CUBGEN;
                    cmd.Parameters.Add("@CUBDIV", SqlDbType.Int).Value      = row.CUBDIV;
                    cmd.Parameters.Add("@DMAJ", SqlDbType.DateTime).Value   = row.DMAJ;
                    cmd.Parameters.Add("@TRANS", SqlDbType.VarChar).Value   = row.TRANS;
                    cmd.Parameters.Add("@ROWID", SqlDbType.Timestamp).Value = row.ROWID;

                    DBBase.SetDBNullParametre(cmd.Parameters);

                    if (cn.State == ConnectionState.Closed)
                    {
                        cn.Open();
                    }
                    StartTransaction(cn);
                    cmd.ExecuteNonQuery(); // Exécution de la procédure stockée
                }
                CommitTransaction(cmd.Transaction);
            }

            catch (Exception ex)
            {
                RollBackTransaction(cmd.Transaction);
                throw new Exception(EnumProcedureStockee.UpdateREGROU + ":" + ex.Message);
            }
            finally
            {
                if (cn.State == ConnectionState.Open)
                {
                    cn.Close();     // Fermeture de la connection
                }
                cmd.Dispose();
            }
        }
Beispiel #10
0
        public void Insert(List <aTa> row)
        {
            foreach (aTa ta in row)
            {
                int rowsAffected = -1;
                cn              = new SqlConnection(ConnectionString);
                cmd             = new SqlCommand();
                cmd.Connection  = cn;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = EnumProcedureStockee.InsertTa.Trim();

                cmd.Parameters.Clear();
                try
                {
                    cmd.Parameters.Add("@CENTRE", SqlDbType.VarChar).Value  = ta.CENTRE;
                    cmd.Parameters.Add("@NUM", SqlDbType.SmallInt).Value    = ta.NUM;
                    cmd.Parameters.Add("@CODE", SqlDbType.SmallInt).Value   = ta.CODE;
                    cmd.Parameters.Add("@TRANS", SqlDbType.VarChar).Value   = ta.TRANS;
                    cmd.Parameters.Add("@LIBELLE", SqlDbType.VarChar).Value = ta.LIBELLE;
                    cmd.Parameters.Add("@DMAJ", SqlDbType.DateTime).Value   = ta.DMAJ;

                    DBBase.SetDBNullParametre(cmd.Parameters);

                    if (cn.State == ConnectionState.Closed)
                    {
                        cn.Open();
                    }



                    StartTransaction(cn);
                    rowsAffected = cmd.ExecuteNonQuery();
                    //cmd.ExecuteNonQuery(); // Exécution de la procédure stockée
                    CommitTransaction(cmd.Transaction);
                }
                catch (Exception ex)
                {
                    RollBackTransaction(cmd.Transaction);
                    throw ex;
                }
                finally
                {
                    if (cn.State == ConnectionState.Open)
                    {
                        cn.Close(); // Fermeture de la connection
                    }
                    cmd.Dispose();
                }
            }
        }
        //public int SaveTarifFacturation(List<CsTarifFacturation> ListeVariableDeTarificationToUpdate_, List<CsTarifFacturation> ListeVariableDeTarificationToInserte_, List<CsTarifFacturation> ListeVariableDeTarificationToDelete_)
        //{
        //    try
        //    {
        //        return TarificationProcedure.SaveTarifFacturation(ListeVariableDeTarificationToUpdate_, ListeVariableDeTarificationToInserte_, ListeVariableDeTarificationToDelete_);
        //    }
        //    catch (Exception ex)
        //    {
        //        throw ex;
        //    }
        //    //return true;
        //}
        //public bool DuplicationTarifVersCentre(int AncienIdCentre, int NouveauIdCentre, int? produit)
        //{
        //    try
        //    {
        //        return TarificationProcedure.DuplicationTarifVersCentre(AncienIdCentre, NouveauIdCentre, produit);
        //    }
        //    catch (Exception ex)
        //    {
        //        throw ex;
        //    }
        //}
        public bool DuplicationTarifVersCentre(int AncienIdCentre, int NouveauIdCentre, int?produit)
        {
            try
            {
                try
                {
                    cn = new SqlConnection(ConnectionString);
                    int resultat = -1;
                    cmd                = new SqlCommand();
                    cmd.Connection     = cn;
                    cmd.CommandTimeout = 3000;
                    cmd.CommandType    = CommandType.StoredProcedure;
                    cmd.CommandText    = "SPX_TARIF_DUPLICATION";
                    cmd.Parameters.Add("@AncienIdCentre", SqlDbType.Int).Value  = AncienIdCentre;
                    cmd.Parameters.Add("@NouveauIdCentre", SqlDbType.Int).Value = NouveauIdCentre;
                    cmd.Parameters.Add("@produitId", SqlDbType.Int).Value       = produit;

                    DBBase.SetDBNullParametre(cmd.Parameters);
                    try
                    {
                        if (cn.State == ConnectionState.Closed)
                        {
                            cn.Open();
                        }
                        resultat = cmd.ExecuteNonQuery();
                        return(resultat < 0 ? false : true);
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(cmd.CommandText + ":" + ex.Message);
                    }
                    finally
                    {
                        if (cn.State == ConnectionState.Open)
                        {
                            cn.Close(); // Fermeture de la connection
                        }
                        cmd.Dispose();
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #12
0
        public List <cStatistiqueReclamation> RetourStatistiqueReclamationSpx(DateTime dateDebut, DateTime dateFin, List <int> lstidcentre)
        {
            try
            {
                cn = new SqlConnection(ConnectionString);
                string lesCentres = DBBase.RetourneStringListeObject(lstidcentre);

                cmd                = new SqlCommand();
                cmd.Connection     = cn;
                cmd.CommandTimeout = 3000;
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandText    = "SPX_RECLAMATION_STATISTIQUERECLAMATION";
                cmd.Parameters.Add("@dateDebut", SqlDbType.DateTime).Value = dateDebut;
                cmd.Parameters.Add("@dateFin", SqlDbType.DateTime).Value   = dateFin;
                cmd.Parameters.Add("@centre", SqlDbType.VarChar).Value     = lesCentres;

                DBBase.SetDBNullParametre(cmd.Parameters);
                try
                {
                    if (cn.State == ConnectionState.Closed)
                    {
                        cn.Open();
                    }
                    SqlDataReader reader = cmd.ExecuteReader();
                    DataTable     dt     = new DataTable();
                    dt.Load(reader);
                    return(Entities.GetEntityListFromQuery <cStatistiqueReclamation>(dt));
                }
                catch (Exception ex)
                {
                    return(null);

                    throw new Exception(cmd.CommandText + ":" + ex.Message);
                }
                finally
                {
                    if (cn.State == ConnectionState.Open)
                    {
                        cn.Close();  // Fermeture de la connection
                    }
                    cmd.Dispose();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public List <CsLclient> ReturneListeDesImpayesSpx(int IdCentre, int?IdCategorie, int?IdTournee)
        {
            try
            {
                cn = new SqlConnection(ConnectionString);

                cmd                = new SqlCommand();
                cmd.Connection     = cn;
                cmd.CommandTimeout = 3000;
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandText    = "SPX_RPT_IMPAYES_CENTRE_CATEGORIE_CENTRE";
                cmd.Parameters.Add("@IdCentre", SqlDbType.Int).Value    = IdCentre;
                cmd.Parameters.Add("@IdCategorie", SqlDbType.Int).Value = IdCategorie;
                cmd.Parameters.Add("@IdTournee", SqlDbType.Int).Value   = IdTournee;

                DBBase.SetDBNullParametre(cmd.Parameters);
                try
                {
                    if (cn.State == ConnectionState.Closed)
                    {
                        cn.Open();
                    }
                    SqlDataReader reader = cmd.ExecuteReader();
                    DataTable     dt     = new DataTable();
                    dt.Load(reader);
                    return(Entities.GetEntityListFromQuery <CsLclient>(dt));
                }
                catch (Exception ex)
                {
                    return(null);

                    throw new Exception(cmd.CommandText + ":" + ex.Message);
                }
                finally
                {
                    if (cn.State == ConnectionState.Open)
                    {
                        cn.Close(); // Fermeture de la connection
                    }
                    cmd.Dispose();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// Testunicite_DEMCOUT
        /// </summary>
        /// <param name="Centre"></param>
        /// <param name="Produit"></param>
        /// <param name="Tdem"></param>
        /// <returns></returns>
        public bool Testunicite_DEMCOUT(string Centre, string Produit, string Tdem)
        {
            bool Result = false;

            try
            {
                cn              = new SqlConnection(ConnectionString);
                cmd             = new SqlCommand();
                cmd.Connection  = cn;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = EnumProcedureStockee.SelectDEMCOUTByKey.Trim();
                cmd.Parameters.Clear();
                cmd.Parameters.Add("@CENTRE", SqlDbType.VarChar).Value  = Centre;
                cmd.Parameters.Add("@PRODUIT", SqlDbType.VarChar).Value = Produit;
                cmd.Parameters.Add("@TDEM", SqlDbType.VarChar).Value    = Tdem;
                DBBase.SetDBNullParametre(cmd.Parameters);
                if (cn.State == ConnectionState.Closed)
                {
                    cn.Open();
                }
                StartTransaction(cn);

                SqlDataReader reader = cmd.ExecuteReader();
                if (reader.HasRows)
                {
                    Result = true;
                }
                reader.Close();
                CommitTransaction(cmd.Transaction);
            }
            catch (Exception ex)
            {
                RollBackTransaction(cmd.Transaction);
                throw ex;
            }
            finally
            {
                if (cn.State == ConnectionState.Open)
                {
                    cn.Close(); // Fermeture de la connection
                }
                cmd.Dispose();
            }
            return(Result);
        }
Beispiel #15
0
        public List <CsCentreProfil> GetCentreProfilActif(int IdUtilidateur, int IdProfil)
        {
            try
            {
                cn = new SqlConnection(ConnectionString);

                cmd                = new SqlCommand();
                cmd.Connection     = cn;
                cmd.CommandTimeout = 3000;
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandText    = "SPX_ADMIN_RETOURECENTREPROFIL";
                cmd.Parameters.Add("@IDPROFIL", SqlDbType.Int).Value      = IdProfil;
                cmd.Parameters.Add("@IDUTILISATEUR", SqlDbType.Int).Value = IdUtilidateur;
                DBBase.SetDBNullParametre(cmd.Parameters);
                try
                {
                    if (cn.State == ConnectionState.Closed)
                    {
                        cn.Open();
                    }
                    SqlDataReader reader = cmd.ExecuteReader();
                    DataTable     dt     = new DataTable();
                    dt.Load(reader);
                    return(Entities.GetEntityListFromQuery <CsCentreProfil>(dt));
                }
                catch (Exception ex)
                {
                    throw new Exception(cmd.CommandText + ":" + ex.Message);
                }
                finally
                {
                    if (cn.State == ConnectionState.Open)
                    {
                        cn.Close(); // Fermeture de la connection
                    }
                    cmd.Dispose();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public bool InsertOrUpdate(CsPosteTransformation st)
        {
            SqlConnection cn  = new SqlConnection(Session.GetSqlConnexionString());
            SqlCommand    cmd = new SqlCommand();

            cmd.Connection     = cn;
            cmd.CommandTimeout = 1800;
            cmd.CommandType    = CommandType.StoredProcedure;
            cmd.CommandText    = "SPX_ACC_INSERTORUPDATE_POSTETRANSFORMATION";
            if (cmd.Parameters != null && cmd.Parameters.Count != 0)
            {
                cmd.Parameters.Clear();
            }

            cmd.Parameters.Add("@PK_ID", SqlDbType.Int).Value                    = st.PK_ID;
            cmd.Parameters.Add("@CODE", SqlDbType.VarChar, 6).Value              = st.CODE;
            cmd.Parameters.Add("@LIBELLE", SqlDbType.VarChar, 50).Value          = st.LIBELLE;
            cmd.Parameters.Add("@USERCREATION", SqlDbType.VarChar, 20).Value     = st.USERCREATION;
            cmd.Parameters.Add("@USERMODIFICATION", SqlDbType.VarChar, 20).Value = st.USERMODIFICATION;
            cmd.Parameters.Add("@FK_IDDEPARTHTA", SqlDbType.Int).Value           = st.FK_IDDEPARTHTA;

            DBBase.SetDBNullParametre(cmd.Parameters);
            try
            {
                if (cn.State == ConnectionState.Closed)
                {
                    cn.Open();
                }
                return(cmd.ExecuteNonQuery() > 0);
            }
            catch (Exception ex)
            {
                throw new Exception(cmd.CommandText + ":" + ex.Message);
            }
            finally
            {
                if (cn.State == ConnectionState.Open)
                {
                    cn.Close(); // Fermeture de la connection
                }
                cmd.Dispose();
            }
        }
Beispiel #17
0
        public CsUtilisateur  VerifieUserExist(string matricule)
        {
            try
            {
                cn = new SqlConnection(ConnectionString);

                cmd                = new SqlCommand();
                cmd.Connection     = cn;
                cmd.CommandTimeout = 3000;
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandText    = "SPX_ADMIN_VERIFIEUTILISATEUR";
                cmd.Parameters.Add("@MATRICULE", SqlDbType.VarChar, 9).Value = matricule;
                DBBase.SetDBNullParametre(cmd.Parameters);
                try
                {
                    if (cn.State == ConnectionState.Closed)
                    {
                        cn.Open();
                    }
                    SqlDataReader reader = cmd.ExecuteReader();
                    DataTable     dt     = new DataTable();
                    dt.Load(reader);
                    return(Entities.GetEntityFromQuery <CsUtilisateur>(dt));
                }
                catch (Exception ex)
                {
                    throw new Exception(cmd.CommandText + ":" + ex.Message);
                }
                finally
                {
                    if (cn.State == ConnectionState.Open)
                    {
                        cn.Close(); // Fermeture de la connection
                    }
                    cmd.Dispose();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public CsUtilisateur GetUserByLoginName(string LoginName)
        {
            try
            {
                cn                 = new SqlConnection(ConnectionString);
                cmd                = new SqlCommand();
                cmd.Connection     = cn;
                cmd.CommandTimeout = 180;
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandText    = "SPX_ADMIN_GETUSERBYLOGIN";
                cmd.Parameters.Add("@LOGINNAME", SqlDbType.VarChar, 20).Value = LoginName;

                DBBase.SetDBNullParametre(cmd.Parameters);
                try
                {
                    if (cn.State == ConnectionState.Closed)
                    {
                        cn.Open();
                    }
                    SqlDataReader reader = cmd.ExecuteReader();
                    DataTable     dt     = new DataTable();
                    dt.Load(reader);
                    return(Entities.GetEntityFromQuery <CsUtilisateur>(dt));
                }
                catch (Exception ex)
                {
                    throw new Exception(cmd.CommandText + ":" + ex.Message);
                }
                finally
                {
                    if (cn.State == ConnectionState.Open)
                    {
                        cn.Close();     // Fermeture de la connection
                    }
                    cmd.Dispose();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public CsStrategieSecurite GetActif()
        {
            try
            {
                cn                 = new SqlConnection(ConnectionString);
                cmd                = new SqlCommand();
                cmd.Connection     = cn;
                cmd.CommandTimeout = 180;
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandText    = "SPX_ADMIN_STRATEGIESECURITE_ACTIVE";

                DBBase.SetDBNullParametre(cmd.Parameters);
                try
                {
                    if (cn.State == ConnectionState.Closed)
                    {
                        cn.Open();
                    }
                    SqlDataReader reader = cmd.ExecuteReader();
                    DataTable     dt     = new DataTable();
                    dt.Load(reader);
                    return(Entities.GetEntityFromQuery <CsStrategieSecurite>(dt));
                }
                catch (Exception ex)
                {
                    throw new Exception(cmd.CommandText + ":" + ex.Message);
                }
                finally
                {
                    if (cn.State == ConnectionState.Open)
                    {
                        cn.Close(); // Fermeture de la connection
                    }
                    cmd.Dispose();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #20
0
        //public List<CsHabilitationProgram> SelectHabilitationByUser(int Iduser)
        //{
        //    try
        //    {
        //        DataTable obj = Galatee.Entity.Model.AuthentProcedures.SelectHabilitationByUser(Iduser);
        //        List<CsHabilitationProgram> l = Tools.Utility.GetEntityFromQuery<CsHabilitationProgram>(obj).ToList();
        //        return l;
        //    }
        //    catch (Exception ex)
        //    {
        //        throw ex;
        //    }
        //}
        #endregion
        public List <CsHabilitationProgram> SelectHabilitationByUser(int Iduser)
        {
            cn = new SqlConnection(ConnectionString);

            cmd                = new SqlCommand();
            cmd.Connection     = cn;
            cmd.CommandTimeout = 180;
            cmd.CommandType    = CommandType.StoredProcedure;
            if (cmd.Parameters != null && cmd.Parameters.Count != 0)
            {
                cmd.Parameters.Clear();
            }
            cmd.CommandText = "SPX_ADMIN_SELECTPROFILUSER";
            cmd.Parameters.Add("@IDUSER", SqlDbType.Int).Value = Iduser;

            DBBase.SetDBNullParametre(cmd.Parameters);
            try
            {
                if (cn.State == ConnectionState.Closed)
                {
                    cn.Open();
                }
                SqlDataReader reader = cmd.ExecuteReader();
                DataTable     dt     = new DataTable();
                dt.Load(reader);
                return(Entities.GetEntityListFromQuery <CsHabilitationProgram>(dt));
            }
            catch (Exception ex)
            {
                throw new Exception(cmd.CommandText + ":" + ex.Message);
            }
            finally
            {
                if (cn.State == ConnectionState.Open)
                {
                    cn.Close(); // Fermeture de la connection
                }
                cmd.Dispose();
            }
        }
        public bool Delete(CsPosteTransformation del)
        {
            SqlConnection cn  = new SqlConnection(Session.GetSqlConnexionString());
            SqlCommand    cmd = new SqlCommand();

            cmd.Connection     = cn;
            cmd.CommandTimeout = 1800;
            cmd.CommandType    = CommandType.StoredProcedure;
            cmd.CommandText    = "SPX_ACC_DELETE_POSTETRANSFORMATION";
            if (cmd.Parameters != null && cmd.Parameters.Count != 0)
            {
                cmd.Parameters.Clear();
            }

            cmd.Parameters.Add("@PK_ID", SqlDbType.Int).Value = del.PK_ID;

            DBBase.SetDBNullParametre(cmd.Parameters);
            try
            {
                if (cn.State == ConnectionState.Closed)
                {
                    cn.Open();
                }
                SqlDataReader reader = cmd.ExecuteReader();
                return(!reader.HasRows);
            }
            catch (Exception ex)
            {
                throw new Exception(cmd.CommandText + ":" + ex.Message);
            }
            finally
            {
                if (cn.State == ConnectionState.Open)
                {
                    cn.Close(); // Fermeture de la connection
                }
                cmd.Dispose();
            }
        }
        public List <CsPosteTransformation> SelectAllPosteTransformation()
        {
            SqlConnection cn  = new SqlConnection(Session.GetSqlConnexionString());
            SqlCommand    cmd = new SqlCommand();

            cmd.Connection     = cn;
            cmd.CommandTimeout = 1800;
            cmd.CommandType    = CommandType.StoredProcedure;
            cmd.CommandText    = "SPX_ACC_GET_POSTETRANSFORMATION";
            if (cmd.Parameters != null && cmd.Parameters.Count != 0)
            {
                cmd.Parameters.Clear();
            }
            DBBase.SetDBNullParametre(cmd.Parameters);
            try
            {
                if (cn.State == ConnectionState.Closed)
                {
                    cn.Open();
                }
                SqlDataReader reader = cmd.ExecuteReader();
                DataTable     dt     = new DataTable();
                dt.Load(reader);
                return(Entities.GetEntityListFromQuery <CsPosteTransformation>(dt));
            }
            catch (Exception ex)
            {
                throw new Exception(cmd.CommandText + ":" + ex.Message);
            }
            finally
            {
                if (cn.State == ConnectionState.Open)
                {
                    cn.Close(); // Fermeture de la connection
                }
                cmd.Dispose();
            }
        }
        public bool Insert(CsAdmRoles admRoles)
        {
            cn              = new SqlConnection(ConnectionString);
            cmd             = new SqlCommand();
            cmd.Connection  = cn;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "spx_AdmRoles_Insert";
            cmd.Parameters.Clear();
            cmd.Parameters.Add("@Centre", SqlDbType.VarChar).Value          = admRoles.Centre;
            cmd.Parameters.Add("@RoleID", SqlDbType.VarChar).Value          = admRoles.RoleID;
            cmd.Parameters.Add("@CodeFonc", SqlDbType.VarChar).Value        = admRoles.CodeFonc;
            cmd.Parameters.Add("@RoleName", SqlDbType.VarChar).Value        = admRoles.RoleName;
            cmd.Parameters.Add("@RoleDisplayName", SqlDbType.VarChar).Value = admRoles.RoleDisplayName;

            DBBase.SetDBNullParametre(cmd.Parameters);

            try
            {
                if (cn.State == ConnectionState.Closed)
                {
                    cn.Open();
                }
                cmd.ExecuteNonQuery();
                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (cn.State == ConnectionState.Open)
                {
                    cn.Close(); // Fermeture de la connection
                }
                cmd.Dispose();
            }
        }
Beispiel #24
0
        public List <CsSchema> RetourneDonneesTableSchema()
        {
            CsSchema        _ta;
            List <CsSchema> ListeTA = new List <CsSchema>();

            ConnectionString = Session.GetSqlConnexionStringAbo07();
            cn              = new SqlConnection(ConnectionString);
            cmd             = new SqlCommand();
            cmd.Connection  = cn;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = EnumProcedureStockee.SelectSCHEMAS;
            cmd.Parameters.Clear();

            DBBase.SetDBNullParametre(cmd.Parameters);
            try
            {
                if (this.cn.State == ConnectionState.Closed)
                {
                    this.cn.Open();
                }

                SqlDataReader reader = cmd.ExecuteReader();
                if (!reader.HasRows)
                {
                    reader.Close();
                    throw new Exception(EnumProcedureStockee.SelectSCHEMAS + ":" + "n'a retourné aucun jeu de caractère");
                }
                while (reader.Read())
                {
                    _ta        = new CsSchema();
                    _ta.CENTRE = string.IsNullOrEmpty(reader.GetValue(0).ToString()) ? string.Empty : reader.GetValue(0).ToString().Trim();
                    _ta.NUM    = string.IsNullOrEmpty(reader.GetValue(1).ToString()) ? string.Empty : reader.GetValue(1).ToString().Trim();
                    _ta.GENE0  = string.IsNullOrEmpty(reader.GetValue(2).ToString()) ? string.Empty : reader.GetValue(2).ToString().Trim();
                    _ta.ANAL0  = string.IsNullOrEmpty(reader.GetValue(3).ToString()) ? string.Empty : reader.GetValue(3).ToString().Trim();
                    _ta.GENE1  = string.IsNullOrEmpty(reader.GetValue(4).ToString()) ? string.Empty : reader.GetValue(4).ToString().Trim();
                    _ta.ANAL1  = string.IsNullOrEmpty(reader.GetValue(5).ToString()) ? string.Empty : reader.GetValue(5).ToString().Trim();
                    _ta.SENS1  = string.IsNullOrEmpty(reader.GetValue(6).ToString()) ? string.Empty : reader.GetValue(6).ToString().Trim();
                    _ta.SIGN1  = string.IsNullOrEmpty(reader.GetValue(7).ToString()) ? string.Empty : reader.GetValue(7).ToString().Trim();
                    _ta.GENE2  = string.IsNullOrEmpty(reader.GetValue(8).ToString()) ? string.Empty : reader.GetValue(8).ToString().Trim();
                    _ta.ANAL2  = string.IsNullOrEmpty(reader.GetValue(9).ToString()) ? string.Empty : reader.GetValue(9).ToString().Trim();
                    _ta.SENS2  = string.IsNullOrEmpty(reader.GetValue(10).ToString()) ? string.Empty : reader.GetValue(10).ToString().Trim();
                    _ta.SIGN2  = string.IsNullOrEmpty(reader.GetValue(11).ToString()) ? string.Empty : reader.GetValue(11).ToString().Trim();
                    _ta.GENE3  = string.IsNullOrEmpty(reader.GetValue(12).ToString()) ? string.Empty : reader.GetValue(12).ToString().Trim();
                    _ta.ANAL3  = string.IsNullOrEmpty(reader.GetValue(13).ToString()) ? string.Empty : reader.GetValue(13).ToString().Trim();
                    _ta.SENS3  = string.IsNullOrEmpty(reader.GetValue(14).ToString()) ? string.Empty : reader.GetValue(14).ToString().Trim();
                    _ta.SIGN3  = string.IsNullOrEmpty(reader.GetValue(15).ToString()) ? string.Empty : reader.GetValue(15).ToString().Trim();
                    _ta.GENE4  = string.IsNullOrEmpty(reader.GetValue(16).ToString()) ? string.Empty : reader.GetValue(16).ToString().Trim();
                    _ta.ANAL4  = string.IsNullOrEmpty(reader.GetValue(17).ToString()) ? string.Empty : reader.GetValue(17).ToString().Trim();
                    _ta.SENS4  = string.IsNullOrEmpty(reader.GetValue(18).ToString()) ? string.Empty : reader.GetValue(18).ToString().Trim();
                    _ta.SIGN4  = string.IsNullOrEmpty(reader.GetValue(19).ToString()) ? string.Empty : reader.GetValue(19).ToString().Trim();
                    _ta.GENE5  = string.IsNullOrEmpty(reader.GetValue(20).ToString()) ? string.Empty : reader.GetValue(20).ToString().Trim();
                    _ta.ANAL5  = string.IsNullOrEmpty(reader.GetValue(21).ToString()) ? string.Empty : reader.GetValue(21).ToString().Trim();
                    _ta.SENS5  = string.IsNullOrEmpty(reader.GetValue(22).ToString()) ? string.Empty : reader.GetValue(22).ToString().Trim();
                    _ta.SIGN5  = string.IsNullOrEmpty(reader.GetValue(23).ToString()) ? string.Empty : reader.GetValue(23).ToString().Trim();
                    _ta.GENE6  = string.IsNullOrEmpty(reader.GetValue(24).ToString()) ? string.Empty : reader.GetValue(24).ToString().Trim();
                    _ta.ANAL6  = string.IsNullOrEmpty(reader.GetValue(25).ToString()) ? string.Empty : reader.GetValue(25).ToString().Trim();
                    _ta.SENS6  = string.IsNullOrEmpty(reader.GetValue(26).ToString()) ? string.Empty : reader.GetValue(26).ToString().Trim();
                    _ta.SIGN6  = string.IsNullOrEmpty(reader.GetValue(27).ToString()) ? string.Empty : reader.GetValue(27).ToString().Trim();
                    ListeTA.Add(_ta);
                }
                //Fermeture reader
                reader.Close();
                return(ListeTA);
            }
            catch (Exception ex)
            {
                throw new Exception(EnumProcedureStockee.SelectSCHEMAS + ":" + ex.Message);
            }
            finally
            {
                if (this.cn.State == ConnectionState.Open)
                {
                    this.cn.Close(); // Fermeture de la connection
                }
                cmd.Dispose();
            }
        }
        /// <summary>
        /// Insertion_DEMCOUT
        /// </summary>
        /// <param name="row"></param>
        public void Insertion_DEMCOUT(List <CsTdemCout> rows)
        {
            cn              = new SqlConnection(ConnectionString);
            cmd             = new SqlCommand();
            cmd.Connection  = cn;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = EnumProcedureStockee.InsertDEMCOUT.Trim();
            cmd.Parameters.Clear();


            try
            {
                foreach (CsTdemCout row in rows)
                {
                    cmd.Parameters.Add("@CENTRE", SqlDbType.VarChar).Value   = row.CENTRE;
                    cmd.Parameters.Add("@PRODUIT", SqlDbType.VarChar).Value  = row.PRODUIT;
                    cmd.Parameters.Add("@TDEM", SqlDbType.VarChar).Value     = row.TDEM;
                    cmd.Parameters.Add("@COPER1", SqlDbType.VarChar).Value   = row.COPER1;
                    cmd.Parameters.Add("@OBLI1", SqlDbType.VarChar).Value    = row.OBLI1;
                    cmd.Parameters.Add("@AUTO1", SqlDbType.VarChar).Value    = row.AUTO1;
                    cmd.Parameters.Add("@MONTANT1", SqlDbType.Decimal).Value = row.MONTANT1;
                    cmd.Parameters.Add("@TAXE1", SqlDbType.VarChar).Value    = row.TAXE1;
                    cmd.Parameters.Add("@COPER2", SqlDbType.VarChar).Value   = row.COPER2;
                    cmd.Parameters.Add("@OBLI2", SqlDbType.VarChar).Value    = row.OBLI2;
                    cmd.Parameters.Add("@AUTO2", SqlDbType.VarChar).Value    = row.AUTO2;
                    cmd.Parameters.Add("@MONTANT2", SqlDbType.Decimal).Value = row.MONTANT2;
                    cmd.Parameters.Add("@TAXE2", SqlDbType.VarChar).Value    = row.TAXE2;
                    cmd.Parameters.Add("@COPER3", SqlDbType.VarChar).Value   = row.COPER3;
                    cmd.Parameters.Add("@OBLI3", SqlDbType.VarChar).Value    = row.OBLI3;
                    cmd.Parameters.Add("@AUTO3", SqlDbType.VarChar).Value    = row.AUTO3;
                    cmd.Parameters.Add("@MONTANT3", SqlDbType.Decimal).Value = row.MONTANT3;
                    cmd.Parameters.Add("@TAXE3", SqlDbType.VarChar).Value    = row.TAXE3;
                    cmd.Parameters.Add("@COPER4", SqlDbType.VarChar).Value   = row.COPER4;
                    cmd.Parameters.Add("@OBLI4", SqlDbType.VarChar).Value    = row.OBLI4;
                    cmd.Parameters.Add("@AUTO4", SqlDbType.VarChar).Value    = row.AUTO4;
                    cmd.Parameters.Add("@MONTANT4", SqlDbType.Decimal).Value = row.MONTANT4;
                    cmd.Parameters.Add("@TAXE4", SqlDbType.VarChar).Value    = row.TAXE4;
                    cmd.Parameters.Add("@COPER5", SqlDbType.VarChar).Value   = row.COPER5;
                    cmd.Parameters.Add("@OBLI5", SqlDbType.VarChar).Value    = row.OBLI5;
                    cmd.Parameters.Add("@AUTO5", SqlDbType.VarChar).Value    = row.AUTO5;
                    cmd.Parameters.Add("@MONTANT5", SqlDbType.Decimal).Value = row.MONTANT5;
                    cmd.Parameters.Add("@TAXE5", SqlDbType.VarChar).Value    = row.TAXE5;
                    cmd.Parameters.Add("@DMAJ", SqlDbType.DateTime).Value    = row.DMAJ;
                    cmd.Parameters.Add("@TRANS", SqlDbType.VarChar).Value    = row.TRANS;
                    DBBase.SetDBNullParametre(cmd.Parameters);

                    if (cn.State == ConnectionState.Closed)
                    {
                        cn.Open();
                    }
                    StartTransaction(cn);

                    cmd.ExecuteNonQuery();
                }
                CommitTransaction(cmd.Transaction);
            }
            catch (Exception ex)
            {
                RollBackTransaction(cmd.Transaction);
                throw new Exception(EnumProcedureStockee.InsertDEMCOUT + ":" + ex.Message);
            }
            finally
            {
                if (cn.State == ConnectionState.Open)
                {
                    cn.Close(); // Fermeture de la connection
                }
                cmd.Dispose();
            }
        }