Exemplo n.º 1
0
        public async Task <GetServiceForEditOutput> GetServiceForEdit(NullableIdInput <long> input)
        {
            ServiceEditDto serviceEditDto;

            if (!input.Id.HasValue)
            {
                serviceEditDto = new ServiceEditDto()
                {
                    Tanks = new List <ServiceTankDto>()
                };
            }
            else
            {
                IRepository <Service, long> repository = this._serviceRepository;
                Service async = await repository.GetAsync(input.Id.Value);

                serviceEditDto = async.MapTo <ServiceEditDto>();
                IRepository <ServiceTank, long> repository1 = this._serviceTankRepository;
                List <ServiceTank> allListAsync             = await repository1.GetAllListAsync((ServiceTank m) => m.ServiceId == async.Id);

                serviceEditDto.Tanks = allListAsync.MapTo <List <ServiceTankDto> >();
            }
            return(new GetServiceForEditOutput()
            {
                Service = serviceEditDto
            });
        }
 public async Task<UserEditOutput> GetUserForEdit(NullableIdInput<long> input)
 {
     User user = new User();
     IList<string> roleNames;
     if (input.Id.HasValue)
     {
         user = await userManager.GetUserByIdAsync((long)input.Id);
         roleNames = await userManager.GetRolesAsync(user.Id);
     }
     else
     {
         roleNames = roleManager.Roles.Where(r => r.IsDefault).Select(r => r.Name).ToList();
     }
     var dto = user.MapTo<UserEditOutput>();
     dto.RoleInfos = new List<dynamic>();
     foreach (Role role in roleManager.Roles.ToList())
     {
         dto.RoleInfos.Add(new
         {
             role.Name,
             IsAssigned = roleNames.Contains(role.Name)
         });
     }
     dto.CanChangeUserName = dto.UserName != "admin";
     return dto;
 }
Exemplo n.º 3
0
        public async Task <GetEditionForEditOutput> GetEditionForEdit(NullableIdInput input)
        {
            var features = FeatureManager.GetAll();

            EditionEditDto   editionEditDto;
            List <NameValue> featureValues;

            if (input.Id.HasValue) //Editing existing edition?
            {
                var edition = await _editionManager.FindByIdAsync(input.Id.Value);

                featureValues  = (await _editionManager.GetFeatureValuesAsync(input.Id.Value)).ToList();
                editionEditDto = edition.MapTo <EditionEditDto>();
            }
            else
            {
                editionEditDto = new EditionEditDto();
                featureValues  = features.Select(f => new NameValue(f.Name, f.DefaultValue)).ToList();
            }

            return(new GetEditionForEditOutput
            {
                Edition = editionEditDto,
                Features = features.MapTo <List <FlatFeatureDto> >().OrderBy(f => f.DisplayName).ToList(),
                FeatureValues = featureValues.Select(fv => new NameValueDto(fv)).ToList()
            });
        }
        public async Task<GetEditionForEditOutput> GetEditionForEdit(NullableIdInput input)
        {
            var features = FeatureManager.GetAll();

            EditionEditDto editionEditDto;
            List<NameValue> featureValues;

            if (input.Id.HasValue) //Editing existing edition?
            {
                var edition = await _editionManager.FindByIdAsync(input.Id.Value);
                featureValues = (await _editionManager.GetFeatureValuesAsync(input.Id.Value)).ToList();
                editionEditDto = edition.MapTo<EditionEditDto>();
            }
            else
            {
                editionEditDto = new EditionEditDto();
                featureValues = features.Select(f => new NameValue(f.Name, f.DefaultValue)).ToList();
            }

            return new GetEditionForEditOutput
            {
                Edition = editionEditDto,
                Features = features.MapTo<List<FlatFeatureDto>>().OrderBy(f => f.DisplayName).ToList(),
                FeatureValues = featureValues.Select(fv => new NameValueDto(fv)).ToList()
            };
        }
