Beispiel #1
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;
            }
        }
Beispiel #2
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;
            }
        }