Ejemplo n.º 1
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;
        }
Ejemplo n.º 2
0
        private void btnPurchase_Click(object sender, RoutedEventArgs e)
        {
            if (txtPurchase.Text == "")
            {
                MessageBox.Show("Invalid Input!");
                return;
            }

            PurchaseRequestController.getInstance().add((int)employee.DepartmentID, txtPurchase.Text);
            MessageBox.Show("Success request for purchase!");
            txtPurchase.Clear();
        }
        private void DoFundRequest(object sender, RoutedEventArgs e)
        {
            int id, money;

            Int32.TryParse(idText.Text, out id);
            Int32.TryParse(moneyText.Text, out money);
            PurchaseRequestController.DoFeedItemMoney(id, money);
            PurchaseRequestController.DoSetMoney(money);
            RequestFundPage fundRequestPage = new RequestFundPage();

            this.NavigationService.Navigate(fundRequestPage);
        }
Ejemplo n.º 4
0
        private int get(int fundID, dynamic fund)
        {
            List <PurchaseRequest> purchases = PurchaseRequestController.getInstance().getAll();

            foreach (PurchaseRequest p in purchases)
            {
                if (p.Status == "Sent" && p.Information == fund.Information)
                {
                    return(p.Id);
                }
            }

            return(0);
        }
Ejemplo n.º 5
0
        private void Search(object sender, RoutedEventArgs e)
        {
            int             id = Int32.Parse(idText.Text);
            PurchaseRequest purchaseRequest = PurchaseRequestController.SearchByID(id);

            if (purchaseRequest.PurchaseStatus.Equals("Waiting For Fund"))
            {
                AcceptButton.IsEnabled = true;
                RejectButton.IsEnabled = false;
            }
            else
            {
                RejectButton.IsEnabled = true;
                AcceptButton.IsEnabled = false;
            }
            NameLabel.Content = purchaseRequest.PurchaseID;
        }
        private dynamic getPurchaseList()
        {
            List <PurchaseRequest> reqs = PurchaseRequestController.getInstance().getAll();

            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
            });

            return(req_filtered);
        }
Ejemplo n.º 7
0
        private void DoBuyMaterial(object sender, RoutedEventArgs e)
        {
            int id;

            Int32.TryParse(idText.Text, out id);

            if (ConnectionController.GetInstance().HeaderFundRequests.Where(x => x.Id.Equals(id) && x.ResponseStatus.Equals("Approved")).FirstOrDefault() != null)
            {
                PurchaseRequestController.DoBuyMaterial(id);
                MessageBox.Show("Material Bought");
            }
            else
            {
                MessageBox.Show("Sorry, you can only buy approved material");
            }

            PurchaseHomePage purchaseHomePage = new PurchaseHomePage();

            this.NavigationService.Navigate(purchaseHomePage);
        }
Ejemplo n.º 8
0
        private void btnSend_Click(object sender, RoutedEventArgs e)
        {
            object id_obj = ((Button)sender).CommandParameter;
            int    id;

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

            var purchase = PurchaseRequestController.getInstance().find(id);
            int money    = 0;

            if (txtMoney.Text == "")
            {
                MessageBox.Show("Predicted money has to be inputted!");
                return;
            }

            int.TryParse(txtMoney.Text, out money);

            FundRequestController.getInstance().add((int)employee.DepartmentID, purchase.Information, money);
            PurchaseRequestController.getInstance().update(id);
            MessageBox.Show("Success send request fund!");

            load();
        }
Ejemplo n.º 9
0
 public RequestFundPage()
 {
     InitializeComponent();
     moneyPrice.Text = PurchaseRequestController.DoFeedMoney();
 }