Пример #1
0
        async Task ExecuteLoadDeptsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Departments.Clear();
                var items = await DataStore.Departments.ToListAsync();

                foreach (var item in items)
                {
                    Departments.Add(item);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Пример #2
0
        public static void RefreshUser()
        {
            if (Securities != null)
            {
                Securities.Clear();
            }
            if (Users != null)
            {
                Users.Clear();
            }
            if (Accounts != null)
            {
                Accounts.Clear();
            }
            if (Blocs != null)
            {
                Blocs.Clear();
            }
            if (Corporations != null)
            {
                Corporations.Clear();
            }
            if (Departments != null)
            {
                Departments.Clear();
            }
            if (Employees != null)
            {
                Employees.Clear();
            }

            User.MenuProvider.RefreshMenus();
        }
Пример #3
0
        public void Inital()
        {
            Departments.Clear();
            using (var db = new DataModel())
            {
                tempPersons = new List <Person>();
                var tempdeps = db.Departments.ToList();
                tempdeps.ForEach(d => Departments.Add(d));
                //people中有外键相连的Departments属性,好像一定要通过Departments = db.Departments.ToList()一下 生成的list中才会生成Departments属性,好奇怪
                tempPersons     = db.Persons.OrderBy(p => p.DepId).ToList();
                Operators       = db.Accountants.Select(p => p.Person.PersonName).ToList();                                       //查询报销操作人员的姓名到List
                AccountantsName = db.Persons.Where(p => p.Department.DepartmentName == "财务部").Select(p => p.PersonName).ToList(); //查询财务部人员的姓名到List
                Persons.Clear();
                tempPersons.ForEach(p => Persons.Add(p));                                                                         //list 转 obserbableColletion
            }
            Department temp = new Department()
            {
                DepartmentId = 0, DepartmentName = ""
            };

            Departments.Insert(0, temp);
            StaffOperateMode         = "浏览模式";
            BtnStaffAppendEna        = true;
            BtnStaffModifyEna        = true;
            BtnStaffCancelConfirmEna = false;
            ComStaffDepartmentEna    = false;
            TextStaffEna             = false;
        }
        private async void Refresh()
        {
            try
            {
                IsRefreshing = true;

                Departments?.Clear();

                await _db.CreateTableAsync <Department>();

                if (await _db.Table <Department>().CountAsync() == 0)
                {
                    // Seed
                    for (int i = 0; i < 100; i++)
                    {
                        await _db.InsertAsync(new Department()
                        {
                            Name = $"Department {i}"
                        });
                    }
                }

                await Task.Delay(2000);

                var d = await _db.Table <Department>().ToArrayAsync();

                Departments = new ObservableCollection <Department>(d);
            }
            finally
            {
                IsRefreshing = false;
            }
        }
Пример #5
0
 void Instance_UserDataLoadComplete(object sender, EventArgs e)
 {
     CompanyName = CompanyEditedName = PersonalHandler.Instance.CompanyName;
     Departments.Clear();
     foreach (var item in PersonalHandler.Instance.Model.Departments)
     {
         Departments.Add(item);
     }
 }
Пример #6
0
        private void LoadDepartmentsForCustomer(int customerId)
        {
            CustomerDto customer = Customers.Where(c => c.CustomerID == customerId).SingleOrDefault();

            Departments.Clear();
            foreach (var item in customer.DepartmentsCollection)
            {
                Departments.Add(item);
            }
        }
Пример #7
0
        private async Task LoadDepartmentLookupAsync()
        {
            Departments.Clear();
            Departments.Add(new NullLookupItem {
                DisplayMember = " - "
            });
            var lookup = await _employeeTypeLookupDataService.GetDepartmentLookupAsync();

            foreach (var lookupItem in lookup)
            {
                Departments.Add(lookupItem);
            }
        }
        public async Task OnSearchDepartment()
        {
            if (String.IsNullOrEmpty(DepartmentSearch) || String.IsNullOrWhiteSpace(DepartmentSearch))
            {
                await _confirmationDialogHelper.ErrorWindowShow("Veuillez remplir le champ de recherche.");
            }
            else
            {
                Departments.Clear();
                if (firstNameOrLastName.IsMatch(DepartmentSearch))
                {
                    for (int i = 0; i < GetDepartments.Count; i++)
                    {
                        if (GetDepartments[i].Code.ToLower().Contains(DepartmentSearch.ToLower()))
                        {
                            Departments.Add(GetDepartments[i]);
                        }
                        else if (GetDepartments[i].Name.ToLower().Contains(DepartmentSearch.ToLower()))
                        {
                            Departments.Add(GetDepartments[i]);
                        }
                    }
                }
                else if (fullNameRx.IsMatch(DepartmentSearch))
                {
                    var word      = DepartmentSearch.Split(' ');
                    var countWord = word.Length;

                    foreach (var depart in GetDepartments)
                    {
                        int i        = 0;
                        var fullname = depart.Name;
                        do
                        {
                            if (fullname.ToLower().Contains((word[i]).ToLower()))
                            {
                                if (i == countWord - 1)
                                {
                                    Departments.Add(depart);
                                }
                                i++;
                            }
                            else
                            {
                                break;
                            }
                        } while (i < countWord);
                    }
                }
            }
        }
 private void ReloadDepartments(List <Department> departments)
 {
     Departments.Clear();
     foreach (var department in departments.OrderBy(d => d.Name))
     {
         Departments.Add(new DepartmentItemViewModel
         {
             Cities       = department.Cities,
             Customers    = department.Customers,
             DepartmentId = department.DepartmentId,
             Name         = department.Name,
         });
     }
 }
Пример #10
0
        private void ReloadDepartment(List <Department> departaments)
        {
            Departments.Clear();

            departaments = departaments.OrderBy(x => x.Name).ToList();

            foreach (var department in departaments)
            {
                Departments.Add(new DepartmentItemViewModel()
                {
                    Cities       = department.Cities,
                    Customers    = department.Customers,
                    DepartmentId = department.DepartmentId,
                    Name         = department.Name
                });
            }
        }
        private async Task UpdateDeptAndContacts()
        {
            if (IsBusy)
            {
                return;
            }
            IsBusy   = true;
            HasError = false;
            Error    = null;
            Departments.Clear();
            Contacts.Clear();
            var result = await contactsService.FetchDepartments(selectedProject);

            if (result.HasError)
            {
                HasError = true;
                Error    = result.Error;
                IsBusy   = false;
            }
            if (result.Model.Count != 0)
            {
                result.Model.Insert(0, null);
            }
            foreach (var item in result.Model)
            {
                Departments.Add(item);
            }
            var result1 = await contactsService.Find(selectedProject);

            if (result1.HasError)
            {
                HasError = true;
                Error    = result1.Error;
                IsBusy   = false;
                return;
            }
            foreach (var item in result1.Model)
            {
                Contacts.Add(item);
            }
            IsBusy = false;
        }
Пример #12
0
 public void RemoveAllDepartment()
 {
     Departments.Clear();
     OnPropertyChanged(nameof(Departments));
 }