Example #1
0
        public void CreerCompteAjax(string paramUserName, string paramAppartement, string paramBatiment, string paramEscalier, int paramEtage, string paramPorte, string paramType, bool paramIsDoubleVitrage, bool paramIsRobinetsThermo, string paramOrientation)
        {
            try
            {
                bdd_appartement = new Bdd_Appartement();


                Appartement appt = new Appartement();
                appt.AppartementName  = paramAppartement;
                appt.Batiment         = paramBatiment;
                appt.Escalier         = paramEscalier;
                appt.Etage            = paramEtage;
                appt.IsDoubleVitrage  = paramIsDoubleVitrage;
                appt.IsRobinetsThermo = paramIsRobinetsThermo;
                appt.Orientation      = paramOrientation;
                appt.Porte            = paramPorte;
                appt.Type             = paramType;
                appt.UserName         = paramUserName;

                if (!bdd_appartement.IsAppartementNamePresent(paramAppartement))
                {
                    bdd_appartement.Add_Appartement(appt);
                    TempData["message"] = "Compte créé";
                }
                else
                {
                    TempData["message"] = "NOKCet appartement a déjà été créé";
                }
            }
            catch (Exception ex)
            {
                TempData["message"] = "NOKErreur lors de le création: " + ex.Message;
            }
        }
Example #2
0
        public ActionResult Index(LoginViewModel vm)
        {
            bdd_appartement = new Bdd_Appartement();
            Appartement appt = new Appartement();

            appt.AppartementName = vm.Appart;
            appt.UserName        = vm.Utilisateur;

            if (bdd_appartement.IsAppartementNamePresent(appt.AppartementName))
            {
                Appartement bddUser = bdd_appartement.Get_AppartementFromName(appt.AppartementName);
                TempData["messageConnexion"] = null;
                if (bddUser.UserName.Equals(appt.UserName))
                {
                    FormsAuthentication.SetAuthCookie(vm.Appart, false);
                }
            }
            else
            {
                TempData["messageConnexion"] = "Impossible de vous authentifier avec ce couplke Appartement / Nom";
            }

            return(Redirect(@Url.Content("~/")));
        }
Example #3
0
 public AppartementController()
 {
     this.bdd_appartement = new Bdd_Appartement();
     this.bdd_conso       = new Bdd_Consommation();
 }