aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.UnitTesting/AdvancedInstaller/DemoProject/Files/File2.txt
blob: c717c6dee139c09618c44aeda0f680617d51dcc8 (plain)
1
File2
0; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Tango.TCC.BL.Entities;
using Tango.TCC.Service.DB;
using Tango.TCC.Service.DTO;
using Tango.TCC.Service.Security;
using Tango.Web.Controllers;
using System.Data.Entity;
using Tango.TCC.BL.Web;
using Tango.TCC.Service.Storage;
using System.Web.Http.Results;
using Tango.TCC.Service.Filters;
using Microsoft.AspNet.SignalR;
using Tango.TCC.Service.Hubs;

namespace Tango.TCC.Service.Controllers
{
    public class ResultsController : TangoController<TokenObject>
    {
        [JwtTokenFilter]
        [HttpGet]
        public List<ResultDTO> GetResults([FromUri] ResultsByDateRequest request)//int count)
        {
            List<ResultDTO> results = new List<ResultDTO>();

            using (var db = TccDbContext.CreateTCC())
            {
                DateTime start, end;
                if (!DateTime.TryParse(request.From, out start) || !DateTime.TryParse(request.To, out end))
                {
                    return results;
                }


                var dbResults = (from RESULTS in db.Results
                                 where DbFunctions.TruncateTime(RESULTS.Date) >= start.Date && DbFunctions.TruncateTime(RESULTS.Date) <= end.Date
                                 join CARDS in db.Cards on RESULTS.CardGuid equals CARDS.Guid
                                 join DEVICES in db.Devices on RESULTS.DeviceGuid equals DEVICES.Guid
                                 where (request.Email == null || DEVICES.Email == request.Email) && (request.DeviceModel == null || DEVICES.DeviceModel == request.DeviceModel)
                                 select new
                                 {
                                     Result = RESULTS,
                                     DeviceModel = DEVICES.DeviceModel,
                                     Email = DEVICES.Email,
                                     CardCode = CARDS.Code,
                                     DeviceID = DEVICES.DeviceID
                                 }).ToList(); 


                foreach (var item in dbResults)
                {
                    ResultDTO dto = ResultDTO.createResultDTO(item.Result, item.CardCode, item.DeviceModel, item.Email, item.DeviceID);
                    results.Add(dto);
                }
            }

            return results;
        }
        [JwtTokenFilter]
        [HttpGet]
        public List<ResultDTO> GetLastResults([FromUri] ResultsByCountRequest request)//int count)
        {
            List<ResultDTO> results = new List<ResultDTO>();

            using (var db = TccDbContext.CreateTCC())
            {
                var dbResults = db.Results.ToList().TakeLast(request.Count);

                foreach (var item in dbResults)
                {
                    ResultDTO dto = ResultDTO.createsampleResultDTO(item);
                    results.Add(dto);
                }
            }

            return results;
        }
        [HttpGet]
        public RedirectResult GetResultSampleImage(String blobName)
        {
            return Redirect(TCCStorageManager.CreateSampleImageURL(blobName));
        }

        [HttpGet]
        public RedirectResult GetResultSourceImage(String blobName)
        {
            return Redirect(TCCStorageManager.CreateSourceImageURL(blobName));
        }
        [JwtTokenFilter]
        [HttpPost]
        public VerificationResponse VerifyDeviceEmail(VerificationRequest request)//int count)
        {
            VerificationResponse response = new VerificationResponse();
            response.Verified = false;

            using (var db = TccDbContext.CreateTCC())
            {
                var device = db.Devices.FirstOrDefault(x => x.Email == request.Email);
                if (device != null)
                {
                    response.Verified = true;
                }
            }
            return response;
        }
        [HttpPost]
        public void Test()
        {
            var myHub = GlobalHost.ConnectionManager.GetHubContext<ResultsHub>() as ResultsHub;
            ResultDTO dto = new ResultDTO();
            dto.Guid = "123";
            dto.Date = DateTime.Now;
            dto.RawColor = -100000;
            dto.ProcessedColor = -100000;
            dto.SampleImageURL = "";
            dto.SourceImageURL = "";
            dto.ProcessTime = 55;
            dto.CardGuid = "";
            dto.CardCode = "";
            dto.DeviceModel = "aaa";
            dto.Email = "Victoria.Plitt@twine-s.com";
            dto.DeviceGuid = "";
            ResultsHub.PushResult(dto);
        }
    }
}