예제 #1
0
        private void LoadDepartments()
        {
            try
            {
                if (Settings.Default.TmpDbLocation == "")
                    return;

                var da = new DataAccess(Settings.Default.TmpDbLocation, Settings.Default.NetworkLocation);
                var deps = da.GetDepartments();
                foreach (var department in deps)
                {
                    cmbccFrom.Items.Add(new ComboBoxItemDepartment
                    {
                        ItemObject = department
                    });
                    cmbccTo.Items.Add(new ComboBoxItemDepartment
                    {
                        ItemObject = department
                    });
                }

                if (cmbccFrom.Items.Count > 0)
                    cmbccFrom.SelectedIndex = 0;

                if (cmbccTo.Items.Count > 0)
                    cmbccTo.SelectedIndex = cmbccTo.Items.Count - 1;
            }
            catch
            {
                //do nothing
            }
        }
예제 #2
0
        private void LoadCostCentres()
        {
            try
            {
                if (Settings.Default.TmpDbLocation == "")
                    return;

                var da = new DataAccess(Settings.Default.TmpDbLocation, Settings.Default.NetworkLocation);
                var cc = da.GetCostCentres();
                foreach (var costCentre in cc)
                {
                    cmbccFrom.Items.Add(new ComboBoxItemCostCentre
                    {
                        ItemObject = costCentre
                    });
                    cmbccTo.Items.Add(new ComboBoxItemCostCentre
                    {
                        ItemObject = costCentre
                    });
                }

                if (cmbccFrom.Items.Count > 0)
                    cmbccFrom.SelectedIndex = 0;

                if (cmbccTo.Items.Count > 0)
                    cmbccTo.SelectedIndex = cmbccTo.Items.Count - 1;
            }
            catch
            {
                //do nothing
            }
        }