Ejemplo n.º 1
0
 protected void filtrerParVilleAndSpec_Click(object sender, EventArgs e)
 {
     using (var ctx = new MedicoContext())
     {
         var cabInfo = from cab in ctx.Cabinets
                       join doc in ctx.Personnes.OfType <Medecin>() on cab.idCabinet equals doc.Cabinet_idCabinet
                       join spec in ctx.Specialites on doc.Specialite_idSpecialite equals spec.idSpecialite
                       select new
         {
             idCab      = cab.idCabinet,
             nomCab     = cab.nom,
             specCab    = doc.Specialite.nom,
             idspecCab  = doc.Specialite_idSpecialite,
             villeCab   = cab.ville,
             adresseCab = cab.adresse,
             photoCab   = cab.photo,
             geoX       = cab.geoLocationX,
             geoY       = cab.geoLocationY,
             nomDoc     = doc.nom,
             prenomDoc  = doc.prenom,
         };
         if (villeCab.SelectedValue != "")
         {
             City villeFilter = (City)(int.Parse(villeCab.SelectedValue));
             cabInfo = cabInfo.Where(c => c.villeCab == villeFilter);
         }
         if (specialityDoc.SelectedValue != "")
         {
             int specFilter = int.Parse(specialityDoc.SelectedValue);
             cabInfo = cabInfo.Where(c => c.idspecCab == specFilter);
         }
         LesCab.DataSource = cabInfo.ToList();
         LesCab.DataBind();
     }
 }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["id"] != null)
            {
                int idCabPass = int.Parse(Request.QueryString["id"]);
                using (var ctx = new MedicoContext())
                {
                    var docInfo = from cab in ctx.Cabinets
                                  join doc in ctx.Personnes.OfType <Medecin>() on cab.idCabinet equals doc.Cabinet_idCabinet
                                  join spec in ctx.Specialites on doc.Specialite_idSpecialite equals spec.idSpecialite
                                  where cab.idCabinet == idCabPass
                                  select new
                    {
                        photoDoc   = doc.photo,
                        nomDoc     = doc.nom,
                        prenomDoc  = doc.prenom,
                        specDoc    = spec.nom,
                        villeDoc   = doc.ville,
                        telDoc     = doc.telephone,
                        emailDoc   = doc.email,
                        adresseDoc = doc.adresse,
                        debutTrav  = doc.timeStartJob,
                        finTrav    = doc.timeEndJob,
                        photoCab   = cab.photo,
                        nomCab     = cab.nom,
                        adresseCab = cab.adresse,
                        villeCab   = cab.ville,
                        cpCab      = cab.code_postale,
                        descCab    = cab.description,
                        geox       = cab.geoLocationX,
                        geoy       = cab.geoLocationY,
                    };
                    var DataInfo = docInfo.First();

                    this.photoDoc   = DataInfo.photoDoc;
                    this.nomDoc     = DataInfo.nomDoc;
                    this.prenomDoc  = DataInfo.prenomDoc;
                    this.specDoc    = DataInfo.specDoc;
                    this.villeDoc   = ((City)DataInfo.villeDoc).ToString();
                    this.telDoc     = DataInfo.telDoc;
                    this.emailDoc   = DataInfo.emailDoc;
                    this.adresseDoc = DataInfo.adresseDoc;
                    this.debutTrav  = DataInfo.debutTrav.ToString().Substring(0, 5);
                    this.finTrav    = DataInfo.finTrav.ToString().Substring(0, 5);
                    this.photoCab   = DataInfo.photoCab;
                    this.nomCab     = DataInfo.nomCab;
                    this.adresseCab = DataInfo.adresseCab;
                    this.villeCab   = ((City)DataInfo.villeCab).ToString();
                    this.cpCab      = DataInfo.cpCab.ToString();
                    this.descCab    = DataInfo.descCab;
                    this.geox       = DataInfo.geox.ToString();
                    this.geoy       = DataInfo.geoy.ToString();
                }
            }
            this.Title = "Cabinet : " + nomCab;
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack || Request.QueryString["nomcab"] == null)
            {
                Hashtable ville = Data.GetVilleForBind(typeof(City));
                villeCab.DataSource     = ville;
                villeCab.DataTextField  = "value";
                villeCab.DataValueField = "key";
                villeCab.DataBind();

                using (var ctx = new MedicoContext())
                {
                    specialityDoc.DataTextField  = "nom";
                    specialityDoc.DataValueField = "idSpecialite";
                    specialityDoc.DataSource     = ctx.Specialites.ToList();
                    specialityDoc.DataBind();

                    var cabInfo = from cab in ctx.Cabinets
                                  join doc in ctx.Personnes.OfType <Medecin>() on cab.idCabinet equals doc.Cabinet_idCabinet
                                  join spec in ctx.Specialites on doc.Specialite_idSpecialite equals spec.idSpecialite
                                  select new
                    {
                        idCab      = cab.idCabinet,
                        nomCab     = cab.nom,
                        specCab    = doc.Specialite.nom,
                        villeCab   = cab.ville,
                        adresseCab = cab.adresse,
                        photoCab   = cab.photo,
                        geoX       = cab.geoLocationX,
                        geoY       = cab.geoLocationY,
                        nomDoc     = doc.nom,
                        prenomDoc  = doc.prenom,
                    };
                    LesCab.DataSource = cabInfo.ToList();
                    LesCab.DataBind();
                }
            }
            if (Request.QueryString["nomcab"] != null)
            {
                using (var ctx = new MedicoContext())
                {
                    string nomCabDecode = HttpUtility.HtmlDecode(Request.QueryString["nomcab"]);
                    var    cabInfo      = from cab in ctx.Cabinets
                                          join doc in ctx.Personnes.OfType <Medecin>() on cab.idCabinet equals doc.Cabinet_idCabinet
                                          join spec in ctx.Specialites on doc.Specialite_idSpecialite equals spec.idSpecialite
                                          where cab.nom.Contains(nomCabDecode)
                                          select new
                    {
                        idCab      = cab.idCabinet,
                        nomCab     = cab.nom,
                        specCab    = doc.Specialite.nom,
                        villeCab   = cab.ville,
                        adresseCab = cab.adresse,
                        photoCab   = cab.photo,
                        geoX       = cab.geoLocationX,
                        geoY       = cab.geoLocationY,
                        nomDoc     = doc.nom,
                        prenomDoc  = doc.prenom,
                    };
                    LesCab.DataSource = cabInfo.ToList();
                    LesCab.DataBind();
                    FilterCabPanel.Visible = false;
                }
            }
        }