Exemplo n.º 5
0
        public async Task<GetLanguageForEditOutput> GetLanguageForEdit(NullableIdInput input)
        {
            ApplicationLanguage language = null;
            if (input.Id.HasValue)
            {
                language = await _languageRepository.GetAsync(input.Id.Value);
            }

            var output = new GetLanguageForEditOutput();

            //Language
            output.Language = language != null
                ? language.MapTo<ApplicationLanguageEditDto>()
                : new ApplicationLanguageEditDto();

            //Language names
            output.LanguageNames = CultureInfo
                .GetCultures(CultureTypes.AllCultures)
                .OrderBy(c => c.DisplayName)
                .Select(c => new ComboboxItemDto(c.Name, c.DisplayName + " (" + c.Name + ")") { IsSelected = output.Language.Name == c.Name })
                .ToList();

            //Flags
            output.Flags = FamFamFamFlagsHelper
                .FlagClassNames
                .OrderBy(f => f)
                .Select(f => new ComboboxItemDto(f, FamFamFamFlagsHelper.GetCountryCode(f)) { IsSelected = output.Language.Icon == f })
                .ToList();

            return output;
        }
Exemplo n.º 6
0
        public async Task <PartialViewResult> CreateOrEditModal(long?id)
        {
            var theId = id;
            NullableIdInput <long> nullableIdInput = new NullableIdInput <long>()
            {
                Id = id
            };
            var getCustomerForEditOutput = await _customerAppService.GetCustomerForEdit(nullableIdInput);

            if (id.HasValue)
            {
                decimal totalOwed = 0;
                // Retrieve active invoices for the customer where they haven't paid at all or haven't paid in full.
                var invoices = await _invoiceRepository.GetAllListAsync(m => m.CustomerId == id &&
                                                                        (!m.PaidTotal.HasValue || m.PaidTotal.HasValue && m.PaidTotal < m.LineTotal) &&
                                                                        m.IsActive);

                foreach (var invoice in invoices)
                {
                    if (invoice.PaidTotal.HasValue)
                    {
                        totalOwed += invoice.PaidTotal.Value - invoice.LineTotal;
                    }
                    else if (invoice.LineTotal > 0)
                    {
                        totalOwed += invoice.LineTotal;
                    }
                }
                getCustomerForEditOutput.CustomerOwesTotal = totalOwed;
            }
            else
            {
                getCustomerForEditOutput.CustomerOwesTotal = 0;
            }
            var createOrEditCustomerModalViewModel = new CreateOrEditCustomerModalViewModel(getCustomerForEditOutput);
            var list   = new List <SelectListItem>();
            var titles = await _titleAppService.GetTitlesForTenant(AbpSession.ImpersonatorTenantId.HasValue?AbpSession.ImpersonatorTenantId.Value : AbpSession.TenantId.Value);

            foreach (var title in titles)
            {
                list.Add(new SelectListItem()
                {
                    Text     = title.Name,
                    Value    = title.Id.ToString(),
                    Disabled = false,
                    Selected = false
                });
            }
            var firstItem = new SelectListItem()
            {
                Text     = String.Empty,
                Value    = String.Empty,
                Disabled = false
            };

            list.Insert(0, firstItem);
            ViewData["Titles"] = list;
            return(PartialView("_CreateOrEditModal", createOrEditCustomerModalViewModel));
        }
Exemplo n.º 7
0
        public async Task <IActionResult> Edit(NullableIdInput input)
        {
            SystemDictionary dictionary = new SystemDictionary();

            if (!input.Id.IsNullOrEmptyGuid())
            {
                dictionary = await _systemDictionaryLogic.GetById(input.Id);
            }
            return(View(dictionary));
        }
Exemplo n.º 8
0
        /// <summary>
        /// 根据表单类型获取所有表单信息
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public Task <IEnumerable <WorkflowForm> > GetFormByFormType(NullableIdInput input)
        {
            StringBuilder sql = new StringBuilder("SELECT * FROM Workflow_Form");

            if (!input.Id.IsNullOrEmptyGuid())
            {
                sql.Append(" WHERE FormType=@formType");
            }
            return(SqlMapperUtil.SqlWithParams <WorkflowForm>(sql.ToString(), new { formType = input.Id }));
        }
