Ejemplo n.º 1
0
        public override EstateRent Create([FromBody] EstateRent viewModel)
        {
            var  documentList = new List <Overtech.DataModels.Document.Document>();
            long folderId     = viewModel.RentFolderHandle.tempFolderId;

            if (viewModel.RentFolderHandle.folderId.HasValue)
            {
                folderId = viewModel.RentFolderHandle.folderId.Value;
            }

            if (folderId > 0)
            {
                viewModel.ContractFolder = folderId;
                foreach (var documentHandle in viewModel.RentFolderHandle.documents)
                {
                    if (documentHandle.tempDocumentId > 0)
                    {
                        var document = _documentService.Read(documentHandle.tempDocumentId);
                        documentList.Add(document);
                    }
                }
            }
            IMapperConfig mapperConfig = estateRentCreatedMapperConfig();

            DataModels.Finance.EstateRent dataModel = viewModel.Map <DataModels.Finance.EstateRent, ViewModels.Finance.EstateRent>(mapperConfig);

            dataModel.DocumentList = documentList;

            return(_dataService.Create(dataModel).Map <DataModels.Finance.EstateRent, ViewModels.Finance.EstateRent>(mapperConfig));
        }
Ejemplo n.º 2
0
        public override ViewModels.Announcement.Notification Create([FromBody] ViewModels.Announcement.Notification viewModel)
        {
            var  documentList = new List <Overtech.DataModels.Document.Document>();
            long folderId     = viewModel.FolderHandle.tempFolderId;

            if (viewModel.FolderHandle.folderId.HasValue)
            {
                folderId = viewModel.FolderHandle.folderId.Value;
            }

            if (folderId > 0)
            {
                viewModel.Folder = folderId;
                foreach (var documentHandle in viewModel.FolderHandle.documents)
                {
                    if (documentHandle.tempDocumentId > 0)
                    {
                        var document = _documentService.Read(documentHandle.tempDocumentId);
                        documentList.Add(document);
                    }
                }
            }

            IMapperConfig mapperConfig = notificationCreatedMapperConfig();

            DataModels.Announcement.Notification dataModel = viewModel.Map <DataModels.Announcement.Notification, ViewModels.Announcement.Notification>(mapperConfig);

            dataModel.DocumentList = documentList;

            return(_dataService.Create(dataModel).Map <DataModels.Announcement.Notification, ViewModels.Announcement.Notification>(mapperConfig));
        }
Ejemplo n.º 3
0
        public ViewModels.Warehouse.WDashboardGathering WDashboardGathering(int gatheringType)
        {
            IMapperConfig mapperConfig = MapperConfig.Init()
                                         .CreateMap <DataModels.Warehouse.WDashboardGathering, ViewModels.Warehouse.WDashboardGathering>()
                                         .CreateMap <DataModels.Warehouse.WDGatherPerformanceSummary, ViewModels.Warehouse.WDGatherPerformanceSummary>()
                                         .CreateMap <DataModels.Warehouse.WDGatheringTrend, ViewModels.Warehouse.WDGatheringTrend>();

            return(_dataService.GetWDashboardGatheringInfo(gatheringType).Map <DataModels.Warehouse.WDashboardGathering, ViewModels.Warehouse.WDashboardGathering>(mapperConfig));
        }
Ejemplo n.º 4
0
        public ViewModels.Warehouse.WDashboardOrder WDashboardOrder()
        {
            IMapperConfig mapperConfig = MapperConfig.Init()
                                         .CreateMap <DataModels.Warehouse.WDashboardOrder, ViewModels.Warehouse.WDashboardOrder>()
                                         .CreateMap <DataModels.Warehouse.WDWidgetData, ViewModels.Warehouse.WDWidgetData>()
                                         .CreateMap <DataModels.Warehouse.WDGatheringDifference, ViewModels.Warehouse.WDGatheringDifference>()
                                         .CreateMap <DataModels.Warehouse.OrderTrend, ViewModels.Warehouse.OrderTrend>();

            return(_dataService.GetWDashboardOrderInfo().Map <DataModels.Warehouse.WDashboardOrder, ViewModels.Warehouse.WDashboardOrder>(mapperConfig));
        }
Ejemplo n.º 5
0
        public DataSourceResult List([System.Web.Http.ModelBinding.ModelBinder(typeof(WebApiDataSourceRequestModelBinder))] DataSourceRequest request)
        {
            ActionOperations actionOperations = new ActionOperations(OTApplication.Context.User.Id);
            IEnumerable <Overtech.Shared.BPM.InboxItem> inboxItems = actionOperations.ListPendingActions(null);

            inboxItems.Localize(item => item.ProcessDefinitionName).ToList();

            IMapperConfig mapperConfig = MapperConfig.Init();

            mapperConfig.CreateMap <Overtech.Shared.BPM.InboxItem, OverStoreInboxItem>();
            IMapper mapper = mapperConfig.CreateMapper();

            IEnumerable <OverStoreInboxItem> mayaInboxItems = inboxItems.Select(item => new OverStoreInboxItem(item, mapper)).OrderByDescending(item => item.ActionId).ToList();

            return(mayaInboxItems.ToDataSourceResult(request));
        }
Ejemplo n.º 6
0
        public virtual IGenericGraph MapToGraph(IInputSource source, IMapperConfig config)
        {
            IGenericGraph OutputGraph = new T();

            cancelled = false;
            foreach (IStatementsConfig entityConfig in config.ListStatementsConfigs())
            {
                if (cancelled)
                {
                    statementAssembler.StopTask();
                    break;
                }
                OutputGraph.Merge(statementAssembler.AssembleEntityStatements(source, entityConfig, config.ListNamespaces()));
            }

            return(OutputGraph);
        }
