private bool initCritereRecherche() { crtRechercheTypeCarte = new CritereRechercheTypeCarte(); if (cbReseau.SelectedIndex > 0) { crtRechercheTypeCarte.ReseauCarte = (string)cbReseau.SelectedItem; } if (!string.IsNullOrEmpty(txtPlfGloPaiement.Text)) { try{ decimal plfGloPaiement = decimal.Parse(txtPlfGloPaiement.Text); crtRechercheTypeCarte.PlfGloPaiement = plfGloPaiement; }catch (Exception) { MessageBox.Show("Le plafond global de paiement n'a pas été saisi correctement", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } } if (!string.IsNullOrEmpty(txtPeriodePlfGloPaiement.Text)) { try{ int periodePlfGloPaiement = int.Parse(txtPeriodePlfGloPaiement.Text); crtRechercheTypeCarte.PeriodePlfPaiement = periodePlfGloPaiement; }catch (Exception) { MessageBox.Show("La période du plafond global de paiement n'a pas été saisie correctement", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } } if (!string.IsNullOrEmpty(txtPlfGloRetrait.Text)) { try{ decimal plfGloRetrait = decimal.Parse(txtPlfGloRetrait.Text); crtRechercheTypeCarte.PlfGlobalRetraitInternes = plfGloRetrait; }catch (Exception) { MessageBox.Show("Le plafond global de retrait n'a pas été saisi correctement", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } } if (!string.IsNullOrEmpty(txtPeriodePlfGloRetrait.Text)) { try{ int periodePlfGloRetrait = int.Parse(txtPeriodePlfGloRetrait.Text); crtRechercheTypeCarte.PeriodePlfGlobalRetrait = periodePlfGloRetrait; }catch (Exception) { MessageBox.Show("La période du plafond global de retrait n'a pas été saisie correctement", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } } if (!string.IsNullOrEmpty(txtId.Text)) { try{ long id = long.Parse(txtId.Text); crtRechercheTypeCarte.IdTypeCarte = id; }catch (Exception) { MessageBox.Show("L'ID n'a pas été saisi correctement", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } } return(true); }
public static DataTable getDataTable(CritereRechercheTypeCarte criteres) { IDataReader reader = get(criteres); DataTable dt = new DataTable(); if (reader != null) { dt.Load(reader); reader.Close(); } return(dt); }
private static IDataReader get(CritereRechercheTypeCarte criteres) { IList <string> champsWhere = new List <string>(); IList <object> valuesWhere = new List <object>(); IList <string> operators = new List <string>(); Utilities.addCritere(champsWhere, valuesWhere, operators, "ID_TYPE_CARTE", criteres.IdTypeCarte, Connexion.EGAL); Utilities.addCritere(champsWhere, valuesWhere, operators, "RESEAU", criteres.ReseauCarte, Connexion.LIKE); Utilities.addCritere(champsWhere, valuesWhere, operators, "PLF_GLO_PAIE", criteres.PlfGloPaiement, Connexion.EGAL); Utilities.addCritere(champsWhere, valuesWhere, operators, "PERI_PLF_PAIE", criteres.PeriodePlfPaiement, Connexion.EGAL); Utilities.addCritere(champsWhere, valuesWhere, operators, "PERI_PLF_GLO_RET", criteres.PeriodePlfGlobalRetrait, Connexion.EGAL); Utilities.addCritere(champsWhere, valuesWhere, operators, "PLF_GLO_RET_INT", criteres.PlfGlobalRetraitInternes, Connexion.EGAL); Utilities.addCritere(champsWhere, valuesWhere, operators, "PLF_RET_ETRG", criteres.PlfRetEtranger, Connexion.EGAL); return(Connexion.get(tableName, champsWhere, valuesWhere, operators)); }