Пример #1
0
        /// <summary>
        /// mbola ts ai oe atao inona
        /// </summary>
        /// <param name="numBonDeCommande"></param>
        /// <returns></returns>
        crlBonDeCommande IntfDalBonDeCommande.isBonDeCommandeCredit(string numBonDeCommande)
        {
            #region declaration
            crlBonDeCommande bonDeCommande = null;
            #endregion

            #region implementation
            if (numBonDeCommande != "")
            {
                this.strCommande  = "SELECT bondecommande.numBonDeCommande, bondecommande.matriculeAgent, bondecommande.descriptionBC,";
                this.strCommande += " bondecommande.numerosBC, bondecommande.dateBC, bondecommande.datePaiementBC,";
                this.strCommande += " bondecommande.montantBC FROM bondecommande";
                this.strCommande += " Left Join recuabonnement ON recuabonnement.numBonDeCommande = bondecommande.numBonDeCommande";
                this.strCommande += " WHERE recuabonnement.numBonDeCommande IS NULL  AND";
                this.strCommande += " bondecommande.numBonDeCommande = '" + numBonDeCommande + "'";

                this.serviceConnectBase.openConnection();
                this.reader = this.serviceConnectBase.select(this.strCommande);
                if (this.reader != null)
                {
                    if (this.reader.HasRows)
                    {
                        if (this.reader.Read())
                        {
                            bonDeCommande = new crlBonDeCommande();
                            try
                            {
                                bonDeCommande.DateBC = Convert.ToDateTime(this.reader["dateBC "].ToString());
                            }
                            catch (Exception)
                            {
                            }
                            try
                            {
                                bonDeCommande.DatePaiementBC = Convert.ToDateTime(this.reader["datePaiementBC"].ToString());
                            }
                            catch (Exception)
                            {
                            }
                            bonDeCommande.DescriptionBC  = this.reader["descriptionBC"].ToString();
                            bonDeCommande.MatriculeAgent = this.reader["matriculeAgent"].ToString();
                            try
                            {
                                bonDeCommande.MontantBC = double.Parse(this.reader["montantBC"].ToString());
                            }
                            catch (Exception)
                            {
                            }
                            bonDeCommande.NumBonDeCommande = this.reader["numBonDeCommande"].ToString();
                            //bonDeCommande.NumerosBC = this.reader["numerosBC"].ToString();
                        }
                    }
                    this.reader.Dispose();
                }
                this.serviceConnectBase.closeConnection();
            }
            #endregion

            return(bonDeCommande);
        }
Пример #2
0
        string IntfDalBonDeCommande.insertBonDeCommande(crlBonDeCommande bonDeCommande, string sigleAgence)
        {
            #region declaration
            string numBonDeCommande = "";
            int    nombreInsert     = 0;
            IntfDalBonDeCommande serviceBonDeCommande = new ImplDalBonDeCommande();

            string numProforma = "";
            #endregion

            #region implementation
            if (bonDeCommande != null)
            {
                if (sigleAgence != "")
                {
                    if (bonDeCommande.NumProforma != "")
                    {
                        numProforma = "'" + bonDeCommande.NumProforma + "'";
                    }
                    else
                    {
                        numProforma = "NULL";
                    }

                    bonDeCommande.NumBonDeCommande = serviceBonDeCommande.getNumBonDeCommande(sigleAgence);
                    this.strCommande  = "INSERT INTO `bondecommande` (`numBonDeCommande`,`matriculeAgent`,`descriptionBC`,";
                    this.strCommande += " `dateBC`,`datePaiementBC`,`montantBC`,`numProforma`)";
                    this.strCommande += " VALUES ('" + bonDeCommande.NumBonDeCommande + "','" + bonDeCommande.MatriculeAgent + "',";
                    this.strCommande += " '" + bonDeCommande.DescriptionBC + "',";
                    this.strCommande += " '" + bonDeCommande.DateBC.ToString("yyyy-MM-dd") + "','" + bonDeCommande.DatePaiementBC.ToString("yyyy-MM-dd") + "',";
                    this.strCommande += " '" + bonDeCommande.MontantBC + "'," + numProforma + ")";

                    this.serviceConnectBase.openConnection();
                    nombreInsert = this.serviceConnectBase.requete(this.strCommande);
                    if (nombreInsert == 1)
                    {
                        numBonDeCommande = bonDeCommande.NumBonDeCommande;
                    }
                    this.serviceConnectBase.closeConnection();
                }
            }
            #endregion

            return(numBonDeCommande);
        }
