Example #1
0
        crlVerification IntfDalVerification.selectVerification(string idVerification)
        {
            #region declaration
            IntfDalLicence    serviceLicence    = new ImplDalLicence();
            IntfDalAgent      serviceAgent      = new ImplDalAgent();
            IntfDalChauffeur  serviceChauffeur  = new ImplDalChauffeur();
            IntfDalItineraire serviceItineraire = new ImplDalItineraire();

            crlVerification verification = null;
            #endregion

            #region implementation
            if (idVerification != "")
            {
                this.strCommande = "SELECT * FROM `verification` WHERE (`idVerification`='" + idVerification + "')";
                this.serviceConnectBase.openConnection();
                reader = this.serviceConnectBase.select(this.strCommande);
                if (reader != null)
                {
                    if (reader.HasRows)
                    {
                        if (reader.Read())
                        {
                            verification              = new crlVerification();
                            verification.AVoireVP     = reader["aVoireVP"].ToString();
                            verification.AVoireVT     = reader["aVoireVT"].ToString();
                            verification.IdItineraire = reader["idItineraire"].ToString();
                            try
                            {
                                verification.DateVerification = Convert.ToDateTime(reader["dateVerification"].ToString());
                            }
                            catch (Exception)
                            {
                            }
                            verification.IdChauffeur                = reader["idChauffeur"].ToString();
                            verification.IdVerification             = reader["idVerification"].ToString();
                            verification.MatriculeAgent             = reader["matriculeAgent"].ToString();
                            verification.NumLicence                 = reader["numLicence"].ToString();
                            verification.ObservationProfessionnelle = reader["observationProfessionnelle"].ToString();
                            verification.VerificationPapier         = int.Parse(reader["verificationPapier"].ToString());
                            verification.VerificationTechnique      = int.Parse(reader["verificationTechnique"].ToString());
                            verification.PlanDepart                 = int.Parse(reader["planDepart"].ToString());
                        }
                    }
                    reader.Dispose();
                }
                this.serviceConnectBase.closeConnection();
                if (verification != null)
                {
                    verification.Licence    = serviceLicence.selectLicence(verification.NumLicence);
                    verification.Agent      = serviceAgent.selectAgent(verification.MatriculeAgent);
                    verification.Chauffeur  = serviceChauffeur.selectChauffeur(verification.IdChauffeur);
                    verification.Itineraire = serviceItineraire.selectItineraire(verification.IdItineraire);
                }
            }
            #endregion

            return(verification);
        }
Example #2
0
        DataTable IntfDalVehicule.getDataTableADForVehicule(string strRqst)
        {
            #region declaration
            DataTable         dataTable         = new DataTable();
            crlItineraire     itineraire        = null;
            IntfDalItineraire serviceItineraire = new ImplDalItineraire();
            IntfDalGeneral    serviceGeneral    = new ImplDalGeneral();
            #endregion

            #region implementation

            #region initialisation du dataTable
            dataTable = new DataTable();
            dataTable.Columns.Add("vehicule", typeof(string));
            dataTable.Columns.Add("chauffeur", typeof(string));
            dataTable.Columns.Add("date", typeof(DateTime));
            dataTable.Columns.Add("itineraire", typeof(string));
            dataTable.Columns.Add("recette", typeof(string));
            dataTable.Columns.Add("reste", typeof(string));
            DataRow dr;
            #endregion

            this.serviceConnection.openConnection();
            this.reader = this.serviceConnection.select(strRqst);
            if (this.reader != null)
            {
                if (this.reader.HasRows)
                {
                    while (this.reader.Read())
                    {
                        dr = dataTable.NewRow();

                        itineraire = serviceItineraire.selectItineraire(this.reader["idItineraire"].ToString());

                        dr["vehicule"]  = this.reader["matriculeVehicule"].ToString() + " " + this.reader["marqueVehicule"].ToString() + " " + this.reader["couleurVehicule"].ToString();
                        dr["chauffeur"] = this.reader["prenomChauffeur"].ToString() + " " + this.reader["nomChauffeur"].ToString();
                        try
                        {
                            dr["date"] = Convert.ToDateTime(this.reader["dateHeurDepart"].ToString());
                        }
                        catch (Exception)
                        {
                            dr["date"] = DateTime.Now;
                        }
                        if (itineraire != null)
                        {
                            dr["itineraire"] = itineraire.villeD.NomVille + "-" + itineraire.villeF.NomVille;
                        }
                        else
                        {
                            dr["itineraire"] = "-";
                        }
                        dr["recette"] = serviceGeneral.separateurDesMilles(this.reader["recetteTotale"].ToString()) + "Ar";
                        dr["reste"]   = serviceGeneral.separateurDesMilles(this.reader["resteRegle"].ToString()) + "Ar";


                        dataTable.Rows.Add(dr);
                    }
                }
                this.reader.Dispose();
            }
            this.serviceConnection.closeConnection();

            #endregion

            return(dataTable);
        }