//string reason;
 public FormRequestTrPrgmChg()
 {
     
     InitializeComponent();
     curr = (Customer)User.Instance.getCurrent();
     listTrainingPrograms = curr.getListTrainingPrograms();
     list = dbConnector.Instance.getTrainers();
     
 }
Пример #2
0
        private void buttonSearch_Click(object sender, EventArgs e)
        {

            if (!validateID()) { return; }

            customerObject = dbcObject.getCusomerById(Convert.ToInt32(textBoxID.Text));

            if (customerObject == null)
            {
                MessageBox.Show("No user with this id number");
                textBoxID.Text = "";
                return;
            }

            if (this.requetsType == "Add")
            {
                // Creat New Training Program with First Free workoutID
                long workoutID = customerObject.getListTrainingPrograms().Count;
                selectedTrp = new TrainingProgram(workoutID, new List<Exercise>());
                // Add The New (Empty) Traning Program To Customer
                customerObject.addTraningProgram(selectedTrp);
            }

            else
            { // Request type is Edit
                buttonSearch.Enabled = false;
                // Get Customers Existing Traning Programs
                listTrainingPrograms = customerObject.getListTrainingPrograms();
                foreach (TrainingProgram trp in listTrainingPrograms)
                {
                    comboBoxTraningPrograms.Items.Add(trp.getWorkoutID());
                }
            }
            // Show Panels
            panelEditExercise.Visible = true;
            panelMainDisplay.Visible = true;
        }