2024-11-03 19:42:19 +04:00
using EventVisitorClientApp.Models ;
using EventVisitorLogic.BindingModels ;
using EventVisitorLogic.Logic ;
using EventVisitorLogic.ViewModels ;
using Microsoft.AspNetCore.Mvc ;
using System ;
using System.Diagnostics ;
2024-11-04 19:46:16 +04:00
using System.Net.NetworkInformation ;
using System.Net ;
using System.Numerics ;
2024-11-03 19:42:19 +04:00
using System.Security.Cryptography.Xml ;
2024-11-04 19:46:16 +04:00
using System.Xml.Linq ;
2024-11-04 20:28:47 +04:00
using Microsoft.Extensions.Logging ;
2024-11-06 03:05:29 +04:00
using static System . Runtime . InteropServices . JavaScript . JSType ;
using DocumentFormat.OpenXml.Office2010.Excel ;
2024-11-09 23:28:41 +04:00
using System.Text ;
using System.Security.Cryptography ;
2024-11-10 12:57:59 +04:00
using DocumentFormat.OpenXml.Spreadsheet ;
2024-11-03 19:42:19 +04:00
namespace EventVisitorClientApp.Controllers
{
public class HomeController : Controller
{
Random rnd = new Random ( ) ;
2024-11-10 12:57:59 +04:00
private static readonly Random _random = new Random ( ) ;
2024-11-09 23:28:41 +04:00
private void DisplayErrorMessage ( string message )
{
ViewBag . ErrorMessage = message ;
}
public IActionResult Index ( )
2024-11-03 19:42:19 +04:00
{
return View ( ) ;
}
[HttpGet]
public IActionResult Enter ( )
{
return View ( ) ;
}
2024-11-09 23:28:41 +04:00
[HttpPost]
2024-11-03 19:42:19 +04:00
public void Enter ( string login , string password )
{
if ( string . IsNullOrEmpty ( login ) | | string . IsNullOrEmpty ( password ) )
{
throw new Exception ( "<22> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> " ) ;
}
2024-11-04 19:46:16 +04:00
APIClient . Client = APIClient . GetRequest < OrganizerViewModel > ( $"api/Organizer/login?login={login}&password={password}" ) ;
2024-11-03 19:42:19 +04:00
if ( APIClient . Client = = null )
{
throw new Exception ( "<22> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> /<2F> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> " ) ;
}
Response . Redirect ( "Index" ) ;
}
[HttpGet]
public IActionResult Privacy ( )
{
if ( APIClient . Client = = null )
{
return Redirect ( "~Home/Enter" ) ;
}
return View ( APIClient . Client ) ;
}
[HttpPost]
public void Privacy ( string login , string password , string surname , string name , string lastname , string role , string organizationName , string phone )
{
if ( APIClient . Client = = null )
{
throw new Exception ( "<22> <> <20> <> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ? <20> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> " ) ;
}
if ( string . IsNullOrEmpty ( login ) )
{
throw new Exception ( "<22> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> e-mail" ) ;
}
if ( string . IsNullOrEmpty ( password ) )
{
throw new Exception ( "<22> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> " ) ;
}
if ( string . IsNullOrEmpty ( name ) )
{
throw new Exception ( "<22> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> " ) ;
}
if ( string . IsNullOrEmpty ( surname ) )
{
throw new Exception ( "<22> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> " ) ;
}
if ( string . IsNullOrEmpty ( organizationName ) )
{
throw new Exception ( "<22> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> " ) ;
}
if ( string . IsNullOrEmpty ( role ) )
{
throw new Exception ( "<22> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> " ) ;
}
APIClient . PostRequest ( "api/client/updatedata" , new OrganizerBindingModel
{
Id = APIClient . Client . Id ,
Name = name ,
Surname = surname ,
LastName = lastname ,
OrganizationName = organizationName ,
Phone = phone ,
Email = login ,
Password = password
} ) ;
APIClient . Client . Name = name ;
APIClient . Client . Surname = surname ;
APIClient . Client . LastName = lastname ;
APIClient . Client . OrganizationName = organizationName ;
APIClient . Client . Phone = phone ;
APIClient . Client . Email = login ;
APIClient . Client . Password = password ;
Response . Redirect ( "Index" ) ;
}
2024-11-17 00:04:09 +04:00
/// <summary>
/// <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
/// </summary>
/// <returns></returns>
2024-11-03 19:42:19 +04:00
[HttpGet]
public IActionResult Register ( )
{
return View ( ) ;
2024-11-17 00:04:09 +04:00
}
public IActionResult Logout ( )
{
APIClient . Client = null ;
return Redirect ( "~/Home/Enter" ) ;
}
2024-11-03 19:42:19 +04:00
2024-11-10 12:57:59 +04:00
public static string GenerateRandomString ( )
{
const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" ;
return new string ( Enumerable . Repeat ( chars , 6 )
. Select ( s = > s [ _random . Next ( s . Length ) ] ) . ToArray ( ) ) ;
}
[HttpPost]
public void Register ( string login , string password , string surname , string name , string lastname , string organizationName , string phone , string code )
2024-11-03 19:42:19 +04:00
{
2024-11-10 12:57:59 +04:00
//var confirmationCode = GenerateRandomString();
//APIClient.PostRequest("api/main/SendToMail", new MailSendInfoBindingModel
//{
// MailAddress = login,
// Subject = "<22> <> <EFBFBD> <20> <> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ",
// Text = $"<22> <> <EFBFBD> <20> <> <EFBFBD> <20> <> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> : {confirmationCode}"
//});
2024-11-09 23:28:41 +04:00
APIClient . PostRequest ( "api/Organizer/Register" , new OrganizerBindingModel
{
Name = name ,
Surname = surname ,
LastName = lastname ,
OrganizationName = organizationName ,
Phone = phone ,
Email = login ,
Password = password
} ) ;
Response . Redirect ( "Enter" ) ;
return ;
}
2024-11-03 19:42:19 +04:00
2024-11-10 12:57:59 +04:00
[HttpPost]
public void CheckCode ( string confirmationCode , string login , string password , string surname , string name , string lastname , string organizationName , string phone )
{
// <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <20> <> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
var storedCode = HttpContext . Session . GetString ( "ConfirmationCode" ) ;
if ( storedCode = = confirmationCode )
{
}
else
{
// <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> , <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> , <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> 400
Response . StatusCode = 400 ;
return ;
}
}
2024-11-17 00:04:09 +04:00
/// <summary>
/// <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
/// </summary>
/// <returns></returns>
2024-11-10 12:57:59 +04:00
public IActionResult MyEvents ( )
2024-11-05 23:50:08 +04:00
{
2024-11-04 19:46:16 +04:00
if ( APIClient . Client = = null )
{
return Redirect ( "~/Home/Enter" ) ;
}
2024-11-05 23:50:08 +04:00
return View ( APIClient . GetRequest < List < EventViewModel > > ( $"api/main/GetEventList?OrganizerId={APIClient.Client.Id}" ) ) ;
}
2024-11-17 00:04:09 +04:00
public IActionResult CreateEvent ( )
{
if ( APIClient . Client = = null )
{
return Redirect ( "~/Home/Enter" ) ;
}
return View ( ) ;
}
public IActionResult ViewEvent ( int id )
{
if ( APIClient . Client = = null )
{
return Redirect ( "~/Home/Enter" ) ;
}
var eventDetails = APIClient . GetRequest < EventViewModel > ( $"api/main/GetEvent?EventId={id}" ) ;
return View ( eventDetails ) ;
}
[HttpPost]
public void CreateEvent ( string name , string description , string type , string phone , string email , string address , string city , string status , int count , DateTime timestart , DateTime timeend )
{
if ( APIClient . Client = = null )
{
throw new Exception ( "<22> <> <20> <> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ? <20> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> " ) ;
}
string eventId = Guid . NewGuid ( ) . ToString ( ) ; // <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
string registrationLink = $"https://localhost:7186/registrationonevent?EventId={eventId}" ; // <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
APIClient . PostRequest ( "api/main/createevent" , new EventBindingModel
{
Name = name ,
Description = description ,
Type = type ,
ContactPhone = phone ,
Address = address ,
City = city ,
Status = status ,
ContactEmail = email ,
TimeEnd = timeend . ToUniversalTime ( ) ,
TimeStart = timestart . ToUniversalTime ( ) ,
Date = DateTime . Now . ToUniversalTime ( ) ,
CountVisitors = count ,
FreePlaces = count ,
OrganizerId = APIClient . Client . Id ,
Link = registrationLink
} ) ;
Response . Redirect ( "MyEvents" ) ;
}
public IActionResult DeleteEvent ( int id )
{
// <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
if ( APIClient . Client = = null )
{
return Redirect ( "~/Home/Enter" ) ;
}
// <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
APIClient . PostRequest ( $"api/main/DeleteEvent" , new EventBindingModel { Id = id } ) ;
// <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
return RedirectToAction ( "MyEvents" ) ;
}
public IActionResult UpdateEvent ( int id )
{
if ( APIClient . Client = = null )
{
return Redirect ( "~/Home/Enter" ) ;
}
var eventDetails = APIClient . GetRequest < EventViewModel > ( $"api/main/GetEvent?EventId={id}" ) ;
return View ( eventDetails ) ;
}
[HttpPost]
public void UpdateEvent ( int id , string name , string description , string type , string phone , string email , string address , string city , string status , int count , DateTime ? timestart , DateTime ? timeend )
{
if ( APIClient . Client = = null )
{
throw new Exception ( "<22> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> " ) ;
}
var existingEvent = APIClient . GetRequest < EventViewModel > ( $"api/main/GetEvent?EventId={id}" ) ;
DateTime start = ( timestart . HasValue ) ? DateTime . SpecifyKind ( timestart . Value , DateTimeKind . Utc ) : existingEvent . TimeStart . ToUniversalTime ( ) ;
DateTime end = ( timeend . HasValue ) ? DateTime . SpecifyKind ( timeend . Value , DateTimeKind . Utc ) : existingEvent . TimeEnd . ToUniversalTime ( ) ;
int countRegisterPlace = existingEvent . CountVisitors - existingEvent . FreePlaces ;
APIClient . PostRequest ( "api/main/UpdateEvent" , new EventBindingModel
{
Id = id ,
Name = name ,
Description = description ,
Type = type ,
ContactPhone = phone ,
Address = address ,
City = city ,
Status = status ,
ContactEmail = email ,
TimeEnd = end ,
TimeStart = start ,
Date = DateTime . Now . ToUniversalTime ( ) ,
CountVisitors = count ,
FreePlaces = count - countRegisterPlace ,
OrganizerId = APIClient . Client . Id
} ) ;
Response . Redirect ( "/Home/MyEvents" ) ;
}
2024-11-05 23:50:08 +04:00
2024-11-17 00:04:09 +04:00
/// <summary>
/// <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
/// </summary>
/// <param></param>
/// <returns></returns>
2024-11-05 23:50:08 +04:00
public IActionResult Visitors ( int id )
{
if ( APIClient . Client = = null )
{
return Redirect ( "~/Home/Enter" ) ;
}
2024-11-06 11:54:20 +04:00
var allVisitors = APIClient . GetRequest < List < VisitorViewModel > > ( $"api/main/GetVisitorList?EventId={id}" ) ;
return View ( allVisitors ) ;
}
[HttpPost]
public void Visitors ( int id , [ FromForm ] List < int > presentIds )
{
var allVisitors = APIClient . GetRequest < List < VisitorViewModel > > ( $"api/main/GetVisitorList?EventId={id}" ) ;
foreach ( var visitor in allVisitors )
{
var status = presentIds . Contains ( visitor . Id ) ? "<22> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> " : "<22> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> " ;
APIClient . PostRequest ( "api/main/updatevisitor" , new VisitorBindingModel
{
Id = visitor . Id ,
Status = status
} ) ;
}
2024-11-03 19:42:19 +04:00
}
2024-11-05 23:50:08 +04:00
2024-11-09 23:28:41 +04:00
public IActionResult ResultRegistration ( )
{
return View ( ) ;
}
2024-11-05 14:09:00 +04:00
2024-11-09 23:28:41 +04:00
public IActionResult RegistrationOnEvent ( int id )
2024-11-05 23:50:08 +04:00
{
var eventDetails = APIClient . GetRequest < EventViewModel > ( $"api/main/GetEvent?EventId={id}" ) ;
2024-11-05 14:09:00 +04:00
2024-11-05 23:50:08 +04:00
return View ( eventDetails ) ;
}
2024-11-09 23:28:41 +04:00
2024-11-05 23:50:08 +04:00
[HttpPost]
2024-11-13 21:45:17 +04:00
public void RegistrationOnEvent ( int id , string name , string phone , string email , DateTime dayBirth )
2024-11-05 23:50:08 +04:00
{
var eventDetails = APIClient . GetRequest < EventViewModel > ( $"api/main/GetEvent?EventId={id}" ) ;
if ( eventDetails ! = null & & eventDetails . FreePlaces > 0 )
{
int updatedFreePlaces = eventDetails . FreePlaces - 1 ;
APIClient . PostRequest ( "api/main/registrationonevent" , new VisitorBindingModel
{
Name = name ,
Phone = phone ,
Email = email ,
DayBirth = dayBirth . ToUniversalTime ( ) ,
EventId = id ,
Status = "<22> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> "
} ) ;
// 4. <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD>
APIClient . PostRequest ( "api/main/updateevent" , new EventBindingModel
{
Id = id ,
Name = eventDetails . Name ,
Description = eventDetails . Description ,
Type = eventDetails . Type ,
ContactPhone = eventDetails . ContactPhone ,
Address = eventDetails . Address ,
City = eventDetails . City ,
Status = eventDetails . Status ,
ContactEmail = eventDetails . ContactEmail ,
TimeEnd = eventDetails . TimeEnd . ToUniversalTime ( ) ,
TimeStart = eventDetails . TimeStart . ToUniversalTime ( ) ,
Date = eventDetails . Date . ToUniversalTime ( ) ,
CountVisitors = eventDetails . CountVisitors ,
OrganizerId = eventDetails . OrganizerId ,
Link = eventDetails . Link ,
FreePlaces = updatedFreePlaces
} ) ;
2024-11-06 03:05:29 +04:00
APIClient . PostRequest ( "api/main/SendToMail" , new MailSendInfoBindingModel
{
MailAddress = email ,
Subject = "<22> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> " ,
Text = "<22> <> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> " + eventDetails . Name + ", <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> " + eventDetails . TimeStart + ". <20> <> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> : " + eventDetails . Address + " <20> . " + eventDetails . City + ".\n" + "<22> <> <20> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> : " + eventDetails . ContactPhone + " <20> <> <EFBFBD> <20> <> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> : " + eventDetails . ContactEmail + ".\n" + "<22> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <20> <> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> !"
} ) ;
2024-11-13 21:45:17 +04:00
Response . Redirect ( "/Home/ResultRegistration" ) ;
2024-11-09 23:28:41 +04:00
}
2024-11-05 23:50:08 +04:00
else
{
2024-11-13 21:45:17 +04:00
Response . Redirect ( "MyEvents" ) ;
2024-11-05 23:50:08 +04:00
}
}
2024-11-05 14:09:00 +04:00
2024-11-04 19:46:16 +04:00
[HttpPost]
2024-11-17 00:04:09 +04:00
public void ViewEvent ( int id , string subject , string message )
2024-11-04 19:46:16 +04:00
{
if ( APIClient . Client = = null )
{
2024-11-17 00:04:09 +04:00
throw new Exception ( "<22> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> " ) ;
2024-11-04 19:46:16 +04:00
}
2024-11-17 00:04:09 +04:00
var visitorList = APIClient . GetRequest < List < VisitorViewModel > > ( $"api/main/GetVisitorList?EventId={id}" ) ;
if ( visitorList ! = null )
2024-11-04 19:46:16 +04:00
{
2024-11-17 00:04:09 +04:00
foreach ( var visitor in visitorList )
{
APIClient . PostRequest ( "api/main/SendToMail" , new MailSendInfoBindingModel
{
MailAddress = visitor . Email ,
Subject = subject ,
Text = message
} ) ;
}
2024-11-04 19:46:16 +04:00
}
2024-11-17 00:04:09 +04:00
APIClient . PostRequest ( "api/main/CreateMessage" , new SentMessageBindingModel
2024-11-04 19:46:16 +04:00
{
2024-11-17 00:04:09 +04:00
Subject = subject ,
Body = message ,
EventId = id ,
OrganizerId = APIClient . Client . Id ,
SentDate = DateTime . Now . ToUniversalTime ( )
} ) ;
Response . Redirect ( $"/Home/ViewEvent/{id}" ) ;
2024-11-04 19:46:16 +04:00
}
2024-11-17 00:04:09 +04:00
public IActionResult MessageHistory ( int id )
2024-11-06 03:05:29 +04:00
{
if ( APIClient . Client = = null )
{
return Redirect ( "~/Home/Enter" ) ;
}
2024-11-17 00:04:09 +04:00
var allMessages = APIClient . GetRequest < List < SentMessageViewModel > > ( $"api/main/GetSentMessageList?EventId={id}" ) ;
return View ( allMessages ) ;
2024-11-06 03:05:29 +04:00
}
2024-11-04 20:28:47 +04:00
2024-11-17 00:04:09 +04:00
/// <summary>
/// <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD>
/// </summary>
/// <returns></returns>
2024-11-06 03:05:29 +04:00
public IActionResult GetWordFile ( )
{
return new PhysicalFileResult ( "F:\\EventVisitor\\wordfile.docx" , "application/vnd.openxmlformats-officedocument.wordprocessingml.document" ) ;
}
2024-11-13 21:45:17 +04:00
2024-11-06 03:05:29 +04:00
public IActionResult GetExcelFile ( )
{
return new PhysicalFileResult ( "F:\\EventVisitor\\excelfile.xlsx" , "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" ) ;
}
//[HttpPost]
//public void ReportWord(int[] Ids, int id)
//{
// if (APIClient.Client == null)
// {
// throw new Exception("<22> <> <20> <> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ? <20> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ");
// }
// List<VisitorViewModel> registeredVisitorsIds = APIClient.GetRequest<List<VisitorViewModel>>($"api/main/GetVisitorList?EventId={id}");
// foreach (var item in Ids)
// {
// res.Add(item);
// }
// APIClient.PostRequest("api/main/createreporttowordfile", new ReportVisitorsBindingModel
// {
// Ids = res,
// FileName = "F:\\EventVisitor\\wordfile.docx"
// });
// Response.Redirect("GetWordFile");
//}
2024-11-03 19:42:19 +04:00
}
}