コード例 #1
0
        public TableViewModel()
        {
            bl = new BussinesLogic();
            //List<Ration> rations = bl.GetAllRations();
            //List<Order> orders = bl.GetAllOrders();
            Tables = new ObservableCollection <Table>();
            _PopulateTables(bl.GetAllTables().AsQueryable());


            Delete = new DeleteCommand(
                () => CanDelete,
                table =>
            {
                CurrentTable = null;
                _PopulateTables(bl.GetAllTables().AsQueryable());
            });

            DeleteRationCmd = new DelegateCommand(
                ration => CanDelete,
                ration =>
            {
                CurrentTable.RationList.Remove(CurrentRation);
                bl.Delete(CurrentRation);
                bl.Update(CurrentTable);
                CurrentRation = null;
                _PopulateTables(bl.GetAllTables().AsQueryable());
            });

            AddTableCmd = new DelegateCommand(
                ration =>
            {
                //CurrentOrder.RationList.Add(new Ration());
                //bl.Delete(CurrentRation);
                //bl.Update(CurrentOrder);
                Table newTable = new Table();
                bl.Insert(newTable);
                CurrentTable = newTable;
                _PopulateTables(bl.GetAllTables().AsQueryable());
            });

            AddRationCmd = new DelegateCommand(
                ration =>
            {
                CurrentTable.RationList.Add(new Ration()
                {
                    CreationDate = DateTime.Now
                });
                //bl.Delete(CurrentRation);
                bl.Update(CurrentTable);
                _PopulateTables(bl.GetAllTables().AsQueryable());
            });
        }
コード例 #2
0
        public CustomiseWindow()
        {
            InitializeComponent();
            bl = new BussinesLogic();

            activeTables           = bl.GetAllTables();
            products               = Enum.GetNames(typeof(RationType)).ToList <String>();
            cmbTable.ItemsSource   = activeTables;
            cmbProduct.ItemsSource = products;
        }
コード例 #3
0
        //public ObservableCollection<RationModel> allRations { get; set; }

        public KitchenViewModel()
        {
            bl      = new BussinesLogic();
            Rations = new ObservableCollection <RationModel>();
            //allRations = new ObservableCollection<RationModel>();

            ActiveTables = bl.GetAllTables();
            RationTaypes = Enum.GetNames(typeof(RationType)).ToList <String>();

            _PopulateRations(bl.GetAllRations‬‎().AsQueryable());

            DoneRationCmd = new DelegateCommand(
                ration => CanDeleteRation,
                ration =>
            {
                CurrentRation.the_r.Done = true;;
                bl.Update(CurrentRation.the_r);
                CurrentRation = null;
                _PopulateRations(bl.GetAllRations‬‎().AsQueryable());
            });
        }