コード例 #1
0
 public PeekWishesViewModel(IRepository <Wishes> repository, Guests currentGuest)
 {
     Repository   = repository;
     Collection   = Repository.Collection.Where(wish => wish.GuestID == currentGuest.GuestID).ToList();
     CurrentGuest = currentGuest;
     Repository.ModelCollectionChanged += () =>
     {
         Collection = Repository.Collection.Where(wish => wish.GuestID == currentGuest.GuestID).ToList();
         RaisePropertyChanged("Collection");
     };
 }
コード例 #2
0
 public ActionResult Sign_Up(Guests g)
 {
     if (ModelState.IsValid)
     {
         return(View("Thank_you", g));
     }
     else
     {
         return(View());
     }
 }
コード例 #3
0
 public ViewResult Inviteform(Guests guests)
 {
     if (ModelState.IsValid)
     {
         return(View("thanks", guests));
     }
     else
     {
         return(View());
     }
 }
コード例 #4
0
        private void AddGuest(object o)
        {
            Guests.Add(new Guest
            {
                Name    = Name,
                Company = Company
            });

            Name    = string.Empty;
            Company = string.Empty;
        }
コード例 #5
0
ファイル: BlogContext.cs プロジェクト: AlisaAlica/Blog-MVC
 //Method for add guest
 public void AddGuest(string name, string text)
 {
     Guests.Add(
         new Guest
     {
         Name      = name,
         GuestText = text,
         Date      = DateTime.Now
     });
     SaveChanges();
 }
コード例 #6
0
        public async Task <IActionResult> Create([Bind("ActorID,ActorFullName,ActorNotes")] Guests guests)
        {
            if (ModelState.IsValid)
            {
                _context.Add(guests);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(guests));
        }
コード例 #7
0
ファイル: GuestsController.cs プロジェクト: mando91/desappnet
        public async Task <IActionResult> Create([Bind("GuestId,GuestTile,GuestForenames,GuestSurnames,GuestsDOB,GuestAddressStreet,GuestAddressTown,GuestAddressSCountry,GuestAddressPostalCode,GuestContactPhone")] Guests guests)
        {
            if (ModelState.IsValid)
            {
                _context.Add(guests);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(guests));
        }
コード例 #8
0
 [HttpPost] //Capturar los datos de la forma y enviarlos
 //Al hacer un submit, se da el POST y se ejecuta la clase
 public ViewResult Reservar(Guests gr)
 {
     if (ModelState.IsValid) //ModelState.IsValid, se va a modelo de Datos y ahi hace las validaciones correspondientes.
     {
         return(View("Gracias", gr));
     }
     else
     {
         return(View());
     }
 }
コード例 #9
0
        public Guest AddGuest(string name, string email, string phoneNumber)
        {
            if (Guests.Any(g => g.Name == name))
            {
                throw new ArgumentException("Guest cannot be added twice.");
            }
            Guest guest = new Guest(name, email, phoneNumber);

            Guests.Add(guest);
            return(guest);
        }
コード例 #10
0
 public ViewResult RsvpForm(Guests guests)
 {
     if (ModelState.IsValid)
     {
         return(View("Thanks", guests));
     }
     else
     {
         return(View());
     }
 }
コード例 #11
0
 public void FilterGuests()
 {
     DisplayedGuests = new ObservableCollection <Guest>(Guests.Where(g =>
                                                                     (g.FirstName != null && g.FirstName.ToLower().Contains(FilterGuestString)) ||
                                                                     (g.LastName != null && g.LastName.ToLower().Contains(FilterGuestString)) ||
                                                                     (g.PhoneNumber != null && g.PhoneNumber.ToLower().Contains(FilterGuestString)) ||
                                                                     (g.PostalCode != null && g.PostalCode.ToLower().Contains(FilterGuestString)) ||
                                                                     (g.EmailAdress != null && g.EmailAdress.ToLower().Contains(FilterGuestString)) ||
                                                                     (g.City != null && g.City.ToLower().Contains(FilterGuestString)) ||
                                                                     (g.Country != null && g.Country.ToLower().Contains(FilterGuestString))));
 }
