Example #1
0
        protected SelectList GetLengthUoMOptions()
        {
            List <UnitOfMeasureDto> dtos = new List <UnitOfMeasureDto>();

            using (UnitOfMeasureService svc = new UnitOfMeasureService())
            {
                dtos.AddRange(svc.GetByTypeCode(UnitOfMeasureTypeDto.LENGTH));
            }
            return(new SelectList(dtos, "ID", "Code"));
        }
        private JsonResult GetByType(string type = "")
        {
            List <UnitOfMeasureModel> data = new List <UnitOfMeasureModel>();

            using (UnitOfMeasureService svc = new UnitOfMeasureService())
            {
                var dtos = svc.GetByTypeCode(type);
                data.AddRange(Mapper.Map <List <UnitOfMeasureDto>, List <UnitOfMeasureModel> >(dtos));
            }
            return(Json(data, JsonRequestBehavior.AllowGet));
        }
        public JsonResult GetUomsByType(string type)
        {
            var scrimRolls = new List <UnitOfMeasureModel>();

            using (var service = new UnitOfMeasureService())
            {
                var dtos = service.GetByTypeCode(type);
                scrimRolls.AddRange(Mapper.Map <List <UnitOfMeasureDto>, List <UnitOfMeasureModel> >(dtos));
            }

            return(Json(scrimRolls, JsonRequestBehavior.AllowGet));
        }
Example #4
0
        public int Add(TPOProductDto dto)
        {
            var entity = Mapper.Map <TPOProductDto, TPOProduct>(dto);

            //Need to set UseCELogo here
            entity.TPOProductCEDetail           = new TPOProductCEDetail();
            entity.TPOProductCEDetail.UseCELogo = dto.UseCELogo;
            entity.TPOProductCapCoreDetail      = new TPOProductCapCoreDetail();
            entity.TPOProductDimDetail          = new TPOProductDimDetail();
            entity.TPOProductGrabDetail         = new TPOProductGrabDetail();
            UnitOfMeasureService uomService = new UnitOfMeasureService();

            entity.TPOProductDimDetail.DimStabTempUoM = uomService.GetByTypeCode("Y").FirstOrDefault().ID;
            entity.ThickTestUoM  = uomService.GetByTypeCode("T").FirstOrDefault().ID;
            entity.ThickTestUoM2 = uomService.GetByTypeCode("T").FirstOrDefault().ID;
            entity.WidthTestUoM  = uomService.GetByTypeCode("D").FirstOrDefault().ID;
            entity.ForceTestUoM  = uomService.GetByTypeCode("F").FirstOrDefault().ID;
            entity.PunctUoM      = uomService.GetByTypeCode("W").FirstOrDefault().ID;
            try
            {
                _repository.Repository <TPOProduct>().Insert(entity);
                _repository.Save();
            }
            catch (DbEntityValidationException valEx)
            {
                HandleValidationException(valEx);
            }
            catch (Exception ex)
            {
                LogException(ex);
                throw;
            }
            return(entity.ID);
        }