Esempio n. 1
0
        public static int IDCha(string numero)
        {
            int id = 0;
            List <C_t_chambres> lTmp_Cha = new G_t_chambres(TablesDeDonnees.SConnexion).Lire("ID");

            foreach (C_t_chambres c in lTmp_Cha)
            {
                if (numero == c.NomCha.ToString())
                {
                    id = c.IDCha;
                    break;
                }
            }

            return(id);
        }
Esempio n. 2
0
        private void AfficherChambres()
        {
            t_chambres = new DataTable();
            t_chambres.Columns.Add(new DataColumn("ID", System.Type.GetType("System.Int32")));
            t_chambres.Columns.Add(new DataColumn("Numéro"));
            t_chambres.Columns.Add(new DataColumn("Etage"));
            t_chambres.Columns.Add(new DataColumn("Service"));
            List <C_t_chambres> lTmp_Cha = new G_t_chambres(sConnexion).Lire("NomCha");

            foreach (C_t_chambres c in lTmp_Cha)
            {
                t_chambres.Rows.Add(c.IDCha, c.NomCha, c.EtageCha, c.ServiceCha);
            }
            bs_chambres            = new BindingSource();
            bs_chambres.DataSource = t_chambres;
            dgvChambres.DataSource = bs_chambres;
        }
        private void AfficherOccupation()
        {
            t_occuper = new DataTable();
            t_occuper.Columns.Add(new DataColumn("ID", System.Type.GetType("System.Int32")));
            t_occuper.Columns.Add(new DataColumn("Patient"));
            t_occuper.Columns.Add(new DataColumn("Chambre"));
            t_occuper.Columns.Add(new DataColumn("Entrée le"));
            t_occuper.Columns.Add(new DataColumn("Sortie le"));
            t_occuper.Columns.Add(new DataColumn("Coût journalier"));
            List <C_t_chambres> lTmp_Cha = new G_t_chambres(sConnexion).Lire("NomCha");
            List <C_t_patients> lTmp_Pat = new G_t_patients(sConnexion).Lire("NomPat");
            List <C_t_occuper>  lTmp_Occ = new G_t_occuper(sConnexion).Lire("IDOcc");

            foreach (C_t_occuper o in lTmp_Occ)
            {
                string Chambre = "", Patient = "";

                foreach (C_t_chambres c in lTmp_Cha)
                {
                    if (o.IDCha == c.IDCha)
                    {
                        Chambre = c.NomCha.ToString();
                        break;
                    }
                }
                foreach (C_t_patients p in lTmp_Pat)
                {
                    if (o.IDPat == p.IDPat)
                    {
                        Patient = p.NomPat + " " + p.PrenomPat;
                        break;
                    }
                }

                t_occuper.Rows.Add(o.IDOcc, Patient, Chambre, o.DateEntree.ToShortDateString(),
                                   o.DateSortie.ToString(), o.PrixJournalier.ToString());
            }
            bs_occuper               = new BindingSource();
            bs_occuper.DataSource    = t_occuper;
            dgvOccupation.DataSource = bs_occuper;
        }
        public static BindingSource AfficherChambres()
        {
            DataTable t_chambres = new DataTable();

            //t_chambres.Columns.Add(new DataColumn("ID", System.Type.GetType("System.Int32")));
            t_chambres.Columns.Add(new DataColumn("Numéro"));
            t_chambres.Columns.Add(new DataColumn("Nombre de lit"));
            t_chambres.Columns.Add(new DataColumn("Type"));
            t_chambres.Columns.Add(new DataColumn("Etage"));
            t_chambres.Columns.Add(new DataColumn("Service"));
            List <C_t_chambres> lTmp_Cha = new G_t_chambres(TablesDeDonnees.SConnexion).Lire("ID");

            foreach (C_t_chambres cha in lTmp_Cha)
            {
                t_chambres.Rows.Add(cha.NomCha.ToString(), cha.QuantiteLits.ToString(), cha.TypeCha, cha.EtageCha.ToString(), cha.ServiceCha);
            }
            BindingSource bs_chambres = TablesDeDonnees.bs_chambres;

            bs_chambres.DataSource = t_chambres;
            return(bs_chambres);
        }
        public static void AfficherDispoCha(string NumCha, DataGridView dgv, int i)
        {
            if (NumCha == "")
            {
                MessageBox.Show("Veuillez saisir un numéro de chambre.", "Attention!", MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);
            }
            else
            {
                int       id = 0, nbr_lit = 0;
                DateTime  Premier_J_Semaine = GestionDates.Date_Premier_J_Semaine(i);
                DataTable t_dispo_chambre = new DataTable();
                t_dispo_chambre.Columns.Add(new DataColumn("Lundi\n" + Premier_J_Semaine.ToShortDateString()));
                t_dispo_chambre.Columns.Add(
                    new DataColumn("Mardi\n" + Premier_J_Semaine.AddDays(1).ToShortDateString()));
                t_dispo_chambre.Columns.Add(
                    new DataColumn("Mercredi\n" + Premier_J_Semaine.AddDays(2).ToShortDateString()));
                t_dispo_chambre.Columns.Add(
                    new DataColumn("Jeudi\n" + Premier_J_Semaine.AddDays(3).ToShortDateString()));
                t_dispo_chambre.Columns.Add(
                    new DataColumn("Vendredi\n" + Premier_J_Semaine.AddDays(4).ToShortDateString()));
                t_dispo_chambre.Columns.Add(
                    new DataColumn("Samedi\n" + Premier_J_Semaine.AddDays(5).ToShortDateString()));
                t_dispo_chambre.Columns.Add(
                    new DataColumn("Dimanche\n" + Premier_J_Semaine.AddDays(6).ToShortDateString()));
                List <C_t_chambres> lTmp_Cha = new G_t_chambres(TablesDeDonnees.SConnexion).Lire("IDCha");
                foreach (C_t_chambres c in lTmp_Cha)
                {
                    if (c.NomCha == int.Parse(NumCha))
                    {
                        id      = c.IDCha;
                        nbr_lit = c.QuantiteLits;
                        break;
                    }
                }

                if (id != 0)
                {
                    int[] Lit_occupe            = new int[] { 0, 0, 0, 0, 0, 0, 0 };
                    List <C_t_occuper> lTmp_Occ = new G_t_occuper(TablesDeDonnees.SConnexion).Lire("IDOcc");
                    for (int j = 0; j < 7; j++)
                    {
                        DateTime Date_Comp = Premier_J_Semaine.AddDays(j);
                        foreach (C_t_occuper o in lTmp_Occ)
                        {
                            if (o.IDCha == id &&
                                (Date_Comp.Date >= o.DateEntree.Date && Date_Comp.Date <= o.DateSortie.Value))
                            {
                                Lit_occupe[j] += 1;
                            }
                        }
                    }

                    t_dispo_chambre.Rows.Add(nbr_lit - Lit_occupe[0], nbr_lit - Lit_occupe[1], nbr_lit - Lit_occupe[2],
                                             nbr_lit - Lit_occupe[3],
                                             nbr_lit - Lit_occupe[4], nbr_lit - Lit_occupe[5], nbr_lit - Lit_occupe[6]);

                    BindingSource bs_dispo_chambre = new BindingSource();
                    bs_dispo_chambre.DataSource = t_dispo_chambre;
                    dgv.DataSource = bs_dispo_chambre;
                    // Bloque du tri sur les colonnes \\
                    dgv.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;
                    dgv.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable;
                    dgv.Columns[2].SortMode = DataGridViewColumnSortMode.NotSortable;
                    dgv.Columns[3].SortMode = DataGridViewColumnSortMode.NotSortable;
                    dgv.Columns[4].SortMode = DataGridViewColumnSortMode.NotSortable;
                    dgv.Columns[5].SortMode = DataGridViewColumnSortMode.NotSortable;
                    dgv.Columns[6].SortMode = DataGridViewColumnSortMode.NotSortable;
                    // désactive le fait d'avoir la première cellule sélectionnée \\
                    dgv.FirstDisplayedCell.Selected = false;
                }
                else
                {
                    MessageBox.Show("La chambre recherchée n'existe pas!", "Attention", MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                }
            }
        }