Exemplo n.º 9
0
        public async Task <ViewResultBase> Edit(NullableIdInput <Guid> input)
        {
            var database = new SystemDataBase();

            if (!input.Id.IsNullOrEmptyGuid())
            {
                database = await _dataBaseLogic.GetByIdAsync(input.Id);
            }
            return(View(database));
        }
Exemplo n.º 10
0
        public async Task <IActionResult> Edit(NullableIdInput input)
        {
            var user = new SystemUser();

            if (!input.Id.IsNullOrEmptyGuid())
            {
                user = await _systemUserLogic.GetById(input.Id);
            }
            return(View(user));
        }
Exemplo n.º 11
0
        public IActionResult Edit(NullableIdInput input)
        {
            SystemArticle Article = new SystemArticle();

            if (!input.Id.IsNullOrEmptyGuid())
            {
                //  Article = await _systemArticleLogic.GetById(input.Id);
            }
            return(View(Article));
        }
Exemplo n.º 12
0
        public async Task <IActionResult> Edit(NullableIdInput input)
        {
            var role = new SystemRole();

            if (!input.Id.IsNullOrEmptyGuid())
            {
                role = await _systemRoleLogic.GetById(input.Id);
            }
            return(View(role));
        }
        public async Task <IActionResult> Edit(NullableIdInput input)
        {
            SystemPays pays = new SystemPays();

            if (!input.Id.IsNullOrEmptyGuid())
            {
                pays = await _systemPaysLogic.GetById(input.Id);
            }
            return(View(pays));
        }
        public IActionResult Edit(NullableIdInput input)
        {
            SystemMenuButton menuButton = new SystemMenuButton();

            if (!input.Id.IsNullOrEmptyGuid())
            {
                // menuButton=await _systemMenuButtonLogic.GetById(input.Id);
            }
            return(View(menuButton));
        }
Exemplo n.º 15
0
        /// <summary>
        /// 根据流程类型获取所有流程
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public Task <IEnumerable <WorkflowProcess> > GetWorkflowByProcessType(NullableIdInput input)
        {
            StringBuilder sql = new StringBuilder("SELECT * FROM Workflow_Process");

            if (!input.Id.IsNullOrEmptyGuid())
            {
                sql.Append(" WHERE ProcessType=@processType");
            }
            return(SqlMapperUtil.SqlWithParams <WorkflowProcess>(sql.ToString(), new { processType = input.Id }));
        }
Exemplo n.º 16
0
        /// <summary>
        ///     日志详情
        /// </summary>
        /// <returns></returns>
        public ActionResult LoginDetails(NullableIdInput input)
        {
            SystemLoginLog systemLogin = new SystemLoginLog();

            // if (!input.Id.IsNullOrEmptyGuid())
            // {
            //     systemLogin = await _loginLogLogic.GetAsync(input.Id.Value);
            // }
            return(View(systemLogin));
        }
Exemplo n.º 17
0
        public async Task <ViewResultBase> Edit(NullableIdInput input)
        {
            SystemEmailAccount emailAccount = new SystemEmailAccount();

            if (!input.Id.IsNullOrEmptyGuid())
            {
                emailAccount = await _systemEmailAccountLogic.GetByIdAsync(input.Id);
            }
            return(View(emailAccount));
        }
Exemplo n.º 18
0
        public async Task <PartialViewResult> CreateOrEditModal(int?id)
        {
            IEditionAppService editionAppService = this._editionAppService;
            NullableIdInput    nullableIdInput   = new NullableIdInput()
            {
                Id = id
            };
            GetEditionForEditOutput editionForEdit = await editionAppService.GetEditionForEdit(nullableIdInput);

            return(this.PartialView("_CreateOrEditModal", new CreateOrEditEditionModalViewModel(editionForEdit)));
        }