Пример #3
0
        bool IntfDalBonDeCommande.updateBonDeCommande(crlBonDeCommande bonDeCommande)
        {
            #region declaration
            bool   isUpdate     = false;
            int    nombreUpdate = 0;
            string numProforma  = "";
            #endregion

            #region implementation
            if (bonDeCommande != null)
            {
                if (bonDeCommande.NumProforma != "")
                {
                    numProforma = "'" + bonDeCommande.NumProforma + "'";
                }
                else
                {
                    numProforma = "NULL";
                }



                this.strCommande  = "UPDATE `bondecommande` SET `dateBC`='" + bonDeCommande.DateBC.ToString("yyyy-MM-dd") + "',";
                this.strCommande += " `datePaiementBC`='" + bonDeCommande.DatePaiementBC.ToString("yyyy-MM-dd") + "',";
                this.strCommande += " `descriptionBC`='" + bonDeCommande.DescriptionBC + "', `matriculeAgent`='" + bonDeCommande.MatriculeAgent + "',";
                this.strCommande += " `montantBC`='" + bonDeCommande.MontantBC + "',";
                this.strCommande += " `numProforma`=" + numProforma + "";
                this.strCommande += " WHERE `numBonDeCommande`='" + bonDeCommande.NumBonDeCommande + "'";

                this.serviceConnectBase.openConnection();
                nombreUpdate = this.serviceConnectBase.requete(this.strCommande);
                if (nombreUpdate == 1)
                {
                    isUpdate = true;
                }
                this.serviceConnectBase.closeConnection();
            }
            #endregion

            return(isUpdate);
        }
Пример #4
0
        crlBonDeCommande IntfDalBonDeCommande.selectBonDeCommande(string numBonDeCommande)
        {
            #region declaration
            crlBonDeCommande bonDeCommande = null;

            IntfDalAgent    serviceAgent    = new ImplDalAgent();
            IntfDalProforma serviceProforma = new ImplDalProforma();
            #endregion

            #region implementation
            if (numBonDeCommande != "")
            {
                this.strCommande = "SELECT * FROM `bondecommande` WHERE (`numBonDeCommande`='" + numBonDeCommande + "')";
                this.serviceConnectBase.openConnection();
                this.reader = this.serviceConnectBase.select(this.strCommande);
                if (this.reader != null)
                {
                    if (this.reader.HasRows)
                    {
                        if (this.reader.Read())
                        {
                            bonDeCommande = new crlBonDeCommande();
                            bonDeCommande.NumBonDeCommande = this.reader["numBonDeCommande"].ToString();
                            try
                            {
                                bonDeCommande.DateBC = Convert.ToDateTime(this.reader["dateBC"].ToString());
                            }
                            catch (Exception)
                            {
                            }
                            try
                            {
                                bonDeCommande.DatePaiementBC = Convert.ToDateTime(this.reader["datePaiementBC"].ToString());
                            }
                            catch (Exception)
                            {
                            }
                            bonDeCommande.DescriptionBC  = this.reader["descriptionBC"].ToString();
                            bonDeCommande.MatriculeAgent = this.reader["matriculeAgent"].ToString();
                            try
                            {
                                bonDeCommande.MontantBC = double.Parse(this.reader["montantBC"].ToString());
                            }
                            catch (Exception)
                            {
                            }
                            bonDeCommande.NumProforma = this.reader["numProforma"].ToString();
                        }
                    }
                    this.reader.Dispose();
                }
                this.serviceConnectBase.closeConnection();

                if (bonDeCommande != null)
                {
                    if (bonDeCommande.NumProforma != "")
                    {
                        bonDeCommande.proforma = serviceProforma.selectProforma(bonDeCommande.NumProforma);
                    }
                    if (bonDeCommande.MatriculeAgent != "")
                    {
                        bonDeCommande.agent = serviceAgent.selectAgent(bonDeCommande.MatriculeAgent);
                    }
                }
            }
            #endregion

            return(bonDeCommande);
        }