Exemplo n.º 1
0
        public ActionResult ReadAjaxServiceFunctionGrid([DataSourceRequest] DataSourceRequest request,
                                                        int?serviceDomainId)
        {
            DataSourceResult result = null;

            try
            {
                if (_appUserContext.Current.CurrentCustomer != null &&
                    _appUserContext.Current.CurrentCustomer.Id > 0 &&
                    serviceDomainId != null &&
                    serviceDomainId > 0)
                {
                    result = _serviceFunctionService
                             .ServiceDomainFunctions(serviceDomainId.Value)
                             .ToDataSourceResult(request, Mapper.Map <ServiceFunctionListItem, ServiceFunctionViewModel>);
                }
                else
                {
                    result = _serviceFunctionService
                             .CustomerServiceFunctions(_appUserContext.Current.CurrentCustomer.Id)
                             .ToDataSourceResult(request, Mapper.Map <ServiceFunctionListItem, ServiceFunctionViewModel>);
                }
            }
            catch (Exception ex)
            {
                _contextManager.ResponseManager.StatusCode = 500;
                _contextManager.ResponseManager.AppendHeader(ModelStateErrorNames.ErrorMessage, ex.Message);
            }

            return(Json(result));
        }
Exemplo n.º 2
0
        public ActionResult Index(string level)
        {
            var serviceFunctionCount = _serviceFunctionService
                                       .CustomerServiceFunctions(_appUserContext.Current.CurrentCustomer.Id)
                                       .Select(s => s.Id)
                                       .Count();

            var model = new ViewServiceComponentViewModel()
            {
                EditLevel = level,
                CanMoveServiceComponent = serviceFunctionCount > 1
            };

            return(View(level, model));
        }
        public void ServiceFunctionService_CustomerServiceFunctions_CallsRepositoryQuery()
        {
            #region Arrange

            #endregion

            #region Act

            _serviceFunctionService.CustomerServiceFunctions(1);

            #endregion

            #region Assert

            _mockServiceFunctionRepository.Verify(x => x.Query(It.IsAny <Expression <Func <ServiceFunction, bool> > >()), Times.Once);

            #endregion
        }
 protected List <SelectListItem> GetServiceFunctionHierarchy()
 {
     return(_serviceFunctionService
            .CustomerServiceFunctions(_appUserContext.Current.CurrentCustomer.Id)
            .Select(x => new SelectListItem
     {
         Text = string.Concat(x.ServiceDeskName,
                              UnicodeCharacters.DoubleArrowRight,
                              x.ServiceDomainName,
                              UnicodeCharacters.DoubleArrowRight,
                              x.AlternativeName ?? x.FunctionName),
         Value = x.Id.ToString()
     })
            .ToList());
 }