Exemplo n.º 19
0
        public async Task <PartialViewResult> CreateOrEditModal(int?id)
        {
            IRoleAppService roleAppService  = this._roleAppService;
            NullableIdInput nullableIdInput = new NullableIdInput()
            {
                Id = id
            };
            GetRoleForEditOutput roleForEdit = await roleAppService.GetRoleForEdit(nullableIdInput);

            return(this.PartialView("_CreateOrEditModal", new CreateOrEditRoleModalViewModel(roleForEdit)));
        }
        public async Task<GetStudentForEditOutput> GetStudent(NullableIdInput input)
        {
            if (input?.Id == null)
                throw new UserFriendlyException("Id is invalid.");

            var info = _list.FirstOrDefault(x => x.Id == input.Id);

            var output = await Task.FromResult(info.MapTo<GetStudentForEditOutput>());
            
            return output;
        }
Exemplo n.º 21
0
        public async Task <PartialViewResult> CreateOrUpdateQuickMenuItemModal(long?id)
        {
            IGenericAppService     genericAppService = this._genericAppService;
            NullableIdInput <long> nullableIdInput   = new NullableIdInput <long>()
            {
                Id = id
            };
            GetQuickMenuItemForEditOutput quickMenuItemForEdit = await genericAppService.GetQuickMenuItemForEdit(nullableIdInput);

            return(this.PartialView("_CreateOrUpdateQuickMenuItemModal", new CreateOrUpdateQuickMenuItemModalViewModel(quickMenuItemForEdit)));
        }
Exemplo n.º 22
0
        public async Task <PartialViewResult> CreateOrUpdateModal(long?id = null)
        {
            IContactAppService     contactAppService = this._contactAppService;
            NullableIdInput <long> nullableIdInput   = new NullableIdInput <long>()
            {
                Id = id
            };
            GetContactForEditOutput contactForEdit = await contactAppService.GetContactForEdit(nullableIdInput);

            return(this.PartialView("_CreateOrUpdateModal", new CreateOrUpdateContactModalViewModel(contactForEdit)));
        }
Exemplo n.º 23
0
        public async Task <PartialViewResult> CreateOrEditModal(int?id)
        {
            ITruckAppService       truckAppService = this._truckAppService;
            NullableIdInput <long> nullableIdInput = new NullableIdInput <long>()
            {
                Id = id
            };
            GetTruckForEditOutput truckForEdit = await truckAppService.GetTruckForEdit(nullableIdInput);

            return(this.PartialView("_CreateOrEditModal", new CreateOrEditTruckModalViewModel(truckForEdit)));
        }
Exemplo n.º 24
0
        public async Task <PartialViewResult> CreateOrEditModal(int?id)
        {
            ILanguageAppService languageAppService = this._languageAppService;
            NullableIdInput     nullableIdInput    = new NullableIdInput()
            {
                Id = id
            };
            GetLanguageForEditOutput languageForEdit = await languageAppService.GetLanguageForEdit(nullableIdInput);

            return(this.PartialView("_CreateOrEditModal", new CreateOrEditLanguageModalViewModel(languageForEdit)));
        }
Exemplo n.º 25
0
        public async Task <PartialViewResult> CreateOrUpdateModal(long?id = null)
        {
            IEmergencyDeliveryFeeRuleAppService emergencyDeliveryFeeRuleAppService = this._emergencyDeliveryFeeRuleAppService;
            NullableIdInput <long> nullableIdInput = new NullableIdInput <long>()
            {
                Id = id
            };
            GetEmergencyDeliveryFeeRuleForEditOutput emergencyDeliveryFeeRuleForEdit = await emergencyDeliveryFeeRuleAppService.GetEmergencyDeliveryFeeRuleForEdit(nullableIdInput);

            return(this.PartialView("_CreateOrUpdateModal", new CreateOrUpdateEmergencyDeliveryFeeRuleModalViewModel(emergencyDeliveryFeeRuleForEdit)));
        }
        public async Task<GetCustomerForEditOutput> GetCustomer(NullableIdInput input)
        {
            if (input == null || input.Id == null)
                throw new UserFriendlyException("Id is invalid.");

            var info = list.FirstOrDefault(x => x.Id == input.Id);

            var output = info.MapTo<GetCustomerForEditOutput>();

            return output;
        }
