Пример #1
0
        //private void Rafraichir()
        //{
        //    using (DataClasses1DataContext entity = new DataClasses1DataContext())
        //    {
        //        var ret = entity.T_HORAIRE.Join(entity.T_PLAGEHORAIRE,
        //            H => H.IDPlageHoraire,
        //            PH => PH.ID,
        //            (H, PH) => new { IDMedecin = H.IDMedecin, IdJour = H.IDJour, Matin = PH.HeureDebut, Soir = PH.HeureFin });
        //        _ListHoraire.Clear();
        //       foreach (var element in ret)
        //       {
        //            _ListHoraire.Add(new Horaire() { IDMedecin = element.IDMedecin, IdJour = element.IdJour, Matin = element.Matin, Soir = element.Soir });
        //       }
        //    }
        //}
        /// <summary>
        /// récupération de la liste des Horaire
        /// </summary>
        /// <param name="IdMedecin"></param>
        /// <param name="ListHoraire"></param>
        /// <returns></returns>
        public Horaire[] AjoutHoraire(int IdMedecin, Horaire[] ListAjoutHoraires)
        {
            if (SiHoraireIdentique(IdMedecin, ListAjoutHoraires))
            {
                return(ListAjoutHoraires);
            }

            if (IdMedecin != -1)
            {
                using (DataClasses1DataContext entity = new DataClasses1DataContext())
                {
                    for (int IdJour = 0; IdJour < 7; IdJour++)
                    {
                        entity.AjoutHoraireOuvertureMedecin(IdMedecin, IdJour, ListAjoutHoraires[IdJour].Matin, ListAjoutHoraires[IdJour].Soir);
                    }
                    //Rafraichir();
                    return(LectureHoraire(IdMedecin));
                }
            }
            return(null);
        }