public void TestCleanup() { if (order1 != null) dataWipe.WipeOrder(order1.Id); if (managerContext1 != null) dataWipe.WipeUser(managerContext1.Id); if (clientContext1 != null) dataWipe.WipeUser(clientContext1.Id); if (waiterContext1 != null) dataWipe.WipeUser(waiterContext1.Id); if (waiterContext2 != null) dataWipe.WipeUser(waiterContext2.Id); if (menuItem1 != null) dataWipe.WipeMenuItem(menuItem1.Id); if (menuItem2 != null) dataWipe.WipeMenuItem(menuItem2.Id); if (menuItem3 != null) dataWipe.WipeMenuItem(menuItem3.Id); if (category1 != null) dataWipe.WipeMenuItemCategory(category1.Id); if (table1 != null) dataWipe.WipeTable(table1.Id); order1 = null; managerContext1 = null; waiterContext1 = null; waiterContext2 = null; clientContext1 = null; category1 = null; menuItem1 = null; menuItem2 = null; menuItem3 = null; table1 = null; }
public bool EditTable(int managerId, Table tableToEdit) { if (!CheckHasUserRole(managerId, UserRole.Manager)) throw new SecurityException(String.Format("User id = {0} is not logged in or is no manager", managerId)); if (tableToEdit == null) throw new ArgumentNullException("tableToEdit is null"); using(var db = new DataAccessProvider()) { TableEntity editedTableEntity = db.Tables.Find(tableToEdit.Id); if (editedTableEntity == null || editedTableEntity.IsDeleted) return false; //db.Entry(editedTableEntity).State = System.Data.Entity.EntityState.Detached; //db.Tables.Attach(tableToEdit); //db.Entry(tableToEdit).State = System.Data.Entity.EntityState.Modified; editedTableEntity.CopyData(tableToEdit); db.Entry(editedTableEntity).State = EntityState.Modified; db.SaveChanges(); return true; } }
public void AddNewTableTest() { ManagerLogInTest(); table1 = managerDataAccess.AddTable(managerContext1.Id, tableNumber1, tableDescription1); Assert.IsNotNull(table1); Assert.AreNotEqual(table1.Id, 0); Assert.AreEqual(table1.Number, tableNumber1); Assert.AreEqual(table1.Description, tableDescription1); ManagerLogOutTest(); }
/// <summary> /// Konstruktor kopiujący /// </summary> /// <param name="tableToCopy">Stolik do skopiowania</param> public Table(Table tableToCopy) : base(tableToCopy) { if(tableToCopy == null) throw new ArgumentNullException("tableToCopy"); Number = tableToCopy.Number; Description = tableToCopy.Description; }
/// <summary> /// Konstruktor kopiujący /// </summary> /// <param name="orderToCopy">Zamówienie do skopiowania</param> public Order(Order orderToCopy) : base(orderToCopy) { if(orderToCopy == null) throw new ArgumentNullException("orderToCopy"); Client = new UserContext(orderToCopy.Client); if (orderToCopy.Waiter != null) Waiter = new UserContext(orderToCopy.Waiter); if (orderToCopy.Table != null) Table = new Table(orderToCopy.Table); if (orderToCopy.MenuItems != null) { MenuItems = new List<MenuItemQuantity>(); foreach (var menuItemQuant in orderToCopy.MenuItems) MenuItems.Add(new MenuItemQuantity(menuItemQuant)); } State = orderToCopy.State; PlacingDate = orderToCopy.PlacingDate; ClosingDate = orderToCopy.ClosingDate; }
public Order(OrderEntity order) : base(order) { Client = new UserContext(order.Client); if (order.Waiter != null) Waiter = new UserContext(order.Waiter); if (order.Table != null) Table = new Table(order.Table); if (order.MenuItems != null) { MenuItems = new List<MenuItemQuantity>(); foreach (var menuItemQuant in order.MenuItems) MenuItems.Add(new MenuItemQuantity(menuItemQuant)); } State = order.State; PlacingDate = order.PlacingDate; ClosingDate = order.ClosingDate; }
public bool EditTable(int managerId, Table tableToEdit) { return EditTable(managerId, tableToEdit); }