Example #1
0
        public void add(int attr_rideID, string information)
        {
            Maintenence m = MaintenenceFactory.create(attr_rideID, information);

            AttractionRideController.getInstance().updtMaintenence(attr_rideID);
            MaintenenceRepository.add(m);
        }
Example #2
0
        private void btnRemove_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?", "Delete Confirmation", System.Windows.MessageBoxButton.YesNo);

            if (messageBoxResult == MessageBoxResult.Yes)
            {
                if (AttractionRideController.getInstance().remove(id))
                {
                    MessageBox.Show("Success remove the data!");
                }
                else
                {
                    MessageBox.Show("Only active attraction or ride that can be removed!");
                }
            }



            load();
        }
Example #3
0
        private void btnAddRA_Click(object sender, RoutedEventArgs e)
        {
            if (txtRAName.Text == "" || txtRADescription.Text == "")
            {
                MessageBox.Show("Invalid Input!");
                reset();
                return;
            }

            if (btnRide.IsChecked == true)
            {
                AttractionRideController.getInstance().add(txtRAName.Text, txtRADescription.Text, "Ride");
                MessageBox.Show("Success add new ride!");
            }


            else
            {
                AttractionRideController.getInstance().add(txtRAName.Text, txtRADescription.Text, "Attraction");
                MessageBox.Show("Success add new attraction!");
            }

            reset();
            load();
        }
        private void btnSubmit_Click(object sender, RoutedEventArgs e)
        {
            if (txtName.Text == "" || txtDesc.Text == "")
            {
                MessageBox.Show("Invalid Input!");
                reset();
                return;
            }

            else
            {
                if (AttractionRideController.getInstance().update(id, txtName.Text, txtDesc.Text))
                {
                    MessageBox.Show("Success update data!");
                }

                else
                {
                    MessageBox.Show("Only active attraction or ride that can be updated!");
                }

                reset();
                Close();
            }
        }
        private void load()
        {
            List <AttractionRide> attr_ride = AttractionRideController.getInstance().getAll();
            var obj = attr_ride.Select(a => a.Name);

            txtName.Text = "Good to see you back, " + employee.Name + "!";
            cbMaintenence.ItemsSource   = obj;
            viewMaintenence.ItemsSource = getMaintenencesList();
            viewPers.ItemsSource        = getPersList();
        }
Example #6
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;
        }
Example #7
0
        private void btnUpdate_Click(object sender, RoutedEventArgs e)
        {
            object id_obj = ((Button)sender).CommandParameter;
            int    id;

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


            AttractionRideController.getInstance().viewUpdate(id).Show();
            load();
        }
        private int getAttr_rideID(string attr_ride_name)
        {
            int id = 0;

            List <AttractionRide> lists = AttractionRideController.getInstance().getAll();

            foreach (AttractionRide a in lists)
            {
                if (a.Name == attr_ride_name)
                {
                    id = a.Id;
                    break;
                }
            }
            return((checkID(id)) ? id : 0);
        }
Example #9
0
 public void remove(int id, int attr_ride)
 {
     MaintenenceRepository.remove(id);
     AttractionRideController.getInstance().updtMaintenence(attr_ride);
 }