コード例 #12
0
        public async Task <IActionResult> Create([Bind("GuestId,GuestFirstName,GuestLastName,GuestFullName,GuestEmail,GuestPhone,OrganizationId,GuestAddress,GuestCity,GuestState,GuestZip")] Guests guests)
        {
            if (ModelState.IsValid)
            {
                _context.Add(guests);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["OrganizationId"] = new SelectList(_context.Organizations, "OrganizationId", "OrganizationName", guests.OrganizationId);
            return(View(guests));
        }
コード例 #13
0
        /// <summary>
        ///
        /// </summary>
        private void btnAddGuest(object sender, RoutedEventArgs e)
        {
            CreateGuestWindow newGuestWindow = new CreateGuestWindow();

            newGuestWindow.ShowDialog();
            if (newGuestWindow.DialogResult.Value)
            {
                Guests.Add(newGuestWindow.Guest);
                lbGuests.ItemsSource = null;
                lbGuests.ItemsSource = Guests;
            }
        }
コード例 #14
0
    private void BindNewGuest(SqlInt32 newGuestId)
    {
        BindGuests();
        Guests guest = new Guests();

        guest.Guest_ID = newGuestId;
        DataTable table = guest.SelectOne();

        grid.DataSource = table;
        grid.DataBind();
        hidNewGuestId.Value = newGuestId.ToString();
    }
コード例 #15
0
        public Guests CreateGuest(Guests guest)
        {
            if (!ModelState.IsValid)
            {
                throw new HttpResponseException(HttpStatusCode.BadRequest);
            }

            _context.Guest.Add(guest);
            _context.SaveChanges();

            return(guest);
        }
コード例 #16
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         Guests g = new Guests();
         dgvGuestlist.DataSource = g.ListGuest();
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
コード例 #17
0
        private void CheckIfGuestsNeedToGoHome()
        {
            List <Sim> simsToGoHome = new List <Sim>();

            foreach (Sim sim in Guests)
            {
                bool flag = VisitSituation.IsGuestAllowedToStayOver(sim);
                if (sim.MoodManager.IsInStrongNegativeMood || (!flag && (sim.BuffManager.HasElement(BuffNames.Tired) || sim.BuffManager.HasElement(BuffNames.Exhausted))))
                {
                    AddSimToGoHome(sim, simsToGoHome);
                }

                if (sim.SimDescription.ChildOrBelow && (SimClock.Hours24 >= GetParams().HourAtWhichChildrenGoHome))
                {
                    AddSimToGoHome(sim, simsToGoHome);
                    foreach (Genealogy genealogy in sim.Genealogy.Parents)
                    {
                        SimDescription simDescription = genealogy.SimDescription;
                        if (simDescription != null)
                        {
                            Sim createdSim = simDescription.CreatedSim;
                            if ((createdSim != null) && Guests.Contains(createdSim))
                            {
                                AddSimToGoHome(createdSim, simsToGoHome);
                            }
                        }
                    }
                }

                float       delta = sim.MoodManager.MoodValue * GetParams().MoodToTimeMod;
                DateAndTime time;
                if (!flag && mTimeForSimToLeave.TryGetValue(sim.ObjectId, out time))
                {
                    time = SimClock.Add(time, TimeUnit.Minutes, delta);
                    if (time.CompareTo(SimClock.CurrentTime()) < 0x0)
                    {
                        AddSimToGoHome(sim, simsToGoHome);
                    }
                    else
                    {
                        mTimeForSimToLeave[sim.ObjectId] = time;
                    }
                }
            }
            foreach (Sim sim3 in simsToGoHome)
            {
                if (sim3.LotCurrent == Lot)
                {
                    MakeGuestGoHome(sim3);
                }
            }
        }
コード例 #18
0
        public IActionResult Unrsvp(int weddingId)
        {
            if (HttpContext.Session.GetInt32("UserId") == null)
            {
                return(RedirectToAction("Index"));
            }
            int    UserId       = HttpContext.Session.GetInt32("UserId") ?? default(int);
            Guests RsvpToRemove = dbContext.guests.FirstOrDefault(x => x.WeddingId == weddingId && x.UserId == UserId);

            dbContext.guests.Remove(RsvpToRemove);
            dbContext.SaveChanges();
            return(RedirectToAction("Weddings"));
        }
コード例 #19
0
        public IActionResult RSVP(int id)
        {
            int?    ThisUserId  = HttpContext.Session.GetInt32("UserId");
            User    ThisUser    = dbContext.user.FirstOrDefault(u => u.UserId == ThisUserId);
            Wedding ThisWedding = dbContext.wedding.FirstOrDefault(w => w.WeddingId == id);
            Guests  NewGuest    = new Guests();

            NewGuest.UserId    = ThisUser.UserId;
            NewGuest.WeddingId = ThisWedding.WeddingId;
            dbContext.guests.Add(NewGuest);
            dbContext.SaveChanges();
            return(RedirectToAction("Dashboard"));
        }
コード例 #20
0
ファイル: Invitation.cs プロジェクト: lflahive/rsvp
        public async Task UpdateAsync(RsvpRepository repository)
        {
            var existingInvitation = await repository.GetInvitationByIdAsync(EventId, Id);

            // Iterate over the existing guests so that we only change the acceptance.
            // Don't allow new guests to be added or old guests to be removed.
            existingInvitation.Guests.ForEach(guest => {
                var matchingGuest = Guests.FirstOrDefault(x => x.Id == guest.Id);
                guest.Accepted    = matchingGuest.Accepted;
            });

            await repository.UpdateInvitationAsync(existingInvitation);
        }
コード例 #21
0
ファイル: UnitController.cs プロジェクト: AleX77NP/CaffeBar
 public IActionResult NewGuests([FromBody] Guests guests)
 {
     try
     {
         unit.Guests.AddGuests(guests);
         unit.Complete();
         return(Ok("New guests added!"));
     }
     catch (Exception ex)
     {
         return(BadRequest("Failed to add guests, " + ex.ToString()));
     }
 }
コード例 #22
0
ファイル: GuestsController.cs プロジェクト: tiger333san/repos
        // GET: Guests/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Guests guests = db.Guests.Find(id);

            if (guests == null)
            {
                return(HttpNotFound());
            }
            return(View(guests));
        }
