示例#1
0
        public List <T001WCompositeDto> GetAuthorizdePlant(UserPlantMapGetAuthorizedPlant input)
        {
            var data = _userPlantService.GetAuthorizdePlant(input);

            //if (data.Count <= 0)
            //{
            //    //there is no user plant map setting
            //    throw new BLLException(ExceptionCodes.BLLExceptions.UserPlantMapSettingNotFound);
            //}
            return(Mapper.Map <List <T001WCompositeDto> >(data));
        }
        public List <T001W> GetAuthorizdePlant(UserPlantMapGetAuthorizedPlant input)
        {
            Expression <Func <USER_PLANT_MAP, bool> > queryFilter = c => c.USER_ID == input.UserId && c.T001W.T001K.BUKRS == input.CompanyCode &&
                                                                    (c.T001W.NPPBKC_ID == input.NppbkcId || c.T001W.NPPBKC_IMPORT_ID == input.NppbkcId);
            var dataMap = _repository.Get(queryFilter, null, "T001W, T001W.T001K").ToList();

            if (dataMap.Count == 0)
            {
                return(new List <T001W>());
            }
            var plantList = dataMap.Where(c => c.T001W != null && (!c.T001W.IS_DELETED.HasValue || !c.T001W.IS_DELETED.Value)).Select(d => d.T001W).Distinct().ToList();

            return(plantList);
        }