Пример #1
0
        private void PopulateFields(int activityId)
        {
            Activity0Helper helper    = new Activity0Helper();
            Activity0       activity0 = helper.GetActivityData(4, activityId);
            Activity4       activity  = (Activity4)activity0;


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

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

                string[] row = { dataGridView2.RowCount + "", participant.Name, participant.Role, participant.Kebele, participant.Sex, participant.Age.ToString() };
                dataGridView2.Rows.Add(row);
            }
        }
Пример #2
0
        private void PopulateFields(int activityId)
        {
            Activity0Helper helper    = new Activity0Helper();
            Activity0       activity0 = helper.GetActivityData(ACTIVITY_TYPE, activityId);
            Activity9       activity  = (Activity9)activity0;


            if (activity != null)
            {
                comboBox1.Text        = activity.Region;
                comboBox2.Text        = activity.Zone;
                comboBox3.Text        = activity.Woreda;
                comboBox5.Text        = activity.Kebele;
                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(ACTIVITY_TYPE, activityId);

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

                string[] row = { dataGridView2.RowCount + "", participant.Name, participant.Kebele, GetStringFromInt(participant.Disabled), participant.Noofadolescent.ToString(), participant.Noofwomen.ToString(), participant.Typeofmaterial, participant.Unit, participant.Quantity.ToString() };
                dataGridView2.Rows.Add(row);
            }
        }
Пример #3
0
        private int GetRowCount(int activityIndex, int year)
        {
            int       rowCounter      = 0;
            string    tableName       = "activity" + activityIndex;
            Activity0 currentActivity = null;

            if (TableExists(tableName))
            {
                User user = null;
                connection = new OleDbConnection(Properties.Settings.Default.DatabaseAddress);
                command    = connection.CreateCommand();

                command.CommandText = "SELECT * FROM " + tableName;
                connection.Open();

                OleDbDataReader dr = command.ExecuteReader();
                while (dr.Read())
                {
                    currentActivity = new Activity0();
                    currentActivity.ActivityDate = dr.GetDateTime(5);
                    int currentYear = currentActivity.ActivityDate.Year;
                    if (currentYear == year)
                    {
                        rowCounter += 1;
                    }
                }
                connection.Close();
                dr.Close();
                return(rowCounter);
            }
            else
            {
                return(0);
            }
        }
Пример #4
0
        private bool IsOfYear(int activityIndex, int activityId, int year)
        {
            string    tableName       = "activity" + activityIndex;
            bool      isOfYear        = false;
            Activity0 currentActivity = null;

            if (TableExists(tableName))
            {
                int totalNumber = 0;
                connection = new OleDbConnection(Properties.Settings.Default.DatabaseAddress);
                command    = connection.CreateCommand();

                command.CommandText = "SELECT * FROM " + tableName + " WHERE [ID]=" + activityId;
                connection.Open();

                OleDbDataReader dr = command.ExecuteReader();
                while (dr.Read())
                {
                    currentActivity = new Activity0();
                    currentActivity.ActivityDate = dr.GetDateTime(5);
                    int currentYear = currentActivity.ActivityDate.Year;
                    if (currentYear == year)
                    {
                        isOfYear = true;
                    }
                }
                connection.Close();
                dr.Close();
                return(isOfYear);
            }
            else
            {
                return(isOfYear);
            }
        }
