Esempio n. 1
0
        public CompareResult Start(string userName, CompareInput compareInput)
        {
            var startTime = DateTime.Now;

            //Start Compare
            Task.Run(() =>
            {
                CompareTask(userName, startTime, compareInput);
            });


            //Insert DB
            var connection = ConnectionFactory.Instance.GetMongoDBConnection();
            var compareDAO = DAOFactory.Instance.GetCompareDAO("webct", "_compareResults");

            compareDAO.Create(connection, new DAOLayer.Entities.CompareResult
            {
                UserName    = userName,
                ProjectName = compareInput.ProjectName,
                Status      = 1,
                Time        = startTime,
                Message     = "Comparing...",
                FileName1   = compareInput.FileName1,
                FileName2   = compareInput.FileName2
            });


            //Return Result
            return(new CompareResult()
            {
                ProjectName = compareInput.ProjectName,
                Status = 1,
                Message = "Start Comparing..."
            });
        }
Esempio n. 2
0
        async Task CompareTask(string userName, DateTime startTime, CompareInput compareInput)
        {
            //Run Compare Task
            await Task.Delay(10000);

            //R...

            //Update DB
            var connection = ConnectionFactory.Instance.GetMongoDBConnection();
            var compareDAO = DAOFactory.Instance.GetCompareDAO("webct", "_compareResults");

            compareDAO.Update(connection, new DAOLayer.Entities.CompareResult
            {
                UserName    = userName,
                ProjectName = compareInput.ProjectName,
                Status      = 2,
                Time        = startTime,
                Message     = "Comparing...",
                FileName1   = compareInput.FileName1,
                FileName2   = compareInput.FileName2
            });
        }