public static hireType ToDto(HireTypeVM vm)
        {
            hireType dto = new hireType();

            dto.code        = vm.Code;
            dto.description = vm.Description;
            dto.id          = vm.Id;
            dto.name        = vm.Name;
            return(dto);
        }
 public static HireTypeVM FromDto(hireType dto, HireTypeVM vm = null)
 {
     if (vm == null)
     {
         vm = new HireTypeVM();
     }
     vm.Code        = dto.code;
     vm.Description = dto.description;
     vm.Id          = dto.id;
     vm.Name        = dto.name;
     return(vm);
 }
Exemple #3
0
        private async void EditItem()
        {
            HireTypeVM 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)
            {
                hireType[] hts   = new hireType[] { HireTypeConvertUtil.ToDto(vm) };
                int        count = await AppCxt.Current.DataPortal.UpdateHireTypes(hts);

                this.ClearEditingState();
                this.RefreshItemsAsync();
            }
        }
Exemple #4
0
        private async void AddItem()
        {
            HireTypeVM vm = new HireTypeVM()
            {
                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)
            {
                hireType[] hts   = new hireType[] { HireTypeConvertUtil.ToDto(vm) };
                int        count = await AppCxt.Current.DataPortal.AddHireTypes(hts);

                this.ClearEditingState();
                this.RefreshItemsAsync();
            }
        }