示例#1
0
 public FunctionVM()
 {
     BasicInfoAppLocalizedResources = new BasicInfoAppLocalizedResources();
     Function = new FunctionDTO {
     };
     init();
 }
示例#2
0
        public void ShowFunctionView(FunctionDTO function, ActionType action)
        {
            var view = ServiceLocator.Current.GetInstance <IFunctionView>();

            ((FunctionVM)view.ViewModel).Load(function, action);
            viewManager.ShowInDialog(view);
        }
示例#3
0
        public async Task <IActionResult> DeletePermissionAsync([FromRoute] int groupId, [FromRoute] int functionId)
        {
            var currentAccount = await _accountRepository.GetAccountByIdAsync(CurrentAccountId);

            if (currentAccount.GroupId > groupId)
            {
                throw new ForbiddenException(); // the lower the group id, the higher the authority; can only delete the group with authority lower than the current group
            }

            var group = await _groupRepository.GetGroupByIdAsync(groupId);

            var function = await _functionRepository.GetFunctionByIdAsync(functionId);

            if (group == null)
            {
                throw new NotFound404Exception("group");
            }

            if (function == null || !(await _groupRepository.AnyByPermissionAsync(functionId, groupId)))
            {
                throw new NotFound404Exception("function");
            }

            await _groupRepository.DeletePermissionAsync(functionId, groupId);

            return(Ok(FunctionDTO.GetFrom(function)));
        }
示例#4
0
        private RoleDTO LoadEntityData(Role entity)
        {
            var myDto = new RoleDTO()
            {
                Id           = entity.Id,
                Name         = entity.Name,
                FunctionDtos = new List <FunctionDTO>()
            };
            //装载该角色功能
            var roleFunctionMaps = _databaseContext.RoleFunctionMaps.Where(a => a.RoleId == myDto.Id);

            foreach (var roleFunctionMap in roleFunctionMaps)
            {
                var functions = _databaseContext.Functions.FirstOrDefault(a => a.Id == roleFunctionMap.FunctionId);
                if (functions != null)
                {
                    var functionDto = new FunctionDTO
                    {
                        Id       = functions.Id,
                        Code     = functions.Code,
                        Name     = functions.Name,
                        ParentId = functions.ParentId,
                        Url      = functions.Url
                    };
                    myDto.FunctionDtos.Add(functionDto);
                }
            }



            return(myDto);
        }
示例#5
0
        public void Update(FunctionDTO f)
        {
            var f1 = functionRepository.GetBy(f.IDCN);

            f.Mapping(f1);

            functionRepository.Update(f1);
        }
示例#6
0
        public void DoAction(FunctionListVM vm)
        {
            var function = new FunctionDTO()
            {
                PolicyId = vm.PolicyFunctions.PolicyId
            };

            basicInfoController.ShowFunctionView(function, ActionType.CreateFunction);
        }
示例#7
0
        public static Function Mapping(this FunctionDTO f)
        {
            var f1 = new Function
            {
                IDCN       = f.IDCN,
                Name       = f.Name,
                NameMethod = f.NameMethod,
            };

            return(f1);
        }
示例#8
0
        public static FunctionDTO MappingDto(this Function f1)
        {
            var f = new FunctionDTO
            {
                IDCN       = f1.IDCN,
                Name       = f1.Name,
                NameMethod = f1.NameMethod,
            };

            return(f);
        }
