public DetailResponse GetDetail(DetailRequest request)
        {
            var contentInformation = _grabber.GetDetail(request.StreamId);
            var vodInformation     = _transcoder.GetAvailableVoDs(contentInformation.ContentLocation);

            return(new DetailResponse(contentInformation, vodInformation));
        }
Ejemplo n.º 2
0
        public IActionResult Detail([FromBody] DetailRequest detail)
        {
            if (detail is null || String.IsNullOrWhiteSpace(detail.CarId))
            {
                return(BadRequest(new ErrorModel
                {
                    CauseValue = "whitespace",
                    CauseValueName = nameof(detail),
                    Message = "Invalid id!"
                }));
            }

            Car car = _repo.FindAndLoadPremise(detail.CarId);

            if (car is null)
            {
                return(NotFound("Car not found!"));
            }

            return(Ok(new DetailDto
            {
                Id = car.Id,
                Brand = car.Brand,
                Model = car.Model,
                Colour = car.Colour,
                LicensePlate = car.LicensePlate,
                EngineDescription = car.EngineDescription,
                Mileage = car.Mileage,
                ImagePath = car.ImagePath,
                PremiseName = car.Premise.Name + ", " + car.Premise.Address,
                Rented = car.RentingId != null
            }));
        }
Ejemplo n.º 3
0
        private async Task initDetailView()
        {
            DetailRequest detailRequest = new DetailRequest(calendarId);
            RestfulClient <DetailResponse> detailRestful = new RestfulClient <DetailResponse>(detailRequest);

            detailResponse = await detailRestful.GetResponse();

            this.img_picture.Source = new BitmapImage(new Uri(detailResponse.picture, UriKind.Absolute));
            txt_author.Content      = detailResponse.creatorName;
            txt_content.Content     = detailResponse.description;
            txt_title.Content       = detailResponse.title;
        }
Ejemplo n.º 4
0
        public IGenericResponseResult ExpandCompositions(String application, [FromUri] DetailRequest detailRequest,
                                                         [FromUri] CompositionExpanderHelper.CompositionExpansionOptions options)
        {
            var user = SecurityFacade.CurrentUser();
            var applicationMetadata = MetadataProvider
                                      .Application(application)
                                      .ApplyPolicies(detailRequest.Key, user, ClientPlatform.Web);
            //            var result = (ApplicationDetailResult)DataSetProvider.LookupAsBaseDataSet(application).Get(applicationMetadata, user, detailRequest);
            var compositionSchemas = CompositionBuilder.InitializeCompositionSchemas(applicationMetadata.Schema);

            return(COMPOSITIONExpander.Expand(SecurityFacade.CurrentUser(), compositionSchemas, options));
        }
        public void AddElement(RequestBindingModel model)
        {
            using (var transaction = context.Database.BeginTransaction())
            {
                try
                {
                    var request = new Request
                    {
                        DateCreate = model.DateCreate
                    };

                    context.Requests.Add(request);
                    context.SaveChanges();

                    var groupDetails = model.DetailRequests
                                       .GroupBy(record => record.DetailId)
                                       .Select(record => new { detailId = record.Key, amount = record.Sum(r => r.Amount) });

                    foreach (var gr in groupDetails)
                    {
                        var detailRequest = new DetailRequest
                        {
                            RequestId = request.Id,
                            DetailId  = gr.detailId,
                            Amount    = gr.amount
                        };

                        context.DetailRequests.Add(detailRequest);
                        context.SaveChanges();

                        var updateDetail = context.Details.FirstOrDefault(record => record.Id == detailRequest.DetailId);

                        if (updateDetail == null)
                        {
                            continue;
                        }
                        updateDetail.TotalAmount += detailRequest.Amount;
                        context.SaveChanges();
                    }

                    transaction.Commit();
                }

                catch (Exception)
                {
                    transaction.Rollback();
                    throw;
                }
            }
        }
Ejemplo n.º 6
0
        public override Task <Detail> GetDetailByName(DetailRequest request, ServerCallContext context)
        {
            var props = properties.FirstOrDefault(t => t.Name.Equals(request.Name));

            if (props != null)
            {
                var d = new Detail {
                    Name = props.Name, Location = new Point {
                        Latitude = (int)props.Location.Lat, Longitude = (int)props.Location.Lon
                    }
                };
                return(Task.FromResult(d));
            }
            return(Task.FromResult(new Detail()));
        }
Ejemplo n.º 7
0
        public async Task <Detail15AResponse> GetDetailsAsync(string id, string accountId, string token)
        {
            var body = new DetailRequest
            {
                Uuid      = id,
                AccountId = accountId,
                Token     = token
            };

            var result = await BaseUrl
                         .AppendPathSegments("15a/v1/device/devicedetail")
                         .PostJsonAsync(body)
                         .ReceiveString()
                         .ConfigureAwait(false);

            return(JsonConvert.DeserializeObject <Detail15AResponse>(result));
        }
