crlUSInfoPasse IntfDalUSInfoPasse.selectUSInfoPasse(string numInfoPasse) { #region delcaration crlUSInfoPasse infoPasse = null; IntfDalUSReductionBillet serviceUSReductionBillet = new ImplDalUSReductionBillet(); #endregion #region implementation if (numInfoPasse != "") { this.strCommande = "SELECT * FROM `usinfopasse` WHERE `numInfoPasse`='" + numInfoPasse + "'"; this.serviceConnectBase.openConnection(); this.reader = this.serviceConnectBase.select(this.strCommande); if (this.reader != null) { if (this.reader.HasRows) { if (this.reader.Read()) { infoPasse = new crlUSInfoPasse(); try { infoPasse.Niveau = int.Parse(this.reader["niveau"].ToString()); } catch (Exception) { } try { infoPasse.NombrePasse = int.Parse(this.reader["nombrePasse"].ToString()); } catch (Exception) { } infoPasse.NumInfoPasse = this.reader["numInfoPasse"].ToString(); infoPasse.NumReductionBillet = this.reader["numReductionBillet"].ToString(); } } this.reader.Dispose(); } this.serviceConnectBase.closeConnection(); if (infoPasse != null) { if (infoPasse.NumReductionBillet != "") { infoPasse.reductionBillet = serviceUSReductionBillet.selectUSReductionBillet(infoPasse.NumReductionBillet); } } } #endregion return(infoPasse); }
void IntfDalUSReductionBillet.insertToGridUSReductionBillet(GridView gridView, string param, string paramLike, string valueLike) { #region declaration IntfDalUSReductionBillet serviceUSReductionBillet = new ImplDalUSReductionBillet(); #endregion #region implementation this.strCommande = "SELECT usreductionbillet.numReductionBillet, usreductionbillet.reductionBillet,"; this.strCommande += " usreductionbillet.reductionPourcentage, usreductionbillet.reductionMontant"; this.strCommande += " FROM usreductionbillet"; this.strCommande += " WHERE " + paramLike + " LIKE '%" + valueLike + "%'"; this.strCommande += " ORDER BY " + param; gridView.DataSource = serviceUSReductionBillet.getDataTableUSReductionBillet(this.strCommande); gridView.DataBind(); #endregion }
string IntfDalUSReductionBillet.insertUSReductionBillet(crlUSReductionBillet reductionBillet, string sigleAgence) { #region declaration string numReductionBillet = ""; int nbInsert = 0; string reductionPourcentage = "NULL"; string reductionMontant = "NULL"; IntfDalUSReductionBillet serviceUSReductionBillet = new ImplDalUSReductionBillet(); #endregion #region implementation if (reductionBillet != null) { if (reductionBillet.ReductionPourcentage >= 0) { reductionPourcentage = "'" + reductionBillet.ReductionPourcentage.ToString() + "'"; } if (reductionBillet.ReductionMontant >= 0) { reductionMontant = "'" + reductionBillet.ReductionMontant.ToString("0") + "'"; } reductionBillet.NumReductionBillet = serviceUSReductionBillet.getNumUSReductionBillet(sigleAgence); this.strCommande = "INSERT INTO `usreductionbillet` (`numReductionBillet`,`reductionBillet`,"; this.strCommande += " `reductionPourcentage`,`reductionMontant`) VALUES"; this.strCommande += " ('" + reductionBillet.NumReductionBillet + "','" + reductionBillet.ReductionBillet + "',"; this.strCommande += " " + reductionPourcentage + "," + reductionMontant + ")"; this.serviceConnectBase.openConnection(); nbInsert = this.serviceConnectBase.requete(this.strCommande); if (nbInsert == 1) { numReductionBillet = reductionBillet.NumReductionBillet; } this.serviceConnectBase.closeConnection(); } #endregion return(numReductionBillet); }
DataTable IntfDalUSInfoPasse.getDataTableInfoPasse(string strRqst) { #region declaration DataTable dataTable = new DataTable(); IntfDalGeneral serviceGeneral = new ImplDalGeneral(); IntfDalUSPlageNombreBillet serviceUSPlageNombreBillet = new ImplDalUSPlageNombreBillet(); IntfDalUSReductionBillet serviceUSReductionBillet = new ImplDalUSReductionBillet(); IntfDalUSPrixBase serviceUSPrixBase = new ImplDalUSPrixBase(); crlUSReductionBillet reduction = null; crlUSPlageNombreBillet plageNombreBillet = null; crlUSPrixBase prixBase = null; #endregion #region implementation #region initialisation du dataTable dataTable = new DataTable(); dataTable.Columns.Add("numInfoPasse", typeof(string)); dataTable.Columns.Add("nombrePasse", typeof(string)); dataTable.Columns.Add("niveau", typeof(string)); dataTable.Columns.Add("prixUnitaire", typeof(string)); dataTable.Columns.Add("dureeValidite", typeof(string)); DataRow dr; #endregion this.serviceConnectBase.openConnection(); this.reader = this.serviceConnectBase.select(strRqst); if (this.reader != null) { if (this.reader.HasRows) { while (this.reader.Read()) { dr = dataTable.NewRow(); dr["numInfoPasse"] = reader["numInfoPasse"].ToString(); dr["nombrePasse"] = reader["nombrePasse"].ToString(); dr["niveau"] = reader["niveau"].ToString(); reduction = serviceUSReductionBillet.selectUSReductionBillet(this.reader["numReductionBillet"].ToString()); try { prixBase = serviceUSPrixBase.selectUSPrixBase(int.Parse(reader["niveau"].ToString())); } catch (Exception) { } try { plageNombreBillet = serviceUSPlageNombreBillet.getPlageNombreBillet(int.Parse(reader["nombrePasse"].ToString())); } catch (Exception) { } if (prixBase != null) { if (reduction != null) { if (reduction.ReductionMontant > 0) { dr["prixUnitaire"] = serviceGeneral.separateurDesMilles((prixBase.MontantPrixBase - reduction.ReductionMontant).ToString("0")) + " Ar"; } else { dr["prixUnitaire"] = serviceGeneral.separateurDesMilles((prixBase.MontantPrixBase - (prixBase.MontantPrixBase * reduction.ReductionPourcentage / 100)).ToString("0")) + " Ar"; } } else { dr["prixUnitaire"] = serviceGeneral.separateurDesMilles(prixBase.MontantPrixBase.ToString("0")) + " Ar"; } } else { dr["prixUnitaire"] = ""; } if (plageNombreBillet != null) { dr["dureeValidite"] = serviceGeneral.getTextTimeSpan(serviceGeneral.getStringTimeSpan(plageNombreBillet.DureeDeValidite)); } else { dr["dureeValidite"] = ""; } reduction = null; prixBase = null; plageNombreBillet = null; dataTable.Rows.Add(dr); } } this.reader.Dispose(); } this.serviceConnectBase.closeConnection(); #endregion return(dataTable); }