示例#9
0
        public async Task <IActionResult> UpdateFunctionAsync([FromRoute] int functionId, [FromBody] FunctionUpdateModel model)
        {
            var function = await _functionRepository.GetFunctionByIdAsync(functionId);

            if (function == null)
            {
                throw new NotFound404Exception("function");
            }

            if (function.Code.Contains("Full"))
            {
                throw new ForbiddenException();
            }

            if (string.IsNullOrWhiteSpace(model.Code))
            {
                throw new IsRequiredException("code");
            }

            if (model.Code.Length > 20)
            {
                throw new CodeIsInvalidException();
            }

            if (function.Code != model.Code && await _functionRepository.AnyByCodeAsync(model.Code))
            {
                throw new AlreadyExistsException("code");
            }

            if (string.IsNullOrWhiteSpace(model.Description))
            {
                throw new IsRequiredException("description");
            }

            if (model.Description.Length < 20)
            {
                throw new DescriptionIsInvalidException();
            }

            if (function.Description != model.Description && await _functionRepository.AnyByDescriptionAsync(model.Description))
            {
                throw new AlreadyExistsException("description");
            }

            // bind data
            function.Code        = model.Code;
            function.Description = model.Description;
            function.IsActive    = model.IsActive;
            function.UpdatedDate = DateTime.Now;

            await _functionRepository.UpdateFunctionAsync(function);

            return(Ok(FunctionDTO.GetFrom(function)));
        }
示例#10
0
        public async Task <IActionResult> GetFunctionByIdAsync([FromRoute] int functionId)
        {
            var function = await _functionRepository.GetFunctionByIdAsync(functionId);

            if (function == null)
            {
                throw new NotFound404Exception("function");
            }

            return(Ok(FunctionDTO.GetFrom(function)));
        }
示例#11
0
        public static bool StoreResult([ActivityTrigger] FunctionDTO <IEnumerable <DeviceDetails> > input,
                                       [Blob("%DeviceLogPath%", FileAccess.Write, Connection = "LogStorageConnectionString")] CloudBlobContainer targetBlob,
                                       ILogger log)
        {
            log.LogInformation("Storing process results...");

            var fileName  = $"{DateTime.UtcNow.ToString("yy-MM-dd")}/{input.OriginalFileDrop}/complete/result.json";
            var blobBlock = targetBlob.GetBlockBlobReference(fileName);

            blobBlock.UploadText(Newtonsoft.Json.JsonConvert.SerializeObject(input.Input));

            return(true);
        }
示例#12
0
        private FunctionDTO LoadEntityData(Function entity)
        {
            var myDto = new FunctionDTO()
            {
                Id       = entity.Id,
                Name     = entity.Name,
                Code     = entity.Code,
                ParentId = entity.ParentId,
                Url      = entity.Url
            };


            return(myDto);
        }
示例#13
0
        public async Task <IActionResult> CreateFunctionAsync([FromBody] FunctionCreateModel model)
        {
            if (string.IsNullOrWhiteSpace(model.Code))
            {
                throw new IsRequiredException("code");
            }

            if (model.Code.Length > 20)
            {
                throw new CodeIsInvalidException();
            }

            if (await _functionRepository.AnyByCodeAsync(model.Code))
            {
                throw new AlreadyExistsException("code");
            }

            if (string.IsNullOrWhiteSpace(model.Description))
            {
                throw new IsRequiredException("description");
            }

            if (model.Description.Length < 20)
            {
                throw new DescriptionIsInvalidException();
            }

            if (await _functionRepository.AnyByDescriptionAsync(model.Description))
            {
                throw new AlreadyExistsException("description");
            }

            DateTime now = DateTime.Now;

            var function = new Function
            {
                Code        = model.Code,
                Description = model.Description,
                CreatedDate = now,
                CreatedBy   = CurrentAccountId,
                UpdatedDate = now,
                UpdatedBy   = CurrentAccountId
            };

            await _functionRepository.CreateFunctionAsync(function);

            return(Ok(FunctionDTO.GetFrom(function)));
        }
示例#14
0
        /// <summary>
        /// 根据Id获取功能
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public FunctionDTO GetFunctionById(int id)
        {
            var dto      = new FunctionDTO();
            var function = _databaseContext.Functions.FirstOrDefault(a => a.Id == id);

            if (function != null)
            {
                dto = new FunctionDTO
                {
                    Id       = function.Id,
                    Code     = function.Code,
                    Name     = function.Name,
                    ParentId = function.ParentId,
                    Url      = function.Url
                };
            }
            return(dto);
        }