Ejemplo n.º 8
0
        public async Task GetDetailByName(string name)
        {
            try
            {
                Log("*** GetDetail: {0}", name);
                var request = new DetailRequest {
                    Name = name
                };
                var result = await _client.GetDetailByNameAsync(request);

                Log("detail found {1} with {0}", result.Name, result.Location != null);
            }
            catch (RpcException e)
            {
                Log("RPC failed " + e);
                throw;
            }
        }
Ejemplo n.º 9
0
        public IApplicationResponse RedirectToNextSchema(ApplicationMetadata applicationMetadata, string operation, string id, ClientPlatform platform,
                                                         ApplicationMetadataSchemaKey currentschemaKey, ApplicationMetadataSchemaKey nextSchemaKey, bool maximoMocked = false)
        {
            var applicationName = applicationMetadata.Name;

            if (nextSchemaKey == null)
            {
                if (HasActionRedirectionDefinedByProperties(applicationMetadata.Schema, operation))
                {
                    return(ActionRedirection(applicationMetadata.Schema, operation));
                }
                nextSchemaKey = ResolveNextSchemaKey(operation, currentschemaKey, platform, applicationMetadata);
            }
            //            var applicationName = currentMetadata.Name;
            var metadata     = MetadataProvider.Application(applicationName);
            var resultSchema = metadata.Schema(nextSchemaKey, true);
            var user         = SecurityFacade.CurrentUser();
            var nextMetadata = metadata.ApplyPolicies(nextSchemaKey, user, ClientPlatform.Web);
            var dataSet      = _dataSetProvider.LookupAsBaseDataSet(applicationName);

            if (resultSchema.Stereotype == SchemaStereotype.Detail)
            {
                if (maximoMocked && id == null)
                {
                    return(mockUtils.GetMockedDataMap(applicationName, resultSchema, nextMetadata));
                }
                var detailRequest = new DetailRequest(nextSchemaKey, null)
                {
                    Id = id
                };
                detailRequest.CompositionsToFetch = operation != OperationConstants.CRUD_CREATE ? "#all" : null;
                var response = dataSet.Get(nextMetadata, SecurityFacade.CurrentUser(), detailRequest);
                return(response);
            }
            if (resultSchema.Stereotype == SchemaStereotype.List)
            {
                var paginatedSearchRequestDto = PaginatedSearchRequestDto.DefaultInstance(resultSchema);
                return(dataSet.Get(nextMetadata, user, new DataRequestAdapter(paginatedSearchRequestDto)));
            }
            throw new NotImplementedException("missing implementation for this kind of schema redirection");
        }
Ejemplo n.º 10
0
        public IActionResult Delete([FromBody] DetailRequest value)
        {
            if (value is null || String.IsNullOrWhiteSpace(value.CarId))
            {
                return(BadRequest(new ErrorModel
                {
                    Message = "Car Id is not set!"
                }));
            }

            Car car = _repo.Find(value.CarId);

            if (car is null)
            {
                return(NoContent());
            }

            _repo.Delete(car.Id);
            _repo.Save();

            return(Ok());
        }
Ejemplo n.º 11
0
        public IApplicationResponse Get(ApplicationMetadata application, InMemoryUser user, IDataRequest request)
        {
            var adapter = request as DataRequestAdapter;

            if (adapter != null)
            {
                if (adapter.SearchDTO != null)
                {
                    request = adapter.SearchDTO;
                }
                else if (adapter.Id != null)
                {
                    request = DetailRequest.GetInstance(application, adapter);
                }
            }

            if (request is PaginatedSearchRequestDto)
            {
                return(GetList(application, (PaginatedSearchRequestDto)request));
            }
            if (request is DetailRequest)
            {
                try {
                    return(GetApplicationDetail(application, user, (DetailRequest)request));
                } catch (InvalidOperationException e) {
                    return(new ApplicationDetailResult(null, null, application.Schema, null, ((DetailRequest)request).Id));
                }
            }
            if (application.Schema.Stereotype == SchemaStereotype.List)
            {
                return(GetList(application, PaginatedSearchRequestDto.DefaultInstance(application.Schema)));
            }
            if (application.Schema.Stereotype == SchemaStereotype.Detail || request.Key.Mode == SchemaMode.input)
            {
                //case of detail of new items
                return(GetApplicationDetail(application, user, DetailRequest.GetInstance(application, adapter)));
            }
            throw new InvalidOperationException("could not determine which operation to take upon request");
        }
 public void UpdateDetailRequest(DetailRequest detail)
 {
     this.otContext.Entry(detail).State = EntityState.Modified;
     this.otContext.SaveChanges();
 }
Ejemplo n.º 13
0
        protected override ApplicationDetailResult GetApplicationDetail(ApplicationMetadata application, InMemoryUser user, DetailRequest request)
        {
            var dbDetail     = base.GetApplicationDetail(application, user, request);
            var resultObject = dbDetail.ResultObject;

            if (application.Schema.Mode == SchemaMode.output)
            {
                HandleClosedDate(resultObject);
            }
            return(dbDetail);
        }
Ejemplo n.º 14
0
        protected override ApplicationDetailResult GetApplicationDetail(ApplicationMetadata application, InMemoryUser user, DetailRequest request)
        {
            var baseDetail = base.GetApplicationDetail(application, user, request);

            FetchRemarks(baseDetail.ResultObject);
            return(baseDetail);
        }
Ejemplo n.º 15
0
        protected override ApplicationDetailResult GetApplicationDetail(ApplicationMetadata application, InMemoryUser user, DetailRequest request)
        {
            var dataResponse = base.GetApplicationDetail(application, user, request);
            var lang         = !string.IsNullOrEmpty(request.Lang) ? request.Lang : "E";

            dataResponse.ResultObject.Attributes["faqid"] = request.Faqid;
            BuildAttachments(request.Faqid, dataResponse);


            return(dataResponse);
        }
 public ActionResult <DetailResponse> GetDetail(DetailRequest request)
 {
     _logger.LogTrace($"{Request.HttpContext.Connection.RemoteIpAddress}: POST {Request.Host}{Request.Path}");
     _authHandler.CheckToken(request.Token);
     return(_serverManager.GetDetail(request));
 }
Ejemplo n.º 17
0
        protected override ApplicationDetailResult GetApplicationDetail(ApplicationMetadata application, InMemoryUser user, DetailRequest request)
        {
            var ctx = _context.LookupContext();

            if (ctx.ApplicationLookupContext == null)
            {
                ctx.ApplicationLookupContext = new ApplicationLookupContext();
            }
            ctx.ApplicationLookupContext.MetadataId = "changedetail";

            return(base.GetApplicationDetail(application, user, request));
        }
Ejemplo n.º 18
0
        protected override ApplicationDetailResult GetApplicationDetail(ApplicationMetadata application,
                                                                        InMemoryUser user, DetailRequest request)
        {
            var isCreationFromAsset = request.InitialValues != null && request.InitialValues.ContainsAttribute("assetnum");

            if (isCreationFromAsset)
            {
                //if the asset is pre selected, we need to determine the right schema out of it (either, printer,phone or general)
                application = DetermineSchemaFromAsset(request.InitialValues);
                AdjustInitialValues(request.InitialValues);
            }

            request.AssociationsToFetch = isCreationFromAsset ? "#all" : "fromlocation";

            var result = base.GetApplicationDetail(application, user, request);

            if (isCreationFromAsset)
            {
                UpdateAssetDependants(application, result);
            }
            result.AllassociationsFetched = isCreationFromAsset;
            if (request.Id != null)
            {
                if (ContextLookuper.LookupContext().IsInModule(FunctionalRole.XItc) && !user.Genericproperties.ContainsKey(HapagPersonGroupConstants.HlagLocationXITCProperty))
                {
                    //HAP-1017 , for XITC we need to fill the list of "sub" locations so that these job plan actions of them become also available
                    //TODO: move to a better place...
                    var allGroups  = LocationManager.GetLocationsOfLoggedUser();
                    var xitcgroups = new HashSet <string>();
                    foreach (var hlagGroupedLocation in allGroups)
                    {
                        var descriptions = hlagGroupedLocation.GetGroupDescriptions();
                        foreach (var description in descriptions)
                        {
                            xitcgroups.Add(description);
                        }
                    }
                    user.Genericproperties[HapagPersonGroupConstants.HlagLocationXITCProperty] = xitcgroups;
                }
                //need to fill in service type from swdb
            }
            return(result);
        }
 public void AddDetailRequest(DetailRequest detail)
 {
     this.otContext.DetailRequests.Add(detail);
     this.otContext.SaveChanges();
 }
        protected override ApplicationDetailResult GetApplicationDetail(ApplicationMetadata application, InMemoryUser user, DetailRequest request)
        {
            //this means that we are creating the service request from an asset
            var isCreationFromAsset = request.InitialValues != null && request.InitialValues.ContainsAttribute("assetnum");

            if (isCreationFromAsset)
            {
                //if the asset is pre selected, we need to determine the right schema out of it (either, printer,phone or general)
                application = DetermineSchemaFromAsset(request.InitialValues);
                AdjustInitialValues(request.InitialValues, application.Schema.SchemaId);
                request.AssociationsToFetch = "#all";
            }
            if (application.Schema.SchemaId == "changedetail")
            {
                _contextLookuper.LookupContext().ApplicationLookupContext.MetadataId = "changedetail";
            }

            var dbDetail     = base.GetApplicationDetail(application, user, request);
            var resultObject = dbDetail.ResultObject;

            if (resultObject == null)
            {
                //it happens only if we´re pointint to a database different then the ws impl
                return(dbDetail);
            }

            if (application.Schema.SchemaId == "creationSummary")
            {
                HandleCreationSummary(resultObject);
            }
            var usefulFaqLinksUtils = GetUsefulFaqLinksUtils(application.Schema);

            if (usefulFaqLinksUtils.Count > 0)
            {
                HandleUsefulFaqLinks(resultObject, usefulFaqLinksUtils);
            }

            if (application.Schema.Mode == SchemaMode.input)
            {
                HandleAffectDateAndTime(resultObject, application);
            }
            else if (application.Schema.Mode == SchemaMode.output)
            {
                HandleClosedDate(resultObject, application);
            }
            dbDetail.AllassociationsFetched = isCreationFromAsset;
            return(dbDetail);
        }