コード例 #23
0
        private void AddGuest(object o)
        {
            // Save state
            _undoMementos.Push(Guests.Memento);

            Guests.Add(new Guest
            {
                Name    = Name,
                Company = Company
            });

            Name    = string.Empty;
            Company = string.Empty;
        }
コード例 #24
0
        public void Put(int id, [FromBody] Guests guest)
        {
            if (guest == null)
            {
                return;
            }
            if (!db.Rooms.Any(x => x.RoomId == guest.RoomId))
            {
                return;
            }

            db.Update(guest);
            db.SaveChanges();
        }
コード例 #25
0
 public static GuestModel ToCustomerModel(this Guests customer)
 {
     return(new GuestModel
     {
         FirstName = customer.FirstName,
         Email = customer.Email,
         PostalCode = customer.PostalCode,
         LastName = customer.LastName,
         CityCode = customer.CityCode,
         GuestId = customer.GuestId,
         RoomId = customer.RoomId,
         TenantName = customer.TenantName
     });
 }
コード例 #26
0
        public void StartAddingGuest()
        {
            var guest = new Guest();

            GroupBoxName = "New Guest";
            var g = new AddGuestViewModel();

            g.Initialize(new EditGuestCommand(guest), () => { StartAddingGuest(); }, guest, () =>
            {
                Guests.Add(guest);
                StartAddingGuest();
            });
            CurrentGuest = g;
        }
コード例 #27
0
        public CardDefault(Binary b)
        {
            this.b = b;
            InitializeComponent();
            Account acc = MapPage._g;

            if (acc is Guests)
            {
                Guests g = acc as Guests;
                if (!DBActions.hasBooked(g, b.PRODUCT))
                {
                    btn.Text = "RESERVERA";
                }
            }
            lbl.Text     = b.PRODUCT.Description;
            btn.Clicked += async(s, e) => {
                if (loading)
                {
                    return;
                }
                if (MapPage._g is Admins)
                {
                    if (await DBActions.Check(MapPage._g as Admins, MapPage.mapPage))
                    {
                        return;
                    }
                }
                loading = true;
                await DBActions.LoadProducts();

                await DBActions.LoadUsers();

                var prds = DBActions.GetProductById(b.PRODUCT.ID);
                if (prds != null && prds.Quantity > 0 &&
                    DBActions.GetAdminById(prds.AdminID) != null)
                {
                    MapPage.mapPage.OpenProduct(b);
                }
                else
                {
                    App.Send("Info", "Produkten finns inte längre!", "Ok");
                    if (DBActions.GetAdminById(prds.AdminID) == null)
                    {
                        await DBActions.CheckProducts();
                    }
                    MapPage.mapPage.ReloadAll();
                }
                loading = false;
            };
        }
コード例 #28
0
ファイル: Hotel.cs プロジェクト: trluxus/NixProject
        public void RemoveGuest(Guest guest)
        {
            var del = Reservations.Where(i => i.Value.Contains(guest.ID));

            foreach (var r in del)
            {
                Reservations[r.Key].Remove(guest.ID);
            }

            ReservationsTrasaction();

            Guests.Remove(guest);
            GuestsTrasaction();
        }
        private void Guest_StateChanged()
        {
            if (Guests.Any())
            {
                Guests.Clear();
            }

            var guests = _searchGuestService.SearchGuest(Guest.FirstName, Guest.LastName, Guest.Phone);

            if (guests.Any())
            {
                Guests = new ObservableCollection <Guest>(guests);
            }
        }
コード例 #30
0
ファイル: DataHandler.cs プロジェクト: shadyObeed/Sadna
        internal Person GetUser(string username)
        {
            var id = IsGuest(username);

            if (id < 0 && Users.ContainsKey(username))
            {
                return(Users[username]);
            }
            if (id >= 0 && Guests.ContainsKey(id))
            {
                return(Guests[id]);
            }
            return(null);
        }