public void EvictGuest(IGuest guest) { if (!_guests.Remove(guest)) { Console.WriteLine("An error occurred while checking out the guest!"); } }
public ReturningCustomerCheck(IGuest g, Form p) { ParentForm = p; _guest = g; InitializeComponent(); }
/// <summary> /// we write down the id of the person who stored this guest, i.e. the first person that was stored /// </summary> /// <param name="guest"></param> /// <param name="storedBy"></param> /// <returns>The id of the guest who stored this guest.</returns> public async Task StoreGuest(IGuest guest, Guid?storedBy = null) { if (guest.Id == null) { guest.Id = GetNextId(); } else { // If they already have an Id then they already exist so this is an update. await UpdateGuest(guest); return; } if (guest.AddedBy == null) { // We assume they stored themself guest.AddedBy = guest.Id; } var row = SerializePerson(guest); using (_GuestWriter = new CsvWriter(_GuestLocation)) { _GuestWriter.WriteLine(row); } }
public async Task RemoveGuest(IGuest guest) { var records = GetAllRecords().ToList(); records.Remove(records.First(x => x[0] == guest.Id.ToString())); WriteAllRecords(records); }
public void Update(IGuest data) { this.Name = data.Name; this.Website = data.Website; this.Email = data.Email; this.IpAddress = data.IpAddress; this.Date = data.Date; this.IsArchived = data.IsArchived; }
/// <summary> /// Inserts a new guest into the DAL. /// </summary> /// <param name="data">DTO to create from</param> /// <returns>An Guest DAL object</returns> /// <exception cref="System.ArgumentException">Errors in data will result in an exception being thrown</exception> public IGuest InsertGuest(IGuest data) { var db = new Context(); var g = Guest.CreateGuest(data); db.Guests.Add(g); db.SaveChanges(); return(g); }
private List <string> SerializePerson(IGuest guest) { var row = new List <string> { $"{guest.Id}", $"{guest.FirstName}", $"{guest.Surname}", $"{guest.Allergies}", $"{guest.IsComing}", $"{guest.AgeGroup}" }; if (guest.AddedBy != null) { row.Add($"{guest.AddedBy}"); } return(row); }
public static Guest CreateGuest(IGuest data) { return(new Guest { GuestUid = data.GuestUid, Name = data.Name, Email = data.Email, Website = data.Website, IpAddress = data.IpAddress, Date = data.Date, IsArchived = data.IsArchived }); }
/// <summary> /// Updates an existing guest. /// </summary> /// <param name="data">Guest to update</param> /// <returns>An User DTO object</returns> /// <exception cref="TooksCms.Core.Exceptions.DataNotFoundException">Guest does not exist</exception> public IGuest UpdateGuest(IGuest data) { var db = new Context(); if (!_guestExists(data.GuestId, db)) { throw new DataNotFoundException("Guest does not exists in the DAL", "id"); } var g = db.Guests.FirstOrDefault(g_ => g_.GuestId == data.GuestId); g.Update(data); db.SaveChanges(); return(g); }
public async Task UpdateGuest(IGuest guest) { var records = GetAllRecords().ToList(); var outputRecords = new List <List <string> >(); foreach (var record in records) { var row = record; var storedGuest = await record.ToGuestViewModel(); if (storedGuest.Id == guest.Id) { row = SerializePerson(guest); } outputRecords.Add(row); } WriteAllRecords(outputRecords); }
public Task AddGuest(IGuest guest, Guid?storerId = null) { return(_StorageProvider.StoreGuest(guest, storerId)); }
// This provides a seam in the factory where I can prime the factory with the user it will then cough up. (for test code) public static void SetGuest(IGuest aGuest) { guest = aGuest; }
public IActionResult AddGuest([FromServices] IGuest guestService, GuestInfo guest) { guestService.AddGuest(guest); return(RedirectToAction("GuestList")); }
public Guest(IGuest data) : base(data, typeof(IGuest)) { LoadRoles(); }
public void AddGuest(IGuest guest) { _guests.Add(guest); }
public async Task RemoveGuest(IGuest guest) { await _GuestStore.RemoveGuest(guest); }
public static ArticleComment CreateArticleComment(int id, Guid uid, int articleId, IUser user, IGuest guest, string title, string content, DateTime date, int?parentId) { return(new ArticleComment { ArticleCommentId = id, ArticleCommentUid = uid, ArticleId = articleId, User = user, Guest = guest, Title = title, Content = content, Date = date, ParentCommentId = parentId }); }
public async Task AddGuest(IGuest guest, Guid?storerId = null) { await _GuestStore.AddGuest(guest, storerId); }
public WeatherForecastController(ILogger <WeatherForecastController> logger, IStringLocalizerFactory factory, IGuest guest) { _logger = logger; _localizer = factory.Create(typeof(SharedResource)); _guest = guest; }
public GuestController(IGuest guestService) { this.serviceGuest = guestService; }
public void addNewGuestToDB(IGuest theGuest) { try { DataSet ds = new DataSet(); string sql = "SELECT * From Guests"; SqlDataAdapter da = new SqlDataAdapter(sql, con); SqlCommandBuilder cb = new SqlCommandBuilder(da); //Generates da.Fill(ds, "GuestsData"); totUsers = ds.Tables["GuestsData"].Rows.Count; DataRow dRow = ds.Tables["GuestsData"].NewRow(); dRow[0] = theGuest.GuestId; dRow[1] = theGuest.FirstName; dRow[2] = theGuest.LastName; dRow[3] = theGuest.Address; dRow[4] = theGuest.Telephone; dRow[5] = theGuest.Dob; dRow[6] = theGuest.Email; dRow[7] = theGuest.Disability; dRow[8] = theGuest.Nationality; dRow[9] = null; dRow[10] = 0; ds.Tables["GuestsData"].Rows.Add(dRow); da.Update(ds, "GuestsData"); } catch (System.Exception excep) { if (con.State.ToString() == "Open") con.Close(); Application.Exit(); //Environment.Exit(0); //Force the application to close } }
public bool blackListGuest(IGuest guest) { try { ds = new DataSet(); string sql = "SELECT * From guests"; da = new SqlDataAdapter(sql, con); da.MissingSchemaAction = MissingSchemaAction.AddWithKey; cb = new SqlCommandBuilder(da); //Generates da.Fill(ds, "GuestData"); DataRow findRow = ds.Tables["GuestData"].Rows.Find(guest.GuestId); if (findRow != null) { findRow[10] = 1; } da.Update(ds, "GuestData"); //remove row from database table } catch (System.Exception excep) { MessageBox.Show(excep.Message); } return true; }
public Task RemoveGuest(IGuest guest) { return(_StorageProvider.RemoveGuest(guest)); }
public static void SetGuest(IGuest aGuest) { guest = aGuest; }