aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/UserView.xaml
blob: 37f649a7a6799bd08ccd483c621c00e95a71bd8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<UserControl x:Class="Tango.MachineStudio.UsersAndRoles.Views.UserView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:entities="clr-namespace:Tango.BL.Entities;assembly=Tango.BL"
             xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI"
             xmlns:pass="clr-namespace:Tango.SharedUI.Helpers;assembly=Tango.SharedUI"
             xmlns:local="clr-namespace:Tango.MachineStudio.UsersAndRoles.Views"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300" d:DataContext="{d:DesignInstance Type=entities:User, IsDesignTimeCreatable=False}">
    
    
    
    <Grid>
        <controls:TableGrid>
            <TextBlock Text="EMAIL"></TextBlock>
            <TextBox Text="{Binding Email}"></TextBox>
        </controls:TableGrid>
    </Grid>
</UserControl>
ring.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;
        }

        [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);
        }
    }
}