Exemplo n.º 27
0
        public async Task <PartialViewResult> CreateOrUpdateModal(long?id = null)
        {
            ITaxAppService         taxAppService   = this._taxAppService;
            NullableIdInput <long> nullableIdInput = new NullableIdInput <long>()
            {
                Id = id
            };
            GetTaxForEditOutput taxForEdit = await taxAppService.GetTaxForEdit(nullableIdInput);

            return(this.PartialView("_CreateOrUpdateModal", new CreateOrUpdateTaxModalViewModel(taxForEdit)));
        }
Exemplo n.º 28
0
        public async Task<GetUserForEditOutput> GetUserForEdit(NullableIdInput<long> input)
        {
            //Getting all available roles
            var userRoleDtos = (await _roleManager.Roles
                .OrderBy(r => r.DisplayName)
                .Select(r => new UserRoleDto
                {
                    RoleId = r.Id,
                    RoleName = r.Name,
                    RoleDisplayName = r.DisplayName
                })
                .ToArrayAsync());

            var output = new GetUserForEditOutput
            {
                Roles = userRoleDtos
            };

            if (!input.Id.HasValue)
            {
                //Creating a new user
                output.User = new UserEditDto { IsActive = true, ShouldChangePasswordOnNextLogin = true };

                foreach (var defaultRole in await _roleManager.Roles.Where(r => r.IsDefault).ToListAsync())
                {
                    var defaultUserRole = userRoleDtos.FirstOrDefault(ur => ur.RoleName == defaultRole.Name);
                    if (defaultUserRole != null)
                    {
                        defaultUserRole.IsAssigned = true;
                    }
                }
            }
            else
            {
                //Editing an existing user
                var user = await UserManager.GetUserByIdAsync(input.Id.Value);

                output.User = user.MapTo<UserEditDto>();
                output.ProfilePictureId = user.ProfilePictureId;

                foreach (var userRoleDto in userRoleDtos)
                {
                    userRoleDto.IsAssigned = await UserManager.IsInRoleAsync(input.Id.Value, userRoleDto.RoleName);
                }
            }

            return output;
        }
 public async Task<EditRoleDto> GetById(NullableIdInput input)
 {
     Role role = new Role();
     if (input.Id.HasValue)
     {
          role = await roleManager.GetRoleByIdAsync((int)input.Id);
     }          
     var roleEditDto = role.MapTo<EditRoleDto>();
     var permissions=await roleManager.GetGrantedPermissionsAsync(role);
   
     var permissionInfos = permissionManager.GetAllPermissions().Select(p => new {
         p.Name,
         DisplayName = p.DisplayName.Localize(localizationContext),
         ParentName = p.Parent == null ? "无" : p.Parent.Name,
         IsGrantedByDefault = permissions.Contains(p) || p.IsGrantedByDefault
     });
     roleEditDto.Permissions = permissionInfos;
     return roleEditDto;
 }
Exemplo n.º 30
0
        public async Task<GetRoleForEditOutput> GetRoleForEdit(NullableIdInput input)
        {
            var permissions = PermissionManager.GetAllPermissions();
            var grantedPermissions = new Permission[0];
            RoleEditDto roleEditDto;

            if (input.Id.HasValue) //Editing existing role?
            {
                var role = await _roleManager.GetRoleByIdAsync(input.Id.Value);
                grantedPermissions = (await _roleManager.GetGrantedPermissionsAsync(role)).ToArray();
                roleEditDto = role.MapTo<RoleEditDto>();
            }
            else
            {
                roleEditDto = new RoleEditDto();
            }

            return new GetRoleForEditOutput
                   {
                       Role = roleEditDto,
                       Permissions = permissions.MapTo<List<FlatPermissionDto>>().OrderBy(p => p.DisplayName).ToList(),
                       GrantedPermissionNames = grantedPermissions.Select(p => p.Name).ToList()
                   };
        }
