예제 #1
0
        public void initContrats()
        {
            CritereRechercheContrat crtRechercheContrat = new CritereRechercheContrat();

            crtRechercheContrat.IdClient = client.IdClient;
            dgvLstContrats.DataSource    = BSGestionClient.RechercherContrats(crtRechercheContrat);
        }
예제 #2
0
        public static DataTable getDataTable(CritereRechercheContrat criteres)
        {
            IDataReader reader = get(criteres);
            DataTable   dt     = new DataTable();

            if (reader != null)
            {
                dt.Load(reader);
                reader.Close();
            }
            return(dt);
        }
예제 #3
0
        private static IDataReader get(CritereRechercheContrat criteres)
        {
            IList <string> champsWhere = new List <string>();
            IList <object> valuesWhere = new List <object>();
            IList <string> operators   = new List <string>();

            Utilities.addCritere(champsWhere, valuesWhere, operators, "INTITULE", criteres.Intitule, Connexion.LIKE);
            Utilities.addCritere(champsWhere, valuesWhere, operators, "TYPE", criteres.Type, Connexion.LIKE);
            Utilities.addCritere(champsWhere, valuesWhere, operators, "DT_SOUS", criteres.DateSouscriptionFin, Connexion.INFEGAL);
            Utilities.addCritere(champsWhere, valuesWhere, operators, "DT_SOUS", criteres.DateSouscriptionDebut, Connexion.SUPEGAL);
            Utilities.addCritere(champsWhere, valuesWhere, operators, "ID_CONTRAT", criteres.IdContrat, Connexion.EGAL);
            Utilities.addCritere(champsWhere, valuesWhere, operators, "ID_CLIENT", criteres.IdClient, Connexion.EGAL);
            Utilities.addCritere(champsWhere, valuesWhere, operators, "ID_PRODUIT", criteres.IdProduit, Connexion.EGAL);
            Utilities.addCritere(champsWhere, valuesWhere, operators, "ID_COMPTE", criteres.IdCompte, Connexion.EGAL);
            return(Connexion.get(tableName, champsWhere, valuesWhere, operators));
        }
예제 #4
0
        private bool initCritereRecherche()
        {
            crtRechercheContrat = new CritereRechercheContrat();
            if (!string.IsNullOrEmpty(txtIdClient.Text))
            {
                try
                {
                    crtRechercheContrat.IdClient = long.Parse(txtIdClient.Text);
                }
                catch
                {
                    Utilities.showErrorMessage("Veuillez saisir un id client valide", "Id client non valide");
                    return(false);
                }
            }
            if (!string.IsNullOrEmpty(txtId.Text))
            {
                try
                {
                    crtRechercheContrat.IdContrat = long.Parse(txtId.Text);
                }
                catch
                {
                    Utilities.showErrorMessage("Veuillez saisir un id contrat valide", "Id contrat non valide");
                    return(false);
                }
            }
            if (!string.IsNullOrEmpty(txtIdCompte.Text))
            {
                try
                {
                    crtRechercheContrat.IdCompte = long.Parse(txtIdCompte.Text);
                }
                catch
                {
                    Utilities.showErrorMessage("Veuillez saisir un id compte valide", "Id compte non valide");
                    return(false);
                }
            }
            if (!string.IsNullOrEmpty(txtIdProduit.Text))
            {
                try
                {
                    crtRechercheContrat.IdProduit = long.Parse(txtIdProduit.Text);
                }
                catch
                {
                    Utilities.showErrorMessage("Veuillez saisir un id produit valide", "Id produit non valide");
                    return(false);
                }
            }

            crtRechercheContrat.Intitule = txtIntitule.Text;
            if (cb_type.SelectedIndex > 0)
            {
                crtRechercheContrat.Type = (string)cb_type.SelectedItem;
            }
            switch (cbDateSouscription.SelectedIndex)
            {
            case 0: break;

            case 1:
                crtRechercheContrat.DateSouscriptionDebut = dtDateSouscriptionDebut.Value;
                crtRechercheContrat.DateSouscriptionFin   = dtDateSouscriptionDebut.Value;
                break;

            case 2:
                crtRechercheContrat.DateSouscriptionDebut = dtDateSouscriptionDebut.Value;
                break;

            case 3:
                crtRechercheContrat.DateSouscriptionFin = dtDateSouscriptionFin.Value;
                break;

            case 4:
                crtRechercheContrat.DateSouscriptionDebut = dtDateSouscriptionDebut.Value;
                crtRechercheContrat.DateSouscriptionFin   = dtDateSouscriptionFin.Value;
                break;
            }
            return(true);
        }