示例#1
0
 public HomeController(ILogger <HomeController> logger, ISystemService systemService,
                       IPlanService planService, IPerformService performService, IProjectService projectService)
 {
     _logger         = logger;
     _systemService  = systemService;
     _planService    = planService;
     _performService = performService;
     _projectService = projectService;
 }
示例#2
0
 public PerformController(ISystemService systemService, IProjectService projectService,
                          IPerformService performService, IPlanService planService, ILogger <PerformController> logger)
 {
     _systemService  = systemService;
     _projectService = projectService;
     _performService = performService;
     _planService    = planService;
     _logger         = logger;
 }
        /// <summary>
        /// 扩展方法,计算项目列表projects的某年度year的两金压降工作月报,并填充viewmodel
        /// </summary>
        /// <param name="model"></param>
        /// <param name="projects"></param>
        public static async Task CalculatePerforms(this ProjectYearViewModel model, int year, IEnumerable <Project> projects,
                                                   IProjectService projectService, IPerformService performService)
        {
            var projectIds = from p in projects select p.ProjectId;
            var performs   = await performService.GetYearPerformsOfProjects(year, projectIds);

            var balances = await projectService.GetAnnualBalancesOfProjects(year - 1, projectIds); //取上一年的结转

            model.Year = year;
            model.ProjectRowsDic.Clear();
            foreach (var proj in projects)
            {
                model.ProjectRowsDic.Add(proj.ProjectId, YearRowViewModel.Create(proj, year, balances, performs));
            }
        }
示例#4
0
        //	Server IPC Cycle.
        //	Receive a request. Service the request. Reply with the result.
        static public async Task <int> ReceiveServiceReply(BufferedStream bufferedStream, IServiceRequest serviceRequest, ILogger logger, IAppDocument appDocument)
        {
            int numberSent;

            //	Receive the request from the client.
            ITcpFrame requestFrame = await ReceiveFrame(bufferedStream, logger);

            //	Identify and create the specific service to be performed.
            IPerformService performService = serviceRequest.CreateService(requestFrame, logger);

            //	Perform the specific service and provide a response.
            ITcpFrame responseFrame = performService.PerformService(logger, appDocument);

            //	Reply the response to the client.
            numberSent = await SendFrame(responseFrame, bufferedStream, logger);

            return(numberSent);
        }
示例#5
0
        public void PerformSyncSucceeds()
        {
            StubServiceHost.FindDefaultService <IPerformService>()
            .Setup(s => s.Perform(It.IsAny <XlangCalculatorRequest>()));

            IPerformService client = null;

            try
            {
                var request = new XlangCalculatorRequest(CALCULATOR_REQUEST_XML);
                client = SimpleServiceClient <CalculatorService, IPerformService> .Create();

                client.Perform(request);
                client.Close();
            }
            catch (Exception)
            {
                if (client != null)
                {
                    client.Abort();
                }
                throw;
            }
        }