Пример #1
0
        public override JobPositionLevelVM DeepClone()
        {
            var dto = JobPositionLevelConvertUtil.ToDto(this);
            var vm  = JobPositionLevelConvertUtil.FromDto(dto);

            base.CopyStateValues(vm);
            return(vm);
        }
Пример #2
0
        private async void RefreshItemsAsync()
        {
            this.ItemList.Clear();
            IsBusy = true;
            ICollection <jobPositionLevel> items = await AppCxt.Current.DataPortal.GetAllJobPositionLevelsAsync();

            IsBusy = false;
            foreach (var item in items)
            {
                JobPositionLevelVM vm = JobPositionLevelConvertUtil.FromDto(item);
                this.ItemList.Add(vm);
            }
        }
Пример #3
0
        private async void EditItem()
        {
            JobPositionLevelVM vm = this.SelectedItem.DeepClone();

            vm.IsDirty              = false;
            vm.IsEditing            = true;
            vm.IsNew                = false;
            this.IsEditing          = true;
            this.CurrentEditingItem = vm;
            bool isSaveClick = await this.EditItemDialog?.ShowDialogAsync("添加", vm);

            if (isSaveClick)
            {
                jobPositionLevel[] items = new jobPositionLevel[] { JobPositionLevelConvertUtil.ToDto(vm) };
                int count = await AppCxt.Current.DataPortal.UpdateJobPositionLevels(items);

                this.ClearEditingState();
                this.RefreshItemsAsync();
            }
        }
Пример #4
0
        private async void AddItem()
        {
            JobPositionLevelVM vm = new JobPositionLevelVM()
            {
                Id = Guid.NewGuid().ToString()
            };

            vm.IsDirty              = true;
            vm.IsEditing            = true;
            vm.IsNew                = true;
            this.IsEditing          = true;
            this.CurrentEditingItem = vm;
            bool isSaveClick = await this.EditItemDialog?.ShowDialogAsync("添加", vm);

            if (isSaveClick)
            {
                jobPositionLevel[] items = new jobPositionLevel[] { JobPositionLevelConvertUtil.ToDto(vm) };
                int count = await AppCxt.Current.DataPortal.AddJobPositionLevels(items);

                this.ClearEditingState();
                this.RefreshItemsAsync();
            }
        }
Пример #5
0
        private async void DeleteItemsAsync()
        {
            if (this.DeleteItemsDialog != null)
            {
                var items = this.ItemList.Where(p => p.IsSelected).ToList();
                if (items.Count == 0)
                {
                    items.Add(this.SelectedItem);
                }
                bool isSureToDelete = await this.DeleteItemsDialog.ShowDialog(items);

                if (isSureToDelete)
                {
                    List <jobPositionLevel> list = items.Select(p => JobPositionLevelConvertUtil.ToDto(p)).ToList();
                    this.IsBusy = true;
                    int result = await AppCxt.Current.DataPortal.DeletJobPositionLevels(list);

                    if (result > 0)
                    {
                        this.RefreshItemsAsync();
                    }
                }
            }
        }