Esempio n. 1
0
        public StringModel ToStringModel <BLModel, StringModel>()
        {
            Mapper.CreateMap <OrderExport, StringOrderExport>()
            .ForAllMembers(item => item.ToString().CutDownTo(50));

            var stringModel = Mapper.Map <OrderExport, StringOrderExport>(this);

            stringModel.UnitCost   = UnitCost.DecimalToString(2);
            stringModel.ExportDate = ExportDate.DateTimeToString();

            stringModel.ItemDescription  = ItemDescription.CutDownTo(50);
            stringModel.LeadTime         = LeadTime.DecimalToString(2);
            stringModel.EstimateOfDemand = EstimateOfDemand.DecimalToString(2);

            stringModel.Returnable = Returnable.CutDownTo(1);
            stringModel.Stocked    = Stocked.CutDownTo(1);
            stringModel.Hazardous  = Hazardous.CutDownTo(1);
            stringModel.DueDate    = DueDate.DateTimeToString();


            Mapper.CreateMap <StringOrderExport, StringModel>();
            var stringModelRet = Mapper.Map <StringOrderExport, StringModel>(stringModel);


            return(stringModelRet);
        }