Exemplo n.º 31
0
        /// <summary>
        /// 修改获取实体
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task<GetProvinceCityForEditOutput> GetProvinceCityForEdit(NullableIdInput<Guid> input)
        {
            BaseProvinceCityInfo provinceCity = null;
            if (input.Id.HasValue) //Editing existing role?
            {
                provinceCity = await _provinceCityRepository.GetAsync(input.Id.Value);
            }

            return new GetProvinceCityForEditOutput
            {
                ProvinceCity = provinceCity.MapTo<ProvinceCityEditDto>(),
            };
        }
Exemplo n.º 32
0
        /// <summary>
        ///修改获取实体
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task<GetMenuItemForEditOutput> GetMenuItemForEdit(NullableIdInput<Guid> input)
        {
            AuthorityMenuItemInfo menuItem = null;
            if (input.Id.HasValue)
            {
                menuItem = await _menuItemRepository.GetAsync(input.Id.Value);
            }

            return new GetMenuItemForEditOutput
            {
                MenuItem = menuItem.MapTo<MenuItemEditDto>(),
            };
        }
        /// <summary>
        ///修改获取实体
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task<GetProjectSupplierForEditOutput> GetProjectSupplierForEdit(NullableIdInput<Guid> input)
        {
            BaseProjectSupplierInfo projectSupplier = null;
            if (input.Id.HasValue)
            {
                projectSupplier = await _projectSupplierRepository.GetAsync(input.Id.Value);
            }

            return new GetProjectSupplierForEditOutput
            {
                ProjectSupplier = projectSupplier.MapTo<ProjectSupplierEditDto>()
            };
        }
Exemplo n.º 34
0
        public async Task<ModuleTreeNode> GetModuleTree(NullableIdInput<Guid> input)
        {
            var query = _repository.GetAll();
            var list = await query.ToListAsync();
            var mappedList = list.MapTo<List<ModuleTreeNode>>();
            var root = new ModuleTreeNode
            {
                ModuleCode = "Root",
                DisplayName = "Root",
                ParentId = null,
                Id = null
            };

            return GetSubItem(mappedList, root, input.Id);
        }
        /// <summary>
        ///修改获取实体
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task<GetQuarterPlanForEditOutput> GetQuarterPlanForEdit(NullableIdInput<Guid> input)
        {
            PlanQuarterPlanInfo quarterPlan = null;
            List<PlanQuarterPlanItemInfo> quarterPlanItems = null;
            if (input.Id.HasValue)
            {
                quarterPlan = await _quarterPlanRepository.GetAsync(input.Id.Value);
                quarterPlanItems = await _quarterPlanItemRepository.GetAllListAsync(e =>e.PlanId == input.Id.Value);
            }
            return new GetQuarterPlanForEditOutput
            {
                QuarterPlan = quarterPlan.MapTo<QuarterPlanEditDto>(),
                QuarterPlanItems = quarterPlanItems.MapTo<List<QuarterPlanItemEditDto>>()

            };
        }
Exemplo n.º 36
0
        /// <summary>
        /// 修改获取实体
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task<GetRoleForEditOutput> GetRoleForEdit(NullableIdInput<Guid> input)
        {
            AuthorityRoleInfo role = null;
            if (input.Id.HasValue) //Editing existing role?
            {
                role = await _roleRepository.GetAsync(input.Id.Value);
            }

            return new GetRoleForEditOutput
            {
                Role = role.MapTo<RoleEditDto>(),
            };
        }
