Exemplo n.º 1
0
        private void PopulateFields(int activityId)
        {
            Activity0Helper helper    = new Activity0Helper();
            Activity0       activity0 = helper.GetActivityData(3, activityId);
            Activity3       activity  = (Activity3)activity0;


            if (activity != null)
            {
                comboBox1.Text        = activity.Region;
                comboBox2.Text        = activity.Zone;
                textBox1.Text         = activity.Trainingtitle;
                textBox2.Text         = activity.Trainingfacilitator;
                comboBox3.Text        = activity.Woreda;
                dateTimePicker1.Value = activity.ActivityDate;
                textBox3.Text         = activity.IssuesRaised;
                textBox4.Text         = activity.AgreedActionPoints;
                textBox7.Text         = activity.FacilitatorName;
                textBox6.Text         = activity.Position;
            }
            List <Participant> participantsList = helper.GetParticpantData(3, activityId);

            for (int i = 0; i < participantsList.Count; i++)
            {
                Participant  participant0 = participantsList[i];
                Participant3 participant  = (Participant3)participant0;

                string[] row = { dataGridView2.RowCount + "", participant.Name, participant.Sex, participant.Organization, participant.Position, participant.Woreda, participant.Kebele };
                dataGridView2.Rows.Add(row);
            }
        }
Exemplo n.º 2
0
    static void Main()
    {
        var activity1 = new Activity1();
        var activity2 = new Activity2();
        var activity3 = new Activity3();

        WorkflowEngine.Run(activity1, activity2, activity3);
    }
Exemplo n.º 3
0
        public void VullenVanInArgumentsVanuitCode1()
        {
            var activity = new Activity3
            {
                Input = new Course
                {
                    Id = 1
                }
            };

            var invoker = new WorkflowInvoker(activity);

            var output = invoker.Invoke();
        }
Exemplo n.º 4
0
        public void VullenVanInArgumentsVanuitCode2()
        {
            var activity = new Activity3
            {
                Input = new CSharpValue<Course>(@"new Course
                {
                    Id = 1
                }")
            };

            var invoker = new WorkflowInvoker(activity);

            var output = invoker.Invoke();
        }
Exemplo n.º 5
0
        public void VullenVanInArgumentsVanuitCode3()
        {
            var activity = new Activity3();
            var invoker = new WorkflowInvoker(activity);
            var arguments = new Dictionary<string, object>
            {
                { "Input", new Course { Id = 1 } }
            };

            var output = invoker.Invoke(arguments);
        }
Exemplo n.º 6
0
        private void SaveData(int saveOrUpdate)
        {
            //mainFieldsValid();
            if (mainFieldsValid())
            {
                //MessageBox.Show("All fields valid. Ready to submit data to database.");
                Activity0Helper helper   = new Activity0Helper();
                Activity3       activity = new Activity3();
                //(region, zone, woreda, kebele, activity_date, user_id, facilitator_name, position, localtimestamp, mac)
                activity.Region              = comboBox1.Text;
                activity.Zone                = comboBox2.Text;
                activity.Woreda              = comboBox3.Text;
                activity.Trainingtitle       = textBox1.Text;
                activity.Trainingfacilitator = textBox2.Text;
                activity.ActivityDate        = dateTimePicker1.Value;
                activity.UserId              = Properties.Settings.Default.UID; //change this using property stored id of currently logged in user
                activity.FacilitatorName     = textBox7.Text;                   //make name of logged in user available in this field
                activity.Position            = textBox6.Text;
                activity.LocalTimeStamp      = DateTime.Now;
                activity.Mac = StringCipher.GetMacAddress();

                activity.IssuesRaised       = textBox3.Text;
                activity.AgreedActionPoints = textBox4.Text;


                List <Participant> participantsList = new List <Participant>();
                if (dataGridView2.RowCount > 1)
                {
                    for (int i = 0; i < dataGridView2.Rows.Count - 1; i++)//-1 to avoid empty row
                    {
                        Participant3 participant = new Participant3();
                        if (dataGridView2.Rows[i].Cells[1].Value != null)
                        {
                            participant.Name = dataGridView2.Rows[i].Cells[1].Value.ToString();
                        }
                        if (dataGridView2.Rows[i].Cells[2].Value != null)
                        {
                            participant.Sex = dataGridView2.Rows[i].Cells[2].Value.ToString();
                        }
                        if (dataGridView2.Rows[i].Cells[3].Value != null)
                        {
                            participant.Organization = dataGridView2.Rows[i].Cells[3].Value.ToString();
                        }
                        if (dataGridView2.Rows[i].Cells[4].Value != null)
                        {
                            participant.Position = dataGridView2.Rows[i].Cells[4].Value.ToString();
                        }
                        if (dataGridView2.Rows[i].Cells[5].Value != null)
                        {
                            participant.Woreda = dataGridView2.Rows[i].Cells[5].Value.ToString();
                        }
                        if (dataGridView2.Rows[i].Cells[6].Value != null)
                        {
                            participant.Kebele = dataGridView2.Rows[i].Cells[6].Value.ToString();
                        }


                        participantsList.Add(participant);
                    }
                }
                //MessageBox.Show(activity.Position);
                int id = helper.Insert(3, activity, participantsList);

                if (id > 0)
                {
                    InsertRegionAndKebeleData();
                    //MessageBox.Show("Activity data added successfully!");
                    MessageBox.Show("Activity data added successfully!", "Successfully Addition", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    //check internet connection before syncing data
                    if (saveOrUpdate == 1)//update button clicked
                    {
                        //if (StringCipher.CheckInternet("http://" + Session.Properties.Settings.Default.RemoteDatabaseAddress))
                        SyncData();
                    }
                    //this.Close(); //or Reset fields

                    this.Close();
                }
            }
        }