예제 #1
0
        //Runs DB class then proceeds to showing form
        private void showForm(Trainer trainer)
        {
            DialogResult = DialogResult.OK;
            Form trainerForm = new AderantFitBaseForm(trainer);

            trainerForm.Show();
            this.Hide();
            trainerForm.FormClosed += (senders, args) => this.Show();
        }
예제 #2
0
        /**
         *
         *
         * Section Below pertains to Buttons and their Functions
         *
         *
         * **/

        //Shows Schedule of Client or Details of a session
        private void BTNschedule_Click(object sender, EventArgs e)
        {
            if (formType == 1)
            {
                var result2 = listClients.Where(cl =>
                                                (cl.firstName + " " + cl.lastName) == LBdata.SelectedItem.ToString()).FirstOrDefault();

                if (result2 != null)
                {
                    Form clientForm = new AderantFitBaseForm(result2, this.trainer);
                    clientForm.Show();
                    this.Hide();
                    clientForm.FormClosed += (senders, args) => this.Show();
                    this.formRefresh();
                    //  this.LBLprofit.Text = (trainer.rate * client.sessCount).ToString();
                }
                else
                {
                    MessageBox.Show("No client selected! Please add or select one", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }

            if (formType == 2)
            {
                if (LBdata.SelectedItem != null)
                {
                    string details     = "Workout Details: \n";
                    int    selection   = LBdata.SelectedIndex + 1;
                    var    selSessions = from session in listSessions
                                         where session.session_num == selection
                                         select new { workoutName = session.workoutName, numReps = session.numReps, numSets = session.numSets, exerciseWeight = session.exerciseWeight };
                    int i = 0;
                    foreach (var item in selSessions)
                    {
                        if (i == 0)
                        {
                            details = details + "\n" + "Workout Name" + "\tReps" + "\tSets" + "\tWeight\n";
                            details = details + "  " + item.workoutName + "\t" + item.numReps + "\t" + item.numSets + "\t" + item.exerciseWeight + "\n";
                            i       = i + 1;
                        }
                        else
                        {
                            details = details + "  " + item.workoutName + "\t" + item.numReps + "\t" + item.numSets + "\t" + item.exerciseWeight + "\n";
                        }
                    }

                    MessageBox.Show(details, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
예제 #3
0
        /**
         *
         *
         * Section Below pertains to functions being utilized by another action/activity
         *
         *
         * **/

        //Function to expand details
        private void LBdata_DoubleClick(object sender, EventArgs e)
        {
            if (LBdata.SelectedItem != null)
            {
                if (formType == 1)
                {
                    Client result = listClients.Find(
                        delegate(Client cl)
                    {
                        return(cl.firstName + " " + cl.lastName == LBdata.SelectedItem.ToString());
                    }
                        );

                    Form clientForm = new AderantFitBaseForm(result, trainer);
                    clientForm.Show();
                    this.Hide();
                    clientForm.FormClosed += (senders, args) => this.Show();
                }
                if (formType == 2)
                {
                    string details     = "Workout Details: \n";
                    int    selection   = LBdata.SelectedIndex + 1;
                    var    selSessions = from session in listSessions
                                         where session.session_num == selection
                                         select new { workoutName = session.workoutName, numReps = session.numReps, numSets = session.numSets, exerciseWeight = session.exerciseWeight };
                    int i = 0;
                    foreach (var item in selSessions)
                    {
                        if (i == 0)
                        {
                            details = details + "Workout Name" + "\tReps" + "\tSets" + "\tWeight\n";
                            details = details + "  " + item.workoutName + "\t" + item.numReps + "\t" + item.numSets + "\t" + item.exerciseWeight + "\n";
                            i       = i + 1;
                        }
                        else
                        {
                            details = details + "  " + item.workoutName + "\t" + item.numReps + "\t" + item.numSets + "\t" + item.exerciseWeight + "\n";
                        }
                    }

                    MessageBox.Show(details, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }