Esempio n. 1
0
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            GenericHelper          genericHelper  = new GenericHelper();
            ActivitySelectorHelper activityHelper = new ActivitySelectorHelper();

            if (activityHelper.TableExists("Region"))
            {
                regionTable = genericHelper.GetList("Region");
            }
            if (activityHelper.TableExists("Zonne"))
            {
                zoneTable = genericHelper.GetList("Zonne");
            }
            if (activityHelper.TableExists("Woreda"))
            {
                woredaTable = genericHelper.GetList("Woreda");
            }
            if (activityHelper.TableExists("Kebele"))
            {
                kebeleTable  = genericHelper.GetList("Kebele");
                kebeleTable2 = genericHelper.GetList("Kebele");
            }
            if (activityHelper.TableExists("Material"))
            {
                materialTable = genericHelper.GetList("Material");
            }
            if (activityHelper.TableExists("Unit"))
            {
                unitTable = genericHelper.GetList("Unit");
            }
        }
Esempio n. 2
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);
            }
        }