Esempio n. 1
0
        public void UpdateIdea()
        {
            var ideaController = new IdeaController(_query);

            ideaController.UpdateIdea(SampleIdea);
            _query.ReceivedWithAnyArgs(1).UpdateItemAsync <Idea>(null);
        }
Esempio n. 2
0
        private void btnPropose_Click(object sender, RoutedEventArgs e)
        {
            bool   success     = false;
            string title       = txtTitle.Text;
            string information = txtInformation.Text;

            if (title == "" || information == "")
            {
                MessageBox.Show("Invalid Input!");
                reset();
                return;
            }

            success = IdeaController.getInstance().insert(title, information);
            if (success)
            {
                MessageBox.Show("Success propose the idea!");
            }

            else
            {
                MessageBox.Show("Error occured!");
            }

            load();
            reset();
        }
Esempio n. 3
0
        public void DeleteIdea()
        {
            var ideaController = new IdeaController(_query);

            ideaController.DeleteIdea("123abc");
            _query.ReceivedWithAnyArgs(1).DeleteItemAsync <Idea>(null);
        }
Esempio n. 4
0
        private void btnSend_Click(object sender, RoutedEventArgs e)
        {
            object id_obj = ((Button)sender).CommandParameter;
            int    id;

            int.TryParse(id_obj.ToString(), out id);


            if (IdeaController.getInstance().send(id) == 1)
            {
                MessageBox.Show("Success send to construction!");
            }

            else if (IdeaController.getInstance().send(id) == 0)
            {
                MessageBox.Show("The idea has been sent!");
            }

            else
            {
                MessageBox.Show("The idea must be accepted!");
            }


            load();
        }
Esempio n. 5
0
        public void GetIdea()
        {
            _query.GetItem <Idea>(SampleIdea.Id).Returns(SampleIdea);
            var ideaController = new IdeaController(_query);
            var result         = ideaController.GetIdea(SampleIdea.Id);

            Assert.Same(SampleIdea, result);
        }
Esempio n. 6
0
        public void CreateIdea()
        {
            _query.CreateItemAsync(SampleIdea).Returns(SampleIdea);
            var ideaController = new IdeaController(_query);
            var result         = ideaController.AddIdea(SampleIdea);

            Assert.Same(SampleIdea, result);
        }
Esempio n. 7
0
        public void load()
        {
            List <PurchaseRequest> reqs      = PurchaseRequestController.getInstance().getAll();
            List <Idea>            ideas     = IdeaController.getInstance().getAll();
            List <FundRequest>     funds     = FundRequestController.getInstance().getAll();
            List <Construction>    cons      = ConstructionController.getInstance().getAll();
            List <PersonalRequest> pers_reqs = PersonalRequestController.getInstance().getAll();

            var pers_status = pers_reqs.Where(p => p.EmployeeID == employee.Id && (p.Status == "Accepted" || p.Status == "Rejected"));

            var cons_status = cons.Where(c => c.Status == "In progress of constructing" || c.Status == "Finish constructing");

            var funds_status = funds.Where(p => (p.Status == "Accepted" || p.Status == "Rejected") &&
                                           p.DepartmentId == employee.DepartmentID);

            var idea_status = ideas.Where(i => i.Status == "Accepted" || i.Status == "Rejected");

            var req_status = reqs.Where(p => (p.Status == "Accepted" || p.Status == "Rejected") &&
                                        p.DepartmentId == employee.DepartmentID);

            var req_filtered = req_status.Select(p => new
            {
                p.Id,
                p.Information,
                p.Note,
                p.Status,
                p.Date
            });

            var cons_filtered = cons_status.Select(c => new
            {
                c.Id,
                title       = c.Idea.Tittle,
                information = c.Idea.Information,
                c.Status
            });

            var pers_filterd = pers_status.Select(p => new
            {
                p.Id,
                p.Title,
                p.Description,
                p.Date,
                p.Note,
                p.Status,
                p.Type
            });

            viewFund.ItemsSource     = funds_status;
            viewPurchase.ItemsSource = req_filtered;
            viewIdeas.ItemsSource    = idea_status;
            viewCons.ItemsSource     = cons_filtered;
            viewRA.ItemsSource       = AttractionRideController.getInstance().getAll();
            viewPers.ItemsSource     = pers_filterd;
        }
Esempio n. 8
0
        public void GetIdeas()
        {
            var SampleIdeas = new List <Idea> {
                SampleIdea
            };

            _query.GetItems <Idea>().Returns(SampleIdeas);
            var ideaController = new IdeaController(_query);
            var result         = ideaController.GetIdeas();

            Assert.Same(SampleIdeas, result);
        }
        private dynamic getIdeaList()
        {
            List <Idea> ideas = IdeaController.getInstance().getAll();

            var idea_status = ideas.Where(i => i.Status == "Pending");

            var idea_filtered = idea_status.Select(p => new
            {
                p.Id,
                p.Tittle,
                p.Information,
                p.Date,
            });

            return(idea_filtered);
        }
        private void btnRejIdea_Click(object sender, RoutedEventArgs e)
        {
            object id_obj = ((Button)sender).CommandParameter;
            int    id;

            int.TryParse(id_obj.ToString(), out id);


            MessageBoxResult messageBoxResult = System.Windows.MessageBox.Show("Are you sure?", "Reject Confirmation", System.Windows.MessageBoxButton.YesNo);

            if (txtNoteIdea.Text == "")
            {
                MessageBox.Show("Note must be inputted!");
                return;
            }

            if (messageBoxResult == MessageBoxResult.Yes)
            {
                IdeaController.getInstance().update(id, txtNoteIdea.Text, "Rejected");
                MessageBox.Show("Success rejected the Idea!");
            }
            txtNoteIdea.Clear();
            Load();
        }