Пример #5
0
        private void PopulateFields(int activityId)
        {
            Activity0Helper helper    = new Activity0Helper();
            Activity0       activity0 = helper.GetActivityData(ACTIVITY_TYPE, activityId);
            Activity7       activity  = (Activity7)activity0;


            if (activity != null)
            {
                comboBox1.Text        = activity.Region;
                comboBox2.Text        = activity.Zone;
                comboBox3.Text        = activity.Woreda;
                comboBox5.Text        = activity.Kebele;
                dateTimePicker1.Value = activity.ActivityDate;
                numericUpDown2.Value  = activity.Totalnumberofmembers;
                textBox3.Text         = activity.IssuesRaised;
                textBox4.Text         = activity.AgreedActionPoints;
                textBox7.Text         = activity.FacilitatorName;
                textBox6.Text         = activity.Position;
            }
            List <Participant> participantsList = helper.GetParticpantData(ACTIVITY_TYPE, activityId);

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

                string[] row = { dataGridView2.RowCount + "", participant.Groupname, GetStringFromInt(participant.Disabled), participant.Kebele, participant.Noofadolescent.ToString(), participant.Noofadolescent.ToString(), participant.Typeoftraining, participant.Capital, participant.Typeofiga, participant.Statusofiga, participant.Amountofsaving, participant.Remark };
                dataGridView2.Rows.Add(row);
            }
        }
Пример #6
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);
            }
        }
Пример #7
0
        private void PopulateFields(int activityId)
        {
            Activity0Helper helper    = new Activity0Helper();
            Activity0       activity0 = helper.GetActivityData(ACTIVITY_TYPE, activityId);
            Activity8       activity  = (Activity8)activity0;


            if (activity != null)
            {
                comboBox1.Text = activity.Region;
                comboBox2.Text = activity.Zone;
                comboBox3.Text = activity.Woreda;
                textBox11.Text = activity.Schoolname;
                DateTime newDateTime = new DateTime(Convert.ToInt32(activity.Year), 1, 1);
                dateTimePicker1.Value = newDateTime;
                dateTimePicker2.Value = activity.ActivityDate;
                textBox3.Text         = activity.IssuesRaised;
                textBox4.Text         = activity.AgreedActionPoints;
                textBox7.Text         = activity.FacilitatorName;
                textBox6.Text         = activity.Position;
            }
            List <Participant> participantsList = helper.GetParticpantData(ACTIVITY_TYPE, activityId);

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

                string[] row = { dataGridView2.RowCount + "", participant.Name, participant.Age.ToString(), GetStringFromInt(participant.Disabled), participant.Gradelevel, participant.Statusofretention, participant.Remark };
                dataGridView2.Rows.Add(row);
            }
        }
Пример #8
0
        public List <Activity0> GetActivityListByPartner(string tableName, string organization, string partner)
        {
            List <Activity0> activityList = new List <Activity0>();

            try
            {
                command.CommandText = "SELECT * FROM " + tableName + " WHERE [sync_status]=1";
                command.CommandType = CommandType.Text;
                connection.Open();

                OleDbDataReader reader = command.ExecuteReader();
                while (reader.Read())
                {
                    Activity0 activity = new Activity0();
                    activity.Aid          = Convert.ToInt32(reader["ID"].ToString());
                    activity.Region       = reader["region"].ToString();
                    activity.Zone         = reader["zone"].ToString();
                    activity.Woreda       = reader["woreda"].ToString();
                    activity.Kebele       = reader["kebele"].ToString();
                    activity.ActivityDate = reader.GetDateTime(5);
                    activity.UserId       = Convert.ToInt32(reader["user_id"].ToString());
                    activity.RemoteId     = Convert.ToInt32(reader["remoteid"].ToString());

                    UserHelper userHelper = new UserHelper();
                    if (userHelper.IsUserOfOrganization(activity.UserId, organization, partner))
                    {
                        activityList.Add(activity);
                    }
                }
                return(activityList);
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (connection != null)
                {
                    connection.Close();
                }
            }
        }