示例#15
0
 /// <summary>
 /// 递归遍历Function_Tree
 /// </summary>
 /// <param name="current_function"></param>
 /// <param name="function_id"></param>
 /// <returns></returns>
 private FunctionDTO FindInFunctionTree(FunctionDTO current_function, string function_id)
 {
     if (current_function.SubFunctionList.Count == 0)
     {
         if (current_function.Id.ToString() == function_id)
         {
             return(current_function);
         }
     }
     else
     {
         foreach (var subFunction in current_function.SubFunctionList)
         {
             FindInFunctionTree(subFunction, function_id);
         }
     }
     return(null);
 }
示例#16
0
        private static ICollection <FunctionDTO> fillGroupFunctionsDTObyGroupID(int id)
        {
            List <FunctionDTO> _FunctionDTOList = new List <FunctionDTO>();
            FunctionDTO        _FunctionDTO     = default(FunctionDTO);

            if (_GroupFunctionList != null && _GroupFunctionList.Count > 0)
            {
                foreach (GroupFunction _GroupFunction in _GroupFunctionList)
                {
                    if (_GroupFunction.groupId == id)
                    {
                        _FunctionDTO = fillFunctionDTObyFunctionID(_GroupFunction.functionId);
                        _FunctionDTOList.Add(_FunctionDTO);
                    }
                }
            }

            return(_FunctionDTOList);
        }
示例#17
0
        private void FoundParentFunctionWithoutRight(FunctionDTO currentFunction, List <FunctionDTO> opFunctionList, List <FunctionDTO> baseFunctionList)
        {
            FunctionDTO parentFunction = CubeDb.From <Mc_Function>()
                                         .Where(Mc_Function._.Id == currentFunction.Parent_Function_Id)
                                         .Select(Mc_Function._.All)
                                         .ToList <FunctionDTO>().FirstOrDefault();

            if (parentFunction != null)
            {
                if (!opFunctionList.Exists(f => f.Id == currentFunction.Parent_Function_Id))
                {
                    opFunctionList.Add(parentFunction);
                }
                if (parentFunction.Parent_Function_Id != null && parentFunction.Parent_Function_Id != Guid.Empty &&
                    !baseFunctionList.Exists(f => f.Id == parentFunction.Parent_Function_Id))
                {
                    FoundParentFunctionWithoutRight(parentFunction, opFunctionList, baseFunctionList);
                }
            }
        }
示例#18
0
        public async Task <IActionResult> CreateFunction([FromBody] FunctionDTO model)
        {
            var exist = await _context.Functions.AnyAsync(f => f.Name == model.Name);

            if (exist)
            {
                return(await Task.FromResult(new BadRequestResult()));
            }

            var function = new Function
            {
                Name = model.Name
            };

            await _context.Functions.AddAsync(function);

            await _context.SaveChangesAsync();

            return(await Task.FromResult(new OkObjectResult(function)));
        }
示例#19
0
        private static FunctionDTO fillFunctionDTObyFunctionID(int?functionId)
        {
            FunctionDTO _FunctionDTO = new FunctionDTO();

            if (_FunctionList != null && _FunctionList.Count > 0)
            {
                foreach (Function _Function in _FunctionList)
                {
                    if (_Function.Id == functionId)
                    {
                        _FunctionDTO.Id     = _Function.Id;
                        _FunctionDTO.name   = _Function.name;
                        _FunctionDTO.status = _Function.status;
                        _FunctionDTO.nameAr = _Function.nameAr;
                        _FunctionDTO.route  = _Function.route;
                    }
                }
            }

            return(_FunctionDTO);
        }