Exemplo n.º 37
0
        /// <summary>
        ///修改获取实体
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task<GetFunctionForEditOutput> GetFunctionForEdit(NullableIdInput<Guid> input)
        {
            AuthorityFunctionInfo function = null;
            if (input.Id.HasValue)
            {
                function = await _functionRepository.GetAsync(input.Id.Value);
            }

            return new GetFunctionForEditOutput
            {
                Function = function.MapTo<FunctionEditDto>()
            };
        }
 public int GetMaterialClassSortCode(NullableIdInput<Guid> input)
 {
     return _materialClassRepository.Count(e => e.ParentId == input.Id) + 1;
 }
        /// <summary>
        ///修改获取实体
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task<GetRequisitionOrderForEditOutput> GetRequisitionOrderForEdit(NullableIdInput<Guid> input)
        {

            MaterialRequisitionOrderInfo requisitionOrder = null;
            List<MaterialRequisitionOrderItemInfo> requisitionOrderItems = null;
            if (input.Id.HasValue)
            {
                requisitionOrder = await _requisitionOrderRepository.GetAsync(input.Id.Value);
                requisitionOrderItems = await _requisitionOrderItemRepository.GetAllListAsync(e => e.OrderId == input.Id.Value);
            }
            return new GetRequisitionOrderForEditOutput
            {
                RequisitionOrder = requisitionOrder.MapTo<RequisitionOrderEditDto>(),
                RequisitionOrderItems = requisitionOrderItems.MapTo<List<RequisitionOrderItemEditDto>>()
            };
        }
Exemplo n.º 40
0
 public int GetRoleSortCode(NullableIdInput<Guid> input)
 {
     return _roleRepository.Count(e => e.ParentId == input.Id) + 1;
 }
        /// <summary>
        ///修改获取实体
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task<GetPurchasePlanForEditOutput> GetPurchasePlanForEdit(NullableIdInput<Guid> input)
        {
            PlanPurchasePlanInfo purchasePlan = null;
            List<PlanPurchasePlanItemInfo> purchasePlanItems = null;
            if (input.Id.HasValue)
            {
                purchasePlan = await _purchasePlanRepository.GetAsync(input.Id.Value);
                purchasePlanItems = await _purchasePlanItemRepository.GetAllListAsync(e => e.PlanId == input.Id.Value);
            }
            return new GetPurchasePlanForEditOutput
            {
                PurchasePlan = purchasePlan.MapTo<PurchasePlanEditDto>(),
                PurchasePlanItems = purchasePlanItems.MapTo<List<PurchasePlanItemEditDto>>()

            };
        }
        /// <summary>
        ///修改获取实体
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task<GetConversionRateForEditOutput> GetConversionRateForEdit(NullableIdInput<Guid> input)
        {
           BaseConversionRateInfo  conversionRate = null;
            if (input.Id.HasValue)
            {
                conversionRate  = await _conversionRateRepository.GetAsync(input.Id.Value);
            }

            return new GetConversionRateForEditOutput
            {
                ConversionRate = conversionRate.MapTo<ConversionRateEditDto>()
            };
        }
 public string CreateCode(NullableIdInput<Guid> input)
 {
   var ss= _provinceCityRepository.GetAll().Where(e => e.ParentId == input.Id).Max(e=>e.Code);
   if (ss == null)
   {
       return _provinceCityRepository.GetAll().Where(e=>e.Id==input.Id).FirstOrDefault().Code+"01";
   }
   else
   {
      return  (Convert.ToInt32(ss) + 1).ToString();
   }
 }
Exemplo n.º 44
0
        /// <summary>
        /// 修改获取实体
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task<GetDataDictionaryDetailForEditOutput> GetDataDictionaryDetailForEdit(NullableIdInput<Guid> input)
        {
            BaseDataDictionaryDetailInfo dataDictionaryDetail = null;
            if (input.Id.HasValue) //Editing existing role?
            {
                dataDictionaryDetail = await _dataDictionaryDetailRepository.GetAsync(input.Id.Value);
            }

            return new GetDataDictionaryDetailForEditOutput
            {
                DataDictionaryDetail = dataDictionaryDetail.MapTo<DataDictionaryDetailEditDto>(),
            };
        }
Exemplo n.º 45
0
        /// <summary>
        /// 修改获取实体
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task<GetOrganizeForEditOutput> GetOrganizeForEdit(NullableIdInput<Guid> input)
        {
            AuthorityOrganizeInfo organize = null;
            if (input.Id.HasValue) //Editing existing role?
            {
                organize = await _organizeRepository.GetAsync(input.Id.Value);
            }

            return new GetOrganizeForEditOutput
            {
                Organize = organize.MapTo<OrganizeEditDto>(),
            };
        }
        /// <summary>
        ///修改获取实体
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task<GetProjectMaterialInfoForEditOutput> GetProjectMaterialInfoForEdit(NullableIdInput<Guid> input)
        {
            BaseProjectMaterialInfo projectMaterialInfo = null;
            if (input.Id.HasValue)
            {
                projectMaterialInfo = await _projectMaterialInfoRepository.GetAsync(input.Id.Value);
            }

            return new GetProjectMaterialInfoForEditOutput
            {
                ProjectMaterialInfo = projectMaterialInfo.MapTo<ProjectMaterialInfoEditDto>()
            };
        }
Exemplo n.º 47
0
        /// <summary>
        /// 修改获取实体
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task<GetMenuAppForEditOutput> GetMenuAppForEdit(NullableIdInput<Guid> input)
        {
            AuthorityMenuAppInfo menuApp = null;
            if (input.Id.HasValue) //Editing existing role?
            {
                menuApp = await _menuAppRepository.GetAsync(input.Id.Value);
            }

            return new GetMenuAppForEditOutput
            {
                MenuApp = menuApp.MapTo<MenuAppEditDto>(),
            };
        }
Exemplo n.º 48
0
 public ListResultOutput<DataDictionaryListDto> GetDataDictionaryById(NullableIdInput<Guid> input)
 {
     var list = GetDataDictionaryList().Where(e => e.Id == input.Id || e.ParentId == input.Id).ToList<BaseDataDictionaryInfo>();
     return new ListResultOutput<DataDictionaryListDto>(list.MapTo<List<DataDictionaryListDto>>()); 
 }
        /// <summary>
        ///修改获取实体
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task<GetMaterialClassForEditOutput> GetMaterialClassForEdit(NullableIdInput<Guid> input)
        {
            BaseMaterialClassInfo materialClass = null;
            if (input.Id.HasValue)
            {
                materialClass = await _materialClassRepository.GetAsync(input.Id.Value);
            }

            return new GetMaterialClassForEditOutput
            {
                MaterialClass = materialClass.MapTo<MaterialClassEditDto>()
            };
        }
Exemplo n.º 50
0
        /// <summary>
        ///修改获取实体
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task<GetYearPlanForEditOutput> GetYearPlanForEdit(NullableIdInput<Guid> input)
        {
            PlanYearPlanInfo yearPlan = null;
            List<PlanYearPlanItemInfo> yearPlanItems = null;
            if (input.Id.HasValue)
            {
                yearPlan = await _yearPlanRepository.GetAsync(input.Id.Value);
                yearPlanItems = await _yearPlanItemRepository.GetAllListAsync(e => e.PlanId == input.Id.Value);
            }
            return new GetYearPlanForEditOutput
            {
                YearPlan = yearPlan.MapTo<YearPlanEditDto>(),
                YearPlanItems = yearPlanItems.MapTo<List<YearPlanItemEditDto>>()

            };
        }
Exemplo n.º 51
0
        /// <summary>
        /// 修改获取实体
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task<GetCodeRuleForEditOutput> GetCodeRuleForEdit(NullableIdInput<Guid> input)
        {
            BaseCodeRuleInfo codeRule = null;
            if (input.Id.HasValue) //Editing existing role?
            {
                codeRule = await _codeRuleRepository.GetAsync(input.Id.Value);
            }

            return new GetCodeRuleForEditOutput
            {
                CodeRule = codeRule.MapTo<CodeRuleEditDto>(),
            };
        }
        /// <summary>
        ///修改获取实体
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task<GetMenuPermissionForEditOutput> GetMenuPermissionForEdit(NullableIdInput<Guid> input)
        {
            AuthorityMenuPermissionInfo menuPermission = null;
            if (input.Id.HasValue)
            {
                menuPermission = await _menuPermissionRepository.GetAsync(input.Id.Value);
            }

            return new GetMenuPermissionForEditOutput
            {
                MenuPermission = menuPermission.MapTo<MenuPermissionEditDto>()
            };
        }