예제 #1
0
        // AJOUTER NOUVEL HOTEL
        public int addHotel(T_E_HOTEL_HOT hotel_)
        {
            //HTR_ID
            T_E_HOTEL_HOT    hotel  = cleanHotel(hotel_);
            string           userID = HttpContext.Current.User.Identity.GetUserId();
            T_E_HOTELIER_HTR user   = SearchUser(userID);

            using (WebClient client = new WebClient())
            {
                string[] tab      = { APIServer, Application, "Hotel" };
                String   FullURL  = string.Join("/", tab);
                byte[]   response =
                    client.UploadValues(FullURL, new NameValueCollection()
                {
                    { "CAT_NBETOILES", hotel.CAT_NBETOILES.ToString() },
                    { "PRX_ID", hotel.PRX_ID.ToString() },
                    { "HOT_ADRLIGNE1", hotel.HOT_ADRLIGNE1.ToString() },
                    { "HOT_ADRLIGNE2", hotel.HOT_ADRLIGNE2.ToString() },
                    { "HOT_CP", hotel.HOT_CP.ToString() },
                    { "HOT_DESCRIPTION", hotel.HOT_DESCRIPTION.ToString() },
                    { "HOT_ETAT", hotel.HOT_ETAT.ToString() },
                    { "HOT_LATITUDE", hotel.HOT_LATITUDE.ToString() },
                    { "HOT_LONGITUDE", hotel.HOT_LONGITUDE.ToString() },
                    { "HOT_MEL", hotel.HOT_MEL.ToString() },
                    { "HOT_NBCHAMBRES", hotel.HOT_NBCHAMBRES.ToString() },
                    { "HOT_NOM", hotel.HOT_NOM.ToString() },
                    { "HOT_SITEWEB", hotel.HOT_SITEWEB.ToString() },
                    { "HOT_TEL", hotel.HOT_TEL.ToString() },
                    { "HOT_VILLE", hotel.HOT_VILLE.ToString() },
                    { "HTR_ID", user.HTR_ID.ToString() },
                    { "IND_INDICATIF", hotel.IND_INDICATIF.ToString() },
                    { "PAY_ID", hotel.PAY_ID.ToString() },
                });

                string result = System.Text.Encoding.UTF8.GetString(response);
                return(0);
            }
        }
예제 #2
0
        public async Task <ActionResult> LoginHotelier(T_E_HOTELIER_HTR model, string returnUrl)
        {
            var claims = new List <Claim>();

            // CREER LES POINTS DAUTHENTIFICATION
            claims.Add(new Claim(ClaimTypes.NameIdentifier, model.HTR_MEL.ToString()));
            claims.Add(new Claim(ClaimTypes.Name, model.HTR_MOTPASSE));
            // AJOUTER LE TYPE DU COMPTE

            claims.Add(new Claim("OrganizationId", "Hotelier"));
            var identity = new ClaimsIdentity(claims,
                                              DefaultAuthenticationTypes.ApplicationCookie);

            HttpContext.GetOwinContext().Authentication.SignIn(new AuthenticationProperties()
            {
                AllowRefresh = true,
                IsPersistent = true,
                ExpiresUtc   = DateTime.UtcNow.AddDays(7)
            }, identity);
            //REDIRIGER VERS LA HOME

            return(View("../Home/Index"));
        }