Exemple #1
0
        private void btn_AddStep_Click(object sender, EventArgs e)
        {
            this.procedure.setName(txtBx_Title.Text);
            this.procedure.setDescription(txtBx_Description.Text);

            //steps[steps.Count - 1] is the previous step of the one which is about to be created.
            //The last step is previous of the one to create now.
            Etape prevStep;

            if (this.procedure.steps != null && this.procedure.steps.Count > 0)
            {
                prevStep = this.procedure.steps[this.procedure.steps.Count - 1];
            }
            else
            {
                prevStep = null;
            }

            //frm_AddStep frm = new frm_AddStep(prevStep, null, this.procedure, Operation.AddNew);
            //frm.ShowDialog();

            usrStep usr = new usrStep(this.pParent, this, prevStep, null, this.procedure, Operation.AddNew);

            usr.Location = new Point(5, 115);
            this.Hide();
            this.Parent.Controls.Add(usr);
        }
Exemple #2
0
        private void lstVew_Steps_DoubleClick(object sender, EventArgs e)
        {
            if (lstVew_Steps.SelectedIndices.Count > 0)
            {
                //Set the procedure data if its not already set.
                this.procedure.setName(txtBx_Title.Text);
                this.procedure.setDescription(txtBx_Description.Text);

                //Get the selected item (step) from the list.
                int          selected = lstVew_Steps.SelectedIndices[0];
                ListViewItem item     = lstVew_Steps.Items[selected];

                Etape step = null;

                //Gets the id of the selected Step.
                int id = Convert.ToInt32(item.SubItems[0].Text);

                //In the list of the procedure steps we look for the step with the previous Id.
                foreach (Etape stp in this.procedure.steps)
                {
                    if (stp.getId() == id)
                    {
                        step = stp;
                        break;
                    }
                }

                usrStep usr = new usrStep(this.pParent, this, null, step, this.procedure, Operation.Update);
                usr.Location = new Point(5, 115);
                this.Hide();
                this.Parent.Controls.Add(usr);
            }
            else
            {
                MessageBox.Show(this, "Sélectionner une étape SVP.", "Message d'erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void lstVew_Steps_DoubleClick(object sender, EventArgs e)
        {
            if (lstVew_Steps.SelectedIndices.Count > 0)
            {
                //Set the procedure data if its not already set.
                this.procedure.setName(txtBx_Title.Text);
                this.procedure.setDescription(txtBx_Description.Text);

                //Get the selected item (step) from the list.
                int selected = lstVew_Steps.SelectedIndices[0];
                ListViewItem item = lstVew_Steps.Items[selected];

                Etape step = null;

                //Gets the id of the selected Step.
                int id = Convert.ToInt32(item.SubItems[0].Text);

                //In the list of the procedure steps we look for the step with the previous Id.
                foreach (Etape stp in this.procedure.steps)
                {
                    if (stp.getId() == id)
                    {
                        step = stp;
                        break;
                    }
                }

                usrStep usr = new usrStep(this.pParent, this, null, step, this.procedure, Operation.Update);
                usr.Location = new Point(5, 115);
                this.Hide();
                this.Parent.Controls.Add(usr);

            }
            else
                MessageBox.Show(this, "Sélectionner une étape SVP.", "Message d'erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
        private void btn_ModifySetp_Click(object sender, EventArgs e)
        {
            if (lstVew_Steps.SelectedIndices.Count > 0)
            {
                //Set the procedure data if its not already set.
                this.procedure.setName(txtBx_Title.Text);
                this.procedure.setDescription(txtBx_Description.Text);

                //Get the selected item (step) from the list.
                int selected = lstVew_Steps.SelectedIndices[0];
                ListViewItem item = lstVew_Steps.Items[selected];

                //Etape step = new Etape(Convert.ToInt32(item.SubItems[0].Text), item.SubItems[1].Text, item.SubItems[2].Text, this.procedure);
                Etape step = null;

                //Gets the id of the selected Step.
                int id = Convert.ToInt32(item.SubItems[0].Text);
                //MessageBox.Show("SelectedStepId: " + id, "frm_AddProcedure.btn_ModifyStep");
                //In the list of the procedure steps we look for the step with the previous Id.
                foreach (Etape stp in this.procedure.steps)
                {
                    if (stp.getId() == id)
                    {
                        step = stp;
                        break;
                    }
                }

                //We send the slected step to the update form.
                //frm_AddStep frm = new frm_AddStep(null, step, this.procedure, Operation.Update);
                //frm.ShowDialog();

                usrStep usr = new usrStep(this.pParent, this, null, step, this.procedure, Operation.Update);
                usr.Location = new Point(5,115);
                this.Hide();
                this.Parent.Controls.Add(usr);

                //Add the created step to the steps list of the procedure.
                //if (frm.Tag != null)
                //{
                //    step = (Etape)frm.Tag;
                //    //Remove the old version of step.
                //    this.procedure.steps.RemoveAt(selected);

                //    //Insert the new version at the same place.
                //    this.procedure.steps.Insert(selected, step);

                //    //Fill the list view with the step's data.
                //    item = new ListViewItem(new string[] { step.getId().ToString(), step.getName(), step.getDescription() });

                //    //Remove the old version of step.
                //    lstVew_Steps.Items.RemoveAt(selected);
                //    //Insert the new version at the same place.
                //    lstVew_Steps.Items.Insert(selected, item);
                //}

            }
            else
                MessageBox.Show(this, "Sélectionner une étape SVP.", "Message d'erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
        private void btn_AddStep_Click(object sender, EventArgs e)
        {
            this.procedure.setName(txtBx_Title.Text);
            this.procedure.setDescription(txtBx_Description.Text);

            //steps[steps.Count - 1] is the previous step of the one which is about to be created.
            //The last step is previous of the one to create now.
            Etape prevStep;
            if (this.procedure.steps != null && this.procedure.steps.Count > 0)
                prevStep = this.procedure.steps[this.procedure.steps.Count - 1];
            else
                prevStep = null;

            //frm_AddStep frm = new frm_AddStep(prevStep, null, this.procedure, Operation.AddNew);
            //frm.ShowDialog();

            usrStep usr = new usrStep(this.pParent,this, prevStep, null, this.procedure, Operation.AddNew);
            usr.Location = new Point(5,115);
            this.Hide();
            this.Parent.Controls.Add(usr);
        }
Exemple #6
0
        private void btn_ModifySetp_Click(object sender, EventArgs e)
        {
            if (lstVew_Steps.SelectedIndices.Count > 0)
            {
                //Set the procedure data if its not already set.
                this.procedure.setName(txtBx_Title.Text);
                this.procedure.setDescription(txtBx_Description.Text);

                //Get the selected item (step) from the list.
                int          selected = lstVew_Steps.SelectedIndices[0];
                ListViewItem item     = lstVew_Steps.Items[selected];

                //Etape step = new Etape(Convert.ToInt32(item.SubItems[0].Text), item.SubItems[1].Text, item.SubItems[2].Text, this.procedure);
                Etape step = null;

                //Gets the id of the selected Step.
                int id = Convert.ToInt32(item.SubItems[0].Text);
                //MessageBox.Show("SelectedStepId: " + id, "frm_AddProcedure.btn_ModifyStep");
                //In the list of the procedure steps we look for the step with the previous Id.
                foreach (Etape stp in this.procedure.steps)
                {
                    if (stp.getId() == id)
                    {
                        step = stp;
                        break;
                    }
                }

                //We send the slected step to the update form.
                //frm_AddStep frm = new frm_AddStep(null, step, this.procedure, Operation.Update);
                //frm.ShowDialog();

                usrStep usr = new usrStep(this.pParent, this, null, step, this.procedure, Operation.Update);
                usr.Location = new Point(5, 115);
                this.Hide();
                this.Parent.Controls.Add(usr);

                //Add the created step to the steps list of the procedure.
                //if (frm.Tag != null)
                //{
                //    step = (Etape)frm.Tag;
                //    //Remove the old version of step.
                //    this.procedure.steps.RemoveAt(selected);

                //    //Insert the new version at the same place.
                //    this.procedure.steps.Insert(selected, step);

                //    //Fill the list view with the step's data.
                //    item = new ListViewItem(new string[] { step.getId().ToString(), step.getName(), step.getDescription() });

                //    //Remove the old version of step.
                //    lstVew_Steps.Items.RemoveAt(selected);
                //    //Insert the new version at the same place.
                //    lstVew_Steps.Items.Insert(selected, item);
                //}
            }
            else
            {
                MessageBox.Show(this, "Sélectionner une étape SVP.", "Message d'erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }