Esempio n. 1
0
        public async Task <PositionFOCGetRes> GetPositionFOC([FromBody] PositionFOCGetReq request)
        {
            var response = new PositionFOCGetRes();

            try
            {
                if (!string.IsNullOrEmpty(request.PositionId))
                {
                    PositionFOCGetRes result = await _positionRepository.GetPositionFOC(request);

                    response.ResponseStatus.Status       = "Success";
                    response.ResponseStatus.ErrorMessage = (result != null && result.PositionFOC != null) ? "" : "No Records Found.";
                    response.StandardFOC = result.StandardFOC;
                    response.PositionFOC = result.PositionFOC;
                }
                else
                {
                    response.ResponseStatus.Status       = "Failure";
                    response.ResponseStatus.ErrorMessage = "PositionId can not be Null/Zero.";
                }
            }
            catch (Exception ex)
            {
                response.ResponseStatus.Status       = "Failure";
                response.ResponseStatus.ErrorMessage = "An Error Occurs :- " + ex.Message;
            }

            return(response);
        }
Esempio n. 2
0
        public async Task <PositionFOCGetRes> GetPostionFOC(PositionFOCGetReq positionFOCGetReq, string ticket)
        {
            PositionFOCGetRes positionFOCGetRes = new PositionFOCGetRes();

            positionFOCGetRes = await serviceProxy.PostData(_configuration.GetValue <string>("ServicePosition:GetPositionFOC"), positionFOCGetReq, typeof(PositionFOCGetRes), ticket);

            return(positionFOCGetRes);
        }
Esempio n. 3
0
        public ActionResult GetPositionFOCPartView(PositionFOCGetReq request)
        {
            PositionFOCGetRes response = new PositionFOCGetRes();

            response = positionProviders.GetPostionFOC(request, token).Result;

            PositionFOCViewModel model = new PositionFOCViewModel {
                StandardFoc = (response.StandardFOC == null || response.StandardFOC == true) ? true : false
            };

            var ProdRangeList = response.PositionFOC.Select(a => new { a.ProductRange, a.ProductRangeId }).Distinct().ToList();

            foreach (var ProdRange in ProdRangeList)
            {
                var IsExist = model.PositionFOCData.Where(a => a.ProductRangeId == ProdRange.ProductRangeId).FirstOrDefault();
                if (IsExist == null)
                {
                    var FOCList = response.PositionFOC.Where(a => a.ProductRangeId == ProdRange.ProductRangeId).Select(a => new { a.ProductRange, a.ProductRangeId, a.FOCQty }).Distinct().ToList();
                    if (FOCList?.Count == 1)
                    {
                        model.PositionFOCData.AddRange(FOCList.Select(a => new PositionFOCData
                        {
                            QRFID           = request.QRFID,
                            PositionId      = request.PositionId,
                            Period          = "ALL",
                            CityName        = "ALL",
                            ProductName     = "ALL",
                            PaxSlab         = "ALL",
                            Type            = "ALL",
                            ProductCategory = "ALL",
                            FOCQty          = a.FOCQty,
                            ProductRange    = a.ProductRange,
                            ProductRangeId  = a.ProductRangeId
                        }));
                    }
                    else
                    {
                        model.PositionFOCData.Add(new PositionFOCData
                        {
                            QRFID           = request.QRFID,
                            PositionId      = request.PositionId,
                            Period          = "ALL",
                            CityName        = "ALL",
                            ProductName     = "ALL",
                            PaxSlab         = "ALL",
                            Type            = "ALL",
                            ProductCategory = "ALL",
                            FOCQty          = 0,
                            ProductRange    = FOCList[0].ProductRange,
                            ProductRangeId  = FOCList[0].ProductRangeId
                        });
                    }
                }
            }

            model.PositionFOCData.AddRange(response.PositionFOC.Select(a => new PositionFOCData
            {
                PositionFOCId     = a.PositionFOCId,
                QRFID             = a.QRFID,
                PositionId        = a.PositionId,
                DepartureId       = a.DepartureId,
                Period            = a.Period.ToString(),
                PaxSlabId         = a.PaxSlabId,
                PaxSlab           = a.PaxSlab,
                Type              = a.Type,
                RoomId            = a.RoomId,
                IsSupplement      = a.IsSupplement,
                SupplierId        = a.SupplierId,
                Supplier          = a.Supplier,
                ProductCategoryId = a.ProductCategoryId,
                ProductCategory   = a.ProductCategory,
                ProductRangeId    = a.ProductRangeId,
                ProductRange      = a.ProductRange,
                ContractId        = a.ContractId,
                CityId            = a.CityId,
                CityName          = a.CityName,
                ProductId         = a.ProductId,
                ProductName       = a.ProductName,
                Quantity          = a.Quantity,
                FOCQty            = a.FOCQty
            }));

            return(PartialView("_PositionFOC", model));
        }