Пример #1
0
        List <crlCommission> IntfDalFicheBord.getCommission(string numerosFB)
        {
            #region declaration
            List <crlCommission>         Commissions     = new List <crlCommission>();
            crlCommission                tempCommission  = null;
            IntfDalReceptionnaire        servicePersonne = new ImplDalReceptionnaire();
            IntfDalRecu                  serviceRecu     = new ImplDalRecu();
            IntfDalClient                serviceClient   = new ImplDalClient();
            IntfDalDesignationCommission serviceDesignationCommission = new ImplDalDesignationCommission();
            IntfDalAgent                 serviceAgent = new ImplDalAgent();
            #endregion

            #region implementation
            if (numerosFB != "")
            {
                this.strCommande  = "SELECT * FROM commission";
                this.strCommande += " Inner Join associationfichebordcommission ON associationfichebordcommission.idCommission = commission.idCommission";
                this.strCommande += " WHERE (associationfichebordcommission.numerosFB ='" + numerosFB + "')";
                this.serviceConnectBase.openConnection();
                this.reader = this.serviceConnectBase.select(this.strCommande);
                if (this.reader != null)
                {
                    if (this.reader.HasRows)
                    {
                        while (this.reader.Read())
                        {
                            tempCommission = new crlCommission();
                            tempCommission.IdCommission = reader["idCommission"].ToString();
                            tempCommission.Destination  = reader["destination"].ToString();
                            tempCommission.Poids        = reader["poids"].ToString();
                            try
                            {
                                tempCommission.Nombre = int.Parse(reader["nombre"].ToString());
                            }
                            catch (Exception)
                            {
                            }
                            try
                            {
                                tempCommission.IsRecu = int.Parse(reader["isRecu"].ToString());
                            }
                            catch (Exception)
                            {
                            }
                            tempCommission.PieceJustificatif = reader["pieceJustificatif"].ToString();
                            tempCommission.FraisEnvoi        = reader["fraisEnvoi"].ToString();
                            tempCommission.NumExpediteur     = reader["numExpediteur"].ToString();
                            tempCommission.NumRecepteur      = reader["numRecepteur"].ToString();
                            tempCommission.NumDesignation    = reader["numDesignation"].ToString();
                            tempCommission.TypeCommission    = reader["typeCommission"].ToString();
                            tempCommission.NumTrajet         = reader["numTrajet"].ToString();
                            try
                            {
                                tempCommission.DateCommission = Convert.ToDateTime(reader["dateCommission"].ToString());
                            }
                            catch (Exception)
                            {
                            }
                            try
                            {
                                tempCommission.DateLivraison = Convert.ToDateTime(reader["dateLivraison"].ToString());
                            }
                            catch (Exception)
                            {
                            }
                            tempCommission.MatriculeAgent          = reader["matriculeAgent"].ToString();
                            tempCommission.MatriculeAgentDelivreur = reader["matriculeAgentDelivreur"].ToString();
                            tempCommission.ModePaiement            = reader["modePaiement"].ToString();


                            Commissions.Add(tempCommission);
                        }
                    }
                    this.reader.Dispose();
                }
                this.serviceConnectBase.closeConnection();

                for (int i = 0; i < Commissions.Count; i++)
                {
                    if (Commissions[i] != null)
                    {
                        Commissions[i].expediteur                        = serviceClient.selectClient(Commissions[i].NumExpediteur);
                        Commissions[i].recepteur                         = servicePersonne.selectPersonne(Commissions[i].NumRecepteur);
                        Commissions[i].designationCommission             = serviceDesignationCommission.selectDesignationCommission(Commissions[i].NumDesignation);
                        Commissions[i].typeCommssionObjet                = new crlTypeCommssion();
                        Commissions[i].typeCommssionObjet.TypeCommission = Commissions[i].TypeCommission;
                        Commissions[i].agent          = serviceAgent.selectAgent(Commissions[i].MatriculeAgent);
                        Commissions[i].agentDelivreur = serviceAgent.selectAgent(Commissions[i].MatriculeAgentDelivreur);
                    }
                }
            }
            #endregion

            return(Commissions);
        }
Пример #2
0
        crlCommissionDevis IntfDalCommissionDevis.selectCommissionDevis(string idCommissionDevis)
        {
            #region initialisation
            IntfDalDesignationCommission serviceDesignationCommission = new ImplDalDesignationCommission();
            IntfDalTrajet         serviceTrajet         = new ImplDalTrajet();
            IntfDalClient         serviceClient         = new ImplDalClient();
            IntfDalReceptionnaire serviceReceptionnaire = new ImplDalReceptionnaire();

            crlCommissionDevis CommissionDevis = null;
            #endregion

            #region implementation
            if (idCommissionDevis != "")
            {
                this.strCommande = "SELECT * FROM `commissiondevis` WHERE (`idCommissionDevis`='" + idCommissionDevis + "')";
                this.serviceConnectBase.openConnection();
                reader = this.serviceConnectBase.select(this.strCommande);
                if (reader != null)
                {
                    if (reader.HasRows)
                    {
                        reader.Read();
                        CommissionDevis             = new crlCommissionDevis();
                        CommissionDevis.Destination = reader["destination"].ToString();
                        try
                        {
                            CommissionDevis.FraisEnvoi = double.Parse(reader["fraisEnvoi"].ToString());
                        }
                        catch (Exception) { }
                        CommissionDevis.IdCommissionDevis = reader["idCommissionDevis"].ToString();
                        CommissionDevis.PieceJustificatif = reader["pieceJustificatif"].ToString();
                        try
                        {
                            CommissionDevis.Poids = double.Parse(reader["poids"].ToString());
                        }
                        catch (Exception) { }
                        CommissionDevis.TypeCommission = reader["typeCommission"].ToString();
                        CommissionDevis.NumDesignation = reader["numDesignation"].ToString();
                        try
                        {
                            CommissionDevis.Nombre = int.Parse(reader["nombre"].ToString());
                        }
                        catch (Exception) { }
                        CommissionDevis.NumTrajet     = reader["numTrajet"].ToString();
                        CommissionDevis.NumProforma   = reader["numProforma"].ToString();
                        CommissionDevis.NumExpediteur = reader["numExpediteur"].ToString();
                        CommissionDevis.NumRecepteur  = reader["numRecepteur"].ToString();
                    }
                    reader.Dispose();
                }
                this.serviceConnectBase.closeConnection();
                if (CommissionDevis != null)
                {
                    if (CommissionDevis.NumDesignation != "")
                    {
                        CommissionDevis.designationCommission = serviceDesignationCommission.selectDesignationCommission(CommissionDevis.NumDesignation);
                    }
                    if (CommissionDevis.NumTrajet != "")
                    {
                        CommissionDevis.trajet = serviceTrajet.selectTrajet(CommissionDevis.NumTrajet);
                    }
                    if (CommissionDevis.NumExpediteur != "")
                    {
                        CommissionDevis.expediteur = serviceClient.selectClient(CommissionDevis.NumExpediteur);
                    }
                    if (CommissionDevis.NumRecepteur != "")
                    {
                        CommissionDevis.recepteur = serviceReceptionnaire.selectPersonne(CommissionDevis.NumRecepteur);
                    }
                }
            }
            #endregion

            return(CommissionDevis);
        }