Ejemplo n.º 7
0
        public override void Update(ViewModels.Announcement.Notification viewModel)
        {
            IMapperConfig mapperConfig = notificationCreatedMapperConfig();

            DataModels.Announcement.Notification dataModel = viewModel.Map <DataModels.Announcement.Notification, ViewModels.Announcement.Notification>(mapperConfig);

            var documentList = new List <Overtech.DataModels.Document.Document>();

            foreach (var documentHandle in viewModel.FolderHandle.documents)
            {
                if (documentHandle.tempDocumentId > 0)
                {
                    var document = _documentService.Read(documentHandle.tempDocumentId);
                    documentList.Add(document);
                }
            }
            dataModel.DocumentList = documentList;
            _dataService.Update(dataModel);
        }
Ejemplo n.º 8
0
        public override void Update(EstateRent viewModel)
        {
            IMapperConfig mapperConfig = estateRentCreatedMapperConfig();

            DataModels.Finance.EstateRent dataModel = viewModel.Map <DataModels.Finance.EstateRent, ViewModels.Finance.EstateRent>(mapperConfig);

            var documentList = new List <Overtech.DataModels.Document.Document>();

            foreach (var documentHandle in viewModel.RentFolderHandle.documents)
            {
                if (documentHandle.tempDocumentId > 0)
                {
                    var document = _documentService.Read(documentHandle.tempDocumentId);
                    documentList.Add(document);
                }
            }
            dataModel.DocumentList = documentList;
            _dataService.Update(dataModel);
        }
Ejemplo n.º 9
0
        public override FirmContact AddLeft([FromBody] FirmContact viewModel)
        {
            try
            {
                IMapperConfig mapperConfig = MapperConfig.Init().CreateMap <Overtech.DataModels.Accounting.FirmContact, Overtech.ViewModels.Accounting.FirmContact>()
                                             .CreateMap <Overtech.DataModels.Contact.Contact, Overtech.ViewModels.Contact.Contact>()
                                             .CreateMap <Overtech.DataModels.Contact.Address, Overtech.ViewModels.Contact.Address>()
                                             .CreateMap <Overtech.DataModels.Contact.Web, Overtech.ViewModels.Contact.Web>()
                                             .CreateMap <Overtech.DataModels.Contact.Phone, Overtech.ViewModels.Contact.Phone>();

                DataModels.Accounting.FirmContact dataModel = viewModel.Map <DataModels.Accounting.FirmContact, FirmContact>(mapperConfig);
                dataModel = _dataService.Create(dataModel);
                FirmContact createdModel = dataModel.Map <DataModels.Accounting.FirmContact, FirmContact>(mapperConfig);

                return(createdModel);
            }
            catch (Exception ex)
            {
                throw CreateUserException(ex, MethodBase.GetCurrentMethod().Name);
            }
        }
Ejemplo n.º 10
0
        public void SetUp()
        {
            //Mock creation
            _mockInputSource  = Mock.Of <IInputSource>();
            _mockMapperConfig = Mock.Of <IMapperConfig>();
            IStatementsConfig   statementsConfig = Mock.Of <IStatementsConfig>();
            IStatementAssembler assemblerMock    = Mock.Of <IStatementAssembler>();

            //Mock setups
            Mock.Get(_mockMapperConfig)
            .Setup(f => f.ListNamespaces())
            .Returns(new Dictionary <string, string>()
            {
                { "prefix1", "ns1" },
                { "prefix2", "ns2" }
            });

            Mock.Get(_mockMapperConfig)
            .Setup(f => f.ListStatementsConfigs())
            .Returns(new List <IStatementsConfig>()
            {
                statementsConfig
            });

            //Instance creation
            BindingFlags flags = BindingFlags.NonPublic | BindingFlags.Instance;

            _graphMapper = (T)Activator.CreateInstance(typeof(T), flags, null, new object[] { assemblerMock }, null);

            //Fake setup
            IGenericGraph fakeGraph = (IGenericGraph)Activator.CreateInstance(_graphMapper.GetGraphType());

            //Mock setup
            Mock.Get(assemblerMock)
            .Setup(f => f.AssembleEntityStatements(
                       It.IsAny <IInputSource>(),
                       It.IsAny <IStatementsConfig>(),
                       It.IsAny <IDictionary <string, string> >()))
            .Returns(fakeGraph);
        }
Ejemplo n.º 11
0
 public MapperBuilder(IMapperConfig config)
 {
     MemberBuilder = new MappingMemberBuilder(config);
 }
Ejemplo n.º 12
0
 public MappingMemberBuilder(IMapperConfig config)
 {
     _config = config;
 }
Ejemplo n.º 13
0
 public void SetUp()
 {
     _mapperConfig = new T();
 }
Ejemplo n.º 14
0
 public void AddMapperConfig(IMapperConfig config)
 {
     _mapperConfig.Add(config);
 }
Ejemplo n.º 15
0
 public ExpressionBuilder(IMapperConfig config) : base(config)
 {
     this.config = config;
 }
Ejemplo n.º 16
0
 public MapperService(IMapperConfig mapperConfig)
 {
     _mapperConfig = mapperConfig;
 }
Ejemplo n.º 17
0
 public static MapperBuilder GetMapperBuilder(IMapperConfig config)
 {
     return(new ExpressionBuilder(config));
 }