Пример #9
0
        private void PopulateFields(int activityId)
        {
            Activity0Helper helper    = new Activity0Helper();
            Activity0       activity0 = helper.GetActivityData(2, activityId);
            Activity2       activity  = (Activity2)activity0;


            if (activity != null)
            {
                comboBox1.Text        = activity.Region;
                comboBox2.Text        = activity.Zone;
                textBox1.Text         = activity.Schoolname;
                textBox2.Text         = activity.Clubname;
                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(2, activityId);

            for (int i = 0; i < participantsList.Count; i++)
            {
                Participant  participant0 = participantsList[i];
                Participant2 participant  = (Participant2)participant0;
                string       disabled     = "No";
                if (participant.Disabled == 0)
                {
                    disabled = "No";
                }
                else
                {
                    disabled = "Yes";
                }
                string[] row = { dataGridView2.RowCount + "", participant.Name, participant.Gradelevel, participant.Sex, participant.Age.ToString(), disabled };
                dataGridView2.Rows.Add(row);
            }
        }
Пример #10
0
        private void PopulateComboBox(int index)
        {
            ActivitySelectorHelper activitySelectorHelper = new ActivitySelectorHelper();

            tableExists = activitySelectorHelper.TableExists(tableNames[index]);
            if (tableExists)
            {
                //EnableFields(true);
                //MessageBox.Show(Properties.Settings.Default.USERORGANIZATION + " : " + Properties.Settings.Default.USERPARTNER);
                List <string>  activityAsString = new List <string>();
                ActivityHelper activityHelper   = new ActivityHelper();
                activity0List = activityHelper.GetActivityListByPartner(tableNames[index], Properties.Settings.Default.USERORGANIZATION, Properties.Settings.Default.USERPARTNER);
                if (activity0List != null)
                {
                    if (activity0List.Count > 0)
                    {
                        EnableFields(true);
                        for (int i = 0; i < activity0List.Count; i++)
                        {
                            Activity0 activity       = activity0List[i];
                            string    activityString = "[Activity " + index + " ~ ID: " + activity.RemoteId + "] ~ On " + activity.ActivityDate + ": " + activity.Region + ", " + activity.Zone + ", " + activity.Woreda + ", " + activity.Kebele;
                            activityAsString.Add(activityString);
                            activityIds.Add(activity.RemoteId);
                        }
                        comboBox2.DataSource = activityAsString;
                    }
                    else
                    {
                        EnableFields(false);
                    }
                }
            }
            else
            {
                MessageBox.Show("Table does not exist!");
                EnableFields(false);
            }
        }
Пример #11
0
        private void PopulateFields(int activityId)
        {
            Activity0Helper helper    = new Activity0Helper();
            Activity0       activity0 = helper.GetActivityData(ACTIVITY_TYPE, activityId);
            Activity5       activity  = (Activity5)activity0;


            if (activity != null)
            {
                comboBox1.Text = activity.Region;
                comboBox2.Text = activity.Zone;
                comboBox3.Text = activity.Woreda;
                comboBox5.Text = activity.Kebele;
                DateTime newDateTime = new DateTime(Convert.ToInt32(activity.Year), 1, 1);
                dateTimePicker1.Value = Convert.ToDateTime(newDateTime);
                dateTimePicker4.Value = activity.ActivityDate;
                textBox3.Text         = activity.IssuesRaised;
                textBox4.Text         = activity.AgreedActionPoints;
                textBox7.Text         = activity.FacilitatorName;
                textBox6.Text         = activity.Position;
            }
            List <Participant> participantsList = helper.GetParticpantData(ACTIVITY_TYPE, activityId);

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

                string[] row = { dataGridView2.RowCount + "", participant.Pdate.ToString(), participant.Code, participant.Town, participant.Age.ToString(), GetStringFromInt(participant.Disabled), participant.Dateofvisit.ToString(), participant.Identifiedcase, participant.Others };
                dataGridView2.Rows.Add(row);
                dataGridView2.Rows[dataGridView2.RowCount - 2].Cells[9].Value  = GetBoolFromInt(participant.Referralhealth);
                dataGridView2.Rows[dataGridView2.RowCount - 2].Cells[10].Value = GetBoolFromInt(participant.Referralpolice);
                dataGridView2.Rows[dataGridView2.RowCount - 2].Cells[11].Value = GetBoolFromInt(participant.Referrallegal);
                dataGridView2.Rows[dataGridView2.RowCount - 2].Cells[12].Value = GetBoolFromInt(participant.Referralpsycho);
            }
        }