示例#20
0
        internal IEnumerable <FunctionDTO> GetFunctionDTOs()
        {
            Console.WriteLine("Started exporting functions data");
            string LocationAsString(Location location)
            {
                if (location.IsInMetadata)
                {
                    return("module: " + location.MetadataModule.ToString());
                }
                else
                {
                    var span = location.GetMappedLineSpan();
                    return("file: " + span.Path + " line: " + span.StartLinePosition.Line);
                }
            }

            return(IndexesDict.Keys.OrderBy(s => IndexesDict[s]).Select(s => {
                var dto = new FunctionDTO()
                {
                    location = LocationAsString(s.OriginalDefinition.Locations.FirstOrDefault()),
                    name = s.ToDisplayString(new SymbolDisplayFormat(
                                                 memberOptions:
                                                 SymbolDisplayMemberOptions.IncludeParameters,
                                                 parameterOptions: SymbolDisplayParameterOptions.IncludeType

                                                 )),
                };
                dto.written = false;
                if (CollectedAnalysisData.ContainsKey(s))
                {
                    var data = CollectedAnalysisData[s];
                    dto.cyclomaticComplexity = data.CyclomaticComplexity;
                    dto.linesOfCode = data.NumberOfLines;
                    dto.numberOfStatements = data.NumberOfStatements;
                    dto.basiliComplexity = data.BasiliComplexity;
                    dto.written = CollectedAnalysisData[s].written;
                }
                return dto;
            }));
        }
示例#21
0
 public void Load(FunctionDTO functionParam, ActionType actionTypeParam)
 {
     actionType = actionTypeParam;
     Function   = functionParam;
     if (actionType == ActionType.ModifyFunction)
     {
         ShowBusyIndicator();
         functionService.GetFunction((res, exp) => appController.BeginInvokeOnDispatcher(() =>
         {
             HideBusyIndicator();
             if (exp == null)
             {
                 Function = res;
             }
             else
             {
                 appController.HandleException(exp);
             }
         }),
                                     functionParam.Id);
     }
 }
示例#22
0
        public async Task <IActionResult> DeleteFunctionAsync([FromRoute] int functionId)
        {
            var function = await _functionRepository.GetFunctionByIdAsync(functionId);

            if (function == null)
            {
                throw new NotFound404Exception("function");
            }

            if (function.Code.Contains("Full"))
            {
                throw new ForbiddenException(); // can not delete 'Full' functions
            }

            function.IsDeleted   = true;
            function.UpdatedDate = DateTime.Now;
            function.UpdatedBy   = CurrentAccountId;

            await _functionRepository.UpdateFunctionAsync(function);

            return(Ok(FunctionDTO.GetFrom(function)));
        }
示例#23
0
        public async Task <IActionResult> CreatePermissionAsync([FromRoute] int groupId, [FromBody] PermissionCreateModel model)
        {
            var currentAccount = await _accountRepository.GetAccountByIdAsync(CurrentAccountId);

            if (currentAccount.GroupId > groupId)
            {
                throw new ForbiddenException(); // the lower the group id, the higher the authority; can only delete the group with authority lower than the current group
            }

            var group = await _groupRepository.GetGroupByIdAsync(groupId);

            var function = await _functionRepository.GetFunctionByIdAsync(model.FunctionId);

            if (group == null)
            {
                throw new NotFound404Exception("group");
            }

            if (function == null)
            {
                throw new NotFound400Exception("function");
            }

            if (await _groupRepository.AnyByPermissionAsync(model.FunctionId, groupId))
            {
                throw new AlreadyExistsException("function");
            }

            var permission = new Permission
            {
                FunctionId = model.FunctionId,
                GroupId    = groupId
            };

            await _groupRepository.CreatePermissionAsync(permission);

            return(Ok(FunctionDTO.GetFrom(function)));
        }
示例#24
0
    private FunctionDTO getfunctionupdateDTO()
    {
        FunctionDTO sign = new FunctionDTO();
        UserLoginDTO userLogin = getUserLogin();
        if (userLogin != null)
        {
            sign.functionId = Convert.ToInt32(hdfId.Value);
            sign.functionName = txtfunctionName.Text;
            sign.description = txtdescription.Text;
            sign.cost = float.Parse(txtcode.Text);
            sign.isDefault = checkisDefault.Checked;

        }
        return sign;
    }