Ejemplo n.º 21
0
        protected virtual ApplicationDetailResult GetApplicationDetail(ApplicationMetadata application, InMemoryUser user, DetailRequest request)
        {
            var     id             = request.Id;
            var     entityMetadata = MetadataProvider.SlicedEntityMetadata(application);
            var     applicationCompositionSchemas = CompositionBuilder.InitializeCompositionSchemas(application.Schema);
            DataMap datamap;

            if (id == null)
            {
                datamap = DefaultValuesBuilder.BuildDefaultValuesDataMap(application, request.InitialValues);
            }
            else
            {
                datamap =
                    (DataMap)
                    _maximoConnectorEngine.FindById(application.Schema, entityMetadata, id);
                if (datamap == null)
                {
                    throw new InvalidOperationException("You don´t have enough permissions to see that register. contact your administrator");
                }

                var prefetchCompositions = "true".EqualsIc(application.Schema.GetProperty(ApplicationSchemaPropertiesCatalog.PreFetchCompositions)) || "#all".Equals(request.CompositionsToFetch);
                var compostionsToUse     = new Dictionary <string, ApplicationCompositionSchema>();
                foreach (var compositionEntry in applicationCompositionSchemas)
                {
                    if (prefetchCompositions || FetchType.Eager.Equals(compositionEntry.Value.FetchType) || compositionEntry.Value.INLINE)
                    {
                        compostionsToUse.Add(compositionEntry.Key, compositionEntry.Value);
                    }
                }
                if (compostionsToUse.Any())
                {
                    GetCompositionData(application, new PreFetchedCompositionFetchRequest(new List <AttributeHolder> {
                        datamap
                    }), null);
                }
            }

            var associationResults = BuildAssociationOptions(datamap, application, request);
            var detailResult       = new ApplicationDetailResult(datamap, associationResults, application.Schema, applicationCompositionSchemas, id);

            return(detailResult);
        }
Ejemplo n.º 22
0
        protected override ApplicationDetailResult GetApplicationDetail(ApplicationMetadata application, InMemoryUser user, DetailRequest request)
        {
            var dbDetail     = base.GetApplicationDetail(application, user, request);
            var resultObject = dbDetail.ResultObject;

            if (resultObject != null && application.Schema.SchemaId == "detail" && application.Schema.Mode == SchemaMode.output)
            {
                HandleAssetTree(resultObject);
                FetchRemarks(resultObject);
                JoinHistoryData(resultObject);
                FillCreationFromAssetData(resultObject);
            }
            return(dbDetail);
        }
Ejemplo n.º 23
0
        protected override ApplicationDetailResult GetApplicationDetail(ApplicationMetadata application, InMemoryUser user, DetailRequest request)
        {
            var dbDetail     = base.GetApplicationDetail(application, user, request);
            var resultObject = dbDetail.ResultObject;

            if (resultObject == null)
            {
                //it happens only if we´re pointint to a database different then the ws impl
                return(dbDetail);
            }

            if (application.Schema.SchemaId == "creationSummary")
            {
                HandleCreationSummary(resultObject);
            }

            return(dbDetail);
        }
Ejemplo n.º 24
0
        protected override ApplicationDetailResult GetApplicationDetail(ApplicationMetadata application,
                                                                        InMemoryUser user, DetailRequest request)
        {
            var baseDetail   = base.GetApplicationDetail(application, user, request);
            var resultObject = baseDetail.ResultObject;

            resultObject.SetAttribute("minstartdate", DateUtil.BeginOfDay(DateTime.Now.AddBusinessDays(3)));
            resultObject.SetAttribute("explanation", Resolver.I18NValue("offering.explanation", Explanation));
            return(baseDetail);
        }