示例#25
0
    public void tblFunction_Update(FunctionDTO dt)
    {
        string sql = "UPDATE tblFunction SET " +
                    "functionName = @functionName, " +
                    "cost = @cost, " +
                    "isDefault= @isDefault " +
                    " WHERE functionid = @functionid";
        SqlCommand cmd = new SqlCommand(sql, ConnectionData._MyConnection);
        cmd.CommandType = CommandType.Text;

        cmd.Parameters.Add("@functionName", SqlDbType.NVarChar).Value = dt.functionName;
        cmd.Parameters.Add("@cost", SqlDbType.Float).Value = dt.cost;
        cmd.Parameters.Add("@isDefault", SqlDbType.Bit).Value = dt.isDefault;
        cmd.Parameters.Add("@functionId", SqlDbType.Int).Value = dt.functionId;
        cmd.ExecuteNonQuery();
        cmd.Dispose();
    }
示例#26
0
 public void tblFunction_insert(FunctionDTO dt)
 {
     string sql = "INSERT INTO tblFunction (functionName, cost,isDefault,description) " +
                  "VALUES( @functionName, @cost,@isDefault,@description) ";
     SqlCommand cmd = new SqlCommand(sql, ConnectionData._MyConnection);
     cmd.CommandType = CommandType.Text;
     cmd.Parameters.Add("@functionName", SqlDbType.NVarChar).Value = dt.functionName;
     cmd.Parameters.Add("@description", SqlDbType.NVarChar).Value = dt.description;
     cmd.Parameters.Add("@cost", SqlDbType.Float).Value = dt.cost;
     cmd.Parameters.Add("@isDefault", SqlDbType.Bit).Value = dt.isDefault;
     cmd.ExecuteNonQuery();
     cmd.Dispose();
 }
示例#27
0
        public void UpdateFunction(Action <FunctionDTO, Exception> action, FunctionDTO function)
        {
            var url = string.Format(apiAddress + "?Id=" + function.Id);

            WebClientHelper.Put(new Uri(url, PMSClientConfig.UriKind), action, function, PMSClientConfig.MsgFormat, PMSClientConfig.CreateHeaderDic(userProvider.Token));
        }
示例#28
0
 public void AddFunction(Action <FunctionDTO, Exception> action, FunctionDTO function)
 {
     WebClientHelper.Post(new Uri(apiAddress, PMSClientConfig.UriKind), action, function, PMSClientConfig.MsgFormat, PMSClientConfig.CreateHeaderDic(userProvider.Token));
 }
示例#29
0
 //public void tblSignature_Update(SignatureDTO dt)
 //{
 //    //sign.tblSignature_Update(dt);
 //    sign.tblFunction_insert(dt);
 //}
 public void tblSignature_Update(FunctionDTO dt)
 {
     sign.tblFunction_Update(dt);
 }
示例#30
0
 //public void tblFunction_insert(FunctionDTO dt)
 //{
 //    //sign.tblSignature_insert(dt);
 //    sign.tblFunction_insert(dt);
 //}
 public void tblFunction_insert(FunctionDTO dt)
 {
     sign.tblFunction_insert(dt);
 }
示例#31
0
        public FunctionDTO AddFunction(FunctionDTO dto)
        {
            var res = functionService.AddFunction(dto.Name, dto.Content, new PolicyId(dto.PolicyId));

            return(functionMapper.MapToModel(res));
        }
示例#32
0
        /// <summary>
        /// 获得用户菜单
        /// </summary>
        /// <returns></returns>
        private MenuDTO GetMenuImp()
        {
            MenuDTO result = new MenuDTO();
            //1.当前user的所有function_id_list
            List <Guid> function_id_list = CubeDb.From <Mc_User_Function>()
                                           .Where(Mc_User_Function._.User_Id == User.Id)
                                           .Select(Mc_User_Function._.Function_Id)
                                           .ToList <Guid>();
            List <FunctionDTO> functionList = functionList = new List <FunctionDTO>();

            if (function_id_list != null)
            {
                functionList = CubeDb.From <Mc_Function>()
                               .Where(Mc_Function._.Id.In(function_id_list))
                               .Select(Mc_Function._.All)
                               .OrderBy(Mc_Function._.Code.Asc)
                               .ToList <FunctionDTO>();
            }

            //应对子功能有权限而父功能没有权限的情况
            List <FunctionDTO> parentFunctionList = new List <FunctionDTO>();

            foreach (FunctionDTO function in functionList)
            {
                if (function.Parent_Function_Id != null && function.Parent_Function_Id != Guid.Empty &&
                    !functionList.Exists(f => f.Id == function.Parent_Function_Id))
                {
                    FoundParentFunctionWithoutRight(function, parentFunctionList, functionList);
                }
            }
            functionList.AddRange(parentFunctionList);

            List <string>    system_id_list = functionList.Where(f => f.System_Id != null).Select(f => f.System_Id).ToList();
            List <SystemDTO> systemList     = CubeDb.From <Mc_System>()
                                              .Where(Mc_System._.Id.In(system_id_list))
                                              .Select(Mc_System._.All)
                                              .ToList <SystemDTO>();

            List <Guid>      domain_id_list = systemList.Where(s => s.Domain_Id != null).Select(s => s.Domain_Id).ToList();
            List <DomainDTO> domainList     = CubeDb.From <Mc_Domain>()
                                              .Where(Mc_Domain._.Id.In(domain_id_list))
                                              .Select(Mc_Domain._.All)
                                              .ToList <DomainDTO>();

            List <Guid>       product_id_list_from_system = systemList.Where(s => s.Product_Id != null).Select(s => s.Product_Id).ToList();
            List <Guid>       product_id_list_from_domain = domainList.Where(d => d.Product_Id != null).Select(d => d.Product_Id).ToList();
            List <Guid>       product_id_list             = product_id_list_from_system.Union(product_id_list_from_domain).ToList();
            List <ProductDTO> productList = CubeDb.From <Mc_Product>()
                                            .Where(Mc_Product._.Id.In(product_id_list))
                                            .Select(Mc_Product._.All)
                                            .ToList <ProductDTO>();

            //2.组装function
            foreach (FunctionDTO function in functionList)
            {
                function.SubFunctionList = functionList.FindAll(f => f.Parent_Function_Id != null && f.Parent_Function_Id.ToString().Equals(function.Id.ToString(), StringComparison.CurrentCultureIgnoreCase));

                if (function.Language_Key != null && !result.LanguageList.Exists(l => l.Language_Key == function.Language_Key))
                {
                    Mc_Language l = CubeDb.From <Mc_Language>()
                                    .Where(Mc_Language._.Language_Key == function.Language_Key)
                                    .Select(Mc_Language._.All)
                                    .ToList().FirstOrDefault();
                    if (l != null)
                    {
                        result.LanguageList.Add(l);
                    }
                }
            }

            //3.组装system
            foreach (SystemDTO system in systemList)
            {
                system.FunctionList = functionList.FindAll(f => (f.Parent_Function_Id == null || f.Parent_Function_Id == Guid.Empty) &&
                                                           f.System_Id != null && f.System_Id.ToString().Equals(system.Id.ToString(), StringComparison.CurrentCultureIgnoreCase));

                if (system.Language_Key != null && !result.LanguageList.Exists(l => l.Language_Key == system.Language_Key))
                {
                    Mc_Language l = CubeDb.From <Mc_Language>()
                                    .Where(Mc_Language._.Language_Key == system.Language_Key)
                                    .Select(Mc_Language._.All)
                                    .ToList().FirstOrDefault();
                    if (l != null)
                    {
                        result.LanguageList.Add(l);
                    }
                }
            }
            //System排序
            systemList = systemList.OrderBy(x => x.Code).ToList();

            //4.组装domain
            foreach (DomainDTO domain in domainList)
            {
                domain.SystemList = systemList.FindAll(s => s.Domain_Id != null &&
                                                       s.Domain_Id.ToString().Equals(domain.Id.ToString(), StringComparison.CurrentCultureIgnoreCase));
                if (domain.Language_Key != null && !result.LanguageList.Exists(l => l.Language_Key == domain.Language_Key))
                {
                    Mc_Language l = CubeDb.From <Mc_Language>()
                                    .Where(Mc_Language._.Language_Key == domain.Language_Key)
                                    .Select(Mc_Language._.All)
                                    .ToList().FirstOrDefault();
                    if (l != null)
                    {
                        result.LanguageList.Add(l);
                    }
                }
            }
            //domain排序
            domainList = domainList.OrderBy(d => d.Code).ToList();

            //5.组装product
            foreach (ProductDTO product in productList)
            {
                product.DomainList = domainList.FindAll(d => d.Product_Id != null &&
                                                        d.Product_Id.ToString().Equals(product.Id.ToString(), StringComparison.CurrentCultureIgnoreCase));
                product.SystemList = systemList.FindAll(s => (s.Domain_Id == null || s.Domain_Id == Guid.Empty) && s.Product_Id != null &&
                                                        s.Product_Id.ToString().Equals(product.Id.ToString(), StringComparison.CurrentCultureIgnoreCase));
            }

            //去除多余的Others
            ProductDTO othersProduct = new ProductDTO()
            {
                Id   = Guid.Empty,
                Name = "Others"
            };

            othersProduct.SystemList = systemList.FindAll(s => (s.Product_Id == null || s.Product_Id == Guid.Empty) &&
                                                          (s.Domain_Id == null || s.Domain_Id == Guid.Empty));
            othersProduct.DomainList = domainList.FindAll(sg => sg.Product_Id == null || sg.Product_Id == Guid.Empty);
            if (othersProduct.SystemList.Count() > 0 || othersProduct.DomainList.Count() > 0)
            {
                productList.Add(othersProduct);
            }

            if (SSOContext.IsDebug)
            {
                string     debugUrl     = System.Web.HttpUtility.UrlDecode(SSOContext.LocalDebugUrl).Replace("http://", "").Replace("https://", "");
                ProductDTO debugProduct = new ProductDTO();
                debugProduct.Id   = Guid.NewGuid();
                debugProduct.Name = "Debug";

                SystemDTO debugSystem = new SystemDTO();
                debugSystem.Code = "DEBUG";
                debugSystem.Id   = Guid.NewGuid();

                FunctionDTO debugFunction = new FunctionDTO();
                debugFunction.Code         = "DEBUG";
                debugFunction.Id           = Guid.NewGuid();
                debugFunction.Language_Key = "lang_debug";
                debugFunction.Url          = debugUrl;

                debugSystem.FunctionList.Add(debugFunction);
                debugProduct.SystemList.Add(debugSystem);
                productList.Add(debugProduct);
            }
            result.ProductList = productList;

            List <Guid> BookmarkIdList = CubeDb.From <Mc_Bookmark>()
                                         .Where(Mc_Bookmark._.User_Id == User.Id)
                                         .Select(Mc_Bookmark._.Function_Id).ToList <Guid>();
            List <FunctionDTO> bookmarkFunctionList = CubeDb.From <Mc_Function>()
                                                      .Where(Mc_Function._.Id.In(BookmarkIdList))
                                                      .Select(Mc_Function._.All)
                                                      .OrderBy(Mc_Function._.Code.Asc)
                                                      .ToList <FunctionDTO>();

            bookmarkFunctionList.RemoveAll(f => !function_id_list.Contains(f.Id));
            result.BookmarkList = bookmarkFunctionList;

            return(result);
        }
示例#33
0
        public FunctionDTO UpdateFunction(FunctionDTO dto)
        {
            var res = functionService.UppdateFunction(new RuleFunctionId(dto.Id), dto.Name, dto.Content);

            return(functionMapper.MapToModel(res));
        }
示例#34
0
 public FunctionDTO PostFunction(FunctionDTO function)
 {
     return(functionService.AddFunction(function));
 }
示例#35
0
 public FunctionDTO PutFunction(FunctionDTO function)
 {
     return(functionService.UpdateFunction(function));
 }
示例#36
0
    private FunctionDTO getfunctionDTO()
    {
        FunctionDTO sign = new FunctionDTO();
        UserLoginDTO userLogin = getUserLogin();
        if (userLogin != null)
        {
            sign.functionId = userLogin.UserId;
            sign.functionName = txtfunctionName.Text;
            sign.description = txtdescription.Text;
            sign.cost = float.Parse(txtcode.Text);
            sign.isDefault = checkisDefault.Checked;

        }
        return sign;
    }