Jelajahi Sumber

modify for telemor

sungrouptech 4 bulan lalu
induk
melakukan
8ef94fec34
100 mengubah file dengan 17308 tambahan dan 0 penghapusan
  1. 2 0
      .gitignore
  2. TEMPAT SAMPAH
      SuperAdmin/References/feather.woff
  3. 12 0
      SuperAdmin/SuperAdmin/.config/dotnet-tools.json
  4. 170 0
      SuperAdmin/SuperAdmin/Connected Services/SvVsa/ConnectedService.json
  5. 1163 0
      SuperAdmin/SuperAdmin/Connected Services/SvVsa/Reference.cs
  6. 1775 0
      SuperAdmin/SuperAdmin/Controllers/AdminController.cs
  7. 419 0
      SuperAdmin/SuperAdmin/Controllers/BaseController.cs
  8. 30 0
      SuperAdmin/SuperAdmin/Controllers/EventController.cs
  9. 130 0
      SuperAdmin/SuperAdmin/Controllers/HomeController.cs
  10. 46 0
      SuperAdmin/SuperAdmin/Controllers/PartialController.cs
  11. 16 0
      SuperAdmin/SuperAdmin/Controllers/ProcedureController.cs
  12. 484 0
      SuperAdmin/SuperAdmin/Controllers/ReportSubController.cs
  13. 16 0
      SuperAdmin/SuperAdmin/Controllers/RolesController.cs
  14. 1391 0
      SuperAdmin/SuperAdmin/Controllers/TreeController.cs
  15. 239 0
      SuperAdmin/SuperAdmin/Controllers/UtilsController.cs
  16. 31 0
      SuperAdmin/SuperAdmin/Extensions/ConfigAction.cs
  17. 29 0
      SuperAdmin/SuperAdmin/Extensions/RewriteSubdomainRule.cs
  18. 29 0
      SuperAdmin/SuperAdmin/Extensions/SessionExtensions.cs
  19. 11 0
      SuperAdmin/SuperAdmin/Models/ErrorViewModel.cs
  20. 55 0
      SuperAdmin/SuperAdmin/Models/Http/ActionRequest.cs
  21. 75 0
      SuperAdmin/SuperAdmin/Models/Http/AppRequest.cs
  22. 51 0
      SuperAdmin/SuperAdmin/Models/Http/AppResponse.cs
  23. 57 0
      SuperAdmin/SuperAdmin/Models/Http/Blacklist.cs
  24. 25 0
      SuperAdmin/SuperAdmin/Models/Http/DashboardModel.cs
  25. 47 0
      SuperAdmin/SuperAdmin/Models/Http/DataTypeOneRequest.cs
  26. 24 0
      SuperAdmin/SuperAdmin/Models/Http/ExportAction.cs
  27. 216 0
      SuperAdmin/SuperAdmin/Models/Http/ExportGetList.cs
  28. 68 0
      SuperAdmin/SuperAdmin/Models/Http/FinanceReport.cs
  29. 51 0
      SuperAdmin/SuperAdmin/Models/Http/GetInfoTicket.cs
  30. 48 0
      SuperAdmin/SuperAdmin/Models/Http/GetParams.cs
  31. 37 0
      SuperAdmin/SuperAdmin/Models/Http/GetRequest.cs
  32. 27 0
      SuperAdmin/SuperAdmin/Models/Http/LoginRequest.cs
  33. 87 0
      SuperAdmin/SuperAdmin/Models/Http/ReportBillOrder.cs
  34. 51 0
      SuperAdmin/SuperAdmin/Models/Http/ReportBolet.cs
  35. 47 0
      SuperAdmin/SuperAdmin/Models/Http/ReportDay.cs
  36. 47 0
      SuperAdmin/SuperAdmin/Models/Http/ReportLucky.cs
  37. 47 0
      SuperAdmin/SuperAdmin/Models/Http/ResultsUpdate.cs
  38. 135 0
      SuperAdmin/SuperAdmin/Models/Http/SearchMsisdn.cs
  39. 39 0
      SuperAdmin/SuperAdmin/Models/Http/SearchMt.cs
  40. 89 0
      SuperAdmin/SuperAdmin/Models/Http/TermGetList.cs
  41. 65 0
      SuperAdmin/SuperAdmin/Models/Http/TopPlayer.cs
  42. 62 0
      SuperAdmin/SuperAdmin/Models/Http/TrafficDay.cs
  43. 41 0
      SuperAdmin/SuperAdmin/Models/Http/TrafficTerm.cs
  44. 17 0
      SuperAdmin/SuperAdmin/Models/Object/Account.cs
  45. 42 0
      SuperAdmin/SuperAdmin/Models/Object/Charging.cs
  46. 21 0
      SuperAdmin/SuperAdmin/Models/Object/Posting.cs
  47. 55 0
      SuperAdmin/SuperAdmin/Models/Object/Province.cs
  48. 219 0
      SuperAdmin/SuperAdmin/Models/Object/RowStructure.cs
  49. 55 0
      SuperAdmin/SuperAdmin/Models/Object/Topic.cs
  50. 112 0
      SuperAdmin/SuperAdmin/Models/Object/UserProfile.cs
  51. 42 0
      SuperAdmin/SuperAdmin/Models/Object/UserRoles.cs
  52. 46 0
      SuperAdmin/SuperAdmin/Models/Sub/ReportDetail.cs
  53. 60 0
      SuperAdmin/SuperAdmin/Models/Sub/ReportHourly.cs
  54. 43 0
      SuperAdmin/SuperAdmin/Models/Sub/ReportRegister.cs
  55. 51 0
      SuperAdmin/SuperAdmin/Models/Sub/ReportSummary.cs
  56. 23 0
      SuperAdmin/SuperAdmin/Models/View/CommonModel.cs
  57. 26 0
      SuperAdmin/SuperAdmin/Models/View/EnewsViewModel.cs
  58. 27 0
      SuperAdmin/SuperAdmin/Models/View/EventViewModel.cs
  59. 21 0
      SuperAdmin/SuperAdmin/Models/View/PartialViewModel.cs
  60. 14 0
      SuperAdmin/SuperAdmin/Models/View/TreeViewModel.cs
  61. 280 0
      SuperAdmin/SuperAdmin/Models/Vsa/Vsa.cs
  62. 78 0
      SuperAdmin/SuperAdmin/Oracle/OracleDynamicParameters.cs
  63. 40 0
      SuperAdmin/SuperAdmin/Program.cs
  64. 21 0
      SuperAdmin/SuperAdmin/Properties/PublishProfiles/FolderProfile.pubxml
  65. 21 0
      SuperAdmin/SuperAdmin/Properties/PublishProfiles/FolderProfile1.pubxml
  66. 27 0
      SuperAdmin/SuperAdmin/Properties/launchSettings.json
  67. 16 0
      SuperAdmin/SuperAdmin/Repositories/ISuperAdminRepo.cs
  68. 60 0
      SuperAdmin/SuperAdmin/Repositories/SuperAdminRepo.cs
  69. 225 0
      SuperAdmin/SuperAdmin/Source/LumilotoUtils.cs
  70. 105 0
      SuperAdmin/SuperAdmin/Startup.cs
  71. 57 0
      SuperAdmin/SuperAdmin/SuperAdmin.csproj
  72. 304 0
      SuperAdmin/SuperAdmin/Views/Admin/BlacklistUpload.cshtml
  73. 428 0
      SuperAdmin/SuperAdmin/Views/Admin/Dashboard.cshtml
  74. 7 0
      SuperAdmin/SuperAdmin/Views/Admin/Index.cshtml
  75. 200 0
      SuperAdmin/SuperAdmin/Views/Admin/PlayerExport.cshtml
  76. 266 0
      SuperAdmin/SuperAdmin/Views/Admin/PlayerMt.cshtml
  77. 333 0
      SuperAdmin/SuperAdmin/Views/Admin/PlayerTicket.cshtml
  78. 383 0
      SuperAdmin/SuperAdmin/Views/Admin/PlayerTransfer.cshtml
  79. 306 0
      SuperAdmin/SuperAdmin/Views/Admin/ReportBillOrderDetail.cshtml
  80. 311 0
      SuperAdmin/SuperAdmin/Views/Admin/ReportBillOrderSummary.cshtml
  81. 322 0
      SuperAdmin/SuperAdmin/Views/Admin/ReportByTerm.cshtml
  82. 373 0
      SuperAdmin/SuperAdmin/Views/Admin/ReportCompact.cshtml
  83. 510 0
      SuperAdmin/SuperAdmin/Views/Admin/ReportFinance.cshtml
  84. 302 0
      SuperAdmin/SuperAdmin/Views/Admin/ReportLuckyDetail.cshtml
  85. 390 0
      SuperAdmin/SuperAdmin/Views/Admin/ReportSummary.cshtml
  86. 400 0
      SuperAdmin/SuperAdmin/Views/Admin/ReportSummaryBolet.cshtml
  87. 336 0
      SuperAdmin/SuperAdmin/Views/Admin/ReportSummaryLucky.cshtml
  88. 592 0
      SuperAdmin/SuperAdmin/Views/Admin/Results.cshtml
  89. 324 0
      SuperAdmin/SuperAdmin/Views/Admin/RewardListSearch.cshtml
  90. 918 0
      SuperAdmin/SuperAdmin/Views/Admin/RewardReq.cshtml
  91. 344 0
      SuperAdmin/SuperAdmin/Views/Admin/Statistics.cshtml
  92. 295 0
      SuperAdmin/SuperAdmin/Views/Admin/Trade.cshtml
  93. 32 0
      SuperAdmin/SuperAdmin/Views/Admin/_Blacklist.cshtml
  94. 84 0
      SuperAdmin/SuperAdmin/Views/Admin/_Dashboard.cshtml
  95. 39 0
      SuperAdmin/SuperAdmin/Views/Admin/_FinanceRevenueDetail.cshtml
  96. 33 0
      SuperAdmin/SuperAdmin/Views/Admin/_FinanceRevenueSummary.cshtml
  97. 38 0
      SuperAdmin/SuperAdmin/Views/Admin/_FinanceRewardDetail.cshtml
  98. 32 0
      SuperAdmin/SuperAdmin/Views/Admin/_FinanceRewardSummary.cshtml
  99. 29 0
      SuperAdmin/SuperAdmin/Views/Admin/_PlayerExport.cshtml
  100. 89 0
      SuperAdmin/SuperAdmin/Views/Admin/_PlayerHistory.cshtml

+ 2 - 0
.gitignore

@@ -32,3 +32,5 @@ msbuild.wrn
 
 # Visual Studio 2015
 .vs/
+/vasgw/VasgwLottery/nbproject/private/
+/vasgw/VasgwLottery/dist/

TEMPAT SAMPAH
SuperAdmin/References/feather.woff


+ 12 - 0
SuperAdmin/SuperAdmin/.config/dotnet-tools.json

@@ -0,0 +1,12 @@
+{
+  "version": 1,
+  "isRoot": true,
+  "tools": {
+    "dotnet-ef": {
+      "version": "5.0.2",
+      "commands": [
+        "dotnet-ef"
+      ]
+    }
+  }
+}

+ 170 - 0
SuperAdmin/SuperAdmin/Connected Services/SvVsa/ConnectedService.json

@@ -0,0 +1,170 @@
+{
+  "ProviderId": "Microsoft.VisualStudio.ConnectedService.Wcf",
+  "Version": "15.0.40203.910",
+  "GettingStartedDocument": {
+    "Uri": "https://go.microsoft.com/fwlink/?linkid=858517"
+  },
+  "ExtendedData": {
+    "inputs": [
+      "http://154.73.105.33:8080/passportv3/passportWS?wsdl"
+    ],
+    "collectionTypes": [
+      "System.Array",
+      "System.Collections.Generic.Dictionary`2"
+    ],
+    "namespaceMappings": [
+      "*, SvVsa"
+    ],
+    "references": [
+      "ClosedXML, {ClosedXML, 0.95.4}",
+      "Dapper, {Dapper, 2.0.78}",
+      "DocumentFormat.OpenXml, {DocumentFormat.OpenXml, 2.7.2}",
+      "dotnet-aspnet-codegenerator-design, {Microsoft.VisualStudio.Web.CodeGeneration.Design, 3.1.5}",
+      "EPPlus, {EPPlus, 5.6.1}",
+      "ExcelNumberFormat, {ExcelNumberFormat, 1.0.10}",
+      "log4net, {log4net, 2.0.12}",
+      "Microsoft.AspNetCore.Authentication.Abstractions, {Microsoft.AspNetCore.Authentication.Abstractions, 2.2.0}",
+      "Microsoft.AspNetCore.Authentication.Core, {Microsoft.AspNetCore.Authentication.Core, 2.2.0}",
+      "Microsoft.AspNetCore.Authorization, {Microsoft.AspNetCore.Authorization, 2.2.0}",
+      "Microsoft.AspNetCore.Authorization.Policy, {Microsoft.AspNetCore.Authorization.Policy, 2.2.0}",
+      "Microsoft.AspNetCore.Hosting.Abstractions, {Microsoft.AspNetCore.Hosting.Abstractions, 2.2.0}",
+      "Microsoft.AspNetCore.Hosting.Server.Abstractions, {Microsoft.AspNetCore.Hosting.Server.Abstractions, 2.2.0}",
+      "Microsoft.AspNetCore.Html.Abstractions, {Microsoft.AspNetCore.Html.Abstractions, 2.2.0}",
+      "Microsoft.AspNetCore.Http, {Microsoft.AspNetCore.Http, 2.2.0}",
+      "Microsoft.AspNetCore.Http.Abstractions, {Microsoft.AspNetCore.Http.Abstractions, 2.2.0}",
+      "Microsoft.AspNetCore.Http.Extensions, {Microsoft.AspNetCore.Http.Extensions, 2.2.0}",
+      "Microsoft.AspNetCore.Http.Features, {Microsoft.AspNetCore.Http.Features, 2.2.0}",
+      "Microsoft.AspNetCore.Mvc.Abstractions, {Microsoft.AspNetCore.Mvc.Abstractions, 2.2.0}",
+      "Microsoft.AspNetCore.Mvc.Core, {Microsoft.AspNetCore.Mvc.Core, 2.2.5}",
+      "Microsoft.AspNetCore.Mvc.Razor.Extensions, {Microsoft.AspNetCore.Mvc.Razor.Extensions, 3.1.0}",
+      "Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation, {Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation, 3.1.0}",
+      "Microsoft.AspNetCore.Razor, {Microsoft.AspNetCore.Razor, 2.2.0}",
+      "Microsoft.AspNetCore.Razor.Language, {Microsoft.AspNetCore.Razor.Language, 3.1.0}",
+      "Microsoft.AspNetCore.Razor.Runtime, {Microsoft.AspNetCore.Razor.Runtime, 2.2.0}",
+      "Microsoft.AspNetCore.ResponseCaching.Abstractions, {Microsoft.AspNetCore.ResponseCaching.Abstractions, 2.2.0}",
+      "Microsoft.AspNetCore.Routing, {Microsoft.AspNetCore.Routing, 2.2.0}",
+      "Microsoft.AspNetCore.Routing.Abstractions, {Microsoft.AspNetCore.Routing.Abstractions, 2.2.0}",
+      "Microsoft.AspNetCore.WebUtilities, {Microsoft.AspNetCore.WebUtilities, 2.2.0}",
+      "Microsoft.CodeAnalysis, {Microsoft.CodeAnalysis.Common, 3.3.1}",
+      "Microsoft.CodeAnalysis.CSharp, {Microsoft.CodeAnalysis.CSharp, 3.3.1}",
+      "Microsoft.CodeAnalysis.CSharp.Workspaces, {Microsoft.CodeAnalysis.CSharp.Workspaces, 3.3.1}",
+      "Microsoft.CodeAnalysis.Razor, {Microsoft.CodeAnalysis.Razor, 3.1.0}",
+      "Microsoft.CodeAnalysis.Workspaces, {Microsoft.CodeAnalysis.Workspaces.Common, 3.3.1}",
+      "Microsoft.Extensions.Configuration, {Microsoft.Extensions.Configuration, 3.1.10}",
+      "Microsoft.Extensions.Configuration.Abstractions, {Microsoft.Extensions.Configuration.Abstractions, 3.1.10}",
+      "Microsoft.Extensions.Configuration.FileExtensions, {Microsoft.Extensions.Configuration.FileExtensions, 3.1.10}",
+      "Microsoft.Extensions.Configuration.Json, {Microsoft.Extensions.Configuration.Json, 3.1.10}",
+      "Microsoft.Extensions.DependencyInjection, {Microsoft.Extensions.DependencyInjection, 3.1.0}",
+      "Microsoft.Extensions.DependencyInjection.Abstractions, {Microsoft.Extensions.DependencyInjection.Abstractions, 3.1.0}",
+      "Microsoft.Extensions.DependencyModel, {Microsoft.Extensions.DependencyModel, 3.1.0}",
+      "Microsoft.Extensions.FileProviders.Abstractions, {Microsoft.Extensions.FileProviders.Abstractions, 3.1.10}",
+      "Microsoft.Extensions.FileProviders.Physical, {Microsoft.Extensions.FileProviders.Physical, 3.1.10}",
+      "Microsoft.Extensions.FileSystemGlobbing, {Microsoft.Extensions.FileSystemGlobbing, 3.1.10}",
+      "Microsoft.Extensions.Hosting.Abstractions, {Microsoft.Extensions.Hosting.Abstractions, 2.2.0}",
+      "Microsoft.Extensions.Logging.Abstractions, {Microsoft.Extensions.Logging.Abstractions, 2.2.0}",
+      "Microsoft.Extensions.ObjectPool, {Microsoft.Extensions.ObjectPool, 2.2.0}",
+      "Microsoft.Extensions.Options, {Microsoft.Extensions.Options, 2.2.0}",
+      "Microsoft.Extensions.PlatformAbstractions, {Microsoft.Extensions.PlatformAbstractions, 1.1.0}",
+      "Microsoft.Extensions.Primitives, {Microsoft.Extensions.Primitives, 3.1.10}",
+      "Microsoft.IO.RecyclableMemoryStream, {Microsoft.IO.RecyclableMemoryStream, 1.4.1}",
+      "Microsoft.Net.Http.Headers, {Microsoft.Net.Http.Headers, 2.2.0}",
+      "Microsoft.VisualStudio.Web.CodeGeneration, {Microsoft.VisualStudio.Web.CodeGeneration, 3.1.5}",
+      "Microsoft.VisualStudio.Web.CodeGeneration.Contracts, {Microsoft.VisualStudio.Web.CodeGeneration.Contracts, 3.1.5}",
+      "Microsoft.VisualStudio.Web.CodeGeneration.Core, {Microsoft.VisualStudio.Web.CodeGeneration.Core, 3.1.5}",
+      "Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore, {Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore, 3.1.5}",
+      "Microsoft.VisualStudio.Web.CodeGeneration.Templating, {Microsoft.VisualStudio.Web.CodeGeneration.Templating, 3.1.5}",
+      "Microsoft.VisualStudio.Web.CodeGeneration.Utils, {Microsoft.VisualStudio.Web.CodeGeneration.Utils, 3.1.5}",
+      "Microsoft.VisualStudio.Web.CodeGenerators.Mvc, {Microsoft.VisualStudio.Web.CodeGenerators.Mvc, 3.1.5}",
+      "Microsoft.Win32.Primitives, {Microsoft.Win32.Primitives, 4.3.0}",
+      "Nancy, {Nancy, 2.0.0}",
+      "Newtonsoft.Json, {Newtonsoft.Json, 12.0.2}",
+      "NuGet.Frameworks, {NuGet.Frameworks, 4.7.0}",
+      "Oracle.ManagedDataAccess, {Oracle.ManagedDataAccess.Core, 2.19.100}",
+      "System.AppContext, {System.AppContext, 4.3.0}",
+      "System.Collections, {System.Collections, 4.3.0}",
+      "System.Collections.Concurrent, {System.Collections.Concurrent, 4.3.0}",
+      "System.Collections.Immutable, {System.Collections.Immutable, 1.5.0}",
+      "System.Collections.NonGeneric, {System.Collections.NonGeneric, 4.3.0}",
+      "System.Collections.Specialized, {System.Collections.Specialized, 4.3.0}",
+      "System.ComponentModel, {System.ComponentModel, 4.3.0}",
+      "System.ComponentModel.Annotations, {System.ComponentModel.Annotations, 4.7.0}",
+      "System.ComponentModel.Primitives, {System.ComponentModel.Primitives, 4.3.0}",
+      "System.ComponentModel.TypeConverter, {System.ComponentModel.TypeConverter, 4.3.0}",
+      "System.Composition.AttributedModel, {System.Composition.AttributedModel, 1.0.31}",
+      "System.Composition.Convention, {System.Composition.Convention, 1.0.31}",
+      "System.Composition.Hosting, {System.Composition.Hosting, 1.0.31}",
+      "System.Composition.Runtime, {System.Composition.Runtime, 1.0.31}",
+      "System.Composition.TypedParts, {System.Composition.TypedParts, 1.0.31}",
+      "System.Configuration.ConfigurationManager, {System.Configuration.ConfigurationManager, 4.5.0}",
+      "System.Console, {System.Console, 4.3.0}",
+      "System.Data.Common, {System.Data.Common, 4.3.0}",
+      "System.Diagnostics.Debug, {System.Diagnostics.Debug, 4.3.0}",
+      "System.Diagnostics.DiagnosticSource, {System.Diagnostics.DiagnosticSource, 4.5.0}",
+      "System.Diagnostics.Tools, {System.Diagnostics.Tools, 4.3.0}",
+      "System.Diagnostics.Tracing, {System.Diagnostics.Tracing, 4.3.0}",
+      "System.Drawing.Common, {System.Drawing.Common, 4.7.1}",
+      "System.Globalization, {System.Globalization, 4.3.0}",
+      "System.Globalization.Calendars, {System.Globalization.Calendars, 4.3.0}",
+      "System.IO, {System.IO, 4.3.0}",
+      "System.IO.Compression, {System.IO.Compression, 4.3.0}",
+      "System.IO.Compression.ZipFile, {System.IO.Compression.ZipFile, 4.3.0}",
+      "System.IO.FileSystem, {System.IO.FileSystem, 4.3.0}",
+      "System.IO.FileSystem.Primitives, {System.IO.FileSystem.Primitives, 4.3.0}",
+      "System.IO.Packaging, {System.IO.Packaging, 4.0.0}",
+      "System.Linq, {System.Linq, 4.3.0}",
+      "System.Linq.Expressions, {System.Linq.Expressions, 4.3.0}",
+      "System.Net.Http, {System.Net.Http, 4.3.0}",
+      "System.Net.NameResolution, {System.Net.NameResolution, 4.3.0}",
+      "System.Net.Primitives, {System.Net.Primitives, 4.3.0}",
+      "System.Net.Sockets, {System.Net.Sockets, 4.3.0}",
+      "System.ObjectModel, {System.ObjectModel, 4.3.0}",
+      "System.Reflection, {System.Reflection, 4.3.0}",
+      "System.Reflection.Extensions, {System.Reflection.Extensions, 4.3.0}",
+      "System.Reflection.Metadata, {System.Reflection.Metadata, 1.6.0}",
+      "System.Reflection.Primitives, {System.Reflection.Primitives, 4.3.0}",
+      "System.Reflection.TypeExtensions, {System.Reflection.TypeExtensions, 4.3.0}",
+      "System.Resources.ResourceManager, {System.Resources.ResourceManager, 4.3.0}",
+      "System.Runtime, {System.Runtime, 4.3.0}",
+      "System.Runtime.CompilerServices.Unsafe, {System.Runtime.CompilerServices.Unsafe, 4.5.2}",
+      "System.Runtime.Extensions, {System.Runtime.Extensions, 4.3.0}",
+      "System.Runtime.Handles, {System.Runtime.Handles, 4.3.0}",
+      "System.Runtime.InteropServices, {System.Runtime.InteropServices, 4.3.0}",
+      "System.Runtime.InteropServices.RuntimeInformation, {System.Runtime.InteropServices.RuntimeInformation, 4.3.0}",
+      "System.Runtime.Numerics, {System.Runtime.Numerics, 4.3.0}",
+      "System.Security.AccessControl, {System.Security.AccessControl, 4.5.0}",
+      "System.Security.Claims, {System.Security.Claims, 4.3.0}",
+      "System.Security.Cryptography.Algorithms, {System.Security.Cryptography.Algorithms, 4.3.0}",
+      "System.Security.Cryptography.Encoding, {System.Security.Cryptography.Encoding, 4.3.0}",
+      "System.Security.Cryptography.Pkcs, {System.Security.Cryptography.Pkcs, 4.7.0}",
+      "System.Security.Cryptography.Primitives, {System.Security.Cryptography.Primitives, 4.3.0}",
+      "System.Security.Cryptography.X509Certificates, {System.Security.Cryptography.X509Certificates, 4.3.2}",
+      "System.Security.Permissions, {System.Security.Permissions, 4.5.0}",
+      "System.Security.Principal, {System.Security.Principal, 4.3.0}",
+      "System.Security.Principal.Windows, {System.Security.Principal.Windows, 4.5.0}",
+      "System.ServiceModel, {System.ServiceModel.Primitives, 4.4.4}",
+      "System.ServiceModel.Duplex, {System.ServiceModel.Duplex, 4.4.4}",
+      "System.ServiceModel.Http, {System.ServiceModel.Http, 4.4.4}",
+      "System.ServiceModel.NetTcp, {System.ServiceModel.NetTcp, 4.4.4}",
+      "System.ServiceModel.Primitives, {System.ServiceModel.Primitives, 4.4.4}",
+      "System.ServiceModel.Security, {System.ServiceModel.Security, 4.4.4}",
+      "System.Text.Encoding, {System.Text.Encoding, 4.3.0}",
+      "System.Text.Encoding.CodePages, {System.Text.Encoding.CodePages, 4.7.1}",
+      "System.Text.Encoding.Extensions, {System.Text.Encoding.Extensions, 4.3.0}",
+      "System.Text.Encodings.Web, {System.Text.Encodings.Web, 4.5.0}",
+      "System.Text.Json, {System.Text.Json, 4.7.0}",
+      "System.Text.RegularExpressions, {System.Text.RegularExpressions, 4.3.0}",
+      "System.Threading, {System.Threading, 4.3.0}",
+      "System.Threading.Tasks, {System.Threading.Tasks, 4.3.0}",
+      "System.Threading.Timer, {System.Threading.Timer, 4.3.0}",
+      "System.Xml.ReaderWriter, {System.Xml.ReaderWriter, 4.3.0}",
+      "System.Xml.XDocument, {System.Xml.XDocument, 4.3.0}",
+      "System.Xml.XmlDocument, {System.Xml.XmlDocument, 4.3.0}",
+      "System.Xml.XmlSerializer, {System.Xml.XmlSerializer, 4.3.0}",
+      "System.Xml.XPath, {System.Xml.XPath, 4.3.0}",
+      "System.Xml.XPath.XmlDocument, {System.Xml.XPath.XmlDocument, 4.3.0}"
+    ],
+    "sync": true,
+    "targetFramework": "netcoreapp3.1",
+    "typeReuseMode": "All"
+  }
+}

+ 1163 - 0
SuperAdmin/SuperAdmin/Connected Services/SvVsa/Reference.cs

@@ -0,0 +1,1163 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     This code was generated by a tool.
+//
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace SvVsa
+{
+    
+    
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.2")]
+    [System.ServiceModel.ServiceContractAttribute(Namespace="http://passport.viettel.com/", ConfigurationName="SvVsa.passportWS")]
+    public interface passportWS
+    {
+        
+        // CODEGEN: Parameter 'return' requires additional schema information that cannot be captured using the parameter mode. The specific attribute is 'Microsoft.Xml.Serialization.XmlElementAttribute'.
+        [System.ServiceModel.OperationContractAttribute(Action="http://passport.viettel.com/passportWS/validateRequest", ReplyAction="http://passport.viettel.com/passportWS/validateResponse")]
+        [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)]
+        [return: System.ServiceModel.MessageParameterAttribute(Name="return")]
+        SvVsa.validateResponse validate(SvVsa.validateRequest request);
+        
+        [System.ServiceModel.OperationContractAttribute(Action="http://passport.viettel.com/passportWS/validateRequest", ReplyAction="http://passport.viettel.com/passportWS/validateResponse")]
+        System.Threading.Tasks.Task<SvVsa.validateResponse> validateAsync(SvVsa.validateRequest request);
+        
+        // CODEGEN: Parameter 'return' requires additional schema information that cannot be captured using the parameter mode. The specific attribute is 'Microsoft.Xml.Serialization.XmlElementAttribute'.
+        [System.ServiceModel.OperationContractAttribute(Action="http://passport.viettel.com/passportWS/getAppFunctionsRequest", ReplyAction="http://passport.viettel.com/passportWS/getAppFunctionsResponse")]
+        [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)]
+        [return: System.ServiceModel.MessageParameterAttribute(Name="return")]
+        SvVsa.getAppFunctionsResponse getAppFunctions(SvVsa.getAppFunctionsRequest request);
+        
+        [System.ServiceModel.OperationContractAttribute(Action="http://passport.viettel.com/passportWS/getAppFunctionsRequest", ReplyAction="http://passport.viettel.com/passportWS/getAppFunctionsResponse")]
+        System.Threading.Tasks.Task<SvVsa.getAppFunctionsResponse> getAppFunctionsAsync(SvVsa.getAppFunctionsRequest request);
+        
+        // CODEGEN: Parameter 'return' requires additional schema information that cannot be captured using the parameter mode. The specific attribute is 'Microsoft.Xml.Serialization.XmlElementAttribute'.
+        [System.ServiceModel.OperationContractAttribute(Action="http://passport.viettel.com/passportWS/validateIncludeIpRequest", ReplyAction="http://passport.viettel.com/passportWS/validateIncludeIpResponse")]
+        [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)]
+        [return: System.ServiceModel.MessageParameterAttribute(Name="return")]
+        SvVsa.validateIncludeIpResponse validateIncludeIp(SvVsa.validateIncludeIpRequest request);
+        
+        [System.ServiceModel.OperationContractAttribute(Action="http://passport.viettel.com/passportWS/validateIncludeIpRequest", ReplyAction="http://passport.viettel.com/passportWS/validateIncludeIpResponse")]
+        System.Threading.Tasks.Task<SvVsa.validateIncludeIpResponse> validateIncludeIpAsync(SvVsa.validateIncludeIpRequest request);
+        
+        // CODEGEN: Parameter 'return' requires additional schema information that cannot be captured using the parameter mode. The specific attribute is 'Microsoft.Xml.Serialization.XmlElementAttribute'.
+        [System.ServiceModel.OperationContractAttribute(Action="http://passport.viettel.com/passportWS/getRolesOfAppRequest", ReplyAction="http://passport.viettel.com/passportWS/getRolesOfAppResponse")]
+        [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)]
+        [return: System.ServiceModel.MessageParameterAttribute(Name="return")]
+        SvVsa.getRolesOfAppResponse getRolesOfApp(SvVsa.getRolesOfAppRequest request);
+        
+        [System.ServiceModel.OperationContractAttribute(Action="http://passport.viettel.com/passportWS/getRolesOfAppRequest", ReplyAction="http://passport.viettel.com/passportWS/getRolesOfAppResponse")]
+        System.Threading.Tasks.Task<SvVsa.getRolesOfAppResponse> getRolesOfAppAsync(SvVsa.getRolesOfAppRequest request);
+        
+        // CODEGEN: Parameter 'return' requires additional schema information that cannot be captured using the parameter mode. The specific attribute is 'Microsoft.Xml.Serialization.XmlElementAttribute'.
+        [System.ServiceModel.OperationContractAttribute(Action="http://passport.viettel.com/passportWS/changePassRequest", ReplyAction="http://passport.viettel.com/passportWS/changePassResponse")]
+        [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)]
+        [System.ServiceModel.ServiceKnownTypeAttribute(typeof(validateIncludeIpResponse))]
+        [System.ServiceModel.ServiceKnownTypeAttribute(typeof(validateIncludeIp))]
+        [System.ServiceModel.ServiceKnownTypeAttribute(typeof(getAppFunctionsResponse))]
+        [System.ServiceModel.ServiceKnownTypeAttribute(typeof(getAppFunctions))]
+        [System.ServiceModel.ServiceKnownTypeAttribute(typeof(getRolesOfAppResponse))]
+        [System.ServiceModel.ServiceKnownTypeAttribute(typeof(getRolesOfApp))]
+        [System.ServiceModel.ServiceKnownTypeAttribute(typeof(changePassResponse))]
+        [System.ServiceModel.ServiceKnownTypeAttribute(typeof(changePass))]
+        [System.ServiceModel.ServiceKnownTypeAttribute(typeof(getAllowedAppResponse))]
+        [System.ServiceModel.ServiceKnownTypeAttribute(typeof(getAllowedApp))]
+        [System.ServiceModel.ServiceKnownTypeAttribute(typeof(validateResponse))]
+        [System.ServiceModel.ServiceKnownTypeAttribute(typeof(validate))]
+        [return: System.ServiceModel.MessageParameterAttribute(Name="return")]
+        SvVsa.changePassResponse1 changePass(SvVsa.changePassRequest request);
+        
+        [System.ServiceModel.OperationContractAttribute(Action="http://passport.viettel.com/passportWS/changePassRequest", ReplyAction="http://passport.viettel.com/passportWS/changePassResponse")]
+        System.Threading.Tasks.Task<SvVsa.changePassResponse1> changePassAsync(SvVsa.changePassRequest request);
+        
+        // CODEGEN: Parameter 'return' requires additional schema information that cannot be captured using the parameter mode. The specific attribute is 'Microsoft.Xml.Serialization.XmlElementAttribute'.
+        [System.ServiceModel.OperationContractAttribute(Action="http://passport.viettel.com/passportWS/getAllowedAppRequest", ReplyAction="http://passport.viettel.com/passportWS/getAllowedAppResponse")]
+        [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)]
+        [System.ServiceModel.ServiceKnownTypeAttribute(typeof(validateIncludeIpResponse))]
+        [System.ServiceModel.ServiceKnownTypeAttribute(typeof(validateIncludeIp))]
+        [System.ServiceModel.ServiceKnownTypeAttribute(typeof(getAppFunctionsResponse))]
+        [System.ServiceModel.ServiceKnownTypeAttribute(typeof(getAppFunctions))]
+        [System.ServiceModel.ServiceKnownTypeAttribute(typeof(getRolesOfAppResponse))]
+        [System.ServiceModel.ServiceKnownTypeAttribute(typeof(getRolesOfApp))]
+        [System.ServiceModel.ServiceKnownTypeAttribute(typeof(changePassResponse))]
+        [System.ServiceModel.ServiceKnownTypeAttribute(typeof(changePass))]
+        [System.ServiceModel.ServiceKnownTypeAttribute(typeof(getAllowedAppResponse))]
+        [System.ServiceModel.ServiceKnownTypeAttribute(typeof(getAllowedApp))]
+        [System.ServiceModel.ServiceKnownTypeAttribute(typeof(validateResponse))]
+        [System.ServiceModel.ServiceKnownTypeAttribute(typeof(validate))]
+        [return: System.ServiceModel.MessageParameterAttribute(Name="return")]
+        SvVsa.getAllowedAppResponse1 getAllowedApp(SvVsa.getAllowedAppRequest request);
+        
+        [System.ServiceModel.OperationContractAttribute(Action="http://passport.viettel.com/passportWS/getAllowedAppRequest", ReplyAction="http://passport.viettel.com/passportWS/getAllowedAppResponse")]
+        System.Threading.Tasks.Task<SvVsa.getAllowedAppResponse1> getAllowedAppAsync(SvVsa.getAllowedAppRequest request);
+    }
+    
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.2")]
+    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+    [System.ServiceModel.MessageContractAttribute(WrapperName="validate", WrapperNamespace="http://passport.viettel.com/", IsWrapped=true)]
+    public partial class validateRequest
+    {
+        
+        [System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://passport.viettel.com/", Order=0)]
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+        public string userName;
+        
+        [System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://passport.viettel.com/", Order=1)]
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+        public string password;
+        
+        [System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://passport.viettel.com/", Order=2)]
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+        public string domainCode;
+        
+        public validateRequest()
+        {
+        }
+        
+        public validateRequest(string userName, string password, string domainCode)
+        {
+            this.userName = userName;
+            this.password = password;
+            this.domainCode = domainCode;
+        }
+    }
+    
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.2")]
+    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+    [System.ServiceModel.MessageContractAttribute(WrapperName="validateResponse", WrapperNamespace="http://passport.viettel.com/", IsWrapped=true)]
+    public partial class validateResponse
+    {
+        
+        [System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://passport.viettel.com/", Order=0)]
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+        public string @return;
+        
+        public validateResponse()
+        {
+        }
+        
+        public validateResponse(string @return)
+        {
+            this.@return = @return;
+        }
+    }
+    
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.2")]
+    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+    [System.ServiceModel.MessageContractAttribute(WrapperName="getAppFunctions", WrapperNamespace="http://passport.viettel.com/", IsWrapped=true)]
+    public partial class getAppFunctionsRequest
+    {
+        
+        [System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://passport.viettel.com/", Order=0)]
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+        public string domainCode;
+        
+        public getAppFunctionsRequest()
+        {
+        }
+        
+        public getAppFunctionsRequest(string domainCode)
+        {
+            this.domainCode = domainCode;
+        }
+    }
+    
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.2")]
+    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+    [System.ServiceModel.MessageContractAttribute(WrapperName="getAppFunctionsResponse", WrapperNamespace="http://passport.viettel.com/", IsWrapped=true)]
+    public partial class getAppFunctionsResponse
+    {
+        
+        [System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://passport.viettel.com/", Order=0)]
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+        public string @return;
+        
+        public getAppFunctionsResponse()
+        {
+        }
+        
+        public getAppFunctionsResponse(string @return)
+        {
+            this.@return = @return;
+        }
+    }
+    
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.2")]
+    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+    [System.ServiceModel.MessageContractAttribute(WrapperName="validateIncludeIp", WrapperNamespace="http://passport.viettel.com/", IsWrapped=true)]
+    public partial class validateIncludeIpRequest
+    {
+        
+        [System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://passport.viettel.com/", Order=0)]
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+        public string userName;
+        
+        [System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://passport.viettel.com/", Order=1)]
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+        public string password;
+        
+        [System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://passport.viettel.com/", Order=2)]
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+        public string domainCode;
+        
+        [System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://passport.viettel.com/", Order=3)]
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+        public string ipCheck;
+        
+        public validateIncludeIpRequest()
+        {
+        }
+        
+        public validateIncludeIpRequest(string userName, string password, string domainCode, string ipCheck)
+        {
+            this.userName = userName;
+            this.password = password;
+            this.domainCode = domainCode;
+            this.ipCheck = ipCheck;
+        }
+    }
+    
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.2")]
+    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+    [System.ServiceModel.MessageContractAttribute(WrapperName="validateIncludeIpResponse", WrapperNamespace="http://passport.viettel.com/", IsWrapped=true)]
+    public partial class validateIncludeIpResponse
+    {
+        
+        [System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://passport.viettel.com/", Order=0)]
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+        public string @return;
+        
+        public validateIncludeIpResponse()
+        {
+        }
+        
+        public validateIncludeIpResponse(string @return)
+        {
+            this.@return = @return;
+        }
+    }
+    
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.2")]
+    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+    [System.ServiceModel.MessageContractAttribute(WrapperName="getRolesOfApp", WrapperNamespace="http://passport.viettel.com/", IsWrapped=true)]
+    public partial class getRolesOfAppRequest
+    {
+        
+        [System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://passport.viettel.com/", Order=0)]
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+        public string domainCode;
+        
+        public getRolesOfAppRequest()
+        {
+        }
+        
+        public getRolesOfAppRequest(string domainCode)
+        {
+            this.domainCode = domainCode;
+        }
+    }
+    
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.2")]
+    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+    [System.ServiceModel.MessageContractAttribute(WrapperName="getRolesOfAppResponse", WrapperNamespace="http://passport.viettel.com/", IsWrapped=true)]
+    public partial class getRolesOfAppResponse
+    {
+        
+        [System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://passport.viettel.com/", Order=0)]
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+        public string @return;
+        
+        public getRolesOfAppResponse()
+        {
+        }
+        
+        public getRolesOfAppResponse(string @return)
+        {
+            this.@return = @return;
+        }
+    }
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.2")]
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://passport.viettel.com/")]
+    public partial class response
+    {
+        
+        private errorCode errorCodeField;
+        
+        private object[] valuesField;
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=0)]
+        public errorCode errorCode
+        {
+            get
+            {
+                return this.errorCodeField;
+            }
+            set
+            {
+                this.errorCodeField = value;
+            }
+        }
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute("values", Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true, Order=1)]
+        public object[] values
+        {
+            get
+            {
+                return this.valuesField;
+            }
+            set
+            {
+                this.valuesField = value;
+            }
+        }
+    }
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.2")]
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://passport.viettel.com/")]
+    public partial class errorCode
+    {
+        
+        private int codeField;
+        
+        private string descriptionField;
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=0)]
+        public int code
+        {
+            get
+            {
+                return this.codeField;
+            }
+            set
+            {
+                this.codeField = value;
+            }
+        }
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=1)]
+        public string description
+        {
+            get
+            {
+                return this.descriptionField;
+            }
+            set
+            {
+                this.descriptionField = value;
+            }
+        }
+    }
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.2")]
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://passport.viettel.com/")]
+    public partial class validateIncludeIpResponse1
+    {
+        
+        private string returnField;
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=0)]
+        public string @return
+        {
+            get
+            {
+                return this.returnField;
+            }
+            set
+            {
+                this.returnField = value;
+            }
+        }
+    }
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.2")]
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://passport.viettel.com/")]
+    public partial class validateIncludeIp
+    {
+        
+        private string userNameField;
+        
+        private string passwordField;
+        
+        private string domainCodeField;
+        
+        private string ipCheckField;
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=0)]
+        public string userName
+        {
+            get
+            {
+                return this.userNameField;
+            }
+            set
+            {
+                this.userNameField = value;
+            }
+        }
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=1)]
+        public string password
+        {
+            get
+            {
+                return this.passwordField;
+            }
+            set
+            {
+                this.passwordField = value;
+            }
+        }
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=2)]
+        public string domainCode
+        {
+            get
+            {
+                return this.domainCodeField;
+            }
+            set
+            {
+                this.domainCodeField = value;
+            }
+        }
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=3)]
+        public string ipCheck
+        {
+            get
+            {
+                return this.ipCheckField;
+            }
+            set
+            {
+                this.ipCheckField = value;
+            }
+        }
+    }
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.2")]
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://passport.viettel.com/")]
+    public partial class getAppFunctionsResponse1
+    {
+        
+        private string returnField;
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=0)]
+        public string @return
+        {
+            get
+            {
+                return this.returnField;
+            }
+            set
+            {
+                this.returnField = value;
+            }
+        }
+    }
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.2")]
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://passport.viettel.com/")]
+    public partial class getAppFunctions
+    {
+        
+        private string domainCodeField;
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=0)]
+        public string domainCode
+        {
+            get
+            {
+                return this.domainCodeField;
+            }
+            set
+            {
+                this.domainCodeField = value;
+            }
+        }
+    }
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.2")]
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://passport.viettel.com/")]
+    public partial class getRolesOfAppResponse1
+    {
+        
+        private string returnField;
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=0)]
+        public string @return
+        {
+            get
+            {
+                return this.returnField;
+            }
+            set
+            {
+                this.returnField = value;
+            }
+        }
+    }
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.2")]
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://passport.viettel.com/")]
+    public partial class getRolesOfApp
+    {
+        
+        private string domainCodeField;
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=0)]
+        public string domainCode
+        {
+            get
+            {
+                return this.domainCodeField;
+            }
+            set
+            {
+                this.domainCodeField = value;
+            }
+        }
+    }
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.2")]
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://passport.viettel.com/")]
+    public partial class changePassResponse
+    {
+        
+        private response returnField;
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=0)]
+        public response @return
+        {
+            get
+            {
+                return this.returnField;
+            }
+            set
+            {
+                this.returnField = value;
+            }
+        }
+    }
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.2")]
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://passport.viettel.com/")]
+    public partial class changePass
+    {
+        
+        private string userNameField;
+        
+        private string oldPassField;
+        
+        private string newPassField;
+        
+        private string repeatPassField;
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=0)]
+        public string userName
+        {
+            get
+            {
+                return this.userNameField;
+            }
+            set
+            {
+                this.userNameField = value;
+            }
+        }
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=1)]
+        public string oldPass
+        {
+            get
+            {
+                return this.oldPassField;
+            }
+            set
+            {
+                this.oldPassField = value;
+            }
+        }
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=2)]
+        public string newPass
+        {
+            get
+            {
+                return this.newPassField;
+            }
+            set
+            {
+                this.newPassField = value;
+            }
+        }
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=3)]
+        public string repeatPass
+        {
+            get
+            {
+                return this.repeatPassField;
+            }
+            set
+            {
+                this.repeatPassField = value;
+            }
+        }
+    }
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.2")]
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://passport.viettel.com/")]
+    public partial class getAllowedAppResponse
+    {
+        
+        private string returnField;
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=0)]
+        public string @return
+        {
+            get
+            {
+                return this.returnField;
+            }
+            set
+            {
+                this.returnField = value;
+            }
+        }
+    }
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.2")]
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://passport.viettel.com/")]
+    public partial class getAllowedApp
+    {
+        
+        private string userNameField;
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=0)]
+        public string userName
+        {
+            get
+            {
+                return this.userNameField;
+            }
+            set
+            {
+                this.userNameField = value;
+            }
+        }
+    }
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.2")]
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://passport.viettel.com/")]
+    public partial class validateResponse1
+    {
+        
+        private string returnField;
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=0)]
+        public string @return
+        {
+            get
+            {
+                return this.returnField;
+            }
+            set
+            {
+                this.returnField = value;
+            }
+        }
+    }
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.2")]
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://passport.viettel.com/")]
+    public partial class validate
+    {
+        
+        private string userNameField;
+        
+        private string passwordField;
+        
+        private string domainCodeField;
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=0)]
+        public string userName
+        {
+            get
+            {
+                return this.userNameField;
+            }
+            set
+            {
+                this.userNameField = value;
+            }
+        }
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=1)]
+        public string password
+        {
+            get
+            {
+                return this.passwordField;
+            }
+            set
+            {
+                this.passwordField = value;
+            }
+        }
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=2)]
+        public string domainCode
+        {
+            get
+            {
+                return this.domainCodeField;
+            }
+            set
+            {
+                this.domainCodeField = value;
+            }
+        }
+    }
+    
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.2")]
+    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+    [System.ServiceModel.MessageContractAttribute(WrapperName="changePass", WrapperNamespace="http://passport.viettel.com/", IsWrapped=true)]
+    public partial class changePassRequest
+    {
+        
+        [System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://passport.viettel.com/", Order=0)]
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+        public string userName;
+        
+        [System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://passport.viettel.com/", Order=1)]
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+        public string oldPass;
+        
+        [System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://passport.viettel.com/", Order=2)]
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+        public string newPass;
+        
+        [System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://passport.viettel.com/", Order=3)]
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+        public string repeatPass;
+        
+        public changePassRequest()
+        {
+        }
+        
+        public changePassRequest(string userName, string oldPass, string newPass, string repeatPass)
+        {
+            this.userName = userName;
+            this.oldPass = oldPass;
+            this.newPass = newPass;
+            this.repeatPass = repeatPass;
+        }
+    }
+    
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.2")]
+    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+    [System.ServiceModel.MessageContractAttribute(WrapperName="changePassResponse", WrapperNamespace="http://passport.viettel.com/", IsWrapped=true)]
+    public partial class changePassResponse1
+    {
+        
+        [System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://passport.viettel.com/", Order=0)]
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+        public SvVsa.response @return;
+        
+        public changePassResponse1()
+        {
+        }
+        
+        public changePassResponse1(SvVsa.response @return)
+        {
+            this.@return = @return;
+        }
+    }
+    
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.2")]
+    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+    [System.ServiceModel.MessageContractAttribute(WrapperName="getAllowedApp", WrapperNamespace="http://passport.viettel.com/", IsWrapped=true)]
+    public partial class getAllowedAppRequest
+    {
+        
+        [System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://passport.viettel.com/", Order=0)]
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+        public string userName;
+        
+        public getAllowedAppRequest()
+        {
+        }
+        
+        public getAllowedAppRequest(string userName)
+        {
+            this.userName = userName;
+        }
+    }
+    
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.2")]
+    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+    [System.ServiceModel.MessageContractAttribute(WrapperName="getAllowedAppResponse", WrapperNamespace="http://passport.viettel.com/", IsWrapped=true)]
+    public partial class getAllowedAppResponse1
+    {
+        
+        [System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://passport.viettel.com/", Order=0)]
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+        public string @return;
+        
+        public getAllowedAppResponse1()
+        {
+        }
+        
+        public getAllowedAppResponse1(string @return)
+        {
+            this.@return = @return;
+        }
+    }
+    
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.2")]
+    public interface passportWSChannel : SvVsa.passportWS, System.ServiceModel.IClientChannel
+    {
+    }
+    
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.2")]
+    public partial class passportWSClient : System.ServiceModel.ClientBase<SvVsa.passportWS>, SvVsa.passportWS
+    {
+        
+        /// <summary>
+        /// Implement this partial method to configure the service endpoint.
+        /// </summary>
+        /// <param name="serviceEndpoint">The endpoint to configure</param>
+        /// <param name="clientCredentials">The client credentials</param>
+        static partial void ConfigureEndpoint(System.ServiceModel.Description.ServiceEndpoint serviceEndpoint, System.ServiceModel.Description.ClientCredentials clientCredentials);
+        
+        public passportWSClient() : 
+                base(passportWSClient.GetDefaultBinding(), passportWSClient.GetDefaultEndpointAddress())
+        {
+            this.Endpoint.Name = EndpointConfiguration.passportWSPort.ToString();
+            ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
+        }
+        
+        public passportWSClient(EndpointConfiguration endpointConfiguration) : 
+                base(passportWSClient.GetBindingForEndpoint(endpointConfiguration), passportWSClient.GetEndpointAddress(endpointConfiguration))
+        {
+            this.Endpoint.Name = endpointConfiguration.ToString();
+            ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
+        }
+        
+        public passportWSClient(EndpointConfiguration endpointConfiguration, string remoteAddress) : 
+                base(passportWSClient.GetBindingForEndpoint(endpointConfiguration), new System.ServiceModel.EndpointAddress(remoteAddress))
+        {
+            this.Endpoint.Name = endpointConfiguration.ToString();
+            ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
+        }
+        
+        public passportWSClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) : 
+                base(passportWSClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress)
+        {
+            this.Endpoint.Name = endpointConfiguration.ToString();
+            ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
+        }
+        
+        public passportWSClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : 
+                base(binding, remoteAddress)
+        {
+        }
+        
+        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+        SvVsa.validateResponse SvVsa.passportWS.validate(SvVsa.validateRequest request)
+        {
+            return base.Channel.validate(request);
+        }
+        
+        public string validate(string userName, string password, string domainCode)
+        {
+            SvVsa.validateRequest inValue = new SvVsa.validateRequest();
+            inValue.userName = userName;
+            inValue.password = password;
+            inValue.domainCode = domainCode;
+            SvVsa.validateResponse retVal = ((SvVsa.passportWS)(this)).validate(inValue);
+            return retVal.@return;
+        }
+        
+        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+        System.Threading.Tasks.Task<SvVsa.validateResponse> SvVsa.passportWS.validateAsync(SvVsa.validateRequest request)
+        {
+            return base.Channel.validateAsync(request);
+        }
+        
+        public System.Threading.Tasks.Task<SvVsa.validateResponse> validateAsync(string userName, string password, string domainCode)
+        {
+            SvVsa.validateRequest inValue = new SvVsa.validateRequest();
+            inValue.userName = userName;
+            inValue.password = password;
+            inValue.domainCode = domainCode;
+            return ((SvVsa.passportWS)(this)).validateAsync(inValue);
+        }
+        
+        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+        SvVsa.getAppFunctionsResponse SvVsa.passportWS.getAppFunctions(SvVsa.getAppFunctionsRequest request)
+        {
+            return base.Channel.getAppFunctions(request);
+        }
+        
+        public string getAppFunctions(string domainCode)
+        {
+            SvVsa.getAppFunctionsRequest inValue = new SvVsa.getAppFunctionsRequest();
+            inValue.domainCode = domainCode;
+            SvVsa.getAppFunctionsResponse retVal = ((SvVsa.passportWS)(this)).getAppFunctions(inValue);
+            return retVal.@return;
+        }
+        
+        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+        System.Threading.Tasks.Task<SvVsa.getAppFunctionsResponse> SvVsa.passportWS.getAppFunctionsAsync(SvVsa.getAppFunctionsRequest request)
+        {
+            return base.Channel.getAppFunctionsAsync(request);
+        }
+        
+        public System.Threading.Tasks.Task<SvVsa.getAppFunctionsResponse> getAppFunctionsAsync(string domainCode)
+        {
+            SvVsa.getAppFunctionsRequest inValue = new SvVsa.getAppFunctionsRequest();
+            inValue.domainCode = domainCode;
+            return ((SvVsa.passportWS)(this)).getAppFunctionsAsync(inValue);
+        }
+        
+        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+        SvVsa.validateIncludeIpResponse SvVsa.passportWS.validateIncludeIp(SvVsa.validateIncludeIpRequest request)
+        {
+            return base.Channel.validateIncludeIp(request);
+        }
+        
+        public string validateIncludeIp(string userName, string password, string domainCode, string ipCheck)
+        {
+            SvVsa.validateIncludeIpRequest inValue = new SvVsa.validateIncludeIpRequest();
+            inValue.userName = userName;
+            inValue.password = password;
+            inValue.domainCode = domainCode;
+            inValue.ipCheck = ipCheck;
+            SvVsa.validateIncludeIpResponse retVal = ((SvVsa.passportWS)(this)).validateIncludeIp(inValue);
+            return retVal.@return;
+        }
+        
+        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+        System.Threading.Tasks.Task<SvVsa.validateIncludeIpResponse> SvVsa.passportWS.validateIncludeIpAsync(SvVsa.validateIncludeIpRequest request)
+        {
+            return base.Channel.validateIncludeIpAsync(request);
+        }
+        
+        public System.Threading.Tasks.Task<SvVsa.validateIncludeIpResponse> validateIncludeIpAsync(string userName, string password, string domainCode, string ipCheck)
+        {
+            SvVsa.validateIncludeIpRequest inValue = new SvVsa.validateIncludeIpRequest();
+            inValue.userName = userName;
+            inValue.password = password;
+            inValue.domainCode = domainCode;
+            inValue.ipCheck = ipCheck;
+            return ((SvVsa.passportWS)(this)).validateIncludeIpAsync(inValue);
+        }
+        
+        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+        SvVsa.getRolesOfAppResponse SvVsa.passportWS.getRolesOfApp(SvVsa.getRolesOfAppRequest request)
+        {
+            return base.Channel.getRolesOfApp(request);
+        }
+        
+        public string getRolesOfApp(string domainCode)
+        {
+            SvVsa.getRolesOfAppRequest inValue = new SvVsa.getRolesOfAppRequest();
+            inValue.domainCode = domainCode;
+            SvVsa.getRolesOfAppResponse retVal = ((SvVsa.passportWS)(this)).getRolesOfApp(inValue);
+            return retVal.@return;
+        }
+        
+        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+        System.Threading.Tasks.Task<SvVsa.getRolesOfAppResponse> SvVsa.passportWS.getRolesOfAppAsync(SvVsa.getRolesOfAppRequest request)
+        {
+            return base.Channel.getRolesOfAppAsync(request);
+        }
+        
+        public System.Threading.Tasks.Task<SvVsa.getRolesOfAppResponse> getRolesOfAppAsync(string domainCode)
+        {
+            SvVsa.getRolesOfAppRequest inValue = new SvVsa.getRolesOfAppRequest();
+            inValue.domainCode = domainCode;
+            return ((SvVsa.passportWS)(this)).getRolesOfAppAsync(inValue);
+        }
+        
+        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+        SvVsa.changePassResponse1 SvVsa.passportWS.changePass(SvVsa.changePassRequest request)
+        {
+            return base.Channel.changePass(request);
+        }
+        
+        public SvVsa.response changePass(string userName, string oldPass, string newPass, string repeatPass)
+        {
+            SvVsa.changePassRequest inValue = new SvVsa.changePassRequest();
+            inValue.userName = userName;
+            inValue.oldPass = oldPass;
+            inValue.newPass = newPass;
+            inValue.repeatPass = repeatPass;
+            SvVsa.changePassResponse1 retVal = ((SvVsa.passportWS)(this)).changePass(inValue);
+            return retVal.@return;
+        }
+        
+        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+        System.Threading.Tasks.Task<SvVsa.changePassResponse1> SvVsa.passportWS.changePassAsync(SvVsa.changePassRequest request)
+        {
+            return base.Channel.changePassAsync(request);
+        }
+        
+        public System.Threading.Tasks.Task<SvVsa.changePassResponse1> changePassAsync(string userName, string oldPass, string newPass, string repeatPass)
+        {
+            SvVsa.changePassRequest inValue = new SvVsa.changePassRequest();
+            inValue.userName = userName;
+            inValue.oldPass = oldPass;
+            inValue.newPass = newPass;
+            inValue.repeatPass = repeatPass;
+            return ((SvVsa.passportWS)(this)).changePassAsync(inValue);
+        }
+        
+        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+        SvVsa.getAllowedAppResponse1 SvVsa.passportWS.getAllowedApp(SvVsa.getAllowedAppRequest request)
+        {
+            return base.Channel.getAllowedApp(request);
+        }
+        
+        public string getAllowedApp(string userName)
+        {
+            SvVsa.getAllowedAppRequest inValue = new SvVsa.getAllowedAppRequest();
+            inValue.userName = userName;
+            SvVsa.getAllowedAppResponse1 retVal = ((SvVsa.passportWS)(this)).getAllowedApp(inValue);
+            return retVal.@return;
+        }
+        
+        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+        System.Threading.Tasks.Task<SvVsa.getAllowedAppResponse1> SvVsa.passportWS.getAllowedAppAsync(SvVsa.getAllowedAppRequest request)
+        {
+            return base.Channel.getAllowedAppAsync(request);
+        }
+        
+        public System.Threading.Tasks.Task<SvVsa.getAllowedAppResponse1> getAllowedAppAsync(string userName)
+        {
+            SvVsa.getAllowedAppRequest inValue = new SvVsa.getAllowedAppRequest();
+            inValue.userName = userName;
+            return ((SvVsa.passportWS)(this)).getAllowedAppAsync(inValue);
+        }
+        
+        public virtual System.Threading.Tasks.Task OpenAsync()
+        {
+            return System.Threading.Tasks.Task.Factory.FromAsync(((System.ServiceModel.ICommunicationObject)(this)).BeginOpen(null, null), new System.Action<System.IAsyncResult>(((System.ServiceModel.ICommunicationObject)(this)).EndOpen));
+        }
+        
+        public virtual System.Threading.Tasks.Task CloseAsync()
+        {
+            return System.Threading.Tasks.Task.Factory.FromAsync(((System.ServiceModel.ICommunicationObject)(this)).BeginClose(null, null), new System.Action<System.IAsyncResult>(((System.ServiceModel.ICommunicationObject)(this)).EndClose));
+        }
+        
+        private static System.ServiceModel.Channels.Binding GetBindingForEndpoint(EndpointConfiguration endpointConfiguration)
+        {
+            if ((endpointConfiguration == EndpointConfiguration.passportWSPort))
+            {
+                System.ServiceModel.BasicHttpBinding result = new System.ServiceModel.BasicHttpBinding();
+                result.MaxBufferSize = int.MaxValue;
+                result.ReaderQuotas = System.Xml.XmlDictionaryReaderQuotas.Max;
+                result.MaxReceivedMessageSize = int.MaxValue;
+                result.AllowCookies = true;
+                return result;
+            }
+            throw new System.InvalidOperationException(string.Format("Could not find endpoint with name \'{0}\'.", endpointConfiguration));
+        }
+        
+        private static System.ServiceModel.EndpointAddress GetEndpointAddress(EndpointConfiguration endpointConfiguration)
+        {
+            if ((endpointConfiguration == EndpointConfiguration.passportWSPort))
+            {
+                return new System.ServiceModel.EndpointAddress("http://154.73.105.33:8080/passportv3/passportWS");
+            }
+            throw new System.InvalidOperationException(string.Format("Could not find endpoint with name \'{0}\'.", endpointConfiguration));
+        }
+        
+        private static System.ServiceModel.Channels.Binding GetDefaultBinding()
+        {
+            return passportWSClient.GetBindingForEndpoint(EndpointConfiguration.passportWSPort);
+        }
+        
+        private static System.ServiceModel.EndpointAddress GetDefaultEndpointAddress()
+        {
+            return passportWSClient.GetEndpointAddress(EndpointConfiguration.passportWSPort);
+        }
+        
+        public enum EndpointConfiguration
+        {
+            
+            passportWSPort,
+        }
+    }
+}

+ 1775 - 0
SuperAdmin/SuperAdmin/Controllers/AdminController.cs

@@ -0,0 +1,1775 @@
+using ClosedXML.Excel;
+using DocumentFormat.OpenXml.Drawing.Spreadsheet;
+using DocumentFormat.OpenXml.Spreadsheet;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Configuration;
+using OfficeOpenXml;
+using SuperAdmin.Models.Http;
+using SuperAdmin.Models.Object;
+using SuperAdmin.Source;
+using SuperCms.Extensions;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace SuperAdmin.Controllers
+{
+    public class AdminController : BaseController
+    {
+        private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(Program));
+
+        public AdminController(IConfiguration _configuration, IWebHostEnvironment hostEnvironment) : base(_configuration, hostEnvironment)
+        {
+            // init
+        }
+
+        public IActionResult Index(String fromDate, String toDate)
+        {
+            try
+            {
+                if (!CheckAuthToken())
+                {
+                    //return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+                    UserRoles vsa = HttpContext.Session.GetComplexData<UserRoles>("userInfo");
+                    //var listMenu = new List<String>();
+                    if (vsa != null && vsa.function != null)
+                    {
+                        var listObj = vsa.function;
+                        foreach (Function obj in listObj)
+                        {
+                            return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + obj.link);
+                        }
+                    }
+                    return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+                }
+                fromDate = fromDate ?? DateTime.Now.AddDays(-15).ToString("dd/MM/yyyy");
+                toDate = toDate ?? DateTime.Now.ToString("dd/MM/yyyy");
+                //DashboardModel model = LoadDashboard(fromDate, toDate);
+                //model.fromDate = fromDate;
+                //model.toDate = toDate;
+
+                return View();
+            }
+            catch (Exception ex)
+            {
+                log.Error("Error admin index: " + ex.Message, ex);
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+            }
+        }
+
+
+
+        // RESULT LUCKY_POWER UPDATE
+        public IActionResult Results()
+        {
+            if (!CheckAuthToken())
+            {
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+            }
+
+            return View();
+        }
+
+        [HttpPost]
+        public JsonResult ResultsGetById(string id)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    content = "Login first"
+                });
+            }
+            //ExportGetListRes res = HttpContext.Session.GetComplexData<ExportGetListRes>("ExportGetListRes");
+
+            TermGetListReq req = new TermGetListReq();
+            req.rowsOnPage = "1";
+            req.seqPage = "1";
+            req.id = id;
+            req.gameId = "-2";
+            string result = SendPost(req, GetParameter(LumilotoUtils.WsType.TermResult));
+            TermGetListRes res = TermGetListRes.Parse(result);
+
+            if (res != null && res.listTerm != null)
+            {
+                return Json(new
+                {
+                    error = "0",
+                    data = res.listTerm[0]
+                });
+            }
+
+            return Json(new
+            {
+                error = "1",
+                content = "Not found"
+            });
+        }
+
+        [HttpPost]
+        public JsonResult ResultsGet(TermGetListReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    content = "Login first"
+                });
+            }
+            //string account = HttpContext.Session.GetString("account");
+            //req.usersName = account;
+            req.rowsOnPage = "1000000";
+            req.seqPage = "1";
+            req.order = "desc";
+            //req.type = "1"; // already result
+
+            String url = GetParameter(LumilotoUtils.WsType.TermResult);
+            string result = SendPost(req, url);
+            TermGetListRes res = TermGetListRes.Parse(result);
+            //HttpContext.Session.SetComplexData("ExportGetListRes", res);
+            return Json(new
+            {
+                error = res.responseCode,
+                content = res.responseMessage,
+                data = res
+            });
+        }
+
+        [HttpPost]
+        public IActionResult ResultsSearch(TermGetListReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    content = "Login first"
+                });
+            }
+            //string account = HttpContext.Session.GetString("account");
+            //req.usersName = account;
+            req.rowsOnPage = "1000000";
+            req.seqPage = "1";
+            req.order = "desc";
+            //req.type = "1"; // already result
+
+            String url = GetParameter(LumilotoUtils.WsType.TermResult);
+            string result = SendPost(req, url);
+            TermGetListRes res = TermGetListRes.Parse(result);
+            //HttpContext.Session.SetComplexData("ExportGetListRes", res);
+            return PartialView("./_Result", res);
+        }
+
+        [HttpPost]
+        public JsonResult ResultsAddUpdate(ResultsUpdateReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    content = "Login first"
+                });
+            }
+            string account = HttpContext.Session.GetString("account");
+            req.users = account;
+            String formatedRs = "";
+            // format number
+            //if (!validPowerResult(req.result, out formatedRs))
+            //{
+            //    return Json(new
+            //    {
+            //        error = "2",
+            //        content = "Wrong input"
+            //    });
+            //}
+            //req.result = formatedRs;
+            string result = SendPost(req, GetParameter(LumilotoUtils.WsType.LkpwResultUpdate));
+            CommonRes res = CommonRes.Parse(result);
+            return Json(new
+            {
+                error = res.responseCode,
+                content = res.responseMessage
+            });
+        }
+
+
+        [HttpPost]
+        public JsonResult ResultsUpdateStatus(ResultsUpdateReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    content = "Login first"
+                });
+            }
+
+            string account = HttpContext.Session.GetString("account");
+            req.users = account;
+            string result = SendPost(req, GetParameter(LumilotoUtils.WsType.LkpwResultUpdate));
+            CommonRes res = CommonRes.Parse(result);
+            return Json(new
+            {
+                error = res.responseCode,
+                content = res.responseMessage
+            });
+        }
+
+
+        [HttpPost]
+        public IActionResult ResultsExport(TermGetListReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return null;
+            }
+
+            ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
+            req.rowsOnPage = "1000000";
+            req.seqPage = "1";
+            req.order = "desc";
+            req.type = "1"; // already result
+
+            String url = GetParameter(LumilotoUtils.WsType.TermResult);
+            string result = SendPost(req, url);
+            TermGetListRes res = TermGetListRes.Parse(result);
+            List<Term> list = res.listTerm;
+
+            string contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
+            string fileName = "results.xlsx";
+            try
+            {
+                using (var workbook = new XLWorkbook())
+                {
+                    int i = 1;
+                    IXLWorksheet worksheet = workbook.Worksheets.Add("Statistics");
+                    worksheet.Column(i).Width = 15;
+                    worksheet.Cell(1, i++).Value = "No.";
+                    worksheet.Column(i).Width = 15;
+                    worksheet.Cell(1, i++).Value = "Game";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Date";
+                    worksheet.Column(i).Width = 15;
+                    worksheet.Cell(1, i++).Value = "Term";
+                    worksheet.Column(i).Width = 80;
+                    worksheet.Cell(1, i++).Value = "Result";
+                    // make color
+                    worksheet.Row(1).Style.Font.Bold = true;
+                    worksheet.Row(1).Style.Fill.BackgroundColor = XLColor.Yellow;
+                    //worksheet.Cell(1, i++).Value = "BetId";
+                    if (list != null && list.Count > 0)
+                    {
+                        for (int index = 1; index <= list.Count; index++)
+                        {
+                            i = 1;
+                            var obj = list[index - 1];
+                            worksheet.Cell(index + 1, i++).Value = index;
+                            worksheet.Cell(index + 1, i++).Value = LumilotoUtils.GetGameName(obj.gameId);
+                            worksheet.Cell(index + 1, i++).Value = obj.date_end;
+                            worksheet.Cell(index + 1, i++).Value = obj.id;
+                            worksheet.Cell(index + 1, i++).Value = ResultVisible(obj.result, req.gameId);
+                        }
+                    }
+                    using (var stream = new MemoryStream())
+                    {
+                        workbook.SaveAs(stream);
+                        var content = stream.ToArray();
+                        return File(content, contentType, fileName);
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                return null;
+            }
+        }
+
+        public String ResultVisible(string result, string gameId)
+        {
+            try
+            {
+                if (gameId == LumilotoUtils.GameIds.LUCKY_POWER)
+                {
+                    var rs = "";
+                    for (var i = 0; i < 7; i++)
+                    {
+                        var num = result.Substring(3 * i, 2);
+                        if (i < 6)
+                        {
+                            rs += num + " ";
+                        }
+                        else
+                        {
+                            rs += "| " + num;
+                        }
+                    }
+                    return rs;
+                }
+                else if (gameId == LumilotoUtils.GameIds.LUCKY_DAY)
+                {
+                    var rs = "";
+                    var results = result.Split("$");
+                    for (var i = 0; i < results.Length; i++)
+                    {
+                        var num = results[i].Split("&");
+                        if (i == 0)
+                        {
+                            rs += "First prize: ";
+                            for (var j = 0; j < num.Length; j++)
+                            {
+                                rs += num[j] + " ";
+                            }
+                        }
+                        else if (i == 1)
+                        {
+                            rs += "\r\nSecond prize: ";
+                            for (var j = 0; j < num.Length; j++)
+                            {
+                                rs += num[j] + " ";
+                            }
+                        }
+                        else if (i == 2)
+                        {
+                            rs += "\r\nThird prize: ";
+                            for (var j = 0; j < num.Length; j++)
+                            {
+                                rs += num[j] + " ";
+                            }
+                        }
+                        else if (i == 3)
+                        {
+                            rs += "\r\nForth prize: ";
+                            for (var j = 0; j < num.Length; j++)
+                            {
+                                rs += num[j] + " ";
+                            }
+                        }
+                    }
+                    return rs;
+                }
+                else
+                {
+                    // plus 
+                    var rs = "";
+                    string[] numbers = result.Split('&')[0].Split('$');
+                    rs += "Numbers: ";
+                    for (var j = 0; j < numbers.Length; j++)
+                    {
+                        rs += numbers[j] + " ";
+                    }
+
+                    if (result.Split('&').Length > 1)
+                    {
+                        string[] sp = result.Split('&')[1].Split(',');
+                        Dictionary<String, String> specials = new Dictionary<String, String>();
+                        foreach (String txt in sp)
+                        {
+                            specials.Add(txt.Split('=')[0], txt.Split('=')[1]);
+                        }
+                        rs += "\r\nOdd/even: ";
+                        if (specials["ISEVEN"] == "1")
+                        {
+                            rs += "Even " + specials["E"] + " ";
+                        }
+                        else
+                        {
+                            rs += "Even " + specials["E"] + " ";
+                        }
+                        if (specials["ISEVEN"] == "2")
+                        {
+                            rs += "Odd " + specials["O"] + " ";
+                        }
+                        else
+                        {
+                            rs += "Odd " + specials["O"] + " ";
+                        }
+
+
+                        rs += "\r\nBig/Small: ";
+                        if (specials["ISBIG"] == "1")
+                        {
+                            rs += "Big " + specials["B"] + " ";
+                        }
+                        else
+                        {
+                            rs += "Big " + specials["B"] + " ";
+                        }
+                        if (specials["ISBIG"] == "2")
+                        {
+                            rs += "Small " + specials["S"] + " ";
+                        }
+                        else
+                        {
+                            rs += "Small " + specials["S"] + " ";
+                        }
+                    }
+
+                    return rs;
+                }
+            }
+            catch (Exception ex)
+            {
+                log.Error("Error parse result: " + result + ": " + ex.Message, ex);
+                return "";
+            }
+        }
+
+        // ReportSummary
+        public IActionResult ReportSummary()
+        {
+            if (!CheckAuthToken())
+            {
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+            }
+            return View();
+        }
+
+        [HttpPost]
+        public JsonResult ReportSummarySearch(RpTotalByDayReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    content = "Login first"
+                });
+            }
+
+
+            string url = GetParameter(LumilotoUtils.WsType.TrafficDayGet);
+            string result = SendPost(req, url);
+            RpTotalByDayRes res = RpTotalByDayRes.Parse(result);
+            return Json(new
+            {
+                error = res.responseCode,
+                content = res.responseMessage,
+                data = res.list
+            });
+        }
+
+        [HttpPost]
+        public IActionResult ReportSummaryExport(RpTotalByDayReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return null;
+            }
+
+            ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
+
+            string url = GetParameter(LumilotoUtils.WsType.TrafficDayGet);
+            string result = SendPost(req, url);
+            RpTotalByDayRes res = RpTotalByDayRes.Parse(result);
+            List<RpTotalByDay> list = res.list;
+
+            string contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
+            string fileName = "report_summary.xlsx";
+            try
+            {
+                using (var workbook = new XLWorkbook())
+                {
+                    int i = 1;
+                    IXLWorksheet worksheet = workbook.Worksheets.Add("Report Summary");
+                    worksheet.Column(i).Width = 15;
+                    worksheet.Cell(1, i++).Value = "No.";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Date";
+                    worksheet.Column(i).Width = 15;
+                    worksheet.Cell(1, i++).Value = "Total Players";
+                    worksheet.Column(i).Width = 15;
+                    worksheet.Cell(1, i++).Value = "Total Tickets";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Total Bet Money(HTG)";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Total Win Player";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Total Win Ticket";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Total Win Money(HTG)";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Total Benefit(HTG)";
+                    // make color
+                    worksheet.Row(1).Style.Font.Bold = true;
+                    worksheet.Row(1).Style.Fill.BackgroundColor = XLColor.Yellow;
+                    //worksheet.Cell(1, i++).Value = "BetId";
+                    if (list != null && list.Count > 0)
+                    {
+                        for (int index = 1; index <= list.Count; index++)
+                        {
+                            i = 1;
+                            var obj = list[index - 1];
+                            worksheet.Cell(index + 1, i++).Value = index;
+                            worksheet.Cell(index + 1, i++).Value = obj.date;
+                            worksheet.Cell(index + 1, i++).Value = obj.player;
+                            worksheet.Cell(index + 1, i++).Value = obj.ticket;
+                            worksheet.Cell(index + 1, i++).Value = obj.money;
+                            worksheet.Cell(index + 1, i++).Value = obj.palyerWin;
+                            worksheet.Cell(index + 1, i++).Value = obj.ticketWin;
+                            worksheet.Cell(index + 1, i++).Value = obj.moneyWin;
+                            worksheet.Cell(index + 1, i++).Value = obj.benefit;
+                        }
+                    }
+                    using (var stream = new MemoryStream())
+                    {
+                        workbook.SaveAs(stream);
+                        var content = stream.ToArray();
+                        return File(content, contentType, fileName);
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                return null;
+            }
+        }
+
+        // Report Compact
+        public IActionResult ReportCompact()
+        {
+            if (!CheckAuthToken())
+            {
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+            }
+            return View();
+        }
+
+        [HttpPost]
+        public JsonResult ReportCompactSearch(RpTotalByDayReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    content = "Login first"
+                });
+            }
+
+
+            string url = GetParameter(LumilotoUtils.WsType.TrafficDayGet);
+            string result = SendPost(req, url);
+            RpTotalByDayRes res = RpTotalByDayRes.Parse(result);
+            return Json(new
+            {
+                error = res.responseCode,
+                content = res.responseMessage,
+                data = res.list
+            });
+        }
+
+        [HttpPost]
+        public IActionResult ReportCompactExport(RpTotalByDayReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return null;
+            }
+
+            ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
+
+            string url = GetParameter(LumilotoUtils.WsType.TrafficDayGet);
+            string result = SendPost(req, url);
+            RpTotalByDayRes res = RpTotalByDayRes.Parse(result);
+            List<RpTotalByDay> list = res.list;
+
+            string contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
+            string fileName = "report_compact.xlsx";
+            try
+            {
+                using (var workbook = new XLWorkbook())
+                {
+                    int i = 1;
+                    IXLWorksheet worksheet = workbook.Worksheets.Add("Report Summary");
+                    worksheet.Column(i).Width = 15;
+                    worksheet.Cell(1, i++).Value = "No.";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Date";
+                    worksheet.Column(i).Width = 15;
+                    worksheet.Cell(1, i++).Value = "Total Players";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Total Bet Money(HTG)";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Total Win Money(HTG)";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Total Benefit(HTG)";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Sharing(HTG)";
+                    // make color
+                    worksheet.Row(1).Style.Font.Bold = true;
+                    worksheet.Row(1).Style.Fill.BackgroundColor = XLColor.Yellow;
+                    //worksheet.Cell(1, i++).Value = "BetId";
+                    if (list != null && list.Count > 0)
+                    {
+                        for (int index = 1; index <= list.Count; index++)
+                        {
+                            i = 1;
+                            var obj = list[index - 1];
+                            worksheet.Cell(index + 1, i++).Value = index;
+                            worksheet.Cell(index + 1, i++).Value = obj.date;
+                            worksheet.Cell(index + 1, i++).Value = obj.player;
+                            worksheet.Cell(index + 1, i++).Value = obj.money;
+                            worksheet.Cell(index + 1, i++).Value = obj.moneyWin;
+                            worksheet.Cell(index + 1, i++).Value = obj.benefit;
+                            worksheet.Cell(index + 1, i++).Value = obj.sharing;
+                        }
+                    }
+                    using (var stream = new MemoryStream())
+                    {
+                        workbook.SaveAs(stream);
+                        var content = stream.ToArray();
+                        return File(content, contentType, fileName);
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                return null;
+            }
+        }
+
+        // Report Summary Bolet
+        public IActionResult ReportSummaryBolet()
+        {
+            if (!CheckAuthToken())
+            {
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+            }
+            return View();
+        }
+
+        [HttpPost]
+        public JsonResult ReportSummaryBoletSearch(RpTotalByBoletReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    content = "Login first"
+                });
+            }
+
+
+            string url = GetParameter(LumilotoUtils.WsType.TrafficBoletGet);
+            string result = SendPost(req, url);
+            RpTotalByBoletRes res = RpTotalByBoletRes.Parse(result);
+            return Json(new
+            {
+                error = res.responseCode,
+                content = res.responseMessage,
+                data = res.list
+            });
+        }
+
+        [HttpPost]
+        public IActionResult ReportSummaryBoletExport(RpTotalByBoletReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return null;
+            }
+
+            ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
+
+            string url = GetParameter(LumilotoUtils.WsType.TrafficBoletGet);
+            string result = SendPost(req, url);
+            RpTotalByBoletRes res = RpTotalByBoletRes.Parse(result);
+            List<RpTotalByBolet> list = res.list;
+
+            string contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
+            string fileName = "report_summary_bolet.xlsx";
+            try
+            {
+                using (var workbook = new XLWorkbook())
+                {
+                    int i = 1;
+                    IXLWorksheet worksheet = workbook.Worksheets.Add("Report Summary");
+                    worksheet.Column(i).Width = 15;
+                    worksheet.Cell(1, i++).Value = "No.";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Date";
+                    worksheet.Column(i).Width = 15;
+                    worksheet.Cell(1, i++).Value = "Total Players";
+                    worksheet.Column(i).Width = 15;
+                    worksheet.Cell(1, i++).Value = "Total Tickets";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Total Bet Money(HTG)";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Total Win money";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Total ticket LOT1";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Total Win Lot1";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Total ticket Lot2";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Total Win Lot2";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Total ticket Lot3";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Total Win Lot 3";
+                    // make color
+                    worksheet.Row(1).Style.Font.Bold = true;
+                    worksheet.Row(1).Style.Fill.BackgroundColor = XLColor.Yellow;
+                    //worksheet.Cell(1, i++).Value = "BetId";
+                    if (list != null && list.Count > 0)
+                    {
+                        for (int index = 1; index <= list.Count; index++)
+                        {
+                            i = 1;
+                            var obj = list[index - 1];
+                            worksheet.Cell(index + 1, i++).Value = index;
+                            worksheet.Cell(index + 1, i++).Value = obj.date;
+                            worksheet.Cell(index + 1, i++).Value = obj.player;
+                            worksheet.Cell(index + 1, i++).Value = obj.ticket;
+                            worksheet.Cell(index + 1, i++).Value = obj.money;
+                            worksheet.Cell(index + 1, i++).Value = obj.moneyWin;
+                            worksheet.Cell(index + 1, i++).Value = obj.ticketWinLot1;
+                            worksheet.Cell(index + 1, i++).Value = obj.moneyWinLot1;
+                            worksheet.Cell(index + 1, i++).Value = obj.ticketWinLot2;
+                            worksheet.Cell(index + 1, i++).Value = obj.moneyWinLot2;
+                            worksheet.Cell(index + 1, i++).Value = obj.ticketWinLot3;
+                            worksheet.Cell(index + 1, i++).Value = obj.moneyWinLot3;
+                        }
+                    }
+                    using (var stream = new MemoryStream())
+                    {
+                        workbook.SaveAs(stream);
+                        var content = stream.ToArray();
+                        return File(content, contentType, fileName);
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                return null;
+            }
+        }
+
+        // Report Summary Lucky
+        public IActionResult ReportSummaryLucky()
+        {
+            if (!CheckAuthToken())
+            {
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+            }
+            return View();
+        }
+
+        [HttpPost]
+        public JsonResult ReportSummaryLuckySearch(RpTotalByDayLkpsReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    content = "Login first"
+                });
+            }
+
+
+            string url = GetParameter(LumilotoUtils.WsType.TrafficLuckyGet);
+            string result = SendPost(req, url);
+            RpTotalByDayLkpsRes res = RpTotalByDayLkpsRes.Parse(result);
+            return Json(new
+            {
+                error = res.responseCode,
+                content = res.responseMessage,
+                data = res.list
+            });
+        }
+
+        [HttpPost]
+        public IActionResult ReportSummaryLuckyExport(RpTotalByDayLkpsReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return null;
+            }
+
+            ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
+
+            string url = GetParameter(LumilotoUtils.WsType.TrafficLuckyGet);
+            string result = SendPost(req, url);
+            RpTotalByDayLkpsRes res = RpTotalByDayLkpsRes.Parse(result);
+            List<RpTotalByDayLkps> list = res.list;
+
+            string contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
+            string fileName = "report_summary_lucky.xlsx";
+            try
+            {
+                using (var workbook = new XLWorkbook())
+                {
+                    int i = 1;
+                    IXLWorksheet worksheet = workbook.Worksheets.Add("Report Summary");
+                    worksheet.Column(i).Width = 15;
+                    worksheet.Cell(1, i++).Value = "No.";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Date";
+                    worksheet.Column(i).Width = 15;
+                    worksheet.Cell(1, i++).Value = "Total Players";
+                    worksheet.Column(i).Width = 15;
+                    worksheet.Cell(1, i++).Value = "Total Tickets";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Total Bet Money(HTG)";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Total Win Player";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Total Win Ticket";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Total Win Money(HTG)";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Total Benefit(HTG)";
+                    // make color
+                    worksheet.Row(1).Style.Font.Bold = true;
+                    worksheet.Row(1).Style.Fill.BackgroundColor = XLColor.Yellow;
+                    //worksheet.Cell(1, i++).Value = "BetId";
+                    if (list != null && list.Count > 0)
+                    {
+                        for (int index = 1; index <= list.Count; index++)
+                        {
+                            i = 1;
+                            var obj = list[index - 1];
+                            worksheet.Cell(index + 1, i++).Value = index;
+                            worksheet.Cell(index + 1, i++).Value = obj.date;
+                            worksheet.Cell(index + 1, i++).Value = obj.player;
+                            worksheet.Cell(index + 1, i++).Value = obj.ticket;
+                            worksheet.Cell(index + 1, i++).Value = obj.money;
+                            worksheet.Cell(index + 1, i++).Value = obj.palyerWin;
+                            worksheet.Cell(index + 1, i++).Value = obj.ticketWin;
+                            worksheet.Cell(index + 1, i++).Value = obj.moneyWin;
+                            worksheet.Cell(index + 1, i++).Value = obj.benefit;
+                        }
+                    }
+                    using (var stream = new MemoryStream())
+                    {
+                        workbook.SaveAs(stream);
+                        var content = stream.ToArray();
+                        return File(content, contentType, fileName);
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                return null;
+            }
+        }
+
+        // Player Lucky
+        public IActionResult ReportLuckyDetail()
+        {
+            if (!CheckAuthToken())
+            {
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+            }
+
+            return View();
+        }
+
+        public IActionResult ReportLuckyDetailSearch(SearchMsisdnReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    content = "Login first"
+                });
+            }
+
+            req.msisdn = BaseController.ValidateMsisdn(req.msisdn);
+            string url = GetParameter(LumilotoUtils.WsType.MsisdnSearchLucky);
+            string result = SendPost(req, url);
+            SearchMsisdnRes res = SearchMsisdnRes.Parse(result);
+            return Json(new
+            {
+                error = res.responseCode,
+                content = res.responseMessage,
+                data = res.list
+            });
+        }
+
+        [HttpPost]
+        public IActionResult ReportLuckyDetailExport(SearchMsisdnReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return null;
+            }
+
+            ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
+
+            string url = GetParameter(LumilotoUtils.WsType.MsisdnSearchLucky);
+            string result = SendPost(req, url);
+            SearchMsisdnRes res = SearchMsisdnRes.Parse(result);
+            List<TicketMsisdn> list = res.list;
+
+            string contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
+            string fileName = "player_ticket.xlsx";
+            try
+            {
+                using (var workbook = new XLWorkbook())
+                {
+                    int i = 1;
+                    IXLWorksheet worksheet = workbook.Worksheets.Add("Player Tickets");
+                    worksheet.Column(i).Width = 15;
+                    worksheet.Cell(1, i++).Value = "No.";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Phone number";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Channel Play";
+                    worksheet.Column(i).Width = 15;
+                    worksheet.Cell(1, i++).Value = "Ticket ID";
+                    worksheet.Column(i).Width = 15;
+                    worksheet.Cell(1, i++).Value = "Bet number";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Bet Money (HTG)";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Buy time";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Drawn time";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Result";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Win Money (HTG)";
+                    // make color
+                    worksheet.Row(1).Style.Font.Bold = true;
+                    worksheet.Row(1).Style.Fill.BackgroundColor = XLColor.Yellow;
+                    //worksheet.Cell(1, i++).Value = "BetId";
+                    if (list != null && list.Count > 0)
+                    {
+                        for (int index = 1; index <= list.Count; index++)
+                        {
+                            i = 1;
+                            var obj = list[index - 1];
+                            worksheet.Cell(index + 1, i++).Value = index;
+                            worksheet.Cell(index + 1, i++).Value = obj.msisdn;
+                            worksheet.Cell(index + 1, i++).Value = obj.channel;
+                            worksheet.Cell(index + 1, i++).Value = obj.ticketId;
+                            worksheet.Cell(index + 1, i++).Value = obj.ticketCode;
+                            worksheet.Cell(index + 1, i++).Value = obj.money;
+                            worksheet.Cell(index + 1, i++).Value = obj.buyTime;
+                            worksheet.Cell(index + 1, i++).Value = obj.drawTime;
+                            worksheet.Cell(index + 1, i++).Value = obj.result;
+                            worksheet.Cell(index + 1, i++).Value = obj.moneyWin;
+                        }
+                    }
+                    using (var stream = new MemoryStream())
+                    {
+                        workbook.SaveAs(stream);
+                        var content = stream.ToArray();
+                        return File(content, contentType, fileName);
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                return null;
+            }
+        }
+
+        // Player
+        public IActionResult PlayerTicket()
+        {
+            if (!CheckAuthToken())
+            {
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+            }
+
+            return View();
+        }
+
+        public IActionResult PlayerTicketSearch(SearchMsisdnReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    content = "Login first"
+                });
+            }
+
+            req.msisdn = BaseController.ValidateMsisdn(req.msisdn);
+            string url = GetParameter(LumilotoUtils.WsType.MsisdnSearch);
+            string result = SendPost(req, url);
+            SearchMsisdnRes res = SearchMsisdnRes.Parse(result);
+            //return Json(new
+            //{
+            //    error = res.responseCode,
+            //    content = res.responseMessage,
+            //    data = res.list
+            //});
+            return PartialView("./_PlayerHistory", res);
+        }
+
+        [HttpPost]
+        public IActionResult PlayerTicketExport(SearchMsisdnReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return null;
+            }
+
+            ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
+
+            string url = GetParameter(LumilotoUtils.WsType.MsisdnSearch);
+            string result = SendPost(req, url);
+            SearchMsisdnRes res = SearchMsisdnRes.Parse(result);
+            List<TicketMsisdn> list = res.list;
+
+            string contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
+            string fileName = "player_ticket.xlsx";
+            try
+            {
+                using (var workbook = new XLWorkbook())
+                {
+                    int i = 1;
+                    IXLWorksheet worksheet = workbook.Worksheets.Add("Player Tickets");
+                    worksheet.Column(i).Width = 15;
+                    worksheet.Cell(1, i++).Value = "No.";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Phone number";
+                    worksheet.Column(i).Width = 15;
+                    worksheet.Cell(1, i++).Value = "Lottery";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Game";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Channel Play";
+                    worksheet.Column(i).Width = 15;
+                    worksheet.Cell(1, i++).Value = "Ticket ID";
+                    worksheet.Column(i).Width = 15;
+                    worksheet.Cell(1, i++).Value = "Bet number";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Bet Money (HTG)";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Buy time";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Drawn time";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Result";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Win Money (HTG)";
+                    // make color
+                    worksheet.Row(1).Style.Font.Bold = true;
+                    worksheet.Row(1).Style.Fill.BackgroundColor = XLColor.Yellow;
+                    //worksheet.Cell(1, i++).Value = "BetId";
+                    if (list != null && list.Count > 0)
+                    {
+                        for (int index = 1; index <= list.Count; index++)
+                        {
+                            i = 1;
+                            var obj = list[index - 1];
+                            worksheet.Cell(index + 1, i++).Value = index;
+                            worksheet.Cell(index + 1, i++).Value = obj.msisdn;
+                            worksheet.Cell(index + 1, i++).Value = obj.lottery;
+                            worksheet.Cell(index + 1, i++).Value = obj.game;
+                            worksheet.Cell(index + 1, i++).Value = obj.channel;
+                            worksheet.Cell(index + 1, i++).Value = obj.ticketId;
+                            worksheet.Cell(index + 1, i++).Value = obj.ticketCode;
+                            worksheet.Cell(index + 1, i++).Value = obj.money;
+                            worksheet.Cell(index + 1, i++).Value = obj.buyTime;
+                            worksheet.Cell(index + 1, i++).Value = obj.drawTime;
+                            worksheet.Cell(index + 1, i++).Value = obj.result;
+                            worksheet.Cell(index + 1, i++).Value = obj.moneyWin;
+                        }
+                    }
+                    using (var stream = new MemoryStream())
+                    {
+                        workbook.SaveAs(stream);
+                        var content = stream.ToArray();
+                        return File(content, contentType, fileName);
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                return null;
+            }
+        }
+
+
+
+        public IActionResult PlayerTransfer()
+        {
+            if (!CheckAuthToken())
+            {
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+            }
+
+            return View();
+        }
+
+        public IActionResult PlayerTransferSearch(SearchTransferMsisdnReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    content = "Login first"
+                });
+            }
+
+            req.order = "desc";
+            req.seqPage = "1";
+            req.rowsOnPage = "1000000";
+            req.msisdn = BaseController.ValidateMsisdn(req.msisdn);
+            if (req.msisdn == null || req.msisdn == "")
+            {
+                return Json(new
+                {
+                    error = "10",
+                    content = "Msisdn required"
+                });
+            }
+            string url = GetParameter(LumilotoUtils.WsType.TransferSearch);
+            string result = SendPost(req, url);
+            TransferMsisdnRes res = TransferMsisdnRes.Parse(result);
+            return PartialView("./_PlayerTransfer", res);
+            //return Json(new
+            //{
+            //    error = res.responseCode,
+            //    content = res.responseMessage,
+            //    data = res.list
+            //});
+        }
+
+        public IActionResult PlayerTransferDetailSearch(SearchTransferMsisdnReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    content = "Login first"
+                });
+            }
+
+            req.order = "desc";
+            req.seqPage = "1";
+            req.rowsOnPage = "1000000";
+
+            string url = GetParameter(LumilotoUtils.WsType.TransferSearch);
+            string result = SendPost(req, url);
+            TransferMsisdnRes res = TransferMsisdnRes.Parse(result);
+            return PartialView("./_PlayerTransferDetail", res);
+        }
+
+
+        [HttpPost]
+        public IActionResult PlayerTransferExport(SearchTransferMsisdnReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return null;
+            }
+
+            ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
+
+            string url = GetParameter(LumilotoUtils.WsType.TransferSearch);
+            string result = SendPost(req, url);
+            TransferMsisdnRes res = TransferMsisdnRes.Parse(result);
+            List<TransferMsisdn> list = res.list;
+
+            string contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
+            string fileName = "player_transfer.xlsx";
+            try
+            {
+                using (var workbook = new XLWorkbook())
+                {
+                    int i = 1;
+                    IXLWorksheet worksheet = workbook.Worksheets.Add("Player Transfer");
+                    worksheet.Column(i).Width = 15;
+                    worksheet.Cell(1, i++).Value = "No.";
+                    worksheet.Column(i).Width = 15;
+                    worksheet.Cell(1, i++).Value = "Phone Request";
+                    worksheet.Column(i).Width = 15;
+                    worksheet.Cell(1, i++).Value = "Phone Receive";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Time Request";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Time Top-up";
+                    worksheet.Column(i).Width = 15;
+                    worksheet.Cell(1, i++).Value = "Status of Toto";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Status Message";
+                    worksheet.Column(i).Width = 15;
+                    worksheet.Cell(1, i++).Value = "Coin Transfer";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Channel Request";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Channel Payment";
+                    worksheet.Column(i).Width = 40;
+                    worksheet.Cell(1, i++).Value = "Request ID";
+                    worksheet.Column(i).Width = 40;
+                    worksheet.Cell(1, i++).Value = "Response ID";
+                    worksheet.Column(i).Width = 15;
+                    worksheet.Cell(1, i++).Value = "errCodeApprove";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "errMsgApprove";
+                    worksheet.Column(i).Width = 15;
+                    worksheet.Cell(1, i++).Value = "errCodeCallback";
+                    worksheet.Column(i).Width = 40;
+                    worksheet.Cell(1, i++).Value = "Transaction";
+                    worksheet.Column(i).Width = 15;
+                    worksheet.Cell(1, i++).Value = "StatusWallet";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "StatusWalletMsg";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "ReasonReject";
+                    // make color
+                    worksheet.Row(1).Style.Font.Bold = true;
+                    worksheet.Row(1).Style.Fill.BackgroundColor = XLColor.Yellow;
+                    //worksheet.Cell(1, i++).Value = "BetId";
+                    if (list != null && list.Count > 0)
+                    {
+                        for (int index = 1; index <= list.Count; index++)
+                        {
+                            i = 1;
+                            var obj = list[index - 1];
+                            worksheet.Cell(index + 1, i++).Value = index;
+                            worksheet.Cell(index + 1, i++).Value = obj.acountSend;
+                            worksheet.Cell(index + 1, i++).Value = obj.acountRecieve;
+                            worksheet.Cell(index + 1, i++).Value = obj.timeRequest;
+                            worksheet.Cell(index + 1, i++).Value = obj.timeTopup;
+                            worksheet.Cell(index + 1, i++).Value = obj.status;
+                            worksheet.Cell(index + 1, i++).Value = obj.statusMsg;
+                            worksheet.Cell(index + 1, i++).Value = obj.money;
+                            worksheet.Cell(index + 1, i++).Value = obj.channelRequest;
+                            worksheet.Cell(index + 1, i++).Value = obj.channelPayment == "1" ? "Main balance" : "Mosan";
+                            worksheet.Cell(index + 1, i++).Value = obj.reqeustId;
+                            worksheet.Cell(index + 1, i++).Value = obj.responseId;
+                            worksheet.Cell(index + 1, i++).Value = obj.errCodeApprove;
+                            worksheet.Cell(index + 1, i++).Value = obj.errMsgApprove;
+                            worksheet.Cell(index + 1, i++).Value = obj.errCodeCallback;
+                            worksheet.Cell(index + 1, i++).Value = obj.transection;
+                            worksheet.Cell(index + 1, i++).Value = obj.statusWallet;
+                            worksheet.Cell(index + 1, i++).Value = obj.statusWalletMsg;
+                            worksheet.Cell(index + 1, i++).Value = obj.reasonReject;
+                        }
+                    }
+                    using (var stream = new MemoryStream())
+                    {
+                        workbook.SaveAs(stream);
+                        var content = stream.ToArray();
+                        return File(content, contentType, fileName);
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                return null;
+            }
+        }
+
+        public IActionResult PlayerExport()
+        {
+            if (!CheckAuthToken())
+            {
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+            }
+
+            return View();
+        }
+
+
+        public IActionResult PlayerExportAction(SearchMsisdnReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return null;
+            }
+
+            ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
+
+            string url = GetParameter(LumilotoUtils.WsType.MsisdnExport);
+            string result = SendPost(req, url);
+            SearchMsisdnRes res = SearchMsisdnRes.Parse(result);
+            List<TicketMsisdn> list = res.list;
+
+            string contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
+            string fileName = "player_list.xlsx";
+            try
+            {
+                using (var workbook = new XLWorkbook())
+                {
+                    int i = 1;
+                    IXLWorksheet worksheet = workbook.Worksheets.Add("Player List");
+                    worksheet.Column(i).Width = 15;
+                    worksheet.Cell(1, i++).Value = "No.";
+                    worksheet.Column(i).Width = 15;
+                    worksheet.Cell(1, i++).Value = "Phone number";
+                    // make color
+                    worksheet.Row(1).Style.Font.Bold = true;
+                    worksheet.Row(1).Style.Fill.BackgroundColor = XLColor.Yellow;
+                    //worksheet.Cell(1, i++).Value = "BetId";
+                    if (list != null && list.Count > 0)
+                    {
+                        for (int index = 1; index <= list.Count; index++)
+                        {
+                            i = 1;
+                            var obj = list[index - 1];
+                            worksheet.Cell(index + 1, i++).Value = index;
+                            worksheet.Cell(index + 1, i++).Value = obj.msisdn;
+                        }
+                    }
+                    using (var stream = new MemoryStream())
+                    {
+                        workbook.SaveAs(stream);
+                        var content = stream.ToArray();
+                        return File(content, contentType, fileName);
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                return null;
+            }
+        }
+
+
+        private String formatStatus(String status)
+        {
+            if (status == "0")
+            {
+                return "Processing";
+            }
+            else if (status == "1")
+            {
+                return "Success";
+            }
+            else if (status == "2")
+            {
+                return "Pending";
+            }
+            else if (status == "3")
+            {
+                return "Revert";
+            }
+            return status;
+        }
+
+        // MT SEARCH
+        public IActionResult PlayerMt()
+        {
+            if (!CheckAuthToken())
+            {
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+            }
+
+            return View();
+        }
+
+        public IActionResult PlayerMtSearch(SearchMtReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    content = "Login first"
+                });
+            }
+
+            req.msisdn = BaseController.ValidateMsisdn(req.msisdn);
+            string url = GetParameter(LumilotoUtils.WsType.MtSearch);
+            string result = SendPost(req, url);
+            SearchMtRes res = SearchMtRes.Parse(result);
+            return Json(new
+            {
+                error = res.responseCode,
+                content = res.responseMessage,
+                data = res.list
+            });
+        }
+
+
+        [HttpPost]
+        public IActionResult PlayerMtExport(SearchMtReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return null;
+            }
+
+            ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
+
+            string url = GetParameter(LumilotoUtils.WsType.MtSearch);
+            string result = SendPost(req, url);
+            SearchMtRes res = SearchMtRes.Parse(result);
+            List<MtRecord> list = res.list;
+
+            string contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
+            string fileName = "player_mt.xlsx";
+            try
+            {
+                using (var workbook = new XLWorkbook())
+                {
+                    int i = 1;
+                    IXLWorksheet worksheet = workbook.Worksheets.Add("Player MT");
+                    worksheet.Column(i).Width = 15;
+                    worksheet.Cell(1, i++).Value = "No.";
+                    worksheet.Column(i).Width = 15;
+                    worksheet.Cell(1, i++).Value = "Phone number";
+                    worksheet.Column(i).Width = 100;
+                    worksheet.Cell(1, i++).Value = "Message Content";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Send Time";
+                    // make color
+                    worksheet.Row(1).Style.Font.Bold = true;
+                    worksheet.Row(1).Style.Fill.BackgroundColor = XLColor.Yellow;
+                    //worksheet.Cell(1, i++).Value = "BetId";
+                    if (list != null && list.Count > 0)
+                    {
+                        for (int index = 1; index <= list.Count; index++)
+                        {
+                            i = 1;
+                            var obj = list[index - 1];
+                            worksheet.Cell(index + 1, i++).Value = index;
+                            worksheet.Cell(index + 1, i++).Value = obj.msisdn;
+                            worksheet.Cell(index + 1, i++).Value = obj.message;
+                            worksheet.Cell(index + 1, i++).Value = obj.sendTime;
+                        }
+                    }
+                    using (var stream = new MemoryStream())
+                    {
+                        workbook.SaveAs(stream);
+                        var content = stream.ToArray();
+                        return File(content, contentType, fileName);
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                return null;
+            }
+        }
+
+
+
+        // REPORT BILL ORDER SUMMARY
+        public IActionResult ReportBillOrderSummary()
+        {
+            if (!CheckAuthToken())
+            {
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+            }
+
+            return View();
+        }
+
+        public IActionResult ReportBillOrderSummarySearch(RpSearchTotallBuyOderReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    content = "Login first"
+                });
+            }
+
+            string url = GetParameter(LumilotoUtils.WsType.rpSearchTotallBuyOder);
+            string result = SendPost(req, url);
+            RpSearchTotallBuyOderRes res = RpSearchTotallBuyOderRes.Parse(result);
+            return PartialView("./_ReportBillOrderSummary", res);
+        }
+
+        [HttpPost]
+        public IActionResult ReportBillOrderSummaryExport(RpSearchTotallBuyOderReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return null;
+            }
+
+            ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
+
+            string url = GetParameter(LumilotoUtils.WsType.rpSearchTotallBuyOder);
+            string result = SendPost(req, url);
+            RpSearchTotallBuyOderRes res = RpSearchTotallBuyOderRes.Parse(result);
+            List<TotallBuyOder> list = res.list;
+
+            string contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
+            string fileName = "bill_order_summary.xlsx";
+            try
+            {
+                using (var workbook = new XLWorkbook())
+                {
+                    int i = 1;
+                    long totalOrder = 0;
+                    long totalMoney = 0;
+                    long totalFee = 0;
+                    long totalTicket = 0;
+                    long totalMoneyWin = 0;
+                    IXLWorksheet worksheet = workbook.Worksheets.Add("Report Bill Order Summary");
+                    worksheet.Column(i).Width = 15;
+                    worksheet.Cell(1, i++).Value = "No.";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Date Time";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Total Bill Order";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Total Money Bet";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Total Cost Telemor";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Total Ticket";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Total Win Money";
+                    // make color
+                    worksheet.Row(1).Style.Font.Bold = true;
+                    worksheet.Row(1).Style.Fill.BackgroundColor = XLColor.Yellow;
+                    //worksheet.Cell(1, i++).Value = "BetId";
+                    if (list != null && list.Count > 0)
+                    {
+                        for (int index = 1; index <= list.Count; index++)
+                        {
+                            i = 1;
+                            var obj = list[index - 1];
+                            totalOrder += long.Parse(obj.totalOder);
+                            totalMoney += long.Parse(obj.totalMoney);
+                            totalFee += long.Parse(obj.totalFee);
+                            totalTicket += long.Parse(obj.totalTicket);
+                            totalMoneyWin += long.Parse(obj.totalMoneyWin);
+                            worksheet.Cell(index + 1, i++).Value = index;
+
+                            worksheet.Cell(index + 1, i).Style.DateFormat.Format = "dd/MM/yyyy";
+                            worksheet.Cell(index + 1, i++).Value = DateTime.ParseExact(obj.date, "dd/MM/yyyy",null);
+                            worksheet.Cell(index + 1, i++).Value = obj.totalOder;
+                            worksheet.Cell(index + 1, i++).Value = obj.totalMoney;
+                            worksheet.Cell(index + 1, i++).Value = obj.totalFee;
+                            worksheet.Cell(index + 1, i++).Value = obj.totalTicket;
+                            worksheet.Cell(index + 1, i++).Value = obj.totalMoneyWin;
+                        }
+                    }
+
+                    int rowIdx = list.Count + 2;
+                    // total row
+                    worksheet.Row(rowIdx).Style.Border.TopBorder = XLBorderStyleValues.Thin;
+                    worksheet.Row(rowIdx).Style.Font.Bold = true;
+                    worksheet.Row(rowIdx).Height = 20;
+                    worksheet.Row(rowIdx).Style.Font.FontSize = 13;
+                    worksheet.Row(rowIdx).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
+                    worksheet.Cell(rowIdx, 2).Value = "Total";
+                    worksheet.Cell(rowIdx, 3).Value = totalOrder;
+                    worksheet.Cell(rowIdx, 4).Value = totalMoney;
+                    worksheet.Cell(rowIdx, 5).Value = totalFee;
+                    worksheet.Cell(rowIdx, 6).Value = totalTicket;
+                    worksheet.Cell(rowIdx, 7).Value = totalMoneyWin;
+
+                    using (var stream = new MemoryStream())
+                    {
+                        workbook.SaveAs(stream);
+                        var content = stream.ToArray();
+                        return File(content, contentType, fileName);
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                return null;
+            }
+        }
+
+        // REPORT BILL ORDER DETAIL
+        public IActionResult ReportBillOrderDetail()
+        {
+            if (!CheckAuthToken())
+            {
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+            }
+
+            return View();
+        }
+
+        public IActionResult ReportBillOrderDetailSearch(RpSearchDetailBuyOderReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    content = "Login first"
+                });
+            }
+
+            string url = GetParameter(LumilotoUtils.WsType.rpSearchDetailBuyOder);
+            string result = SendPost(req, url);
+            RpSearchDetailBuyOderRes res = RpSearchDetailBuyOderRes.Parse(result);
+            return PartialView("./_ReportBillOrderDetail", res);
+        }
+
+        [HttpPost]
+        public IActionResult ReportBillOrderDetailExport(RpSearchDetailBuyOderReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return null;
+            }
+
+            ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
+
+            string url = GetParameter(LumilotoUtils.WsType.rpSearchDetailBuyOder);
+            string result = SendPost(req, url);
+            RpSearchDetailBuyOderRes res = RpSearchDetailBuyOderRes.Parse(result);
+            List<DetailBuyOder> list = res.list;
+
+            string contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
+            string fileName = "bill_order_detail.xlsx";
+            try
+            {
+                using (var workbook = new XLWorkbook())
+                {
+                    int i = 1;
+                    IXLWorksheet worksheet = workbook.Worksheets.Add("Report Bill Order Detail");
+                    // make color
+                    worksheet.Row(1).Style.Font.Bold = true;
+                    worksheet.Row(1).Style.Fill.BackgroundColor = XLColor.Yellow;
+                    worksheet.Row(1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
+                    worksheet.Row(2).Style.Font.Bold = true;
+                    worksheet.Row(2).Style.Fill.BackgroundColor = XLColor.Yellow;
+                    worksheet.Row(2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
+
+                    worksheet.Range(1, i, 2, i).Merge();
+                    worksheet.Column(i).Width = 15;
+                    worksheet.Range(1, i, 2, i).Style.Border.RightBorder = XLBorderStyleValues.Thin;
+                    worksheet.Cell(1, i++).Value = "No.";
+
+                    worksheet.Range(1, i, 2, i).Merge();
+                    worksheet.Column(i).Width = 15;
+                    worksheet.Range(1, i, 2, i).Style.Border.RightBorder = XLBorderStyleValues.Thin;
+                    worksheet.Cell(1, i++).Value = "Phone Number";
+
+                    worksheet.Range(1, i, 2, i).Merge();
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Range(1, i, 2, i).Style.Border.RightBorder = XLBorderStyleValues.Thin;
+                    worksheet.Cell(1, i++).Value = "Bill Order";
+
+                    worksheet.Range(1, i, 2, i).Merge();
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Range(1, i, 2, i).Style.Border.RightBorder = XLBorderStyleValues.Thin;
+                    worksheet.Cell(1, i++).Value = "Channel Buy";
+
+                    worksheet.Range(1, i, 2, i).Merge();
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Range(1, i, 2, i).Style.Border.RightBorder = XLBorderStyleValues.Thin;
+                    worksheet.Cell(1, i++).Value = "Total Money";
+
+                    worksheet.Range(1, i, 2, i).Merge();
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Range(1, i, 2, i).Style.Border.RightBorder = XLBorderStyleValues.Thin;
+                    worksheet.Cell(1, i++).Value = "Total Fee";
+
+                    worksheet.Range(1, i, 2, i).Merge();
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Range(1, i, 2, i).Style.Border.RightBorder = XLBorderStyleValues.Thin;
+                    worksheet.Cell(1, i++).Value = "Buying Time";
+
+                    worksheet.Range(1, i, 2, i).Merge();
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Range(1, i, 2, i).Style.Border.RightBorder = XLBorderStyleValues.Thin;
+                    worksheet.Cell(1, i++).Value = "Game Name";
+
+                    // ticket info, merge 3 col
+                    worksheet.Range(1, i, 1, i + 2).Merge();
+                    worksheet.Range(1, i, 1, i + 2).Style.Border.BottomBorder = XLBorderStyleValues.Thin;
+                    worksheet.Range(1, i + 2, 2, i + 2).Style.Border.RightBorder = XLBorderStyleValues.Thin;
+                    worksheet.Cell(1, i).Value = "Ticket Information";
+                    // row 2 of ticket info
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(2, i).Style.Border.RightBorder = XLBorderStyleValues.Thin;
+                    worksheet.Cell(2, i++).Value = "Ticket";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(2, i).Style.Border.RightBorder = XLBorderStyleValues.Thin;
+                    worksheet.Cell(2, i++).Value = "Money (cents)";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(21, i).Style.Border.RightBorder = XLBorderStyleValues.Thin;
+                    worksheet.Cell(2, i++).Value = "Turn ID";
+
+
+                    worksheet.Row(3).Style.Border.TopBorder = XLBorderStyleValues.Thin;
+                    worksheet.Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
+
+                    //worksheet.Cell(1, i++).Value = "BetId";
+                    if (list != null && list.Count > 0)
+                    {
+                        int rowIdx = 3;
+                        long totalMoney = 0;
+                        long totalFee = 0;
+                        long moneyTicket = 0;
+                        for (int index = 1; index <= list.Count; index++)
+                        {
+                            i = 1;
+                            var obj = list[index - 1];
+                            totalMoney += long.Parse(obj.money);
+                            totalFee += long.Parse(obj.fee);
+                            var ticketNum = obj.listTicket.Count;
+                            worksheet.Range(rowIdx, i, rowIdx + ticketNum - 1, i).Merge();
+                            worksheet.Cell(rowIdx, i++).Value = index;
+                            worksheet.Range(rowIdx, i, rowIdx + ticketNum - 1, i).Merge();
+                            worksheet.Cell(rowIdx, i++).Value = obj.user;
+                            worksheet.Range(rowIdx, i, rowIdx + ticketNum - 1, i).Merge();
+                            worksheet.Cell(rowIdx, i++).Value = obj.billCode;
+                            worksheet.Range(rowIdx, i, rowIdx + ticketNum - 1, i).Merge();
+                            worksheet.Cell(rowIdx, i++).Value = obj.channel;
+                            worksheet.Range(rowIdx, i, rowIdx + ticketNum - 1, i).Merge();
+                            worksheet.Cell(rowIdx, i++).Value = obj.money;
+                            worksheet.Range(rowIdx, i, rowIdx + ticketNum - 1, i).Merge();
+                            worksheet.Cell(rowIdx, i++).Value = obj.fee;
+                            worksheet.Range(rowIdx, i, rowIdx + ticketNum - 1, i).Merge();
+                            worksheet.Cell(rowIdx, i).Style.DateFormat.Format = "dd/MM/yyyy HH:mm:ss";
+                            worksheet.Cell(rowIdx, i++).Value = DateTime.ParseExact(obj.buyTime, "dd/MM/yyyy HH:mm:ss", null);  
+                            worksheet.Range(rowIdx, i, rowIdx + ticketNum - 1, i).Merge();
+                            worksheet.Cell(rowIdx, i++).Value = obj.gameName;
+                            //ticket list
+                            for (int j = 0; j < ticketNum; j++)
+                            {
+                                var ticket = obj.listTicket[j];
+                                moneyTicket += long.Parse(ticket.money);
+                                worksheet.Cell(rowIdx, i).Value = ticket.ticket;
+                                worksheet.Cell(rowIdx, i + 1).Value = ticket.money;
+                                worksheet.Cell(rowIdx, i + 2).Value = ticket.turnId;
+                                rowIdx++;
+                            }
+                            //rowIdx += ticketNum;
+                        }
+
+                        // total row
+                        worksheet.Row(rowIdx).Style.Border.TopBorder = XLBorderStyleValues.Thin;
+                        worksheet.Row(rowIdx).Style.Font.Bold = true;
+                        worksheet.Row(rowIdx).Height = 20;
+                        worksheet.Row(rowIdx).Style.Font.FontSize = 13;
+                        worksheet.Row(rowIdx).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
+                        worksheet.Cell(rowIdx, 2).Value = "Total";
+                        worksheet.Cell(rowIdx, 5).Value = totalMoney;
+                        worksheet.Cell(rowIdx, 6).Value = totalFee;
+                        worksheet.Cell(rowIdx, 10).Value = moneyTicket;
+                    }
+                    using (var stream = new MemoryStream())
+                    {
+                        workbook.SaveAs(stream);
+                        var content = stream.ToArray();
+                        return File(content, contentType, fileName);
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                return null;
+            }
+        }
+
+    }
+}

+ 419 - 0
SuperAdmin/SuperAdmin/Controllers/BaseController.cs

@@ -0,0 +1,419 @@
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Net.Http;
+using System.Security.Cryptography;
+using System.Text;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Configuration;
+using Newtonsoft.Json;
+using SuperAdmin.Models.Http;
+using SuperAdmin.Models.Object;
+using SuperAdmin.Source;
+using SuperCms.Extensions;
+
+namespace SuperAdmin.Controllers
+{
+    public class BaseController : Controller
+    {
+
+        private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(Program));
+        private readonly IWebHostEnvironment webHostEnvironment;
+
+        protected IConfiguration configuration;
+        protected static String VsaAppId = "";
+        protected static String VsaWsUrl = "";
+        public static String useVsa = "0";
+        public static String PARENT_ID = "100207";
+        public static String Channel = "APP";
+        public static String RoleAdminSale = "admin_sale_loto";
+        public static String RoleAdminCC = "admin_cc_loto";
+        public static String RoleStaffSale = "staff_sale_loto";
+        public static String NumberSeparated = ".";
+        public static String CountryCode = "509";
+        public static String ServiceId = "1";
+
+        public BaseController() { }
+        public BaseController(IConfiguration _configuration, IWebHostEnvironment hostEnvironment)
+        {
+            configuration = _configuration;
+            webHostEnvironment = hostEnvironment;
+            CountryCode = configuration["countryCode"];
+            ServiceId = configuration["service_id"];
+            VsaAppId = configuration["vsaAppId"];
+            VsaWsUrl = configuration["vsaWsUrl"];
+            useVsa = configuration["useVsa"];
+            Channel = configuration["channel"];
+            NumberSeparated = configuration["numberSeparated"];
+            PARENT_ID = configuration["PARENT_ID"];
+            //RequestKey = configuration["requestKey"];
+            //CaptchaSiteKey = configuration["recaptchaPublicKey"];
+            //CaptchaSecretKey = configuration["recaptchaPrivateKey"];
+            //ExpirePrize = int.Parse(configuration["expirePrize"]);
+        }
+
+        protected bool UseVsa()
+        {
+            if (useVsa == "0")
+            {
+                return false;
+            }
+            return true;
+        }
+
+        public static bool UsingVsa()
+        {
+            if (useVsa == "0")
+            {
+                return false;
+            }
+            return true;
+        }
+
+        private static Dictionary<string, ParamObj> mapParam = null;
+        private Dictionary<string, ParamObj> MapParam()
+        {
+            if (mapParam == null)
+            {
+                mapParam = loadParam();
+            }
+            return mapParam;
+        }
+        private Dictionary<string, ParamObj> loadParam()
+        {
+            try
+            {
+                Dictionary<string, ParamObj> mParam = new Dictionary<string, ParamObj>();
+                GetParamsReq req = new GetParamsReq();
+                string result = SendPost(req, GetParameter(LumilotoUtils.WsType.Executes));
+                GetParamsRes res = GetParamsRes.Parse(result);
+                if (res != null && res.paramList != null)
+                {
+                    foreach (ParamObj param in res.paramList)
+                    {
+                        mParam.Add(param.code, param);
+                    }
+                    return mParam;
+                }
+                return null;
+            }
+            catch (Exception ex)
+            {
+                log.Error("Error load param: " + ex.Message, ex);
+                return null;
+            }
+        }
+        public ParamObj GetParam(string paramCode)
+        {
+            try
+            {
+                return MapParam()[paramCode];
+            }
+            catch { return null; }
+        }
+
+        public String GetParameter(String key)
+        {
+            return configuration.GetSection(key).Value;
+        }
+
+        public String GetParameter(String parentKey, String key)
+        {
+            var configs = configuration.GetSection(parentKey).GetChildren();
+            foreach (IConfiguration config in configs)
+            {
+                if (config[key] != null)
+                {
+                    return config[key];
+                }
+            }
+            return "";
+        }
+
+        public async Task<IActionResult> OnPostUploadAsync(List<IFormFile> files)
+        {
+            long size = files.Sum(f => f.Length);
+
+            foreach (var formFile in files)
+            {
+                if (formFile.Length > 0)
+                {
+                    var filePath = Path.GetTempFileName();
+                    log.Info("path " + filePath);
+                    using (var stream = System.IO.File.Create(filePath))
+                    {
+                        await formFile.CopyToAsync(stream);
+                    }
+                }
+            }
+
+            // Process uploaded files
+            // Don't rely on or trust the FileName property without validation.
+
+            return Ok(new { count = files.Count, size });
+        }
+
+        public string RandomString(int size, bool lowerCase)
+        {
+            StringBuilder builder = new StringBuilder();
+            Random random = new Random();
+            char ch;
+            for (int i = 0; i < size; i++)
+            {
+                ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65)));
+                builder.Append(ch);
+            }
+            if (lowerCase)
+                return builder.ToString().ToLower();
+            return builder.ToString();
+        }
+
+        protected string convertToDateTimeServer(String date)
+        {
+            // date: 
+            DateTime oDateFrom = DateTime.Parse(date);
+            string hour = oDateFrom.Hour < 10 ? "0" + oDateFrom.Hour : oDateFrom.Hour.ToString();
+            string minute = oDateFrom.Minute < 10 ? "0" + oDateFrom.Minute : oDateFrom.Minute.ToString();
+            string second = oDateFrom.Second < 10 ? "0" + oDateFrom.Second : oDateFrom.Second.ToString();
+            string month = oDateFrom.Month < 10 ? "0" + oDateFrom.Month : oDateFrom.Month.ToString();
+            string day = oDateFrom.Day < 10 ? "0" + oDateFrom.Day : oDateFrom.Day.ToString();
+            string fromCheck = day + "/" + month + "/" + oDateFrom.Year + " " + hour + ":" + minute + ":" + second;
+            return fromCheck; //MM/dd/yyyy HH24:mm:ss
+        }
+        public String SendPost(Posting obj, String url)
+        {
+            return SendPost(obj, ServiceId, url);
+
+        }
+        public String SendPost(Posting obj, String serviceId, String url, bool checkToken)
+        {
+            obj.serviceId = serviceId;
+            obj.SV_ID = serviceId;
+            obj.service_id = serviceId;
+            obj.key = GetParameter("keyPost");
+            if (checkToken)
+            {
+                UserRoles vsa = HttpContext.Session.GetComplexData<UserRoles>("userInfo");
+                if (vsa == null)
+                {
+                    log.Debug("Session timeout");
+                    return null;
+                }
+                obj.token = vsa.token;
+            }
+            if (obj.channel == null)
+            {
+                obj.channel = "WEB";
+            }
+
+            var json = JsonConvert.SerializeObject(obj);
+            var data = new StringContent(json, Encoding.UTF8, "application/json");
+
+            log.Debug(url);
+            log.Debug("Request: " + json);
+
+            using (var client = new HttpClient())
+            {
+                var response = client.PostAsync(url, data).Result;
+                if (response.IsSuccessStatusCode)
+                {
+                    var responseContent = response.Content;
+                    // by calling .Result you are synchronously reading the result
+                    string responseString = responseContent.ReadAsStringAsync().Result;
+                    log.Debug("Response: " + responseString);
+                    return responseString;
+                }
+                else
+                {
+                    log.Error("Response: " + response.StatusCode.ToString());
+                    return response.StatusCode.ToString();
+                }
+            }
+        }
+        public String SendPost(Posting obj, String serviceId, String url)
+        {
+            return SendPost(obj, serviceId, url, true);
+        }
+        protected void CreateAuthToken(String account, Object userObj)
+        {
+            // create session authen
+            // Create the random value we will use to secure the session.
+            string authId = GenerateAuthId();
+
+            // Store the value in both our Session and a Cookie.
+            HttpContext.Session.SetString("AuthorizationCookieId", authId);
+            string sessionValue = HttpContext.Session.GetString("AuthorizationCookieId");
+            //CookieOptions option = new CookieOptions
+            //{
+            //    Expires = DateTime.Now.AddMinutes(1)
+            //};
+            //Response.Cookies.Append("Key Name", "Value", option);
+            CookieOptions options = new CookieOptions()
+            {
+                //Path = "/",
+                //HttpOnly = true,
+                //Secure = false,
+                //SameSite = SameSiteMode.None
+                Expires = DateTime.Now.AddMinutes(60)
+            };
+            HttpContext.Response.Cookies.Append("AuthorizationCookie", authId, options);
+            string cookieValue = HttpContext.Request.Cookies["AuthorizationCookie"];
+
+
+            HttpContext.Session.SetString("account", account);
+            HttpContext.Session.SetComplexData("userInfo", userObj);
+        }
+
+        protected bool CheckAuthToken()
+        {
+            string cookieValue = HttpContext.Request.Cookies["AuthorizationCookie"];
+            string sessionValue = HttpContext.Session.GetString("AuthorizationCookieId");
+
+            if (cookieValue == null || sessionValue == null || cookieValue != sessionValue)
+            {
+                // Invalidate the session and log out the current user.
+                return false;
+            }
+            if (sessionValue == null)
+            {
+                // Invalidate the session and log out the current user.
+                return false;
+            }
+
+            // check vsaCheckRole
+            if (useVsa == "1")
+            {
+                var path = HttpContext.Request.Path.Value;
+
+                return CheckRole(path);
+            }
+            return true;
+        }
+
+        protected bool ClearCache()
+        {
+            HttpContext.Session.Clear();
+            foreach (var cookieKey in HttpContext.Request.Cookies.Keys)
+            {
+                HttpContext.Response.Cookies.Delete(cookieKey);
+            }
+            return true;
+        }
+
+        private string GenerateAuthId()
+        {
+            using (RandomNumberGenerator rng = new RNGCryptoServiceProvider())
+            {
+                byte[] tokenData = new byte[32];
+                rng.GetBytes(tokenData);
+                return Convert.ToBase64String(tokenData);
+            }
+        }
+
+        protected string UploadedFile(IFormFile image, String folder)
+        {
+            try
+            {
+                //string uploadsFolder = Path.Combine(webHostEnvironment.WebRootPath, "img");
+                string uploadsFolder = GetParameter(UtilsController.Constant.PATH_OUTSIDE);
+                string uniqueFileName = Guid.NewGuid().ToString() + "_" + image.FileName;
+                string filePath = Path.Combine(uploadsFolder, folder, uniqueFileName);
+                using (var fileStream = new FileStream(filePath, FileMode.Create))
+                {
+                    image.CopyTo(fileStream);
+                }
+                return filePath;
+            }
+            catch (Exception ex)
+            {
+                log.Error("Exception: " + ex);
+                return "";
+            }
+        }
+
+        protected bool CheckRole(String path)
+        {
+            //
+            UserRoles userInfo = HttpContext.Session.GetComplexData<UserRoles>("userInfo");
+            if (userInfo == null || userInfo.function == null)
+            {
+                log.Info("Not found user VSA");
+                return false;
+            }
+            foreach (Function obj in userInfo.function)
+            {
+                if (obj.link.ToUpper() == path.ToUpper())
+                {
+                    return true;
+                }
+            }
+
+            log.Info("Not have privileges: " + ", executing path: " + path);
+            return false;
+        }
+
+        //public bool CheckHasRole(String role)
+        //{
+        //    VsaValidateResult userInfo = HttpContext.Session.GetComplexData<VsaValidateResult>("userInfo");
+        //    if (userInfo == null || userInfo.ObjectAll == null || userInfo.ObjectAll.Row == null)
+        //    {
+        //        log.Info("Not found user VSA");
+        //        return false;
+        //    }
+        //    foreach (VsaRole obj in userInfo.Roles.Row)
+        //    {
+        //        if (obj.ROLENAME.ToUpper() == role.ToUpper())
+        //        {
+        //            return true;
+        //        }
+        //    }
+
+        //    log.Info("Not have privileges: " + userInfo.UserData.Row.USERNAME + ", executing role: " + role);
+        //    return false;
+        //}
+
+        public static String FormatNumber(float number)
+        {
+            var nfi = (NumberFormatInfo)CultureInfo.InvariantCulture.NumberFormat.Clone();
+            nfi.NumberGroupSeparator = NumberSeparated;
+            return number.ToString("#,0", nfi);
+        }
+        public static String FormatNumber(String number)
+        {
+            var nfi = (NumberFormatInfo)CultureInfo.InvariantCulture.NumberFormat.Clone();
+            nfi.NumberGroupSeparator = NumberSeparated;
+            return float.Parse(number).ToString("#,0", nfi);
+        }
+
+        public static String ValidateMsisdn(String msisdn)
+        {
+            if (msisdn == null || msisdn.Trim().Length == 0)
+            {
+                return "";
+            }
+            if (msisdn.StartsWith("0"))
+            {
+                return CountryCode + msisdn.Substring(1);
+            }
+
+            if (msisdn.StartsWith(CountryCode))
+            {
+                return msisdn;
+            }
+
+            return CountryCode + msisdn;
+        }
+
+        //protected VsaValidateResult GetUserInfo()
+        //{
+        //    VsaValidateResult userInfo = HttpContext.Session.GetComplexData<VsaValidateResult>("userInfo");
+        //    return userInfo;
+        //}
+    }
+}

+ 30 - 0
SuperAdmin/SuperAdmin/Controllers/EventController.cs

@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.Options;
+using SuperAdmin.Models.Http;
+using SuperAdmin.Models.Object;
+using SuperAdmin.Models.View;
+using SuperCms.Extensions;
+using static SuperAdmin.Models.View.CommonModel;
+
+namespace SuperAdmin.Controllers
+{
+    public class EventController : BaseController
+    {
+        private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(Program));
+        public EventController(IConfiguration _configuration, IWebHostEnvironment hostEnvironment) : base(_configuration, hostEnvironment)
+        {
+            // init
+        }
+
+        
+
+    }
+}

+ 130 - 0
SuperAdmin/SuperAdmin/Controllers/HomeController.cs

@@ -0,0 +1,130 @@
+using System;
+using System.Diagnostics;
+using System.ServiceModel;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Configuration;
+using SuperAdmin.Models;
+using SuperAdmin.Models.Http;
+using SuperAdmin.Models.Object;
+//using SuperAdmin.Models.Vsa;
+using SuperAdmin.Source;
+using SuperCms.Extensions;
+using SvVsa;
+
+namespace SuperAdmin.Controllers
+{
+    public class HomeController : BaseController
+    {
+        private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(Program));
+
+        public HomeController(IConfiguration _configuration, IWebHostEnvironment hostEnvironment) : base(_configuration, hostEnvironment)
+        {
+            // init
+        }
+
+        //public String GetParameter(String parentKey, String key)
+        //{
+        //    var configs = configuration.GetSection(parentKey).GetChildren();
+        //    foreach (IConfiguration config in configs)
+        //    {
+        //        if (config[key] != null)
+        //        {
+        //            return config[key];
+        //        }
+        //    }
+        //    return "";
+        //}
+
+        public IActionResult Index()
+        {
+            string serviceName = GetParameter(UtilsController.Constant.SERVICE_NAME);
+            string subDomain = GetParameter(UtilsController.Constant.SUB_DOMAIN);
+
+            HttpContext.Session.SetComplexData("serviceName", serviceName);
+            HttpContext.Session.SetComplexData("subDomain", subDomain);
+
+            if (!CheckAuthToken())
+            {
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+            }
+            return View();
+        }
+
+        public IActionResult Privacy()
+        {
+            return View();
+        }
+
+        [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
+        public IActionResult Error()
+        {
+            return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
+        }
+
+        public IActionResult Login()
+        {
+            return View();
+        }
+         
+
+        public IActionResult LoginAction(String account, String password)
+        {
+            var st = new StackTrace();
+            var sf = st.GetFrame(0);
+            String name = sf.GetMethod().Name;
+            String module = sf.GetMethod().DeclaringType.Name;
+
+            //var fullUrl = this.Url.Action(name, module.Substring(0, module.Length - 10), null, null);
+
+            if (account == null || password == null)
+            {
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+            }
+            //// vsa
+            //if (useVsa == "1")
+            //{
+            //    VsaValidateResult vsaRes = LoginVsa(account, password);
+            //    if (vsaRes != null)
+            //    {
+            //        CreateAuthToken(account, vsaRes);
+            //        return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Admin/Index");
+            //    }
+            //    // login failed
+            //    return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+            //}
+
+            // login without vsa
+            LoginAdminRequest request = new LoginAdminRequest();
+            request.users = account;
+            request.pass = password;
+
+            String rs = SendPost(request, GetParameter(UtilsController.Constant.SERVICE_ID), GetParameter(UtilsController.Constant.ADMIN_LOGIN), false);
+            UserRoles res = UserRoles.Parse(rs);
+            if (res.status == UtilsController.Constant.SUCCESS)
+            {
+                CreateAuthToken(account, res);
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Admin/Index");
+            }
+            else
+            {
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+            }
+        }
+
+        public IActionResult Logout()
+        {
+            try
+            {
+                ClearCache();
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+            }
+            catch (Exception ex)
+            {
+                log.Error("Exception " + ex);
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Shared/Error");
+            }
+
+        }
+    }
+}

+ 46 - 0
SuperAdmin/SuperAdmin/Controllers/PartialController.cs

@@ -0,0 +1,46 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Mvc;
+using SuperAdmin.Models.View;
+
+namespace SuperCms.Controllers
+{
+    public class PartialController : Controller
+    {
+        public IActionResult Response(String message, String url)
+        {
+            PartialViewModel model = new PartialViewModel();
+            model.message = message;
+            model.url = url;
+            return PartialView("Response", model);
+        }
+
+        public IActionResult TreeResponse(String message, List<String> ids)
+        {
+            PartialViewModel model = new PartialViewModel();
+            model.message = message;
+            model.ids = ids;
+            return PartialView("TreeResponse", model);
+        }
+
+        public IActionResult Confirm(String message, String url, String id)
+        {
+            PartialViewModel model = new PartialViewModel();
+            model.url = url;
+            model.id = id;
+            model.message = message;
+            return PartialView("Confirm", model);
+        }
+
+        public IActionResult TreeConfirm(String message, String url, String id)
+        {
+            PartialViewModel model = new PartialViewModel();
+            model.url = url;
+            model.id = id;
+            model.message = message;
+            return PartialView("TreeConfirm", model);
+        }
+    }
+}

+ 16 - 0
SuperAdmin/SuperAdmin/Controllers/ProcedureController.cs

@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Mvc;
+
+namespace SuperAdmin.Controllers
+{
+    public class ProcedureController : Controller
+    {
+        public IActionResult Index()
+        {
+            return View();
+        }
+    }
+}

+ 484 - 0
SuperAdmin/SuperAdmin/Controllers/ReportSubController.cs

@@ -0,0 +1,484 @@
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Configuration;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using SuperAdmin.Models.Sub;
+using SuperAdmin.Source;
+using OfficeOpenXml;
+using ClosedXML.Excel;
+using System.IO;
+
+namespace SuperAdmin.Controllers
+{
+    public class ReportSubController : BaseController
+    {
+        private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(Program));
+
+        public ReportSubController(IConfiguration _configuration, IWebHostEnvironment hostEnvironment) : base(_configuration, hostEnvironment)
+        {
+            // init
+        }
+
+        // REPORT SUMMARY
+        public ActionResult ReportSummary(String serviceId)
+        {
+            if (!CheckAuthToken())
+            {
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+            }
+            return View();
+        }
+
+        [HttpPost]
+        public ActionResult GetReport(ReportSummaryReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    content = "Login first"
+                });
+            }
+
+            string result = SendPost(req, GetParameter(LumilotoUtils.WsType.wsSubReportSummary));
+            ReportSummaryRes res = ReportSummaryRes.Parse(result);
+
+            if (res != null && res.data != null)
+            {
+                return PartialView("_ReportSummary", res.data);
+            }
+
+            return Json(new
+            {
+                error = res.errorCode,
+                content = res.message
+            });
+        }
+
+        [HttpPost]
+        public IActionResult ReportExport(ReportSummaryReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    content = "Login first"
+                });
+            }
+
+            return ExportReport(req);
+        }
+
+        private FileContentResult ExportReport(ReportSummaryReq req)
+        {
+            try
+            {
+                ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
+
+                string result = SendPost(req, GetParameter(LumilotoUtils.WsType.wsSubReportSummary));
+                ReportSummaryRes res = ReportSummaryRes.Parse(result);
+
+                string contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
+                string fileName = "report_total.xlsx";
+                using (var workbook = new XLWorkbook())
+                {
+                    int i = 1;
+                    IXLWorksheet worksheet = workbook.Worksheets.Add("Report Summary");
+                    worksheet.Column(i).Width = 15;
+                    worksheet.Cell(1, i++).Value = "No.";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Report date";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Total Revenue";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Total subs active";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Total register new";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Total re - register";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Total renew success 3HTG";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Total renew success 2HTG";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Total renew success 1HTG";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Total users in promotion";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Total charge fail";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Total cancel";
+
+                    // make color
+                    worksheet.Row(1).Style.Font.Bold = true;
+                    worksheet.Row(1).Style.Fill.BackgroundColor = XLColor.Yellow;
+                    //worksheet.Cell(1, i++).Value = "BetId";
+                    if (res != null && res.data.Count > 0)
+                    {
+                        for (int index = 1; index <= res.data.Count; index++)
+                        {
+                            i = 1;
+                            var news = res.data[index - 1];
+                            worksheet.Cell(index + 1, i++).Value = index;
+                            worksheet.Cell(index + 1, i++).SetValue(news.report_date);
+                            worksheet.Cell(index + 1, i++).SetValue(news.revenue);
+                            worksheet.Cell(index + 1, i++).SetValue(news.count_active);
+                            worksheet.Cell(index + 1, i++).SetValue(news.count_reg);
+                            worksheet.Cell(index + 1, i++).SetValue(news.count_re_reg);
+
+                            var existed = false;
+                            foreach (var renew in news.renew)
+                            {
+                                if (renew.step == 3)
+                                {
+                                    existed = true;
+                                    worksheet.Cell(index + 1, i++).SetValue(renew.count_renew);
+                                    break;
+                                }
+                            }
+                            if (!existed)
+                            {
+                                worksheet.Cell(index + 1, i++).SetValue(0);
+                            }
+                            foreach (var renew in news.renew)
+                            {
+                                existed = false;
+                                if (renew.step == 2)
+                                {
+                                    existed = true;
+                                    worksheet.Cell(index + 1, i++).SetValue(renew.count_renew);
+                                    break;
+                                }
+                            }
+                            if (!existed)
+                            {
+                                worksheet.Cell(index + 1, i++).SetValue(0);
+                            }
+                            foreach (var renew in news.renew)
+                            {
+                                existed = false;
+                                if (renew.step == 1)
+                                {
+                                    existed = true;
+                                    worksheet.Cell(index + 1, i++).SetValue(renew.count_renew);
+                                    break;
+                                }
+                            }
+                            if (!existed)
+                            {
+                                worksheet.Cell(index + 1, i++).SetValue(0);
+                            }
+
+                            worksheet.Cell(index + 1, i++).SetValue(news.count_promotion);
+                            worksheet.Cell(index + 1, i++).SetValue(news.charge_fail);
+                            worksheet.Cell(index + 1, i++).SetValue(news.count_deactive);
+                        }
+                    }
+                    using (var stream = new MemoryStream())
+                    {
+                        workbook.SaveAs(stream);
+                        var content = stream.ToArray();
+                        return File(content, contentType, fileName);
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                return null;
+            }
+        }
+
+        // REPORT HOURLY
+        public ActionResult ReportHourly(String serviceId)
+        {
+            if (!CheckAuthToken())
+            {
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+            }
+            return View();
+        }
+
+        [HttpPost]
+        public ActionResult GetReportHourly(ReportHourlyReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    content = "Login first"
+                });
+            }
+
+            string result = SendPost(req, GetParameter(LumilotoUtils.WsType.wsSubReportHourly));
+            ReportHourlyRes res = ReportHourlyRes.Parse(result);
+
+            if (res != null && res.data != null)
+            {
+                return PartialView("_ReportHourly", res.data);
+            }
+
+            return Json(new
+            {
+                error = res.errorCode,
+                content = res.message
+            });
+        }
+
+        [HttpPost]
+        public IActionResult ReportDetailExport(ReportDetailReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    content = "Login first"
+                });
+            }
+
+            return ExportReportDetail(req);
+        }
+
+        private FileContentResult ExportReportDetail(ReportDetailReq req)
+        {
+            try
+            {
+                ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
+
+                string result = SendPost(req, GetParameter(LumilotoUtils.WsType.wsSubReportDetail));
+                ReportDetailRes res = ReportDetailRes.Parse(result);
+
+                string contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
+                string fileName = "report_detail.xlsx";
+                using (var workbook = new XLWorkbook())
+                {
+                    int i = 1;
+                    IXLWorksheet worksheet = workbook.Worksheets.Add("Report Detail");
+                    worksheet.Column(i).Width = 15;
+                    worksheet.Cell(1, i++).Value = "No.";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Report date";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Phone Number";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Transaction ID ";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Transaction Partner ID";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Money Charge";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Time Charge";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Status Charge";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Package";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Description";
+
+                    // make color
+                    worksheet.Row(1).Style.Font.Bold = true;
+                    worksheet.Row(1).Style.Fill.BackgroundColor = XLColor.Yellow;
+                    //worksheet.Cell(1, i++).Value = "BetId";
+                    if (res != null && res.data.Count > 0)
+                    {
+                        for (int index = 1; index <= res.data.Count; index++)
+                        {
+                            i = 1;
+                            var news = res.data[index - 1];
+                            worksheet.Cell(index + 1, i++).Value = index;
+                            worksheet.Cell(index + 1, i++).SetValue(news.report_date);
+                            worksheet.Cell(index + 1, i++).SetValue(news.msisdn);
+                            worksheet.Cell(index + 1, i++).SetValue(news.transaction_id);
+                            worksheet.Cell(index + 1, i++).SetValue(news.reference_id);
+                            worksheet.Cell(index + 1, i++).SetValue(news.money_charge);
+                            worksheet.Cell(index + 1, i++).SetValue(news.charge_time);
+                            worksheet.Cell(index + 1, i++).SetValue(news.status == "0" ? "SUCCESS" : "FAILED");
+                            worksheet.Cell(index + 1, i++).SetValue(news.service_name);
+                            worksheet.Cell(index + 1, i++).SetValue(news.description);
+                        }
+                    }
+                    using (var stream = new MemoryStream())
+                    {
+                        workbook.SaveAs(stream);
+                        var content = stream.ToArray();
+                        return File(content, contentType, fileName);
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                return null;
+            }
+        }
+
+        [HttpPost]
+        public IActionResult ReportRegisterExport(ReportRegisterReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    content = "Login first"
+                });
+            }
+
+            try
+            {
+                ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
+
+                string result = SendPost(req, GetParameter(LumilotoUtils.WsType.wsSubReportRegCancel));
+                ReportRegisterRes res = ReportRegisterRes.Parse(result);
+
+                string contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
+                string fileName = "report_reg_cancel.xlsx";
+                using (var workbook = new XLWorkbook())
+                {
+                    int i = 1;
+                    IXLWorksheet worksheet = workbook.Worksheets.Add("Report Reg_Cancel");
+                    worksheet.Column(i).Width = 15;
+                    worksheet.Cell(1, i++).Value = "No.";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Report date";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Phone Number";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Description";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Time";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Package";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Channel";
+
+                    // make color
+                    worksheet.Row(1).Style.Font.Bold = true;
+                    worksheet.Row(1).Style.Fill.BackgroundColor = XLColor.Yellow;
+                    //worksheet.Cell(1, i++).Value = "BetId";
+                    if (res != null && res.data.Count > 0)
+                    {
+                        for (int index = 1; index <= res.data.Count; index++)
+                        {
+                            i = 1;
+                            var news = res.data[index - 1];
+                            worksheet.Cell(index + 1, i++).Value = index;
+                            worksheet.Cell(index + 1, i++).SetValue(news.report_date);
+                            worksheet.Cell(index + 1, i++).SetValue(news.msisdn);
+                            worksheet.Cell(index + 1, i++).SetValue(news.action);
+                            worksheet.Cell(index + 1, i++).SetValue(news.action_time);
+                            worksheet.Cell(index + 1, i++).SetValue(news.service_name);
+                            worksheet.Cell(index + 1, i++).SetValue(news.channel);
+                        }
+                    }
+                    using (var stream = new MemoryStream())
+                    {
+                        workbook.SaveAs(stream);
+                        var content = stream.ToArray();
+                        return File(content, contentType, fileName);
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                return null;
+            }
+        }
+
+        // REPORT DETAIL
+        public ActionResult ReportDetail(String serviceId)
+        {
+            if (!CheckAuthToken())
+            {
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+            }
+            return View();
+        }
+
+        [HttpPost]
+        public ActionResult GetReportDetail(ReportDetailReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    content = "Login first"
+                });
+            }
+            if (req.msisdn == null || req.msisdn == "")
+            {
+                return Json(new
+                {
+                    error = "2",
+                    content = "Enter phone number"
+                });
+            }
+            string result = SendPost(req, GetParameter(LumilotoUtils.WsType.wsSubReportDetail));
+            ReportDetailRes res = ReportDetailRes.Parse(result);
+
+            if (res != null && res.data != null)
+            {
+                return PartialView("_ReportDetail", res.data);
+            }
+
+            return Json(new
+            {
+                error = res.errorCode,
+                content = res.message
+            });
+        }
+
+
+
+        // REPORT REGISTER
+        public ActionResult ReportRegister(String serviceId)
+        {
+            if (!CheckAuthToken())
+            {
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+            }
+            return View();
+        }
+
+        [HttpPost]
+        public ActionResult GetReportRegister(ReportRegisterReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    content = "Login first"
+                });
+            }
+            if (req.msisdn == null || req.msisdn == "")
+            {
+                return Json(new
+                {
+                    error = "2",
+                    content = "Enter phone number"
+                });
+            }
+            string result = SendPost(req, GetParameter(LumilotoUtils.WsType.wsSubReportRegCancel));
+            ReportRegisterRes res = ReportRegisterRes.Parse(result);
+
+            if (res != null && res.data != null)
+            {
+                return PartialView("_ReportRegister", res.data);
+            }
+
+            return Json(new
+            {
+                error = res.errorCode,
+                content = res.message
+            });
+        }
+
+    }
+}

+ 16 - 0
SuperAdmin/SuperAdmin/Controllers/RolesController.cs

@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Mvc;
+
+namespace SuperAdmin.Controllers
+{
+    public class RolesController : Controller
+    {
+        public IActionResult Index()
+        {
+            return View();
+        }
+    }
+}

+ 1391 - 0
SuperAdmin/SuperAdmin/Controllers/TreeController.cs

@@ -0,0 +1,1391 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Configuration;
+using SuperAdmin.Models.Http;
+using SuperAdmin.Models.Object;
+using SuperAdmin.Models.View;
+using SuperCms.Extensions;
+using static SuperAdmin.Models.View.CommonModel;
+
+namespace SuperAdmin.Controllers
+{
+    public class TreeController : BaseController
+    {
+        private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(Program));
+
+        public TreeController(IConfiguration _configuration, IWebHostEnvironment hostEnvironment) : base(_configuration, hostEnvironment)
+        {
+            // init
+        }
+
+        public IActionResult Index(String id)
+        {
+            try
+            {
+                if (!CheckAuthToken())
+                {
+                    return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+                }
+                string serviceName = GetParameter(UtilsController.Constant.SERVICE_NAME);
+                HttpContext.Session.SetComplexData("serviceName", serviceName);
+
+                if (!CheckAuthToken())
+                {
+                    return RedirectToAction("Index", "Home");
+                }
+                RowStructures rows = HttpContext.Session.GetComplexData<RowStructures>("rows");
+
+                TreeViewModel model = new TreeViewModel();
+                model.rows = new RowStructures();
+                model.rows.data = new List<RowStructure>();
+
+                if (rows == null || 1 == 1)
+                {
+                    GetRequest request = new GetRequest();
+                    request.ID = id != null ? id : BaseController.PARENT_ID;
+                    //request.isGetChildById = "1";
+                    String rs = SendPost(request, GetParameter(UtilsController.Constant.SERVICE_ID), GetParameter(UtilsController.Constant.GET_BY_PARENT_ID));
+                    AppResponse res = new AppResponse(rs);
+                    if (res.status == UtilsController.Constant.SUCCESS)
+                    {
+                        RowStructures rowsGet = new RowStructures(configuration, rs);
+                        rowsGet.data.ForEach(x => model.rows.data.Add(x));
+                    }
+                    HttpContext.Session.SetComplexData("rows", model.rows);
+                }
+                else
+                {
+                    rows.data.ForEach(x => model.rows.data.Add(x));
+                    model.rows.data = model.rows.data.FindAll(x => x.parent_id == BaseController.PARENT_ID);
+                }
+
+                return View("Index", model);
+            }
+            catch (Exception ex)
+            {
+                log.Error("Exception " + ex);
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Shared/Error");
+            }
+
+        }
+
+        public IActionResult GetTreeData(String id)
+        {
+            try
+            {
+                if (!CheckAuthToken())
+                {
+                    return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+                }
+                TreeViewModel model = new TreeViewModel();
+                model.rows = new RowStructures();
+                model.rows.data = new List<RowStructure>();
+
+                RowStructures rows = HttpContext.Session.GetComplexData<RowStructures>("rows");
+
+                List<RowStructure> rowGetSession = rows != null ? rows.data.FindAll(x => x.parent_id == id) : null;
+                if (rowGetSession == null || rowGetSession.Count == 0)
+                {
+                    GetRequest request = new GetRequest();
+                    request.ID = id;
+                    String rs = SendPost(request, GetParameter(UtilsController.Constant.SERVICE_ID), GetParameter(UtilsController.Constant.GET_BY_PARENT_ID));
+                    AppResponse res = new AppResponse(rs);
+                    if (res.status == UtilsController.Constant.SUCCESS)
+                    {
+                        RowStructures rowsGet = new RowStructures(configuration, rs);
+                        rowsGet.data.ForEach(x => rows.data.Add(x));
+                        model.rows = rowsGet;
+                    }
+                    HttpContext.Session.SetComplexData("rows", rows);
+                }
+                else
+                {
+                    model.rows.data = rowGetSession;
+                }
+
+                return PartialView("TreePartial", model);
+            }
+            catch (Exception ex)
+            {
+                log.Error("Exception " + ex);
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Shared/Error");
+            }
+        }
+
+        public IActionResult GetTableData(String id)
+        {
+            try
+            {
+                if (!CheckAuthToken())
+                {
+                    return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+                }
+                TreeViewModel model = new TreeViewModel();
+                model.rows = new RowStructures();
+                model.rows.data = new List<RowStructure>();
+
+                RowStructures rows = HttpContext.Session.GetComplexData<RowStructures>("rows");
+                if (rows != null)
+                {
+                    RowStructure parent = rows.data.Find(x => x.id == id);
+                    model.parent = parent;
+                    List<RowStructure> rowGetSession = rows != null ? rows.data.FindAll(x => x.parent_id == id) : null;
+                    if (rowGetSession == null || rowGetSession.Count == 0)
+                    {
+                        GetRequest request = new GetRequest();
+                        request.ID = id;
+                        String rs = SendPost(request, GetParameter(UtilsController.Constant.SERVICE_ID), GetParameter(UtilsController.Constant.GET_BY_PARENT_ID));
+                        AppResponse res = new AppResponse(rs);
+                        if (res.status == UtilsController.Constant.SUCCESS)
+                        {
+                            RowStructures rowsGet = new RowStructures(configuration, rs);
+                            rowsGet.data.ForEach(x => rows.data.Add(x));
+                            model.rows = rowsGet;
+                        }
+                        HttpContext.Session.SetComplexData("rows", rows);
+                    }
+                    else
+                    {
+                        model.rows.data = rowGetSession;
+                    }
+                }
+                return PartialView("TablePartial", model);
+            }
+            catch (Exception ex)
+            {
+                log.Error("Exception " + ex);
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Shared/Error");
+            }
+        }
+
+        // data
+        private string UploadedFile(String folder, IFormFile image)
+        {
+            try
+            {
+                //string uploadsFolder = Path.Combine(webHostEnvironment.WebRootPath, "img");
+                string uploadsFolder = GetParameter(UtilsController.Constant.PATH_OUTSIDE);
+                uploadsFolder = Path.Combine(uploadsFolder, folder);
+                if (!Directory.Exists(uploadsFolder))
+                {
+                    Directory.CreateDirectory(uploadsFolder);
+                }
+
+                string uniqueFileName = Guid.NewGuid().ToString() + "_" + image.FileName;
+                string filePath = Path.Combine(uploadsFolder, uniqueFileName);
+                using (var fileStream = new FileStream(filePath, FileMode.Create))
+                {
+                    image.CopyTo(fileStream);
+                }
+                return Path.Combine(folder, uniqueFileName);
+            }
+            catch (Exception ex)
+            {
+                log.Error("Exception: " + ex);
+                return "";
+            }
+
+        }
+
+        public IActionResult Adding(String id)
+        {
+            try
+            {
+                if (!CheckAuthToken())
+                {
+                    return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+                }
+
+                EventViewModel model = new EventViewModel();
+
+                if (id != BaseController.PARENT_ID)
+                {
+                    RowStructures rows = HttpContext.Session.GetComplexData<RowStructures>("rows");
+                    model.parent = rows.data.Find(x => x.id == id);
+                }
+                Provinces provinces = HttpContext.Session.GetComplexData<Provinces>("provinces");
+                Topics topics = HttpContext.Session.GetComplexData<Topics>("topics");
+
+                if (provinces == null)
+                {
+                    provinces = new Provinces();
+                    provinces.data = new List<Province>();
+
+                    AppRequest userRequest = new AppRequest();
+                    userRequest.language = UtilsController.Constant.LANGUAGE_GLOBAL;
+
+                    String rsProvince = SendPost(userRequest, GetParameter(UtilsController.Constant.SERVICE_ID), GetParameter(UtilsController.Constant.GET_PROVINCES));
+                    AppResponse resProvince = new AppResponse(rsProvince);
+                    if (resProvince.status == UtilsController.Constant.SUCCESS)
+                    {
+                        provinces = new Provinces(rsProvince);
+                        HttpContext.Session.SetComplexData("provinces", provinces);
+                    }
+                }
+
+                if (topics == null)
+                {
+                    topics = new Topics();
+                    topics.data = new List<Topic>();
+
+                    AppRequest topicRequest = new AppRequest();
+                    topicRequest.language = UtilsController.Constant.LANGUAGE_GLOBAL;
+
+                    String rsTopic = SendPost(topicRequest, GetParameter(UtilsController.Constant.SERVICE_ID), GetParameter(UtilsController.Constant.GET_TOPICS));
+                    AppResponse resTopic = new AppResponse(rsTopic);
+                    if (resTopic.status == UtilsController.Constant.SUCCESS)
+                    {
+                        topics = new Topics(rsTopic);
+                        HttpContext.Session.SetComplexData("topics", topics);
+                    }
+                }
+
+                model.provinces = provinces;
+                model.topics = topics;
+
+                return PartialView("~/Views/Tree/Event/Adding.cshtml", model);
+            }
+            catch (Exception ex)
+            {
+                log.Error("Exception " + ex);
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Shared/Error");
+            }
+
+        }
+
+        [ValidateAntiForgeryToken]
+        [HttpPost]
+        public JsonResult AddingAction(RowStructure data, IFormFile icon, IFormFile logo)
+        {
+            try
+            {
+                if (!CheckAuthToken())
+                {
+                    return Json(new
+                    {
+                        code = UtilsController.Constant.AUTHEN_FAIL,
+                        href = GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login"
+                    });
+                }
+                String page = HttpContext.Session.GetComplexData<String>("page");
+
+                // check image upload
+                if (icon != null && (icon.FileName.EndsWith(".png") || icon.FileName.EndsWith(".jpg") || icon.FileName.EndsWith(".jpeg"))
+                    && logo != null)
+                {
+                    //List<IFormFile> newFiles = new List<IFormFile>();
+                    //newFiles.Add(icon);
+                    //newFiles.Add(logo);
+                    //Task<IActionResult> resUpload = OnPostUploadAsync(newFiles);
+                    //data.realIcon = icon.FileName;
+                    //data.realLogo = logo.FileName;
+                    String resIcon = UploadedFile(data.parent_id, icon);
+                    String resLogo = UploadedFile(data.parent_id, logo);
+                    if (resIcon != "" && resLogo != "")
+                    {
+                        data.realIcon = resIcon;
+                        data.realLogo = resLogo;
+                    }
+                    else
+                    {
+                        return Json(new
+                        {
+                            error_code = UtilsController.Constant.FAILURE,
+                            error_content = "An error happens with your logo or your icon.",
+                        });
+                    }
+                }
+                else if (icon != null || logo != null)
+                {
+                    return Json(new
+                    {
+                        error_code = UtilsController.Constant.FAILURE,
+                        error_content = "An error happens with your logo",
+                    });
+                }
+
+                data.sv_id = GetParameter(UtilsController.Constant.SERVICE_ID);
+                data.from_date = convertToDateTimeServer(data.from_date);
+                data.to_date = convertToDateTimeServer(data.to_date);
+
+                // push event to the server
+                ActionRequest userRequest = new ActionRequest();
+
+                userRequest.NOTE = "";
+                userRequest.PARENT_ID = data.parent_id;
+                userRequest.CODE = data.code;
+                userRequest.NAME_GLOBAL = data.name_global;
+                userRequest.NAME_LOCAL = data.name_local;
+                userRequest.DESCRIPTION_GLOBAL = data.description_global;
+                userRequest.DESCRIPTION_LOCAL = data.description_local;
+                userRequest.INTRODUCTION_GLOBAL = data.introduction_global;
+                userRequest.INTRODUCTION_LOCAL = data.introduction_local;
+                userRequest.ICON = data.realIcon;
+                userRequest.LOGO = data.realLogo;
+                userRequest.CONTENT = data.content;
+                userRequest.CONTENT_TYPE = UtilsController.Constant.TEXT_TYPE;
+                userRequest.IS_SHOW = data.is_show;
+
+                userRequest.PROVINCE_ID = UtilsController.Constant.ALL_CATEGORIES;
+                userRequest.TOPIC_ID = UtilsController.Constant.ALL_CATEGORIES;
+
+                userRequest.FROM_DATE = data.from_date;
+                userRequest.TO_DATE = data.to_date;
+                userRequest.TYPE = UtilsController.Constant.ADMIN_TYPE;
+
+                String rs = SendPost(userRequest, GetParameter(UtilsController.Constant.SERVICE_ID), GetParameter(UtilsController.Constant.INSERT_DATA));
+                AppResponse res = new AppResponse(rs);
+
+                if (res.status == UtilsController.Constant.SUCCESS)
+                {
+                    RowStructures rows = HttpContext.Session.GetComplexData<RowStructures>("rows");
+                    data.id = res.newsId;
+                    data.name = data.name_global;
+                    rows.data.Add(data);
+                    HttpContext.Session.SetComplexData("rows", rows);
+                    List<String> ids = new List<string>();
+                    ids.Add(data.parent_id);
+                    return Json(new
+                    {
+                        code = UtilsController.Constant.SUCCESS,
+                        message = "Adding successful",
+                        ids = ids,
+                    });
+                }
+                else
+                {
+                    return Json(new
+                    {
+                        code = UtilsController.Constant.FAILURE,
+                        message = "We have a problem!",
+                    });
+                }
+            }
+            catch (Exception ex)
+            {
+                log.Error("Exception " + ex);
+                return Json(new
+                {
+                    code = UtilsController.Constant.EXCEPTION,
+                    href = GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Shared/Error"
+                });
+            }
+        }
+
+        public IActionResult Editing(String id, String action)
+        {
+            try
+            {
+
+                if (!CheckAuthToken())
+                {
+                    return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+                }
+
+                if (id == null)
+                {
+                    //return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Shared/Error");
+                    id = BaseController.PARENT_ID;
+                }
+
+                EventViewModel model = new EventViewModel();
+                model.action = action;
+
+                if (action == "add")
+                {
+                    if (id != BaseController.PARENT_ID)
+                    {
+                        RowStructures rows = HttpContext.Session.GetComplexData<RowStructures>("rows");
+                        model.parent = rows.data.Find(x => x.id == id);
+                    }
+                }
+                else
+                {
+                    // edit
+                    RowStructures rows = HttpContext.Session.GetComplexData<RowStructures>("rows");
+                    model.now = rows.data.Find(x => x.id == id);
+                    model.parent = rows.data.Find(x => x.id == model.now.parent_id);
+
+
+                    if (model.now != null)
+                    {
+                        // get details
+                        GetRequest request1 = new GetRequest();
+                        request1.ID = id;
+                        request1.isGetContet = UtilsController.Constant.GET_CONTENT;
+                        String rs1 = SendPost(request1, GetParameter(UtilsController.Constant.SERVICE_ID), GetParameter(UtilsController.Constant.GET_BY_ID));
+                        AppResponse res1 = new AppResponse(rs1);
+                        if (res1.status == UtilsController.Constant.SUCCESS)
+                        {
+                            RowStructures rowsGet = new RowStructures(configuration, rs1);
+                            model.now = rowsGet.data[0];
+                        }
+                    }
+                    HttpContext.Session.SetComplexData("editing", model.now);
+                }
+
+
+                //Provinces provinces = HttpContext.Session.GetComplexData<Provinces>("provinces");
+                //Topics topics = HttpContext.Session.GetComplexData<Topics>("topics");
+
+                //if (provinces == null)
+                //{
+                //    provinces = new Provinces();
+                //    provinces.data = new List<Province>();
+
+                //    AppRequest userRequest = new AppRequest();
+                //    userRequest.language = UtilsController.Constant.LANGUAGE_GLOBAL;
+
+                //    String rsProvince = SendPost(userRequest, GetParameter(UtilsController.Constant.SERVICE_ID), GetParameter(UtilsController.Constant.GET_PROVINCES));
+                //    AppResponse resProvince = new AppResponse(rsProvince);
+                //    if (resProvince.status == UtilsController.Constant.SUCCESS)
+                //    {
+                //        provinces = new Provinces(rsProvince);
+                //        HttpContext.Session.SetComplexData("provinces", provinces);
+                //    }
+                //}
+
+                //if (topics == null)
+                //{
+                //    topics = new Topics();
+                //    topics.data = new List<Topic>();
+
+                //    AppRequest topicRequest = new AppRequest();
+                //    topicRequest.language = UtilsController.Constant.LANGUAGE_GLOBAL;
+
+                //    String rsTopic = SendPost(topicRequest, GetParameter(UtilsController.Constant.SERVICE_ID), GetParameter(UtilsController.Constant.GET_TOPICS));
+                //    AppResponse resTopic = new AppResponse(rsTopic);
+                //    if (resTopic.status == UtilsController.Constant.SUCCESS)
+                //    {
+                //        topics = new Topics(rsTopic);
+                //        HttpContext.Session.SetComplexData("topics", topics);
+                //    }
+                //}
+
+                //model.provinces = provinces;
+                //model.topics = topics;
+
+                // get all parents
+                GetRequest request = new GetRequest();
+                request.ID = id;
+                request.isGetChildById = "2"; // get all parents
+                String rs = SendPost(request, GetParameter(UtilsController.Constant.SERVICE_ID), GetParameter(UtilsController.Constant.GET_BY_PARENT_ID));
+                AppResponse res = new AppResponse(rs);
+                if (res.status == UtilsController.Constant.SUCCESS)
+                {
+                    model.categories = new RowStructures(configuration, rs);
+                }
+
+                return PartialView("~/Views/Tree/Event/Editing.cshtml", model);
+
+            }
+            catch (Exception ex)
+            {
+                log.Error("Exception " + ex);
+                return Redirect(HttpContext.Session.GetComplexData<RowStructures>(UtilsController.Constant.SUB_DOMAIN) + "/Shared/Error");
+            }
+
+        }
+
+        [ValidateAntiForgeryToken]
+        [HttpPost]
+        public JsonResult EditingAction(RowStructure data, IFormFile icon, IFormFile logo, string action)
+        {
+            try
+            {
+                if (!CheckAuthToken())
+                {
+                    return Json(new
+                    {
+                        code = UtilsController.Constant.AUTHEN_FAIL,
+                        href = GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login"
+                    });
+                }
+                String page = HttpContext.Session.GetComplexData<String>("page");
+
+                // check image upload
+                if (icon != null && (icon.FileName.EndsWith(".png") || icon.FileName.EndsWith(".jpg") || icon.FileName.EndsWith(".jpeg")) && logo != null)
+                {
+                    String resIcon = UploadedFile(data.parent_id, icon);
+                    //String resLogo = UploadedFile(logo);
+                    if (resIcon != "")
+                    {
+                        data.realIcon = resIcon;
+                        //data.realLogo = resLogo;
+                    }
+                    else
+                    {
+                        return Json(new
+                        {
+                            error_code = UtilsController.Constant.FAILURE,
+                            error_content = "An error happens with your logo or your icon.",
+                        });
+                    }
+                }
+
+
+                if (logo != null)
+                {
+                    //String resIcon = UploadedFile(icon);
+                    String resLogo = UploadedFile(data.parent_id, logo);
+                    if (resLogo != "")
+                    {
+                        //data.realIcon = resIcon;
+                        data.realLogo = resLogo;
+                    }
+                    else
+                    {
+                        return Json(new
+                        {
+                            error_code = UtilsController.Constant.FAILURE,
+                            error_content = "An error happens with your logo or your icon.",
+                        });
+                    }
+                }
+
+                //else if (icon != null || logo != null)
+                //{
+                //    return Json(new
+                //    {
+                //        error_code = UtilsController.Constant.FAILURE,
+                //        error_content = "An error happens with your logo",
+                //    });
+                //}
+
+                RowStructure edit = HttpContext.Session.GetComplexData<RowStructure>("editing");
+
+                data.sv_id = GetParameter(UtilsController.Constant.SERVICE_ID);
+                data.from_date = convertToDateTimeServer(data.from_date);
+                data.to_date = convertToDateTimeServer(data.to_date);
+
+                // push event to the server
+                ActionRequest userRequest = new ActionRequest();
+                userRequest.NOTE = "";
+                userRequest.PARENT_ID = data.parent_id;
+
+                userRequest.NAME_GLOBAL = data.name_global;
+                userRequest.NAME_GLOBAL1 = data.name_global1;
+                userRequest.NAME_GLOBAL2 = data.name_global2;
+                userRequest.NAME_LOCAL = data.name_local;
+                userRequest.DESCRIPTION_GLOBAL = data.description_global;
+                userRequest.DESCRIPTION_GLOBAL1 = data.description_global1;
+                userRequest.DESCRIPTION_GLOBAL2 = data.description_global2;
+                userRequest.DESCRIPTION_LOCAL = data.description_local;
+                userRequest.INTRODUCTION_GLOBAL = data.introduction_global;
+                userRequest.INTRODUCTION_GLOBAL1 = data.introduction_global1;
+                userRequest.INTRODUCTION_GLOBAL2 = data.introduction_global2;
+                userRequest.INTRODUCTION_LOCAL = data.introduction_local;
+                userRequest.ICON = data.realIcon;
+                userRequest.LOGO = data.realLogo;
+                userRequest.CONTENT = data.content;
+                userRequest.CONTENT_GLOBAL = data.content_global;
+                userRequest.CONTENT_GLOBAL1 = data.content_global1;
+                userRequest.CONTENT_GLOBAL2 = data.content_global2;
+                userRequest.CONTENT_TYPE = UtilsController.Constant.TEXT_TYPE;
+                userRequest.IS_SHOW = UtilsController.Constant.WAIT_APPROVAL;//data.is_show;
+                userRequest.PROVINCE_ID = UtilsController.Constant.ALL_CATEGORIES;
+                userRequest.TOPIC_ID = UtilsController.Constant.ALL_CATEGORIES;
+                userRequest.FROM_DATE = data.from_date;
+                userRequest.TO_DATE = data.to_date;
+                userRequest.TYPE = UtilsController.Constant.EDITING;
+
+                if (action == "add")
+                {
+                    userRequest.CODE = data.code;
+                }
+                else
+                {
+                    data.id = edit.id;
+                    data.parent_id = edit.parent_id;
+                    userRequest.CODE = data.code;
+                }
+
+                if (action == "add")
+                {
+                    // add new
+                    String rs = SendPost(userRequest, GetParameter(UtilsController.Constant.SERVICE_ID), GetParameter(UtilsController.Constant.INSERT_DATA));
+                    AppResponse res = new AppResponse(rs);
+
+                    if (res.status == UtilsController.Constant.SUCCESS)
+                    {
+                        RowStructures rows = HttpContext.Session.GetComplexData<RowStructures>("rows");
+                        data.id = res.newsId;
+                        data.name = data.name_global;
+                        rows.data.Add(data);
+                        HttpContext.Session.SetComplexData("rows", rows);
+                        List<String> ids = new List<string>();
+                        ids.Add(data.parent_id);
+                        return Json(new
+                        {
+                            code = UtilsController.Constant.SUCCESS,
+                            message = "Adding successful",
+                            ids = ids,
+                        });
+                    }
+                    else
+                    {
+                        return Json(new
+                        {
+                            code = UtilsController.Constant.FAILURE,
+                            message = "We have a problem!",
+                        });
+                    }
+                }
+                else
+                {
+                    // edit
+                    userRequest.ID = data.id;
+                    String rs = SendPost(userRequest, GetParameter(UtilsController.Constant.SERVICE_ID), GetParameter(UtilsController.Constant.UPDATE_DATA));
+                    AppResponse res = new AppResponse(rs);
+
+                    if (res.status == UtilsController.Constant.SUCCESS)
+                    {
+                        RowStructures rows = HttpContext.Session.GetComplexData<RowStructures>("rows");
+                        rows.data.Where(S => S.id == data.id).Select(S =>
+                        {
+                            S.code = data.code;
+                            S.name = data.name;
+                            S.name_global = data.name_global;
+                            S.name_global1 = data.name_global1;
+                            S.name_global2 = data.name_global2;
+                            S.name_local = data.name_local;
+                            S.description_global = data.description_global;
+                            S.description_global1 = data.description_global1;
+                            S.description_global2 = data.description_global2;
+                            S.description_local = data.description_local;
+                            S.introduction_global = data.introduction_global;
+                            S.introduction_global1 = data.introduction_global1;
+                            S.introduction_global2 = data.introduction_global2;
+                            S.introduction_local = data.introduction_local;
+                            S.icon = data.realIcon;
+                            S.logo = data.realLogo;
+                            S.content = data.content;
+                            S.content_global = data.content_global;
+                            S.content_global1 = data.content_global1;
+                            S.content_global2 = data.content_global2;
+                            S.content_type = UtilsController.Constant.TEXT_TYPE;
+                            S.is_show = data.is_show;
+                            S.province_id = data.province_id;
+                            S.topic_id = data.topic_id;
+                            S.from_date = data.from_date;
+                            S.to_date = data.to_date;
+                            S.permission = UtilsController.Constant.ADMIN_TYPE;
+                            return S;
+                        }).ToList();
+                        HttpContext.Session.SetComplexData("rows", rows);
+                        List<String> ids = new List<string>();
+                        ids.Add(data.parent_id);
+                        return Json(new
+                        {
+                            ids = ids,
+                            code = UtilsController.Constant.SUCCESS,
+                            message = "Editing successful",
+                        });
+                    }
+                    else
+                    {
+                        return Json(new
+                        {
+                            code = UtilsController.Constant.FAILURE,
+                            message = "We have a problem!",
+                        });
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                log.Error("Exception " + ex);
+                return Json(new
+                {
+                    code = UtilsController.Constant.EXCEPTION,
+                    href = GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Shared/Error"
+                });
+            }
+        }
+
+        [ValidateAntiForgeryToken]
+        public JsonResult DeletingAction(String id)
+        {
+            try
+            {
+                if (!CheckAuthToken())
+                {
+                    return Json(new
+                    {
+                        code = UtilsController.Constant.AUTHEN_FAIL,
+                        href = GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login"
+                    });
+                }
+
+                RowStructures rows = HttpContext.Session.GetComplexData<RowStructures>("rows");
+
+                RowStructure data = rows.data.Find(x => x.id == id);
+                if (data == null)
+                {
+                    return Json(new
+                    {
+                        code = UtilsController.Constant.FAILURE,
+                        href = GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home"
+                    });
+                }
+
+                ActionRequest request = new ActionRequest();
+                request.ID = data.id;
+                request.TYPE = UtilsController.Constant.DELETE;
+
+                String rs = SendPost(request, GetParameter(UtilsController.Constant.SERVICE_ID), GetParameter(UtilsController.Constant.UPDATE_DATA));
+                AppResponse res = new AppResponse(rs);
+                if (res.status == UtilsController.Constant.SUCCESS)
+                {
+                    //return Redirect("/EventAdmin/EventShowing");
+                    rows.data.RemoveAll(x => x.id == id);
+                    HttpContext.Session.SetComplexData("rows", rows);
+                    List<String> ids = new List<string>();
+                    ids.Add(data.parent_id);
+
+                    List<String> funcs = new List<string>();
+                    funcs.Add(UtilsController.Constant.GetTableAction);
+
+                    List<String> paras = new List<string>();
+                    paras.Add(data.parent_id);
+                    return Json(new
+                    {
+                        ids = ids,
+                        code = UtilsController.Constant.SUCCESS,
+                        message = "Deleting successful",
+                        functions = funcs,
+                        parameters = paras,
+                    });
+                }
+                else
+                {
+                    return Json(new
+                    {
+                        code = UtilsController.Constant.FAILURE,
+                        message = "We have a problem!",
+                    });
+                }
+            }
+            catch (Exception ex)
+            {
+                log.Error("Exception " + ex);
+                return Json(new
+                {
+                    code = UtilsController.Constant.EXCEPTION,
+                    href = GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home"
+                });
+            }
+        }
+
+        [ValidateAntiForgeryToken]
+        public JsonResult MovingAction(String sourceID, String destinationID)
+        {
+            try
+            {
+                if (!CheckAuthToken())
+                {
+                    return Json(new
+                    {
+                        code = UtilsController.Constant.AUTHEN_FAIL,
+                        href = GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login"
+                    });
+                }
+                if (sourceID == null || destinationID == null)
+                {
+                    return Json(new
+                    {
+                        code = UtilsController.Constant.FAILURE,
+                        href = GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Shared/Error"
+                    });
+                }
+                RowStructures rows = HttpContext.Session.GetComplexData<RowStructures>("rows");
+
+                RowStructure source = rows.data.Find(x => x.id == sourceID);
+                RowStructure destination = rows.data.Find(x => x.id == destinationID);
+
+                if (source == null || destination == null)
+                {
+                    return Json(new
+                    {
+                        code = UtilsController.Constant.FAILURE,
+                        href = GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Shared/Error"
+                    });
+                }
+
+                String oldParent = source.parent_id;
+
+                // update source parent id to destination
+                source.parent_id = destination.id;
+
+                // push event to the server
+                ActionRequest userRequest = new ActionRequest();
+                userRequest.ID = source.id;
+                userRequest.NOTE = "";
+                userRequest.PARENT_ID = source.parent_id;
+                userRequest.CODE = source.code;
+                userRequest.NAME_GLOBAL = source.name_global;
+                userRequest.NAME_LOCAL = source.name_local;
+                userRequest.DESCRIPTION_GLOBAL = source.description_global;
+                userRequest.DESCRIPTION_LOCAL = source.description_local;
+                userRequest.INTRODUCTION_GLOBAL = source.introduction_global;
+                userRequest.INTRODUCTION_LOCAL = source.introduction_local;
+                userRequest.ICON = source.realIcon;
+                userRequest.LOGO = source.realLogo;
+                userRequest.CONTENT = source.content;
+                userRequest.CONTENT_TYPE = UtilsController.Constant.TEXT_TYPE;
+                userRequest.IS_SHOW = source.is_show;
+                userRequest.PROVINCE_ID = source.province_id;
+                userRequest.TOPIC_ID = source.topic_id;
+                userRequest.FROM_DATE = source.from_date;
+                userRequest.TO_DATE = source.to_date;
+                userRequest.TYPE = UtilsController.Constant.ADMIN_TYPE;
+
+                String rs = SendPost(userRequest, GetParameter(UtilsController.Constant.SERVICE_ID), GetParameter(UtilsController.Constant.UPDATE_DATA));
+                AppResponse res = new AppResponse(rs);
+
+                if (res.status == UtilsController.Constant.SUCCESS)
+                {
+                    rows.data.Where(S => S.id == source.id).Select(S =>
+                    {
+                        S.parent_id = source.parent_id;
+                        return S;
+                    }).ToList();
+                    HttpContext.Session.SetComplexData("rows", rows);
+                    List<String> ids = new List<string>();
+                    ids.Add(destination.id);
+                    ids.Add(oldParent);
+
+                    return Json(new
+                    {
+                        ids = ids,
+                        code = UtilsController.Constant.SUCCESS,
+                        message = "Moving successful",
+                    });
+                }
+                else
+                {
+                    return Json(new
+                    {
+                        code = UtilsController.Constant.FAILURE,
+                        message = "We have a problem!",
+                    });
+                }
+
+            }
+            catch (Exception ex)
+            {
+                log.Error("Exception " + ex);
+                return Json(new
+                {
+                    code = UtilsController.Constant.EXCEPTION,
+                    href = GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home"
+                });
+            }
+        }
+
+        [ValidateAntiForgeryToken]
+        public JsonResult CopyingAction(String sourceID, String destinationID)
+        {
+            try
+            {
+                if (!CheckAuthToken())
+                {
+                    return Json(new
+                    {
+                        code = UtilsController.Constant.AUTHEN_FAIL,
+                        href = GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login"
+                    });
+                }
+                if (sourceID == null || destinationID == null)
+                {
+                    return Json(new
+                    {
+                        code = UtilsController.Constant.FAILURE,
+                        href = GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Shared/Error"
+                    });
+                }
+                RowStructures rows = HttpContext.Session.GetComplexData<RowStructures>("rows");
+
+                RowStructure source = rows.data.Find(x => x.id == sourceID);
+                RowStructure destination = rows.data.Find(x => x.id == destinationID);
+
+                if (source == null || destination == null)
+                {
+                    return Json(new
+                    {
+                        code = UtilsController.Constant.FAILURE,
+                        message = "We have a problem. Parent id was not found!",
+                        href = GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Shared/Error"
+                    });
+                }
+                MapData map = new MapData();
+                map.oldData = source;
+                DistributedByLevel one = new DistributedByLevel();
+                one.mapData = new List<MapData>();
+                one.mapData.Add(map);
+                one.level = 1;
+                List<DistributedByLevel> listOne = new List<DistributedByLevel>();
+                listOne.Add(one);
+                List<DistributedByLevel> dataCopy = GetAllDataSource(1, listOne);
+                Boolean res = CopyAllDataSource(destinationID, dataCopy, 1, new List<DistributedByLevel>());
+
+                if (res)
+                {
+                    List<String> ids = new List<string>();
+                    ids.Add(source.parent_id);
+                    ids.Add(destination.id);
+                    return Json(new
+                    {
+                        ids = ids,
+                        code = UtilsController.Constant.SUCCESS,
+                        message = "Copying successful",
+                    });
+                }
+                else
+                {
+                    return Json(new
+                    {
+                        code = UtilsController.Constant.FAILURE,
+                        message = "We have a problem!",
+                    });
+                }
+            }
+            catch (Exception ex)
+            {
+                log.Error("Exception " + ex);
+                return Json(new
+                {
+                    code = UtilsController.Constant.EXCEPTION,
+                    message = "We have a problem. Exception!",
+                    href = GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home"
+                });
+            }
+        }
+
+        private List<DistributedByLevel> GetAllDataSource(int level, List<DistributedByLevel> result)
+        {
+            DistributedByLevel now = result.Find(x => x.level == level);
+
+            DistributedByLevel newDis = new DistributedByLevel();
+            newDis.level = level + 1;
+            newDis.mapData = new List<MapData>();
+
+            int check = 1;
+            for (int i = 0; i < now.mapData.Count; i++)
+            {
+                GetRequest request = new GetRequest();
+                request.ID = now.mapData[i].oldData.id;
+                request.isGetContet = UtilsController.Constant.GET_CONTENT;
+                String rs = SendPost(request, GetParameter(UtilsController.Constant.SERVICE_ID), GetParameter(UtilsController.Constant.GET_BY_PARENT_ID));
+                AppResponse res = new AppResponse(rs);
+                if (res.status == UtilsController.Constant.SUCCESS)
+                {
+                    RowStructures rowsGet = new RowStructures(configuration, rs);
+                    for (int a = 0; a < rowsGet.data.Count; a++)
+                    {
+                        MapData map = new MapData();
+                        map.oldData = rowsGet.data[a];
+                        newDis.mapData.Add(map);
+                    }
+                }
+                else
+                {
+                    check *= 0;
+                }
+            }
+            if (check == 1)
+            {
+                result.Add(newDis);
+                return GetAllDataSource(level + 1, result);
+            }
+            else
+            {
+                return result;
+            }
+        }
+
+        private Boolean CopyAllDataSource(String destinationID, List<DistributedByLevel> source, int count, List<DistributedByLevel> result)
+        {
+            if (source.Count == count - 1)
+            {
+                return true;
+            }
+            else
+            {
+                DistributedByLevel child = source.Find(x => x.level == count);
+                DistributedByLevel parent = result.Find(x => x.level == count - 1);
+
+                for (int i = 0; i < child.mapData.Count; i++)
+                {
+                    MapData childMap = child.mapData[i];
+
+                    MapData parentMap = count > 1 ? parent.mapData.Find(x => x.oldData.id == childMap.oldData.parent_id) : null;
+                    childMap.newData = (RowStructure)childMap.oldData.Clone();
+
+                    // push event to the server
+                    ActionRequest userRequest = new ActionRequest();
+
+                    userRequest.PARENT_ID = count > 1 ? parentMap.newData.id : destinationID;
+                    userRequest.CODE = childMap.newData.code;
+                    userRequest.NAME_GLOBAL = childMap.newData.name_global;
+                    userRequest.NAME_LOCAL = childMap.newData.name_local;
+                    userRequest.DESCRIPTION_GLOBAL = childMap.newData.description_global;
+                    userRequest.DESCRIPTION_LOCAL = childMap.newData.description_local;
+                    userRequest.INTRODUCTION_GLOBAL = childMap.newData.introduction_global;
+                    userRequest.INTRODUCTION_LOCAL = childMap.newData.introduction_local;
+                    userRequest.ICON = childMap.newData.realIcon;
+                    userRequest.LOGO = childMap.newData.realLogo;
+                    userRequest.CONTENT = childMap.newData.content;
+                    userRequest.CONTENT_TYPE = UtilsController.Constant.TEXT_TYPE;
+                    userRequest.IS_SHOW = UtilsController.Constant.ALL_TYPE;
+                    userRequest.PROVINCE_ID = UtilsController.Constant.ALL_CATEGORIES;
+                    userRequest.TOPIC_ID = UtilsController.Constant.ALL_CATEGORIES;
+                    userRequest.FROM_DATE = childMap.newData.from_date;
+                    userRequest.TO_DATE = childMap.newData.to_date;
+                    userRequest.TYPE = UtilsController.Constant.ADMIN_TYPE;
+                    userRequest.NOTE = "";
+
+                    String rs = SendPost(userRequest, GetParameter(UtilsController.Constant.SERVICE_ID), GetParameter(UtilsController.Constant.INSERT_DATA));
+                    AppResponse res = new AppResponse(rs);
+
+                    if (res.status == UtilsController.Constant.SUCCESS)
+                    {
+                        childMap.newData.id = res.newsId;
+                        childMap.newData.parent_id = count > 1 ? parentMap.newData.id : destinationID;
+
+                        child.mapData.Where(S => S.oldData.id == childMap.oldData.id).Select(S =>
+                        {
+                            S.newData = childMap.newData;
+                            return S;
+                        }).ToList();
+                        RowStructures rows = HttpContext.Session.GetComplexData<RowStructures>("rows");
+                        rows.data.Add(childMap.newData);
+                        HttpContext.Session.SetComplexData("rows", rows);
+                    }
+                    else
+                    {
+                        return false;
+                    }
+                }
+                child.level = count;
+                result.Add(child);
+                return CopyAllDataSource(destinationID, source, count + 1, result);
+
+            }
+        }
+
+        // PROCEDURES
+        public IActionResult Approves(String page, String status)
+        {
+            try
+            {
+                if (!CheckAuthToken())
+                {
+                    return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+                }
+                string serviceName = GetParameter(UtilsController.Constant.SERVICE_NAME);
+                HttpContext.Session.SetComplexData("serviceName", serviceName);
+
+                EventViewModel model = new EventViewModel();
+                //model.categories = new RowStructures();
+                //model.categories.data = new List<RowStructure>();
+                //model.columns = new RowStructures();
+                //model.columns.data = new List<RowStructure>();
+
+                model.page = page == null ? "1" : page;
+                model.status = status != null ? status : UtilsController.Constant.WAIT_APPROVAL;
+
+                model.events = new RowStructures();
+                model.events.data = new List<RowStructure>();
+
+                //RowStructures categories = HttpContext.Session.GetComplexData<RowStructures>("categories");
+                //RowStructures columns = HttpContext.Session.GetComplexData<RowStructures>("columns");
+
+                //if (categories == null)
+                //{
+                //    // get all categories
+                //    GetRequest request = new GetRequest();
+                //    request.ID = BaseController.PARENT_ID;
+                //    String rs = SendPost(request, GetParameter(UtilsController.Constant.SERVICE_ID), GetParameter(UtilsController.Constant.GET_BY_PARENT_ID));
+                //    AppResponse res = new AppResponse(rs);
+                //    if (res.status == UtilsController.Constant.SUCCESS)
+                //    {
+                //        categories = new RowStructures(configuration, rs);
+                //    }
+                //    HttpContext.Session.SetComplexData("categories", categories);
+                //}
+                //model.categories = categories;
+
+                //if (columns == null)
+                //{
+                //    columns = new RowStructures();
+                //    columns.data = new List<RowStructure>();
+                //    for (int i = 0; i < model.categories.data.Count; i++)
+                //    {
+                //        // get all columns
+                //        GetRequest columnsReq = new GetRequest();
+                //        columnsReq.ID = model.categories.data[i].id;
+                //        String rsColumn = SendPost(columnsReq, GetParameter(UtilsController.Constant.SERVICE_ID), GetParameter(UtilsController.Constant.GET_BY_PARENT_ID));
+                //        AppResponse resColumn = new AppResponse(rsColumn);
+                //        if (resColumn.status == UtilsController.Constant.SUCCESS)
+                //        {
+                //            RowStructures dataGet = new RowStructures(configuration, rsColumn);
+                //            dataGet.data.ForEach(x => columns.data.Add(x));
+                //        }
+                //    }
+                //    HttpContext.Session.SetComplexData("columns", columns);
+                //}
+                //model.columns = columns;
+
+                //for (int i = 0; i < model.columns.data.Count; i++)
+                //{
+                //    // get all approved events
+                //    GetRequest requestEvent = new GetRequest();
+                //    //request.users = account.username;
+                //    //request.msisdn = account.username;
+
+                //    requestEvent.ID = model.columns.data[i].id;
+                //    requestEvent.type = status == UtilsController.Constant.USER_TYPE ? UtilsController.Constant.ADMIN_TYPE : UtilsController.Constant.ALL_TYPE;
+                //    requestEvent.rowsOnPage = UtilsController.Constant.ROWS_ON_PAGE;
+                //    requestEvent.seqPage = page == null ? "1" : page;
+                //    requestEvent.isGetContet = UtilsController.Constant.NOT_GET_CONTENT;
+                //    requestEvent.isShow = status != null ? status : UtilsController.Constant.WAIT_APPROVAL;
+
+                //    String rsEvent = SendPost(requestEvent, GetParameter(UtilsController.Constant.SERVICE_ID), GetParameter(UtilsController.Constant.GET_BY_PARENT_ID));
+                //    AppResponse resEvent = new AppResponse(rsEvent);
+                //    if (resEvent.status == UtilsController.Constant.SUCCESS)
+                //    {
+                //        model.totalPage = resEvent.totalPage;
+                //        RowStructures events = new RowStructures(configuration, rsEvent);
+                //        events.data.ForEach(x => model.events.data.Add(x));
+                //    }
+                //}
+                //model.events.data = model.events.data.FindAll(x => x.is_show != UtilsController.Constant.ALL_TYPE);
+
+                // get all approved events
+                GetRequest requestEvent = new GetRequest();
+                //request.users = account.username;
+                //request.msisdn = account.username;
+
+                requestEvent.ID = BaseController.PARENT_ID;
+                requestEvent.type = status == UtilsController.Constant.USER_TYPE ? UtilsController.Constant.ADMIN_TYPE : UtilsController.Constant.ALL_TYPE;
+                requestEvent.rowsOnPage = UtilsController.Constant.ROWS_ON_PAGE;
+                requestEvent.seqPage = page == null ? "1" : page;
+                requestEvent.isGetContet = UtilsController.Constant.NOT_GET_CONTENT;
+                requestEvent.isShow = status != null ? status : UtilsController.Constant.WAIT_APPROVAL;
+                requestEvent.isGetChildById = "1";
+
+                String rsEvent = SendPost(requestEvent, GetParameter(UtilsController.Constant.SERVICE_ID), GetParameter(UtilsController.Constant.GET_BY_PARENT_ID));
+                AppResponse resEvent = new AppResponse(rsEvent);
+                if (resEvent.status == UtilsController.Constant.SUCCESS)
+                {
+                    model.totalPage = resEvent.totalPage;
+                    RowStructures events = new RowStructures(configuration, rsEvent);
+                    events.data.ForEach(x => model.events.data.Add(x));
+                }
+
+                HttpContext.Session.SetComplexData("events", model.events);
+                return View("~/Views/Tree/Event/Approves.cshtml", model);
+                //return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Event/Approves?page=" + page + "&status=" + status);
+            }
+            catch (Exception ex)
+            {
+                log.Error("Exception " + ex);
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home");
+            }
+
+        }
+
+        public IActionResult Aprroving(String id)
+        {
+            try
+            {
+                if (!CheckAuthToken())
+                {
+                    return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+                }
+
+                if (id == null)
+                {
+                    return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Shared/Error");
+                }
+
+                string serviceName = GetParameter(UtilsController.Constant.SERVICE_NAME);
+                HttpContext.Session.SetComplexData("serviceName", serviceName);
+
+                EventViewModel model = new EventViewModel();
+                model.categories = new RowStructures();
+                model.categories.data = new List<RowStructure>();
+                model.columns = new RowStructures();
+                model.columns.data = new List<RowStructure>();
+                //RowStructures rows = HttpContext.Session.GetComplexData<RowStructures>("events");
+                //model.now = rows.data.Find(x => x.id == id);
+                //model.parent = rows.data.Find(x => x.id == model.now.parent_id);
+
+                //RowStructures categories = HttpContext.Session.GetComplexData<RowStructures>("categories");
+                //RowStructures columns = HttpContext.Session.GetComplexData<RowStructures>("columns");
+
+                //if (categories == null)
+                //{
+                //    // get all categories
+                //    GetRequest request = new GetRequest();
+                //    request.ID = BaseController.PARENT_ID;
+                //    String rs = SendPost(request, GetParameter(UtilsController.Constant.SERVICE_ID), GetParameter(UtilsController.Constant.GET_BY_PARENT_ID));
+                //    AppResponse res = new AppResponse(rs);
+                //    if (res.status == UtilsController.Constant.SUCCESS)
+                //    {
+                //        categories = new RowStructures(configuration, rs);
+                //    }
+                //    HttpContext.Session.SetComplexData("categories", categories);
+                //}
+                //model.categories = categories;
+
+                //if (columns == null)
+                //{
+                //    columns = new RowStructures();
+                //    columns.data = new List<RowStructure>();
+                //    for (int i = 0; i < model.categories.data.Count; i++)
+                //    {
+                //        // get all columns
+                //        GetRequest columnsReq = new GetRequest();
+                //        columnsReq.ID = BaseController.PARENT_ID;
+                //        String rsColumn = SendPost(columnsReq, GetParameter(UtilsController.Constant.SERVICE_ID), GetParameter(UtilsController.Constant.GET_BY_PARENT_ID));
+                //        AppResponse resColumn = new AppResponse(rsColumn);
+                //        if (resColumn.status == UtilsController.Constant.SUCCESS)
+                //        {
+                //            RowStructures dataGet = new RowStructures(configuration, rsColumn);
+                //            dataGet.data.ForEach(x => columns.data.Add(x));
+                //        }
+                //    }
+                //    HttpContext.Session.SetComplexData("columns", columns);
+                //}
+                //model.columns = columns;
+
+                //if (model.now != null)
+                //{
+                // get details
+                GetRequest request1 = new GetRequest();
+                request1.ID = id;
+                request1.isGetContet = UtilsController.Constant.GET_CONTENT;
+                String rs1 = SendPost(request1, GetParameter(UtilsController.Constant.SERVICE_ID), GetParameter(UtilsController.Constant.GET_BY_ID));
+                AppResponse res1 = new AppResponse(rs1);
+                if (res1.status == UtilsController.Constant.SUCCESS)
+                {
+                    RowStructures rowsGet = new RowStructures(configuration, rs1);
+                    model.now = rowsGet.data[0];
+                }
+
+
+                // get all parents
+                GetRequest request = new GetRequest();
+                request.ID = model.now.id;
+                request.isGetChildById = "2"; // get all parents
+                String rs = SendPost(request, GetParameter(UtilsController.Constant.SERVICE_ID), GetParameter(UtilsController.Constant.GET_BY_PARENT_ID));
+                AppResponse res = new AppResponse(rs);
+                if (res.status == UtilsController.Constant.SUCCESS)
+                {
+                    model.categories = new RowStructures(configuration, rs);
+                }
+                //}
+                HttpContext.Session.SetComplexData("approving", model.now);
+
+                return PartialView("~/Views/Tree/Event/Approving.cshtml", model);
+            }
+            catch (Exception ex)
+            {
+                log.Error("Exception " + ex);
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Shared/Error");
+            }
+        }
+
+        [ValidateAntiForgeryToken]
+        public JsonResult ApprovingAction(String action, String note)
+        {
+            try
+            {
+                if (!CheckAuthToken())
+                {
+                    return Json(new
+                    {
+                        code = UtilsController.Constant.AUTHEN_FAIL,
+                        href = GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login"
+                    });
+                }
+                String page = HttpContext.Session.GetComplexData<String>("page");
+
+                RowStructure data = HttpContext.Session.GetComplexData<RowStructure>("approving");
+
+                data.note = note;
+
+                // push event to the server
+                ActionRequest userRequest = new ActionRequest();
+                userRequest.ID = data.id;
+                userRequest.NOTE = "";
+                userRequest.PARENT_ID = data.parent_id;
+                userRequest.CODE = data.code;
+                userRequest.NAME_GLOBAL = data.name_global;
+                userRequest.NAME_LOCAL = data.name_local;
+                userRequest.DESCRIPTION_GLOBAL = data.description_global;
+                userRequest.DESCRIPTION_LOCAL = data.description_local;
+                userRequest.INTRODUCTION_GLOBAL = data.introduction_global;
+                userRequest.INTRODUCTION_LOCAL = data.introduction_local;
+                userRequest.ICON = data.realIcon;
+                userRequest.LOGO = data.realLogo;
+                userRequest.CONTENT = data.content;
+                userRequest.CONTENT_TYPE = UtilsController.Constant.TEXT_TYPE;
+                //userRequest.IS_SHOW = data.is_show;
+                userRequest.PROVINCE_ID = data.province_id;
+                userRequest.TOPIC_ID = data.topic_id;
+                userRequest.FROM_DATE = data.from_date;
+                userRequest.TO_DATE = data.to_date;
+                userRequest.TYPE = UtilsController.Constant.EDITING;
+                userRequest.IS_SHOW = action == UtilsController.Constant.SAVE ? data.is_show :
+                    action == UtilsController.Constant.PUBLISH ? UtilsController.Constant.APPROVED :
+                    UtilsController.Constant.REJECTED;
+
+                String rs = SendPost(userRequest, GetParameter(UtilsController.Constant.SERVICE_ID), GetParameter(UtilsController.Constant.UPDATE_DATA));
+                AppResponse res = new AppResponse(rs);
+
+                if (res.status == UtilsController.Constant.SUCCESS)
+                {
+                    RowStructures rows = HttpContext.Session.GetComplexData<RowStructures>("events");
+                    rows.data.Where(S => S.id == data.id).Select(S =>
+                    {
+                        S.note = data.note;
+                        return S;
+                    }).ToList();
+                    HttpContext.Session.SetComplexData("events", rows);
+
+                    return Json(new
+                    {
+                        code = UtilsController.Constant.SUCCESS,
+                        message = "Approve successful",
+                    });
+                }
+                else
+                {
+                    return Json(new
+                    {
+                        code = UtilsController.Constant.FAILURE,
+                        message = "We have a problem!",
+                    });
+                }
+            }
+            catch (Exception ex)
+            {
+                log.Error("Exception " + ex);
+                return Json(new
+                {
+                    code = UtilsController.Constant.EXCEPTION,
+                    href = GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Shared/Error"
+                });
+            }
+        }
+    }
+}

+ 239 - 0
SuperAdmin/SuperAdmin/Controllers/UtilsController.cs

@@ -0,0 +1,239 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Mvc;
+
+namespace SuperAdmin.Controllers
+{
+    public class UtilsController : Controller
+    {
+        public class Constant
+        {
+            public const int DATA_TYPE_ONE = 1;
+
+
+            public const String SERVICE_ID = "service_id";
+            public const String GET_BY_ID = "newsGetById";
+            public const String GET_BY_PARENT_ID = "newsGetByParentId";
+            public const String INSERT_DATA = "newsInsert";
+            public const String UPDATE_DATA = "newsUpdate";
+            public const String DELETE_DATA = "newsDelete";
+            public const String GET_PROVINCES = "usersGetProvice";
+            public const String GET_TOPICS = "usersGetTopic";
+            public const String ADMIN_LOGIN = "usersadminlogin";
+
+            public const String PATH_CONTENT = "pathContent";
+            public const String PATH_OUTSIDE = "pathOutside";
+            public const String SERVICE_NAME = "serviceName";
+            public const String SUB_DOMAIN = "subDomain";
+            public const String SUB_DOMAIN_ = "subDomain_";
+
+
+            public const String Enews = "\"Enews\"";
+
+            public const String TEXT_TYPE = "1";
+            public const String AUDIO_LINK = "2";
+            public const String VIDEO_LINK = "3";
+            public const String AUDIO_FILE = "4";
+            public const String VIDEO_FILE = "5";
+            public const String PICTURE_FILE = "6";
+
+
+            // http code
+            public const String USER_SUBSCRIBER = "1";
+            public const String USER_NORMAL = "0";
+            public const String WAITING_OTP = "100";
+            public const String NO_DATA = "1";
+            public const String SUCCESS = "0";
+            public const String INVALID_MSISDN = "-1";
+            public const String EXCEPTION = "-2";
+            public const String USER_EXISTED = "2";
+            public const String AUTHEN_FAIL = "-10";
+            // code
+            public const String FAILURE = "-1";
+
+            // servive
+            public const String EVENT_SERVICE = "Event";
+            public const String RELIGIAO_SERVICE = "Religiao";
+            public const String MAGAZINE_SERVICE = "Magazine";
+
+
+            // service constant
+            public const String VOCABULARY = "VOCABULARY";
+            public const String GRAMMAR = "GRAMMAR";
+            public const String LISTEN = "LISTEN";
+
+            //public const String PARENT_ID = "-1";
+
+
+            // type
+            public const String DELETE = "0";
+            public const String EDITING = "1";
+            public const String ADDING = "2";
+
+
+            public const String GET_CONTENT = "1";
+            public const String NOT_GET_CONTENT = "0";
+
+            public const String NEWS_BUY = "RGL_CHARGE_2";
+            public const String EVENT_REGISTER_NEWS = "EVENT_REGISTER_NEWS";
+            public const String EVENT_REGISTER_UPLOAD = "EVENT_REGISTER_UPLOAD";
+
+
+            public const String USER_NOT_LOGIN = "-1";
+            public const String HAVE_A_PROBLEM = "-20";
+
+
+            public const String RESULT_SEARCH_NULL = "0";
+            public const String RESULT_SEARCH = "1";
+
+            public const String LANGUAGE_GLOBAL = "0";
+            public const String LANGUAGE_LOCAL = "1";
+            public const String UNKNOWN_NAME = "-1";
+            public const String ROWS_ON_PAGE = "10";
+
+            public const String ADMIN_TYPE = "1";
+            public const String USER_TYPE = "0";
+            public const String ALL_TYPE = "-1";
+
+
+            // is_show
+            public const String EVENT_ALL = "-1";
+            public const String ALL_CATEGORIES = "-1";
+
+            public const String DRAFT = "0";
+            public const String WAIT_APPROVAL = "1";
+            public const String APPROVED = "2";
+            public const String REJECTED = "3";
+
+
+            // action
+            public const String CANCEL = "0";
+            public const String SAVE = "1";
+            public const String REJECT = "2";
+            public const String PUBLISH = "3";
+            public const String REMOVE = "4";
+
+            // functions
+            public const String GetTableAction = "0";
+
+
+            // ENEWS
+            // show in right column
+            public const String STATUS_IMPORTANCE = "3";
+            // show without picture
+            public const String STATUS_SECONDARY = "2";
+            // show in the top of page
+            public const String STATUS_FOCUS = "1";
+            // show by catalogue
+            public const String STATUS_NORMAL = "0";
+
+        }
+
+        public class GetContentPath
+        {
+            public const String PATH = "http://tevent.tls.tl/Content/img/event/";
+        }
+
+        public static string RandomString(int size, bool lowerCase)
+        {
+            StringBuilder builder = new StringBuilder();
+            Random random = new Random();
+            char ch;
+            for (int i = 0; i < size; i++)
+            {
+                ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65)));
+                builder.Append(ch);
+            }
+            if (lowerCase)
+                return builder.ToString().ToLower();
+            return builder.ToString();
+        }
+
+        public static string GetStatus(String status)
+        {
+            switch (status)
+            {
+                case Constant.WAIT_APPROVAL: return "Wait approval";
+                case Constant.APPROVED: return "Approved";
+                case Constant.REJECTED: return "Rejected";
+                default: return status;
+            }
+        }
+
+        public static List<String> GetListContentType()
+        {
+            List<String> list = new List<string>();
+            list.Add("Text type");
+            list.Add("Audio link type");
+            list.Add("Video link type");
+            list.Add("Audio file type");
+            list.Add("Video file type");
+            list.Add("Picture file type");
+            return list;
+        }
+
+        public static List<String> GetListIsShow()
+        {
+            List<String> list = new List<string>();
+            list.Add("DRAFT");
+            list.Add("WAIT APPROVAL");
+            list.Add("APPROVED");
+            list.Add("REJECTED");
+            return list;
+        }
+
+        public static List<String> GetListStatus()
+        {
+            List<String> list = new List<string>();
+            list.Add("Normal news");
+            list.Add("Focus news");
+            list.Add("Secondary news");
+            list.Add("Important news");
+            return list;
+        }
+
+        public static string ConvertStatusType(String type)
+        {
+            switch (type)
+            {
+                case "0": return "Normal news";
+                case "1": return "Focus news";
+                case "2": return "Secondary news";
+                case "3": return "Important news";
+                default: return type + " UNKNOWN CODE";
+            }
+        }
+
+        public static string ConvertContentType(String type)
+        {
+            switch (type)
+            {
+                case "1": return "Text type";
+                case "2": return "Audio link type";
+                case "3": return "Video link type";
+                case "4": return "Audio file type";
+                case "5": return "Video file type";
+                case "6": return "Picture file type";
+                default: return type + " UNKNOWN CODE";
+            }
+        }
+
+        public static string ConvertIsShow(String isShow)
+        {
+            switch (isShow)
+            {
+                case "-1": return "All TYPE";
+                case "0": return "DRAFT";
+                case "1": return "WAIT APPROVAL";
+                case "2": return "APPROVED";
+                case "3": return "REJECTED";
+                //case "3": return "EVENT REJECTED";
+                //case "4": return "EVENT EXPIRED";
+                default: return isShow;
+            }
+        }
+    }
+}

+ 31 - 0
SuperAdmin/SuperAdmin/Extensions/ConfigAction.cs

@@ -0,0 +1,31 @@
+using Microsoft.AspNetCore.Mvc.Filters;
+using Microsoft.Extensions.Configuration;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace SuperAdmin.Extensions
+{
+    public class ConfigAction : IAsyncActionFilter
+    {
+        private MyConfig _options;
+        public ConfigAction(IConfiguration configuration)
+        {
+
+            _options = new MyConfig();
+            configuration.Bind(_options);
+        }
+
+        public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
+        {
+            ((Microsoft.AspNetCore.Mvc.Controller)context.Controller).ViewBag.MyConfig = _options;
+            await next();
+        }
+    }
+
+    public class MyConfig
+    {
+        public string MyValue { get; set; }
+    }
+}

+ 29 - 0
SuperAdmin/SuperAdmin/Extensions/RewriteSubdomainRule.cs

@@ -0,0 +1,29 @@
+using Microsoft.AspNetCore.Rewrite;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+
+namespace SuperAdmin.Extensions
+{
+    public class RewriteSubdomainRule : IRule
+    {
+        public void ApplyRule(RewriteContext context)
+        {
+            var request = context.HttpContext.Request;
+            var host = request.Host.Host;
+            // Check if the host is subdomain.domain.com or subdomain.localhost for debugging
+            if (Regex.IsMatch(host, @"^[A-Za-z\d]+\.(?:[A-Za-z\d]+\.[A-Za-z\d]+|localhost)$"))
+            {
+                string subdomain = host.Split('.')[0];
+                //modifying the request path to let the routing catch the subdomain
+                context.HttpContext.Request.Path = "/subdomain/" + subdomain + context.HttpContext.Request.Path;
+                context.Result = RuleResult.ContinueRules;
+                return;
+            }
+            context.Result = RuleResult.ContinueRules;
+            return;
+        }
+    }
+}

+ 29 - 0
SuperAdmin/SuperAdmin/Extensions/SessionExtensions.cs

@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace SuperCms.Extensions
+{
+    using System;
+    using Microsoft.AspNetCore.Http;
+    using Newtonsoft.Json;
+
+    public static class SessionExtensions
+    {
+        public static T GetComplexData<T>(this ISession session, string key)
+        {
+            var data = session.GetString(key);
+            if (data == null)
+            {
+                return default(T);
+            }
+            return JsonConvert.DeserializeObject<T>(data);
+        }
+
+        public static void SetComplexData(this ISession session, string key, object value)
+        {
+            session.SetString(key, JsonConvert.SerializeObject(value));
+        }
+    }
+}

+ 11 - 0
SuperAdmin/SuperAdmin/Models/ErrorViewModel.cs

@@ -0,0 +1,11 @@
+using System;
+
+namespace SuperAdmin.Models
+{
+    public class ErrorViewModel
+    {
+        public string RequestId { get; set; }
+
+        public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
+    }
+}

+ 55 - 0
SuperAdmin/SuperAdmin/Models/Http/ActionRequest.cs

@@ -0,0 +1,55 @@
+using SuperAdmin.Models.Object;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace SuperAdmin.Models.Http
+{
+    public class ActionRequest : Posting
+    {
+        public String msisdn { get; set; }
+        public String users { get; set; }
+
+        public String language { get; set; }
+
+        // reading
+        public String NEWS_ID { get; set; }
+        public String newsId { get; set; }
+
+        // for ADD/EDIT
+        public String ID { get; set; }
+        // edit or update
+        public String TYPE { get; set; }
+        public String PARENT_ID { get; set; }
+        public String CODE { get; set; }
+        public String NAME_GLOBAL { get; set; }
+        public String NAME_GLOBAL1 { get; set; }
+        public String NAME_GLOBAL2 { get; set; }
+        public String NAME_LOCAL { get; set; }
+        public String DESCRIPTION_GLOBAL { get; set; }
+        public String DESCRIPTION_GLOBAL1 { get; set; }
+        public String DESCRIPTION_GLOBAL2 { get; set; }
+        public String DESCRIPTION_LOCAL { get; set; }
+        public String INTRODUCTION_GLOBAL { get; set; }
+        public String INTRODUCTION_GLOBAL1 { get; set; }
+        public String INTRODUCTION_GLOBAL2 { get; set; }
+        public String INTRODUCTION_LOCAL { get; set; }
+        public String ICON { get; set; }
+        public String LOGO { get; set; }
+        public String CONTENT { get; set; }
+        public String CONTENT_GLOBAL { get; set; }
+        public String CONTENT_GLOBAL1 { get; set; }
+        public String CONTENT_GLOBAL2 { get; set; }
+        public String CONTENT_TYPE { get; set; }
+        public String PROVINCE_ID { get; set; }
+        public String TOPIC_ID { get; set; }
+        public String FROM_DATE { get; set; }
+        public String TO_DATE { get; set; }
+        public String IS_SHOW { get; set; }
+        public String NOTE { get; set; }
+
+        //user or admin depend on special case
+        public String type { get; set; }
+    }
+}

+ 75 - 0
SuperAdmin/SuperAdmin/Models/Http/AppRequest.cs

@@ -0,0 +1,75 @@
+using SuperAdmin.Models.Object;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace SuperAdmin.Models.Http
+{
+    public class AppRequest : Posting
+    {
+        public String msisdn { get; set; }
+        public String users { get; set; }
+        public String pass { get; set; }
+        public String passnew { get; set; }
+        //public String serviceid { get; set; }
+        public String command { get; set; }
+        //public String channel { get; set; }
+        public String rowsOnPage { get; set; }
+        public String seqPage { get; set; }
+        public String isGetContet { get; set; }
+        public String top { get; set; }
+        public String level { get; set; }
+        public String language { get; set; }
+        public String name { get; set; }
+        public String proviceId { get; set; }
+        public String topicId { get; set; }
+        
+        public String fromDate { get; set; }
+        public String toDate { get; set; }
+        public String isShow { get; set; }
+
+
+        // reading
+        public String NEWS_ID { get; set; }
+        public String newsId { get; set; }
+
+        // for ADD/EDIT
+        public String ID { get; set; }
+        // edit or update
+        public String TYPE { get; set; }
+        public String PARENT_ID { get; set; }
+        public String CODE { get; set; }
+        public String NAME_GLOBAL { get; set; }
+        public String NAME_LOCAL { get; set; }
+        public String DESCRIPTION_GLOBAL { get; set; }
+        public String DESCRIPTION_LOCAL { get; set; }
+        public String INTRODUCTION_GLOBAL { get; set; }
+        public String INTRODUCTION_LOCAL { get; set; }
+        public String ICON { get; set; }
+        public String LOGO { get; set; }
+        public String CONTENT { get; set; }
+        public String CONTENT_TYPE { get; set; }
+        public String PROVINCE_ID { get; set; }
+        public String TOPIC_ID { get; set; }
+        public String FROM_DATE { get; set; }
+        public String TO_DATE { get; set; }
+        public String IS_SHOW { get; set; }
+        public String NOTE { get; set; }
+
+        //user or admin depend on special case
+        public String type { get; set; }
+
+
+
+        // Old service
+        //public String categoryCode { get; set; }
+        //public String courseId { get; set; }
+        //public String lessonId { get; set; }
+
+        public String codeBuy { get; set; }
+        public String requestId { get; set; }
+        public String otp { get; set; }
+        public String subServiceCode { get; set; }
+    }
+}

+ 51 - 0
SuperAdmin/SuperAdmin/Models/Http/AppResponse.cs

@@ -0,0 +1,51 @@
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace SuperAdmin.Models.Http
+{
+    public class AppResponse
+    {
+        public string status { get; set; }
+        public string message { get; set; }
+        public string Message { get; set; }
+
+        // only for BuyCourse
+        public string requestID { get; set; }
+
+        // only for register sub
+        public string responseCode { get; set; }
+        public string newsId { get; set; }
+        public string rowsOnPage { get; set; }
+        public string seqPage { get; set; }
+        public string totalPage { get; set; }
+        public string totalSub { get; set; }
+
+        public AppResponse() { }
+        public AppResponse(string json)
+        {
+            try
+            {
+                JObject jObject = JObject.Parse(json);
+                if (jObject != null)
+                {
+                    status = (string)jObject["status"];
+                    message = (string)jObject["message"];
+                    Message = (string)jObject["Message"];
+                    newsId = (string)jObject["newsId"];
+                    rowsOnPage = (string)jObject["rowsOnPage"];
+                    seqPage = (string)jObject["seqPage"];
+                    totalPage = (string)jObject["totalPage"];
+                    totalSub = (string)jObject["totalSub"];
+
+
+                    requestID = (string)jObject["requestId"];
+                    responseCode = (string)jObject["responseCode"];
+                }
+            }
+            catch { }
+        }
+    }
+}

+ 57 - 0
SuperAdmin/SuperAdmin/Models/Http/Blacklist.cs

@@ -0,0 +1,57 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace SuperAdmin.Models.Http
+{
+    public class BlacklistInsertReq : Posting
+    {
+        public string type { get; set; }
+        public string campaignId { get; set; }
+        public string users { get; set; }
+        public List<Blacklist> data { get; set; }
+    }
+
+    public class Blacklist
+    {
+        public string msisdn { get; set; }
+        public string action { get; set; }
+    }
+
+    public class BlacklistDetail
+    {
+        public string id { get; set; }
+        public string msisdn { get; set; }
+        public string type { get; set; }
+        public string serviceId { get; set; }
+        public string sysdate { get; set; }
+        public string users { get; set; }
+        public string campaignName { get; set; }
+    }
+
+
+    public class BlacklistSearchReq : Posting
+    {
+        public string msisdn { get; set; }
+        public string type { get; set; }
+        public string campaignId { get; set; }
+        public string users { get; set; }
+
+    }
+
+    public class BlacklistSearchRes
+    {
+        public List<BlacklistDetail> list { get; set; }
+        public string responseCode { get; set; }
+        public string responseMessage { get; set; }
+        public BlacklistSearchRes() { }
+
+        public static BlacklistSearchRes Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<BlacklistSearchRes>(json);
+        }
+    }
+}

+ 25 - 0
SuperAdmin/SuperAdmin/Models/Http/DashboardModel.cs

@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace SuperAdmin.Models.Http
+{
+    public class DashboardModel
+    {
+        public TrafficTotalRes revenueTotal { get; set; }
+        public RevenueDay revenueLuckyPower { get; set; }
+        public RevenueDay revenueLuckyDay { get; set; }
+        public RevenueDay revenueLuckyPlus { get; set; }
+
+        public TopPlayerRes topPlay { get; set; }
+        public TopPlayerRes topWin { get; set; }
+        public String fromDate { get; set; }
+        public String toDate { get; set; }
+
+        public List<RevenueDay> listRevenueTotal { get; set; }
+        public List<RevenueDay> listRevenuePower { get; set; }
+        public List<RevenueDay> listRevenueDay { get; set; }
+        public List<RevenueDay> listRevenuePlus { get; set; }
+    }
+}

+ 47 - 0
SuperAdmin/SuperAdmin/Models/Http/DataTypeOneRequest.cs

@@ -0,0 +1,47 @@
+using SuperAdmin.Models.Object;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace SuperAdmin.Models.Http
+{
+    public class DataTypeOneRequest : Posting
+    {
+        public String msisdn { get; set; }
+        public String users { get; set; }
+
+        public String language { get; set; }
+
+        // reading
+        public String newsId { get; set; }
+
+        // for ADD/EDIT
+        public String id { get; set; }
+        // edit or update
+        public String type { get; set; }
+        public String parent_id { get; set; }
+        public String code { get; set; }
+        public String name_global { get; set; }
+        public String name_local { get; set; }
+        public String description_global { get; set; }
+        public String description_local { get; set; }
+        public String introduction_global { get; set; }
+        public String introduction_local { get; set; }
+        public String icon { get; set; }
+        public String logo { get; set; }
+        public String content { get; set; }
+        public String content_type { get; set; }
+        public String province_id { get; set; }
+        public String topic_id { get; set; }
+        public String from_date { get; set; }
+        public String to_date { get; set; }
+        public String is_show { get; set; }
+        public String note { get; set; }
+
+        //user or admin depend on special case
+        public String is_read { get; set; }
+        public String status { get; set; }
+
+    }
+}

+ 24 - 0
SuperAdmin/SuperAdmin/Models/Http/ExportAction.cs

@@ -0,0 +1,24 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace SuperAdmin.Models.Http
+{
+    public class ExportActionReq : Posting
+    {
+        public String usersName { get; set; }
+        public String exportId { get; set; }
+        public String type { get; set; }
+        public String note { get; set; }
+
+
+        public ExportActionReq() { }
+        public static ExportActionReq Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<ExportActionReq>(json);
+        }
+    }
+}

+ 216 - 0
SuperAdmin/SuperAdmin/Models/Http/ExportGetList.cs

@@ -0,0 +1,216 @@
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using SuperAdmin.Models.Object;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace SuperAdmin.Models.Http
+{
+    public class ExportGetListReq : Posting
+    {
+        public String usersName { get; set; }
+        public String gameId { get; set; }
+        public String fromDate { get; set; }
+        public String toDate { get; set; }
+        public String rowsOnPage { get; set; }
+        public String seqPage { get; set; }
+        public String status { get; set; }
+        public String exportId { get; set; }
+        public String name { get; set; }
+        public String action { get; set; }
+        public String type { get; set; }
+        public String note { get; set; }
+
+        public ExportGetListReq() { }
+
+        public static ExportGetListReq Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<ExportGetListReq>(json);
+        }
+    }
+
+    public class LotoExport
+    {
+        public string seq { get; set; }
+        public string id { get; set; }
+        public string code { get; set; }
+        public string name { get; set; }
+        public string gameId { get; set; }
+        public string fromDate { get; set; }
+        public string toDate { get; set; }
+        public string status { get; set; }
+        public string createUsers { get; set; }
+        public string createDate { get; set; }
+        public string acceptUsers { get; set; }
+        public string acceptDate { get; set; }
+        public string moneySystem { get; set; }
+        public string moneyImport { get; set; }
+        public string moneyNotImport { get; set; }
+        public string moneyNotSys { get; set; }
+
+        public LotoExport() { }
+        public LotoExport(string json) : this(JObject.Parse(json))
+        { }
+
+        public LotoExport(JObject jObject)
+        {
+            if (jObject != null)
+            {
+                seq = (string)jObject["seq"];
+                id = (string)jObject["id"];
+                code = (string)jObject["code"];
+                name = (string)jObject["name"];
+                gameId = (string)jObject["gameId"];
+                fromDate = (string)jObject["fromDate"];
+                toDate = (string)jObject["toDate"];
+                status = (string)jObject["status"];
+                createUsers = (string)jObject["createUsers"];
+                createDate = (string)jObject["createDate"];
+                acceptUsers = (string)jObject["acceptUsers"];
+                acceptDate = (string)jObject["acceptDate"];
+                moneySystem = (string)jObject["moneySystem"];
+                moneyImport = (string)jObject["moneyImport"];
+                moneyNotImport = (string)jObject["moneyNotImport"];
+                moneyNotSys = (string)jObject["moneyNotSys"];
+            }
+        }
+
+        public static LotoExport Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<LotoExport>(json);
+        }
+
+    }
+
+    public class ExportGetListRes
+    {
+        public string rowsOnPage { get; set; }
+        public string seqPage { get; set; }
+        public string totalPage { get; set; }
+        public object totalRow { get; set; }
+        public string responseCode { get; set; }
+        public string responseMessage { get; set; }
+        public List<LotoExport> listLotoExportGet { get; set; }
+
+        public ExportGetListRes() { }
+        public ExportGetListRes(string json) : this(JObject.Parse(json))
+        { }
+
+        public ExportGetListRes(JObject jObject)
+        {
+            if (jObject != null)
+            {
+                rowsOnPage = (string)jObject["rowsOnPage"];
+                seqPage = (string)jObject["seqPage"];
+                totalPage = (string)jObject["totalPage"];
+                totalRow = (string)jObject["totalRow"];
+                responseCode = (string)jObject["responseCode"];
+                responseMessage = (string)jObject["responseMessage"];
+                var list = jObject["listLotoExportGet"];
+                if (list != null && list.HasValues)
+                {
+                    listLotoExportGet = new List<LotoExport>();
+                    JArray a = (JArray)list;
+                    foreach (JObject o in a.Children<JObject>())
+                    {
+                        listLotoExportGet.Add(new LotoExport(o));
+                    }
+                }
+            }
+        }
+        public static ExportGetListRes Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<ExportGetListRes>(json);
+        }
+    }
+
+    public class CommonRes
+    {
+        public string responseCode { get; set; }
+        public string responseMessage { get; set; }
+
+        public CommonRes() { }
+        public static CommonRes Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<CommonRes>(json);
+        }
+    }
+
+    //exportWinnerGetDataById
+    //{"usersName":"1234","exportId":"1","type":"1","rowsOnPage":"1000","seqPage":"1","key":"jqB3Vi1fIlu+9a2ODQs65w=="}  
+    public class ExportWinnerGetDataReq : Posting
+    {
+        //{"usersName":"1234","gameId":"1","fromDate":"01/01/2021 00:00:00","toDate":"01/04/2021 00:00:00","key":"jqB3Vi1fIlu+9a2ODQs65w==","isPayOnline":"-1","rowsOnPage":"1000","seqPage":"1"} 
+        public String usersName { get; set; }
+        public String gameId { get; set; }
+        public String fromDate { get; set; }
+        public String toDate { get; set; }
+        public String isPayOnline { get; set; }
+        public String isPayType { get; set; }
+        public String exportId { get; set; }
+        public String type { get; set; }
+        public String rowsOnPage { get; set; }
+        public String seqPage { get; set; }
+
+
+        public ExportWinnerGetDataReq() { }
+
+        public static ExportWinnerGetDataReq Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<ExportWinnerGetDataReq>(json);
+        }
+    }
+
+    public class LotoExportWinner
+    {
+        public string seq { get; set; }
+        public string winnerId { get; set; }
+        public string msisdn { get; set; }
+        public string date { get; set; }
+        public string gameId { get; set; }
+        public string randomId { get; set; }
+        public string betId { get; set; }
+        public string isPayOnline { get; set; }
+        public string isPay { get; set; }
+        public string winnerCode { get; set; }
+        public string winnerName { get; set; }
+        public string prizeName { get; set; }
+        public string money { get; set; }
+        public LotoExportWinner() { }
+        public static LotoExportWinner Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<LotoExportWinner>(json);
+        }
+    }
+
+    public class ExportWinnerGetDataRes
+    {
+        public string rowsOnPage { get; set; }
+        public string seqPage { get; set; }
+        public string totalPage { get; set; }
+        public object totalRow { get; set; }
+        public string responseCode { get; set; }
+        public string responseMessage { get; set; }
+        public List<LotoExportWinner> listLotoExportData { get; set; }
+        public static ExportWinnerGetDataRes Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<ExportWinnerGetDataRes>(json);
+        }
+    }
+
+    public class ExportInsertDataReq : Posting
+    {
+        public String exportId { get; set; }
+        public List<LotoExportWinner> data { get; set; }
+
+        public ExportInsertDataReq() { }
+
+        public static ExportInsertDataReq Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<ExportInsertDataReq>(json);
+        }
+    }
+
+}

+ 68 - 0
SuperAdmin/SuperAdmin/Models/Http/FinanceReport.cs

@@ -0,0 +1,68 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace SuperAdmin.Models.Http
+{
+    public class FinanceReportReq : Posting
+    {
+        public String type { get; set; } // 1,2,3,4
+        //public String channel { get; set; }
+        public String gameId { get; set; }
+        public String fromDate { get; set; }
+        public String toDate { get; set; }
+    }
+    public class FinanceSummary
+    {
+        public String seq { get; set; }
+        public String gameName { get; set; }
+        public String total { get; set; }
+        public String moneyBeforeTax { get; set; }
+        public String tax { get; set; }
+        public String moneyTax { get; set; }
+        public String moneyAfterTax { get; set; }
+    }
+
+    public class FinanceDetail
+    {
+        public String seq { get; set; }
+        public String gameName { get; set; }
+        public String billCode { get; set; }
+        public String tranCode { get; set; }
+        public String date { get; set; }
+        public String cusName { get; set; }
+        public String msisdn { get; set; }
+        public String quantity { get; set; }
+        public String price { get; set; }
+        public String moneyBeforeTax { get; set; }
+        public String tax { get; set; }
+        public String moneyTax { get; set; }
+        public String moneyAfterTax { get; set; }
+    }
+
+    public class FinanceSummaryRes
+    {
+        public List<FinanceSummary> list { get; set; }
+        public String responseCode { get; set; }
+        public String responseMessage { get; set; }
+        public FinanceSummaryRes() { }
+        public static FinanceSummaryRes Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<FinanceSummaryRes>(json);
+        }
+    }
+    public class FinanceDetailRes
+    {
+        public List<FinanceDetail> list { get; set; }
+        public String responseCode { get; set; }
+        public String responseMessage { get; set; }
+        public FinanceDetailRes() { }
+        public static FinanceDetailRes Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<FinanceDetailRes>(json);
+        }
+    } 
+}

+ 51 - 0
SuperAdmin/SuperAdmin/Models/Http/GetInfoTicket.cs

@@ -0,0 +1,51 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace SuperAdmin.Models.Http
+{
+    public class GetInfoTicketReq : Posting
+    {
+        public string gameId { get; set; }
+        public string msisdn { get; set; }
+        public string fromDate { get; set; }
+        public string toDate { get; set; }
+        public string rowsOnPage { get; set; }
+        public string seqPage { get; set; }
+    }
+
+    public class TicketInfo
+    {
+        public string seq { get; set; }
+        public string id { get; set; }
+        public string billCode { get; set; }
+        public string subId { get; set; }
+        public string users { get; set; }
+        public string date { get; set; }
+        public string money { get; set; }
+        public string gameId { get; set; }
+        public string ticket { get; set; }
+        public string randomId { get; set; }
+        public string note { get; set; }
+    }
+
+    public class GetInfoTicketRes
+    {
+        public string rowsOnPage { get; set; }
+        public string seqPage { get; set; }
+        public string totalPage { get; set; }
+        public object totalRow { get; set; }
+        public List<TicketInfo> listTicketInfo { get; set; }
+        public string responseCode { get; set; }
+        public string responseMessage { get; set; }
+
+        public GetInfoTicketRes() { }
+        public static GetInfoTicketRes Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<GetInfoTicketRes>(json);
+        }
+    }
+}

+ 48 - 0
SuperAdmin/SuperAdmin/Models/Http/GetParams.cs

@@ -0,0 +1,48 @@
+using Newtonsoft.Json;
+using SuperAdmin.Controllers;
+using SuperAdmin.Models.Object;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace SuperAdmin.Models.Http
+{
+    public class Data
+    {
+    }
+
+    public class GetParamsReq : Posting
+    {
+        public string requestId { get; set; }
+        public string gameId { get; set; }
+        public string language { get; set; }
+        public string cmd { get; set; } = "getParam";
+        //public string channel { get; set; } = BaseController.Channel;
+        public Data data { get; set; } = new Data();
+    }
+
+    public class ParamObj
+    {
+        public string id { get; set; }
+        public string codeGroup { get; set; }
+        public string code { get; set; }
+        public string values { get; set; }
+        public string display { get; set; }
+        public string channel { get; set; }
+    }
+
+    public class GetParamsRes
+    {
+        public List<ParamObj> paramList { get; set; }
+        public string responseCode { get; set; }
+        public string responseMessage { get; set; }
+
+        public GetParamsRes() { }
+        public static GetParamsRes Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<GetParamsRes>(json);
+        }
+    }
+
+}

+ 37 - 0
SuperAdmin/SuperAdmin/Models/Http/GetRequest.cs

@@ -0,0 +1,37 @@
+using SuperAdmin.Models.Object;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace SuperAdmin.Models.Http
+{
+    public class GetRequest : Posting
+    {
+        public String msisdn { get; set; }
+        public String users { get; set; }
+        public String rowsOnPage { get; set; }
+        public String seqPage { get; set; }
+        public String isGetContet { get; set; }
+        public String top { get; set; }
+        public String level { get; set; }
+        public String language { get; set; }
+        public String name { get; set; }
+        public String proviceId { get; set; }
+        public String topicId { get; set; }
+
+        public String fromDate { get; set; }
+        public String toDate { get; set; }
+        public String isShow { get; set; }
+        public String isGetChildById { get; set; }
+
+
+        // reading
+        public String NEWS_ID { get; set; }
+        public String newsId { get; set; }
+        public String ID { get; set; }
+
+        //user or admin depend on special case
+        public String type { get; set; }
+    }
+}

+ 27 - 0
SuperAdmin/SuperAdmin/Models/Http/LoginRequest.cs

@@ -0,0 +1,27 @@
+using SuperAdmin.Models.Object;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace SuperAdmin.Models.Http
+{
+    public class LoginRequest : Posting
+    {
+        public String msisdn { get; set; }
+        public String users { get; set; }
+        public String pass { get; set; }
+        public String passnew { get; set; }
+        //public String serviceid { get; set; }
+        public String command { get; set; }
+        //public String channel { get; set; }
+
+        //user or admin depend on special case
+        public String type { get; set; }
+
+        public String codeBuy { get; set; }
+        public String requestId { get; set; }
+        public String otp { get; set; }
+        public String subServiceCode { get; set; }
+    }
+}

+ 87 - 0
SuperAdmin/SuperAdmin/Models/Http/ReportBillOrder.cs

@@ -0,0 +1,87 @@
+using DocumentFormat.OpenXml.Office2010.ExcelAc;
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace SuperAdmin.Models.Http
+{
+    // SUMMARY
+    public class RpSearchTotallBuyOderReq : Posting
+    {
+        public string gameId { get; set; }
+        public string language { get; set; }
+        public string channelBuy { get; set; }
+        public string fromDate { get; set; }
+        public string toDate { get; set; }
+    }
+
+    public class TotallBuyOder
+    {
+        public string date { get; set; }
+        public string totalOder { get; set; }
+        public string totalMoney { get; set; }
+        public string totalFee { get; set; }
+        public string totalTicket { get; set; }
+        public string totalMoneyWin { get; set; }
+    }
+
+    public class RpSearchTotallBuyOderRes
+    {
+        public List<TotallBuyOder> list { get; set; }
+        public string responseCode { get; set; }
+        public string responseMessage { get; set; }
+
+        public static RpSearchTotallBuyOderRes Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<RpSearchTotallBuyOderRes>(json);
+        }
+    }
+
+    //DETAIL
+
+    public class DetailBuyOder
+    {
+        public string id { get; set; }
+        public string user { get; set; }
+        public string billCode { get; set; }
+        public string channel { get; set; }
+        public string money { get; set; }
+        public string fee { get; set; }
+        public string strTicket { get; set; }
+        public string buyTime { get; set; }
+        public string gameName { get; set; }
+        public List<BillTicket> listTicket { get; set; }
+    }
+
+    public class BillTicket
+    {
+        public string turnId { get; set; }
+        public string ticket { get; set; }
+        public string money { get; set; }
+    }
+
+    public class RpSearchDetailBuyOderReq : Posting
+    {
+        public string msisdn { get; set; }
+        public string gameId { get; set; }
+        public string language { get; set; }
+        public string channelBuy { get; set; }
+        public string fromDate { get; set; }
+        public string toDate { get; set; }
+    }
+
+    public class RpSearchDetailBuyOderRes
+    {
+        public List<DetailBuyOder> list { get; set; }
+        public string responseCode { get; set; }
+        public string responseMessage { get; set; }
+
+        public static RpSearchDetailBuyOderRes Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<RpSearchDetailBuyOderRes>(json);
+        }
+    }
+}

+ 51 - 0
SuperAdmin/SuperAdmin/Models/Http/ReportBolet.cs

@@ -0,0 +1,51 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace SuperAdmin.Models.Http
+{
+    public class RpTotalByBoletReq : Posting
+    {
+        public string msisdn { get; set; }
+        public string gameType { get; set; }
+        public string isEvening { get; set; }
+        public string language { get; set; }
+        public string channelPayment { get; set; }
+        public string fromDate { get; set; }
+        public string toDate { get; set; }
+
+    }
+
+    public class RpTotalByBolet
+    {
+        public string date { get; set; }
+        public string player { get; set; }
+        public string ticket { get; set; }
+        public string money { get; set; }
+        public string palyerWin { get; set; }
+        public string ticketWin { get; set; }
+        public string moneyWin { get; set; }
+        public string ticketWinLot1 { get; set; }
+        public string moneyWinLot1 { get; set; }
+        public string ticketWinLot2 { get; set; }
+        public string moneyWinLot2 { get; set; }
+        public string ticketWinLot3 { get; set; }
+        public string moneyWinLot3 { get; set; }
+    }
+
+    public class RpTotalByBoletRes
+    {
+        public List<RpTotalByBolet> list { get; set; }
+        public string responseCode { get; set; }
+        public string responseMessage { get; set; }
+
+        public static RpTotalByBoletRes Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<RpTotalByBoletRes>(json);
+        }
+    }
+
+}

+ 47 - 0
SuperAdmin/SuperAdmin/Models/Http/ReportDay.cs

@@ -0,0 +1,47 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace SuperAdmin.Models.Http
+{
+    public class RpTotalByDayReq : Posting
+    {
+        public string msisdn { get; set; }
+        public string gameId { get; set; }
+        public string gameType { get; set; }
+        public string isEvening { get; set; }
+        public string language { get; set; }
+        public string channelPayment { get; set; }
+        public string fromDate { get; set; }
+        public string toDate { get; set; } 
+    }
+
+    public class RpTotalByDay
+    {
+        public string date { get; set; }
+        public string player { get; set; }
+        public string ticket { get; set; }
+        public string money { get; set; }
+        public string palyerWin { get; set; }
+        public string ticketWin { get; set; }
+        public string moneyWin { get; set; }
+        public string benefit { get; set; }
+        public string sharing { get; set; }
+    }
+
+    public class RpTotalByDayRes
+    {
+        public List<RpTotalByDay> list { get; set; }
+        public string responseCode { get; set; }
+        public string responseMessage { get; set; }
+
+        public static RpTotalByDayRes Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<RpTotalByDayRes>(json);
+        }
+    }
+
+}

+ 47 - 0
SuperAdmin/SuperAdmin/Models/Http/ReportLucky.cs

@@ -0,0 +1,47 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace SuperAdmin.Models.Http
+{
+    public class RpTotalByDayLkpsReq : Posting
+    {
+        public string msisdn { get; set; }  
+        public string language { get; set; }
+        public string channelPayment { get; set; }
+        public string fromDate { get; set; }
+        public string toDate { get; set; }
+
+    }
+
+    public class RpTotalByDayLkps
+    {
+        public string date { get; set; }
+        public string player { get; set; }
+        public string ticket { get; set; }
+        public string money { get; set; }
+        public string palyerWin { get; set; }
+        public string ticketWin { get; set; }
+        public string moneyWin { get; set; } 
+        public string benefit { get; set; } 
+        public string sharing { get; set; } 
+    }
+
+    public class RpTotalByDayLkpsRes
+    {
+        public List<RpTotalByDayLkps> list { get; set; }
+        public string responseCode { get; set; }
+        public string responseMessage { get; set; }
+
+        public static RpTotalByDayLkpsRes Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<RpTotalByDayLkpsRes>(json);
+        }
+    }
+
+
+
+}

+ 47 - 0
SuperAdmin/SuperAdmin/Models/Http/ResultsUpdate.cs

@@ -0,0 +1,47 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace SuperAdmin.Models.Http
+{
+    public class ResultsUpdateReq : Posting
+    {
+        public string users { get; set; }
+        public string termId { get; set; }
+        public string result { get; set; }
+        public string action { get; set; }
+        public string note { get; set; }
+    }
+
+    public class UpdateHis
+    {
+        public string id { get; set; }
+        public string randomId { get; set; }
+        public string date { get; set; }
+        public string result { get; set; }
+        public string usersName { get; set; }
+        public string status { get; set; }
+        public string action { get; set; }
+        public string note { get; set; }
+        public UpdateHis() { }
+        public static UpdateHis Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<UpdateHis>(json);
+        }
+    }
+
+    public class ResultsGetHisRes
+    {
+        public List<UpdateHis> listHis { get; set; }
+        public string responseCode { get; set; }
+        public string responseMessage { get; set; }
+        public ResultsGetHisRes() { }
+        public static ResultsGetHisRes Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<ResultsGetHisRes>(json);
+        }
+    }
+}

+ 135 - 0
SuperAdmin/SuperAdmin/Models/Http/SearchMsisdn.cs

@@ -0,0 +1,135 @@
+using DocumentFormat.OpenXml.Office2010.ExcelAc;
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace SuperAdmin.Models.Http
+{
+    public class SearchMsisdnReq : Posting
+    {
+        public string msisdn { get; set; }
+        public string gameId { get; set; }
+        public string gameType { get; set; }
+        public string isEvening { get; set; }
+        public string isWin { get; set; }
+        public string language { get; set; }
+        public string channelPayment { get; set; }
+        public string fromDate { get; set; }
+        public string toDate { get; set; }
+
+        public string id { get; set; }
+        public string type { get; set; }
+        public string order { get; set; }
+        public string rowsOnPage { get; set; }
+        public string seqPage { get; set; }
+    }
+    public class SearchTransferMsisdnReq : Posting
+    {
+        public string msisdn { get; set; }
+        public string id { get; set; }
+        public string reqeustId { get; set; }
+        public string approveId { get; set; }
+        public string transId { get; set; }
+        public string getDetail { get; set; }
+        public string language { get; set; }
+        public string channelPayment { get; set; }
+        public string type { get; set; }
+        public string fromDate { get; set; }
+        public string toDate { get; set; }
+        public string order { get; set; }
+        public string rowsOnPage { get; set; }
+        public string seqPage { get; set; }
+    }
+
+    public class TicketMsisdn
+    {
+        public string msisdn { get; set; }
+        public string lottery { get; set; }
+        public string game { get; set; }
+        public string channel { get; set; }
+        public string ticketId { get; set; }
+        public string ticketCode { get; set; }
+        public string buyTime { get; set; }
+        public string isEvening { get; set; }
+        public string drawTime { get; set; }
+        public string money { get; set; }
+        public string moneyWin { get; set; }
+        public string result { get; set; }
+    }
+
+    public class SearchMsisdnRes
+    {
+        public List<TicketMsisdn> list { get; set; }
+        public string responseCode { get; set; }
+        public string responseMessage { get; set; }
+        public static SearchMsisdnRes Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<SearchMsisdnRes>(json);
+        }
+    }
+
+    public class DetailLog
+    {
+        public string id { get; set; }
+        public string topupId { get; set; }
+        public string topupCode { get; set; }
+        public string httpErr { get; set; }
+        public string blockErr { get; set; }
+        public string blockErrMsg { get; set; }
+        public string statusWallet { get; set; }
+        public string statusWalletStr { get; set; }
+        public string bodyJson { get; set; }
+        public string reqeustId { get; set; }
+        public string sysdate { get; set; }
+    }
+
+    public class TransferMsisdn
+    {
+        public string seq { get; set; }
+        public string id { get; set; }
+        public string acountSend { get; set; }
+        public string acountRecieve { get; set; }
+        public string timeRequest { get; set; }
+        public string timeTopup { get; set; }
+        public string status { get; set; }
+        public object statusMsg { get; set; }
+        public string money { get; set; }
+        public string channelRequest { get; set; }
+        public string channelPayment { get; set; }
+        public string reqeustId { get; set; }
+        public string responseId { get; set; }
+        public string errCodeApprove { get; set; }
+        public string errMsgApprove { get; set; }
+        public string errCodeCallback { get; set; }
+        public string errMsgCallBack { get; set; }
+        public string transection { get; set; }
+        public string statusWallet { get; set; }
+        public string statusWalletMsg { get; set; }
+        public string reasonReject { get; set; }
+        public string bodyJson { get; set; }
+        public List<DetailLog> detailLog { get; set; }
+        public string serviceId { get; set; }
+        public object responseCode { get; set; }
+        public object responseMessage { get; set; }
+    }
+
+    public class TransferMsisdnRes
+    {
+        public string rowsOnPage { get; set; }
+        public string seqPage { get; set; }
+        public string totalPage { get; set; }
+        public string totalRow { get; set; }
+        public List<TransferMsisdn> list { get; set; }
+        public string responseCode { get; set; }
+        public string responseMessage { get; set; }
+
+        public static TransferMsisdnRes Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<TransferMsisdnRes>(json);
+        }
+    }
+
+}

+ 39 - 0
SuperAdmin/SuperAdmin/Models/Http/SearchMt.cs

@@ -0,0 +1,39 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace SuperAdmin.Models.Http
+{
+    public class SearchMtReq : Posting
+    {
+        public string msisdn { get; set; }
+        public string fromDate { get; set; }
+        public string toDate { get; set; }
+        public string language { get; set; }
+    }
+
+    public class MtRecord
+    {
+        public string id { get; set; }
+        public string msisdn { get; set; }
+        public string message { get; set; }
+        public string sendTime { get; set; }
+        public string receiveTime { get; set; }
+        public string status { get; set; }
+        public string channel { get; set; }
+    }
+
+    public class SearchMtRes
+    {
+        public List<MtRecord> list { get; set; }
+        public string responseCode { get; set; }
+        public string responseMessage { get; set; }
+        public static SearchMtRes Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<SearchMtRes>(json);
+        }
+    }
+}

+ 89 - 0
SuperAdmin/SuperAdmin/Models/Http/TermGetList.cs

@@ -0,0 +1,89 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using SuperAdmin.Source;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace SuperAdmin.Models.Http
+{
+    public class TermGetListReq : Posting
+    {
+        public string usersName { get; set; }
+        public string gameId { get; set; }
+        //public string channel { get; set; }
+        public string language { get; set; }
+        public string fromDate { get; set; }
+        public string toDate { get; set; }
+        public string status { get; set; }
+        public string rowsOnPage { get; set; }
+        public string seqPage { get; set; }
+        public string id { get; set; }
+        public string type { get; set; }
+        public string order { get; set; }
+    }
+
+    public class Term
+    {
+        public string seq { get; set; }
+        public string id { get; set; }
+        public string status { get; set; }
+        public string date_start { get; set; }
+        public string date_end { get; set; }
+        public string date_random { get; set; }
+        public object money_winner { get; set; }
+        public string gameId { get; set; }
+        public string result { get; set; }
+        public string split { get; set; }
+        public string countDownSeconds { get; set; }
+        public string numberGame { get; set; }
+        public string isEvening { get; set; }
+        public string win4Game { get; set; }
+        public string bolet { get; set; }
+        public string mariaj { get; set; }
+        public string lotto3 { get; set; }
+
+        public string GetStatus()
+        {
+            switch (status)
+            {
+                case LumilotoUtils.GetTermStatus.accepted:
+                    return "Result Accepted";
+                case LumilotoUtils.GetTermStatus.available:
+                    return "Available for ticket";
+                case LumilotoUtils.GetTermStatus.rejected:
+                    return "Result Rejected";
+                case LumilotoUtils.GetTermStatus.waitApproved:
+                    return "Wait for approving result";
+                case LumilotoUtils.GetTermStatus.waitResult:
+                    return "Locked, wait for result";
+                default:
+                    return "";
+            }
+        }
+        public Term() { }
+        public static Term Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<Term>(json);
+        }
+    }
+
+    public class TermGetListRes
+    {
+        public string rowsOnPage { get; set; }
+        public string seqPage { get; set; }
+        public string totalPage { get; set; }
+        public object totalRow { get; set; }
+        public string gameId { get; set; }
+        public List<Term> listTerm { get; set; }
+        public string responseCode { get; set; }
+        public string responseMessage { get; set; }
+        public TermGetListRes() { }
+
+        public static TermGetListRes Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<TermGetListRes>(json);
+        }
+    }
+}

+ 65 - 0
SuperAdmin/SuperAdmin/Models/Http/TopPlayer.cs

@@ -0,0 +1,65 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace SuperAdmin.Models.Http
+{
+    public class TopPlayerReq : Posting
+    {
+        public string gameId { get; set; }
+        public string fromDate { get; set; }
+        public string toDate { get; set; }
+        public string type { get; set; }
+        public string totalRow { get; set; }
+        public string rowsOnPage { get; set; }
+        public string seqPage { get; set; }
+    }
+
+    public class LotoCusTop
+    {
+        public string seq { get; set; }
+        public string money { get; set; }
+        public string cusId { get; set; }
+        public string actStatus { get; set; }
+        public string address { get; set; }
+        public string birthday { get; set; }
+        public string district { get; set; }
+        public string gentder { get; set; }
+        public string idno { get; set; }
+        public string idtype { get; set; }
+        public string imageName1 { get; set; }
+        public string imageName2 { get; set; }
+        public string imageName3 { get; set; }
+        public string imagePath { get; set; }
+        public string isdn { get; set; }
+        public string language { get; set; }
+        public string precinct { get; set; }
+        public string province { get; set; }
+        public string subId { get; set; }
+        public string subName { get; set; }
+        public string isConfirm { get; set; }
+        public string date { get; set; }
+        public string lastUpdate { get; set; }
+    }
+
+    public class TopPlayerRes
+    {
+        public string rowsOnPage { get; set; }
+        public string seqPage { get; set; }
+        public string totalPage { get; set; }
+        public object totalRow { get; set; }
+        public List<LotoCusTop> listLotoCusTop { get; set; }
+        public string responseCode { get; set; }
+        public string responseMessage { get; set; }
+
+        public TopPlayerRes() { }
+        public static TopPlayerRes Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<TopPlayerRes>(json);
+        }
+    }
+
+}

+ 62 - 0
SuperAdmin/SuperAdmin/Models/Http/TrafficDay.cs

@@ -0,0 +1,62 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace SuperAdmin.Models.Http
+{
+    public class TrafficDayReq : Posting
+    {
+        public string gameId { get; set; }
+        public string fromDate { get; set; }
+        public string toDate { get; set; }
+        public string rowsOnPage { get; set; }
+        public string seqPage { get; set; }
+    }
+
+    public class RevenueDay
+    {
+        public string date { get; set; }
+        public string gameId { get; set; }
+        public string totalUser { get; set; }
+        public string totalTicket { get; set; }
+        public string totalMoney { get; set; }
+        public string totalTicketWin { get; set; }
+        public string totalMoneyWin { get; set; }
+        public string rate { get; set; }
+    }
+
+    public class TrafficDayRes
+    {
+        public string rowsOnPage { get; set; }
+        public string seqPage { get; set; }
+        public string totalPage { get; set; }
+        public object totalRow { get; set; }
+        public List<RevenueDay> listRevenue { get; set; }
+        public string responseCode { get; set; }
+        public string responseMessage { get; set; }
+        public TrafficDayRes() { }
+        public static TrafficDayRes Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<TrafficDayRes>(json);
+        }
+    }
+
+    public class TrafficTotalRes
+    {
+        public string uniqueUsers { get; set; }
+        public string totalTicket { get; set; }
+        public string totalMoney { get; set; }
+        public string totalTicketWin { get; set; }
+        public string totalMoneyWin { get; set; }
+        public string responseCode { get; set; }
+        public string responseMessage { get; set; }
+        public TrafficTotalRes() { }
+        public static TrafficTotalRes Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<TrafficTotalRes>(json);
+        }
+    }
+}

+ 41 - 0
SuperAdmin/SuperAdmin/Models/Http/TrafficTerm.cs

@@ -0,0 +1,41 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+
+namespace SuperAdmin.Models.Http
+{
+    public class TrafficTermReq : Posting
+    {
+        public string gameId { get; set; }
+        public string fromDate { get; set; }
+        public string toDate { get; set; }
+    }
+
+    public class TrafficTerm
+    {
+        public String randomId { get; set; }
+        public String startDate { get; set; }
+        public String endDate { get; set; }
+        public String result { get; set; }
+        public String status { get; set; }
+        public String money { get; set; }
+        public String moneyWin { get; set; }
+        public String rate { get; set; }
+    }
+
+    public class TrafficTermRes
+    {
+        public List<TrafficTerm> list { get; set; }
+        public String responseCode { get; set; }
+        public String responseMessage { get; set; }
+        public TrafficTermRes() { }
+        public static TrafficTermRes Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<TrafficTermRes>(json);
+        }
+    }
+
+}

+ 17 - 0
SuperAdmin/SuperAdmin/Models/Object/Account.cs

@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace SuperAdmin.Models.Object
+{
+    public class Account
+    {
+        public String serviceId { get; set; }
+        public String username { get; set; }
+        public String password { get; set; }
+
+        public UserProfile profile { get; set; }
+        public String responsibility { get; set; }
+    }
+}

+ 42 - 0
SuperAdmin/SuperAdmin/Models/Object/Charging.cs

@@ -0,0 +1,42 @@
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace SuperAdmin.Models.Object
+{
+    public class Charging
+    {
+        // only for BuyCourse
+        public string requestId { get; set; }
+
+        // only for register sub
+        public string responseCode { get; set; }
+        public string requestID { get; set; }
+        public string cmd { get; set; }
+        public string money { get; set; }
+        public string source { get; set; }
+        public string otpType { get; set; }
+
+
+
+        public Charging() { }
+        public Charging(string json)
+        {
+            JObject jObject = JObject.Parse(json);
+            if (jObject != null)
+            {
+                responseCode = (string)jObject["responseCode"];
+                requestId = (string)jObject["requestId"];
+                requestID = (string)jObject["requestID"];
+
+                cmd = (string)jObject["cmd"];
+                money = (string)jObject["money"];
+                source = (string)jObject["source"];
+                otpType = (string)jObject["otpType"];
+
+            }
+        }
+    }
+}

+ 21 - 0
SuperAdmin/SuperAdmin/Models/Object/Posting.cs

@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace SuperAdmin.Models.Object
+{
+    public class Posting
+    {
+        public string serviceId { get; set; }
+        public string SV_ID { get; set; }
+        public string service_id { get; set; }
+
+        public string key { get; set; }
+        public string token { get; set; }
+        public string channel { get; set; }
+        public int pageNumber { get; set; }
+        public int pageSize { get; set; } = 10000000;
+
+    }
+}

+ 55 - 0
SuperAdmin/SuperAdmin/Models/Object/Province.cs

@@ -0,0 +1,55 @@
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace SuperAdmin.Models.Object
+{
+    public class Province
+    {
+        public String id { get; set; }
+        public String name { get; set; }
+        public String code { get; set; }
+        public Province(string id, string name, string code)
+        {
+            this.id = id;
+            this.name = name;
+            this.code = code;
+        }
+        public Province() { }
+        public Province(string json) : this(JObject.Parse(json))
+        { }
+        public Province(JObject jObject)
+        {
+            if (jObject != null)
+            {
+                id = (string)jObject["id"];
+                name = (string)jObject["name"];
+                code = (string)jObject["code"];
+            }
+        }
+    }
+    public class Provinces
+    {
+        public List<Province> data { get; set; }
+        public Provinces() { }
+        public Provinces(string json) : this(JObject.Parse(json)) { }
+        public Provinces(JObject jObject)
+        {
+            if (jObject != null)
+            {
+                var list = jObject["listProvice"];
+                if (list != null && list.HasValues)
+                {
+                    data = new List<Province>();
+                    JArray a = (JArray)list;
+                    foreach (JObject o in a.Children<JObject>())
+                    {
+                        data.Add(new Province(o));
+                    }
+                }
+            }
+        }
+    }
+}

+ 219 - 0
SuperAdmin/SuperAdmin/Models/Object/RowStructure.cs

@@ -0,0 +1,219 @@
+using Microsoft.Extensions.Configuration;
+using Newtonsoft.Json.Linq;
+using SuperAdmin.Controllers;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace SuperAdmin.Models.Object
+{
+    public class RowStructure
+    {
+        public String id { get; set; }
+        public String parent_id { get; set; }
+        public String sv_id { get; set; }
+
+        public String code { get; set; }
+        public String name { get; set; }
+        public String[] names { get; set; }
+
+        public String name_global { get; set; }
+        public String name_global1 { get; set; }
+        public String name_global2 { get; set; }
+        public String name_local { get; set; }
+        public String description { get; set; }
+        public String[] descriptions { get; set; }
+        public String description_global { get; set; }
+        public String description_global1 { get; set; }
+        public String description_global2 { get; set; }
+        public String description_local { get; set; }
+        public String introduction { get; set; }
+        public String[] introductions { get; set; }
+        public String introduction_global { get; set; }
+        public String introduction_global1 { get; set; }
+        public String introduction_global2 { get; set; }
+        public String introduction_local { get; set; }
+        public String icon { get; set; }
+        public String logo { get; set; }
+        public String realIcon { get; set; }
+        public String realLogo { get; set; }
+        public String content { get; set; }
+        public String[] contents { get; set; }
+        public String content_global { get; set; }
+        public String content_global1 { get; set; }
+        public String content_global2 { get; set; }
+        public String content_type { get; set; }
+        public String created_date { get; set; }
+        public String update_date { get; set; }
+        public String from_date { get; set; }
+        public String to_date { get; set; }
+        public String province_id { get; set; }
+        public String topic_id { get; set; }
+        public String level { get; set; }
+        public String is_read { get; set; }
+
+        // 1 publish - 0 draft
+        public String status { get; set; }
+
+        // to determine showing or not
+        public String is_show { get; set; }
+
+        // to distinguish (1) admin and (0) user
+        public String permission { get; set; }
+        public String note { get; set; }
+
+        // enews
+        public String service_id { get; set; }
+
+        public RowStructure() { }
+
+        public RowStructure(IConfiguration configuration, string json) : this(configuration, JObject.Parse(json))
+        { }
+
+        public RowStructure(IConfiguration configuration, JObject jObject)
+        {
+            if (jObject != null)
+            {
+                id = (string)jObject["ID"];
+                parent_id = (string)jObject["PARENT_ID"];
+                sv_id = (string)jObject["SV_ID"];
+                code = (string)jObject["CODE"];
+                name = (string)jObject["NAME"];
+                name_global = (string)jObject["NAME_GLOBAL"];
+                name_global1 = (string)jObject["NAME_GLOBAL1"];
+                name_global2 = (string)jObject["NAME_GLOBAL2"];
+                name_local = (string)jObject["NAME_LOCAL"];
+                names = new string[] { name_local, name_global, name_global1, name_global2 };
+                description = (string)jObject["DESCRIPTION"];
+                description_global = (string)jObject["DESCRIPTION_GLOBAL"];
+                description_global1 = (string)jObject["DESCRIPTION_GLOBAL1"];
+                description_global2 = (string)jObject["DESCRIPTION_GLOBAL2"];
+                description_local = (string)jObject["DESCRIPTION_LOCAL"];
+                descriptions = new string[] { description_local, description_global, description_global1, description_global2 };
+                introduction = (string)jObject["INTRODUCTION"];
+                introduction_global = (string)jObject["INTRODUCTION_GLOBAL"];
+                introduction_global1 = (string)jObject["INTRODUCTION_GLOBAL1"];
+                introduction_global2 = (string)jObject["INTRODUCTION_GLOBAL2"];
+                introduction_local = (string)jObject["INTRODUCTION_LOCAL"];
+                introductions = new string[] { introduction_local, introduction_global, introduction_global1, introduction_global2 };
+                level = (string)jObject["LEVEL"];
+
+                permission = (string)jObject["TYPE"];
+
+                String img = (string)jObject["ICON"];
+                icon = img == null || img == "" ? "" : configuration.GetSection(UtilsController.Constant.PATH_CONTENT).Value + "/" + img;
+                realIcon = (string)jObject["ICON"];
+
+                img = (string)jObject["LOGO"];
+                logo = img == null || img == "" ? "" : configuration.GetSection(UtilsController.Constant.PATH_CONTENT).Value + "/" + img; 
+                realLogo = img;
+
+                content = (string)jObject["CONTENT"];
+                content_global = (string)jObject["CONTENT_GLOBAL"];
+                content_global1 = (string)jObject["CONTENT_GLOBAL1"];
+                content_global2 = (string)jObject["CONTENT_GLOBAL2"];
+                content_type = (string)jObject["CONTENT_TYPE"];
+                contents = new string[] { content, content_global, content_global1, content_global2 };
+                from_date = (string)jObject["FROM_DATE"];
+                to_date = (string)jObject["TO_DATE"];
+                created_date = (string)jObject["CREATED_DATE"];
+                update_date = (string)jObject["UPDATE_DATE"];
+
+                province_id = (string)jObject["PROVINCE_ID"];
+                topic_id = (string)jObject["TOPIC_ID"];
+
+                is_read = (string)jObject["IS_READ"];
+                status = (string)jObject["STATUS"];
+                is_show = (string)jObject["IS_SHOW"];
+                note = (string)jObject["NOTE"];
+
+            }
+        }
+
+        //public RowStructure(IConfiguration configuration, JObject jObject, int type)
+        //{
+        //    if (jObject != null)
+        //    {
+        //        if (type == UtilsController.Constant.DATA_TYPE_ONE)
+        //        {
+        //            id = (string)jObject["id"];
+        //            parent_id = (string)jObject["parent_id"];
+        //            sv_id = (string)jObject["service_id"];
+        //            code = (string)jObject["code"];
+        //            name = (string)jObject["name"];
+        //            name_global = (string)jObject["name_global"];
+        //            name_local = (string)jObject["name_local"];
+        //            description = (string)jObject["description"];
+        //            description_global = (string)jObject["description_global"];
+        //            description_local = (string)jObject["description_local"];
+        //            introduction = (string)jObject["introduction"];
+        //            introduction_global = (string)jObject["introduction_global"];
+        //            introduction_local = (string)jObject["introduction_local"];
+        //            level = (string)jObject["level"];
+
+        //            permission = (string)jObject["TYPE"];
+
+        //            icon = configuration.GetSection(UtilsController.Constant.PATH_CONTENT).Value + (string)jObject["icon"];
+        //            logo = configuration.GetSection(UtilsController.Constant.PATH_CONTENT).Value + (string)jObject["logo"];
+
+        //            realIcon = (string)jObject["icon"];
+        //            realLogo = (string)jObject["logo"];
+
+        //            content = (string)jObject["content"];
+        //            content_type = (string)jObject["content_type"];
+        //            from_date = (string)jObject["from_date"];
+        //            to_date = (string)jObject["to_date"];
+        //            created_date = (string)jObject["create_date"];
+        //            update_date = (string)jObject["update_date"];
+
+        //            province_id = (string)jObject["province_id"];
+        //            topic_id = (string)jObject["topic_id"];
+
+        //            is_read = (string)jObject["is_read"];
+        //            status = (string)jObject["status"];
+        //            is_show = (string)jObject["is_show"];
+        //            note = (string)jObject["note"];
+        //        }
+        //    }
+        //}
+
+        public object Clone()
+        {
+            return this.MemberwiseClone();
+        }
+    }
+
+    public class RowStructures
+    {
+        public List<RowStructure> data { get; set; }
+        public RowStructures() { }
+        public RowStructures(IConfiguration configuration, string json) : this(configuration, JObject.Parse(json)) { }
+        public RowStructures(IConfiguration configuration, JObject jObject)
+        {
+            if (jObject != null)
+            {
+                var list = jObject["listNews"];
+                //var dataTypeOne = jObject["dataTypeOne"];
+                if (list != null && list.HasValues)
+                {
+                    data = new List<RowStructure>();
+                    JArray a = (JArray)list;
+                    foreach (JObject o in a.Children<JObject>())
+                    {
+                        data.Add(new RowStructure(configuration, o));
+                    }
+                }
+                //else if (dataTypeOne != null && dataTypeOne.HasValues)
+                //{
+                //    data = new List<RowStructure>();
+                //    JArray a = (JArray)dataTypeOne;
+                //    foreach (JObject o in a.Children<JObject>())
+                //    {
+                //        data.Add(new RowStructure(configuration, o));
+                //    }
+                //}
+            }
+        }
+    }
+}

+ 55 - 0
SuperAdmin/SuperAdmin/Models/Object/Topic.cs

@@ -0,0 +1,55 @@
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace SuperAdmin.Models.Object
+{
+    public class Topic
+    {
+        public String id { get; set; }
+        public String name { get; set; }
+        public String code { get; set; }
+        public Topic(string id, string name, string code)
+        {
+            this.id = id;
+            this.name = name;
+            this.code = code;
+        }
+        public Topic() { }
+        public Topic(string json) : this(JObject.Parse(json))
+        { }
+        public Topic(JObject jObject)
+        {
+            if (jObject != null)
+            {
+                id = (string)jObject["id"];
+                name = (string)jObject["name"];
+                code = (string)jObject["code"];
+            }
+        }
+    }
+    public class Topics
+    {
+        public List<Topic> data { get; set; }
+        public Topics() { }
+        public Topics(string json) : this(JObject.Parse(json)) { }
+        public Topics(JObject jObject)
+        {
+            if (jObject != null)
+            {
+                var list = jObject["listTopic"];
+                if (list != null && list.HasValues)
+                {
+                    data = new List<Topic>();
+                    JArray a = (JArray)list;
+                    foreach (JObject o in a.Children<JObject>())
+                    {
+                        data.Add(new Topic(o));
+                    }
+                }
+            }
+        }
+    }
+}

+ 112 - 0
SuperAdmin/SuperAdmin/Models/Object/UserProfile.cs

@@ -0,0 +1,112 @@
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace SuperAdmin.Models.Object
+{
+    public class UserProfile : Posting
+    {
+        public String id { get; set; }
+        public String usersId { get; set; }
+        public String users { get; set; }
+        //public String serviceid { get; set; }
+        public String fullName { get; set; }
+        public String sex { get; set; }
+        public String address { get; set; }
+        public String provinceId { get; set; }
+        public String cardNumber { get; set; }
+        public String email { get; set; }
+        public String company { get; set; }
+        public String description { get; set; }
+        public String picture { get; set; }
+        public String sexNeed { get; set; }
+        public String birthday { get; set; }
+        public String birthday_day { get; set; }
+        public String birthday_month { get; set; }
+        public String birthday_year { get; set; }
+        public String height { get; set; }
+        public String weight { get; set; }
+        public String work { get; set; }
+        public String isLike { get; set; }
+        public String totalLike { get; set; }
+        public String totalPic { get; set; }
+        public String totalView { get; set; }
+        public String lookingFor { get; set; }
+        public List<Interest> listInterests { get; set; }
+        public String interests { get; set; }
+
+        public UserProfile() { }
+        public UserProfile(string json) : this(JObject.Parse(json))
+        { }
+
+        public UserProfile(JObject jObject)
+        {
+            if (jObject != null)
+            {
+                id = (string)jObject["id"];
+                usersId = (string)jObject["usersId"];
+                users = (string)jObject["users"];
+                //serviceid = (string)jObject["serviceid"];
+                fullName = (string)jObject["fullName"];
+                sex = (string)jObject["sex"];
+                address = (string)jObject["address"];
+                provinceId = (string)jObject["provinceId"];
+                cardNumber = (string)jObject["cardNumber"];
+                email = (string)jObject["email"];
+                company = (string)jObject["company"];
+                description = (string)jObject["description"];
+                picture = (string)jObject["picture"];
+                sexNeed = (string)jObject["sexNeed"];
+                birthday = (string)jObject["birthday"];
+                if (birthday != null && birthday != "")
+                {
+                    birthday_day = birthday.Substring(0, 2);
+                    birthday_month = birthday.Substring(3, 2);
+                    birthday_year = birthday.Substring(6);
+                }
+                height = (string)jObject["height"];
+                weight = (string)jObject["weight"];
+                work = (string)jObject["work"];
+                isLike = (string)jObject["isLike"];
+                totalLike = (string)jObject["totalLike"];
+                totalPic = (string)jObject["totalPic"];
+                totalView = (string)jObject["totalView"];
+                lookingFor = (string)jObject["lookingFor"];
+
+                var list = jObject["listInterests"];
+                if (list != null && list.HasValues)
+                {
+                    listInterests = new List<Interest>();
+                    JArray a = (JArray)list;
+                    foreach (JObject o in a.Children<JObject>())
+                    {
+                        listInterests.Add(new Interest(o));
+                    }
+                }
+            }
+        }
+    }
+
+    public class Interest
+    {
+        public String id { get; set; }
+        public String code { get; set; }
+        public String name { get; set; }
+        public String picture { get; set; }
+
+        public Interest() { }
+        public Interest(JObject jObject)
+        {
+            if (jObject != null)
+            {
+                id = (string)jObject["id"];
+                code = (string)jObject["code"];
+                name = (string)jObject["name"];
+                picture = (string)jObject["picture"];
+            }
+        }
+    }
+
+}

+ 42 - 0
SuperAdmin/SuperAdmin/Models/Object/UserRoles.cs

@@ -0,0 +1,42 @@
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace SuperAdmin.Models.Object
+{
+    public class LoginAdminRequest : Posting
+    {
+        public String users { get; set; }
+        public String pass { get; set; }
+        //public String channel { get; set; }
+
+    }
+    public class Function
+    {
+        public string id { get; set; }
+        public string role { get; set; }
+        public string name { get; set; }
+        public string link { get; set; }
+        public string note { get; set; }
+        public static Function Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<Function>(json);
+        }
+    }
+
+    public class UserRoles
+    {
+        public string role { get; set; }
+        public string token { get; set; }
+        public List<Function> function { get; set; }
+        public string status { get; set; }
+        public string message { get; set; }
+
+        public static UserRoles Parse(string json)
+        {
+            return JsonConvert.DeserializeObject<UserRoles>(json);
+        }
+    }
+}

+ 46 - 0
SuperAdmin/SuperAdmin/Models/Sub/ReportDetail.cs

@@ -0,0 +1,46 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace SuperAdmin.Models.Sub
+{
+    public class ReportDetailReq : Posting
+    {
+        public string serviceName { get; set; }
+        public string fromDate { get; set; }
+        public string toDate { get; set; }
+        public string msisdn { get; set; }
+        public string status { get; set; }
+    }
+
+    public class ReportDetail
+    {
+        public string report_date { get; set; }
+        public string service_name { get; set; }
+        public string charge_time { get; set; }
+        public string msisdn { get; set; }
+        public string transaction_id { get; set; }
+        public string reference_id { get; set; }
+        public double money_charge { get; set; }
+        public string status { get; set; }
+        public string description { get; set; }
+    }
+
+    public class ReportDetailRes
+    {
+        public string errorCode { get; set; }
+        public string message { get; set; }
+        public int totalPage { get; set; }
+        public int totalRow { get; set; }
+        public List<ReportDetail> data { get; set; }
+
+        public static ReportDetailRes Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<ReportDetailRes>(json);
+        }
+    }
+
+}

+ 60 - 0
SuperAdmin/SuperAdmin/Models/Sub/ReportHourly.cs

@@ -0,0 +1,60 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace SuperAdmin.Models.Sub
+{
+    public class ReportHourlyReq : Posting
+    { 
+        public string serviceName { get; set; }
+        public string fromDate { get; set; }
+        public string toDate { get; set; } 
+    }
+
+    public class ReportHourly
+    {
+        public string service_name { get; set; }
+        public string report_date { get; set; }
+        public long TOTAL { get; set; }
+        public long h00 { get; set; }
+        public long h01 { get; set; }
+        public long h02 { get; set; }
+        public long h03 { get; set; }
+        public long h04 { get; set; }
+        public long h05 { get; set; }
+        public long h06 { get; set; }
+        public long h07 { get; set; }
+        public long h08 { get; set; }
+        public long h09 { get; set; }
+        public long h10 { get; set; }
+        public long h11 { get; set; }
+        public long h12 { get; set; }
+        public long h13 { get; set; }
+        public long h14 { get; set; }
+        public long h15 { get; set; }
+        public long h16 { get; set; }
+        public long h17 { get; set; }
+        public long h18 { get; set; }
+        public long h19 { get; set; }
+        public long h20 { get; set; }
+        public long h21 { get; set; }
+        public long h22 { get; set; }
+        public long h23 { get; set; }
+    }
+     
+    public class ReportHourlyRes
+    {
+        public List<ReportHourly> data { get; set; }
+        public string errorCode { get; set; }
+        public string message { get; set; }
+
+        public static ReportHourlyRes Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<ReportHourlyRes>(json);
+        }
+    }
+
+}

+ 43 - 0
SuperAdmin/SuperAdmin/Models/Sub/ReportRegister.cs

@@ -0,0 +1,43 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace SuperAdmin.Models.Sub
+{
+    public class ReportRegisterReq : Posting
+    {
+        public string serviceName { get; set; }
+        public string fromDate { get; set; }
+        public string toDate { get; set; }
+        public string msisdn { get; set; }
+        public int action { get; set; }
+    }
+
+    public class ReportRegister
+    {
+        public string report_date { get; set; }
+        public string service_name { get; set; }
+        public string action_time { get; set; }
+        public string msisdn { get; set; }
+        public string action { get; set; }
+        public string channel { get; set; }
+    }
+
+    public class ReportRegisterRes
+    {
+        public string errorCode { get; set; }
+        public string message { get; set; }
+        public int totalPage { get; set; }
+        public int totalRow { get; set; }
+        public List<ReportRegister> data { get; set; }
+
+        public static ReportRegisterRes Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<ReportRegisterRes>(json);
+        }
+    }
+
+}

+ 51 - 0
SuperAdmin/SuperAdmin/Models/Sub/ReportSummary.cs

@@ -0,0 +1,51 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace SuperAdmin.Models.Sub
+{
+    public class ReportSummaryReq : Posting
+    {
+        public string serviceName { get; set; }
+        public string fromDate { get; set; }
+        public string toDate { get; set; }
+    }
+
+    public class ReportSummary
+    {
+        public string service_name { get; set; }
+        public string report_date { get; set; }
+        public int revenue { get; set; }
+        public int count_reg { get; set; }
+        public int count_re_reg { get; set; }
+        public int count_promotion { get; set; }
+        public int charge_fail { get; set; }
+        public int count_active { get; set; }
+        public int count_deactive { get; set; }
+        public List<RenewStep> renew { get; set; }
+    }
+
+    public class RenewStep
+    {
+        public int step { get; set; }
+        public int count_renew { get; set; }
+    }
+
+    public class ReportSummaryRes
+    {
+        public string errorCode { get; set; }
+        public string message { get; set; }
+        public int totalPage { get; set; }
+        public int totalRow { get; set; }
+        public List<ReportSummary> data { get; set; }
+
+        public static ReportSummaryRes Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<ReportSummaryRes>(json);
+        }
+    }
+
+}

+ 23 - 0
SuperAdmin/SuperAdmin/Models/View/CommonModel.cs

@@ -0,0 +1,23 @@
+using SuperAdmin.Models.Object;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace SuperAdmin.Models.View
+{
+    public class CommonModel
+    {
+        public class DistributedByLevel
+        {
+            public List<MapData> mapData { get; set; }
+            public int level { get; set; }
+        }
+
+        public class MapData
+        {
+            public RowStructure oldData { get; set; }
+            public RowStructure newData { get; set; }
+        }
+    }
+}

+ 26 - 0
SuperAdmin/SuperAdmin/Models/View/EnewsViewModel.cs

@@ -0,0 +1,26 @@
+using SuperAdmin.Models.Object;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace SuperAdmin.Models.View
+{
+    public class EnewsViewModel
+    {
+        public RowStructure parent { get; set; }
+        public RowStructure now { get; set; }
+        public RowStructures events { get; set; }
+
+        // event showing
+        public String page { get; set; }
+        public String status { get; set; }
+
+        public RowStructures categories { get; set; }
+        public RowStructures columns { get; set; }
+
+
+    }
+
+
+}

+ 27 - 0
SuperAdmin/SuperAdmin/Models/View/EventViewModel.cs

@@ -0,0 +1,27 @@
+using SuperAdmin.Models.Object;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace SuperAdmin.Models.View
+{
+    public class EventViewModel
+    {
+        public Topics topics { get; set; }
+        public Provinces provinces { get; set; }
+        public RowStructure parent { get; set; }
+        public RowStructure now { get; set; }
+        public RowStructures events { get; set; }
+
+        // event showing
+        public String page { get; set; }
+        public String totalPage { get; set; }
+        public String status { get; set; }
+
+        public RowStructures categories { get; set; }
+        public RowStructures columns { get; set; }
+        public string action { get; set; }
+
+    }
+}

+ 21 - 0
SuperAdmin/SuperAdmin/Models/View/PartialViewModel.cs

@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace SuperAdmin.Models.View
+{
+    public class PartialViewModel
+    {
+        public String message { get; set; }
+        public String id { get; set; }
+        public String url { get; set; }
+        public String tableType { get; set; }
+
+        // tree response
+        public List<String> ids { get; set; }
+        public List<String> functions { get; set; }
+        public List<String> parameters { get; set; }
+
+    }
+}

+ 14 - 0
SuperAdmin/SuperAdmin/Models/View/TreeViewModel.cs

@@ -0,0 +1,14 @@
+using SuperAdmin.Models.Object;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace SuperAdmin.Models.View
+{
+    public class TreeViewModel
+    {
+        public RowStructure parent { get; set; }
+        public RowStructures rows { get; set; }
+    }
+}

+ 280 - 0
SuperAdmin/SuperAdmin/Models/Vsa/Vsa.cs

@@ -0,0 +1,280 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Xml.Serialization;
+
+namespace SuperAdmin.Models.Vsa
+{
+
+    [XmlRoot(ElementName = "Row")]
+    public class VsaUser
+    {
+        [XmlElement(ElementName = "USER_ID")]
+        public int USERID { get; set; }
+
+        [XmlElement(ElementName = "USER_RIGHT")]
+        public int USERRIGHT { get; set; }
+
+        [XmlElement(ElementName = "USER_NAME")]
+        public string USERNAME { get; set; }
+
+        [XmlElement(ElementName = "PASSWORD")]
+        public string PASSWORD { get; set; }
+
+        [XmlElement(ElementName = "STATUS")]
+        public int STATUS { get; set; }
+
+        [XmlElement(ElementName = "EMAIL")]
+        public string EMAIL { get; set; }
+
+        [XmlElement(ElementName = "CELLPHONE")]
+        public int CELLPHONE { get; set; }
+
+        [XmlElement(ElementName = "GENDER")]
+        public int GENDER { get; set; }
+
+        [XmlElement(ElementName = "LAST_CHANGE_PASSWORD")]
+        public String LASTCHANGEPASSWORD { get; set; }
+
+        [XmlElement(ElementName = "LOGIN_FAILURE_COUNT")]
+        public int LOGINFAILURECOUNT { get; set; }
+
+        [XmlElement(ElementName = "IDENTITY_CARD")]
+        public string IDENTITYCARD { get; set; }
+
+        [XmlElement(ElementName = "FULL_NAME")]
+        public string FULLNAME { get; set; }
+
+        [XmlElement(ElementName = "USER_TYPE_ID")]
+        public int USERTYPEID { get; set; }
+
+        [XmlElement(ElementName = "CREATE_DATE")]
+        public String CREATEDATE { get; set; }
+
+        [XmlElement(ElementName = "STAFF_CODE")]
+        public string STAFFCODE { get; set; }
+
+        [XmlElement(ElementName = "MANAGER_ID")]
+        public int MANAGERID { get; set; }
+
+        [XmlElement(ElementName = "PASSWORDCHANGED")]
+        public int PASSWORDCHANGED { get; set; }
+
+        [XmlElement(ElementName = "LAST_LOGIN")]
+        public String LASTLOGIN { get; set; }
+
+        [XmlElement(ElementName = "PROFILE_ID")]
+        public int PROFILEID { get; set; }
+
+        [XmlElement(ElementName = "LAST_RESET_PASSWORD")]
+        public String LASTRESETPASSWORD { get; set; }
+
+        [XmlElement(ElementName = "IP")]
+        public string IP { get; set; }
+
+        [XmlElement(ElementName = "DEPT_ID")]
+        public int DEPTID { get; set; }
+
+        [XmlElement(ElementName = "DEPT_LEVEL")]
+        public double DEPTLEVEL { get; set; }
+
+        [XmlElement(ElementName = "POS_ID")]
+        public int POSID { get; set; }
+
+        [XmlElement(ElementName = "DEPT_NAME")]
+        public string DEPTNAME { get; set; }
+
+        [XmlElement(ElementName = "IGNORE_CHECK_IP")]
+        public int IGNORECHECKIP { get; set; }
+
+        [XmlElement(ElementName = "CHECK_VALID_TIME")]
+        public int CHECKVALIDTIME { get; set; }
+
+        [XmlElement(ElementName = "START_TIME_TO_CHANGE_PASSWORD")]
+        public string STARTTIMETOCHANGEPASSWORD { get; set; }
+
+        [XmlElement(ElementName = "IP_LAN")]
+        public string IPLAN { get; set; }
+
+        [XmlElement(ElementName = "CHECK_IP")]
+        public int CHECKIP { get; set; }
+
+        [XmlElement(ElementName = "CHECK_IP_LAN")]
+        public int CHECKIPLAN { get; set; }
+
+        [XmlElement(ElementName = "TEMP_LOCK_COUNT")]
+        public int TEMPLOCKCOUNT { get; set; }
+
+        [XmlElement(ElementName = "USE_SALT")]
+        public int USESALT { get; set; }
+
+        [XmlElement(ElementName = "LANGUAGE")]
+        public string LANGUAGE { get; set; }
+
+        [XmlElement(ElementName = "LOGIN_FAIL_ALLOW")]
+        public int LOGINFAILALLOW { get; set; }
+
+        [XmlElement(ElementName = "TEMPORARY_LOCK_TIME")]
+        public int TEMPORARYLOCKTIME { get; set; }
+
+        [XmlElement(ElementName = "MAX_TMP_LOCK_ADAY")]
+        public int MAXTMPLOCKADAY { get; set; }
+
+        [XmlElement(ElementName = "PASSWORD_VALID_TIME")]
+        public int PASSWORDVALIDTIME { get; set; }
+
+        [XmlElement(ElementName = "USER_VALID_TIME")]
+        public int USERVALIDTIME { get; set; }
+
+        [XmlElement(ElementName = "ALLOW_MULTI_IP_LOGIN")]
+        public int ALLOWMULTIIPLOGIN { get; set; }
+
+        [XmlElement(ElementName = "ALLOW_IP")]
+        public string ALLOWIP { get; set; }
+
+        [XmlElement(ElementName = "ALLOW_LOGIN_TIME_START")]
+        public int ALLOWLOGINTIMESTART { get; set; }
+
+        [XmlElement(ElementName = "ALLOW_LOGIN_TIME_END")]
+        public int ALLOWLOGINTIMEEND { get; set; }
+
+        [XmlElement(ElementName = "ID")]
+        public int ID { get; set; }
+
+        [XmlElement(ElementName = "NAME")]
+        public string NAME { get; set; }
+
+        [XmlElement(ElementName = "NEED_CHANGE_PASSWORD")]
+        public int NEEDCHANGEPASSWORD { get; set; }
+
+        [XmlElement(ElementName = "TIME_TO_CHANGE_PASSWORD")]
+        public int TIMETOCHANGEPASSWORD { get; set; }
+
+        [XmlElement(ElementName = "TIME_TO_PASSWORD_EXPIRE")]
+        public int TIMETOPASSWORDEXPIRE { get; set; }
+    }
+
+    [XmlRoot(ElementName = "Row")]
+    public class VsaRole
+    {
+
+        [XmlElement(ElementName = "STATUS")]
+        public int STATUS { get; set; }
+
+        [XmlElement(ElementName = "ROLE_ID")]
+        public int ROLEID { get; set; }
+
+        [XmlElement(ElementName = "ROLE_NAME")]
+        public string ROLENAME { get; set; }
+
+        [XmlElement(ElementName = "DESCRIPTION")]
+        public string DESCRIPTION { get; set; }
+
+        [XmlElement(ElementName = "ROLE_CODE")]
+        public string ROLECODE { get; set; }
+
+        [XmlElement(ElementName = "CREATE_DATE")]
+        public string CREATEDATE { get; set; }
+
+        [XmlElement(ElementName = "CREATOR_ID")]
+        public int CREATORID { get; set; }
+
+        [XmlElement(ElementName = "CREATOR_NAME")]
+        public string CREATORNAME { get; set; }
+
+        [XmlElement(ElementName = "IP_OFFICE_WAN")]
+        public int IPOFFICEWAN { get; set; }
+    }
+
+    [XmlRoot(ElementName = "Row")]
+    public class VsaObject
+    {
+
+        [XmlElement(ElementName = "OBJECT_ID")]
+        public int OBJECTID { get; set; }
+
+        [XmlElement(ElementName = "APP_ID")]
+        public int APPID { get; set; }
+
+        [XmlElement(ElementName = "PARENT_ID")]
+        public int PARENTID { get; set; }
+
+        [XmlElement(ElementName = "STATUS")]
+        public int STATUS { get; set; }
+
+        [XmlElement(ElementName = "ORD")]
+        public int ORD { get; set; }
+
+        [XmlElement(ElementName = "OBJECT_URL")]
+        public string OBJECTURL { get; set; }
+
+        [XmlElement(ElementName = "OBJECT_NAME")]
+        public string OBJECTNAME { get; set; }
+
+        [XmlElement(ElementName = "OBJECT_TYPE_ID")]
+        public int OBJECTTYPEID { get; set; }
+
+        [XmlElement(ElementName = "OBJECT_CODE")]
+        public string OBJECTCODE { get; set; }
+
+        [XmlElement(ElementName = "OBJECT_LEVEL")]
+        public double OBJECTLEVEL { get; set; }
+
+        [XmlElement(ElementName = "CREATE_DATE")]
+        public string CREATEDATE { get; set; }
+    }
+
+
+    [XmlRoot(ElementName = "UserData")]
+    public class VsaUserData
+    {
+        [XmlElement(ElementName = "Row")]
+        public VsaUser Row { get; set; }
+    }
+
+    [XmlRoot(ElementName = "Roles")]
+    public class VsaRoles
+    {
+
+        [XmlElement(ElementName = "Row")]
+        public List<VsaRole> Row { get; set; }
+    }
+
+    [XmlRoot(ElementName = "ObjectAll")]
+    public class VsaObjectAll
+    {
+
+        [XmlElement(ElementName = "Row")]
+        public List<VsaObject> Row { get; set; }
+    }
+
+    [XmlRoot(ElementName = "Results")]
+    public class VsaValidateResult
+    {
+        public static VsaValidateResult Parse(String xml)
+        {
+            XmlSerializer serializer = new XmlSerializer(typeof(VsaValidateResult));
+            using (StringReader reader = new StringReader(xml))
+            {
+                var test = (VsaValidateResult)serializer.Deserialize(reader);
+                return test;
+            }
+        }
+
+        [XmlElement(ElementName = "UserData")]
+        public VsaUserData UserData { get; set; }
+
+        [XmlElement(ElementName = "Depts")]
+        public object VsaDepts { get; set; }
+
+        [XmlElement(ElementName = "Roles")]
+        public VsaRoles Roles { get; set; }
+
+        [XmlElement(ElementName = "ObjectAll")]
+        public VsaObjectAll ObjectAll { get; set; }
+    }
+
+
+}

+ 78 - 0
SuperAdmin/SuperAdmin/Oracle/OracleDynamicParameters.cs

@@ -0,0 +1,78 @@
+using Dapper;
+using Oracle.ManagedDataAccess.Client;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace SuperAdmin.Oracle
+{
+    public class OracleDynamicParameters : SqlMapper.IDynamicParameters
+    {
+        private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(OracleDynamicParameters));
+        private readonly DynamicParameters dynamicParameters = new DynamicParameters();
+        private readonly List<OracleParameter> oracleParameters = new List<OracleParameter>();
+
+        public void Add(string name, OracleDbType oracleDbType, ParameterDirection direction, object value = null, int? size = null)
+        {
+            try
+            {
+                OracleParameter oracleParameter;
+                if (size.HasValue)
+                {
+                    oracleParameter = new OracleParameter(name, oracleDbType, size.Value, value, direction);
+                }
+                else
+                {
+                    oracleParameter = new OracleParameter(name, oracleDbType, value, direction);
+                }
+
+                oracleParameters.Add(oracleParameter);
+            }
+            catch (Exception ex)
+            {
+                log.Error(ex);
+                throw ex;
+            }
+
+        }
+
+        public void Add(string name, OracleDbType oracleDbType, ParameterDirection direction)
+        {
+            try
+            {
+                var oracleParameter = new OracleParameter(name, oracleDbType, direction);
+                oracleParameters.Add(oracleParameter);
+            }
+            catch (Exception ex)
+            {
+                log.Error(ex);
+                throw ex;
+            }
+
+        }
+
+        public void AddParameters(IDbCommand command, SqlMapper.Identity identity)
+        {
+            try
+            {
+                ((SqlMapper.IDynamicParameters)dynamicParameters).AddParameters(command, identity);
+
+                var oracleCommand = command as OracleCommand;
+
+                if (oracleCommand != null)
+                {
+                    oracleCommand.Parameters.AddRange(oracleParameters.ToArray());
+                }
+            }
+            catch (Exception ex)
+            {
+                log.Error(ex);
+                throw ex;
+            }
+
+        }
+
+    }
+}

+ 40 - 0
SuperAdmin/SuperAdmin/Program.cs

@@ -0,0 +1,40 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Reflection;
+using System.Threading.Tasks;
+using System.Xml;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.Hosting;
+using Microsoft.Extensions.Logging;
+
+namespace SuperAdmin
+{
+    public class Program
+    {
+        private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(Program));
+
+        public static void Main(string[] args)
+        {
+            XmlDocument log4netConfig = new XmlDocument();
+            log4netConfig.Load(File.OpenRead("log4net.config"));
+
+            var repo = log4net.LogManager.CreateRepository(
+                Assembly.GetEntryAssembly(), typeof(log4net.Repository.Hierarchy.Hierarchy));
+
+            log4net.Config.XmlConfigurator.Configure(repo, log4netConfig["log4net"]);
+
+            log.Info("Application - Main is invoked");
+            CreateHostBuilder(args).Build().Run();
+        }
+
+        public static IHostBuilder CreateHostBuilder(string[] args) =>
+            Host.CreateDefaultBuilder(args)
+                .ConfigureWebHostDefaults(webBuilder =>
+                {
+                    webBuilder.UseStartup<Startup>();
+                });
+    }
+}

+ 21 - 0
SuperAdmin/SuperAdmin/Properties/PublishProfiles/FolderProfile.pubxml

@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+https://go.microsoft.com/fwlink/?LinkID=208121. 
+-->
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <DeleteExistingFiles>true</DeleteExistingFiles>
+    <ExcludeApp_Data>false</ExcludeApp_Data>
+    <LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
+    <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
+    <LastUsedPlatform>Any CPU</LastUsedPlatform>
+    <PublishProvider>FileSystem</PublishProvider>
+    <PublishUrl>D:\Common\Publish</PublishUrl>
+    <WebPublishMethod>FileSystem</WebPublishMethod>
+    <SiteUrlToLaunchAfterPublish />
+    <TargetFramework>net5.0</TargetFramework>
+    <ProjectGuid>000a9a28-ee22-4214-887d-108273a43763</ProjectGuid>
+    <SelfContained>true</SelfContained>
+    <RuntimeIdentifier>win-x64</RuntimeIdentifier>
+  </PropertyGroup>
+</Project>

+ 21 - 0
SuperAdmin/SuperAdmin/Properties/PublishProfiles/FolderProfile1.pubxml

@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+https://go.microsoft.com/fwlink/?LinkID=208121. 
+-->
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <DeleteExistingFiles>true</DeleteExistingFiles>
+    <ExcludeApp_Data>false</ExcludeApp_Data>
+    <LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
+    <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
+    <LastUsedPlatform>Any CPU</LastUsedPlatform>
+    <PublishProvider>FileSystem</PublishProvider>
+    <PublishUrl>D:\Common\PublishCms</PublishUrl>
+    <WebPublishMethod>FileSystem</WebPublishMethod>
+    <SiteUrlToLaunchAfterPublish />
+    <TargetFramework>net5.0</TargetFramework>
+    <RuntimeIdentifier>linux-x64</RuntimeIdentifier>
+    <ProjectGuid>000a9a28-ee22-4214-887d-108273a43763</ProjectGuid>
+    <SelfContained>true</SelfContained>
+  </PropertyGroup>
+</Project>

+ 27 - 0
SuperAdmin/SuperAdmin/Properties/launchSettings.json

@@ -0,0 +1,27 @@
+{
+  "iisSettings": {
+    "windowsAuthentication": false,
+    "anonymousAuthentication": true,
+    "iisExpress": {
+      "applicationUrl": "http://localhost:57292",
+      "sslPort": 44302
+    }
+  },
+  "profiles": {
+    "IIS Express": {
+      "commandName": "IISExpress",
+      "launchBrowser": true,
+      "environmentVariables": {
+        "ASPNETCORE_ENVIRONMENT": "Development"
+      }
+    },
+    "SuperAdmin": {
+      "commandName": "Project",
+      "launchBrowser": true,
+      "applicationUrl": "https://localhost:5001;http://localhost:5000",
+      "environmentVariables": {
+        "ASPNETCORE_ENVIRONMENT": "Development"
+      }
+    }
+  }
+}

+ 16 - 0
SuperAdmin/SuperAdmin/Repositories/ISuperAdminRepo.cs

@@ -0,0 +1,16 @@
+using Dapper;
+using Microsoft.Extensions.Configuration;
+using Oracle.ManagedDataAccess.Client;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace SuperCms.Repositories
+{
+    public interface ISuperAdminRepo
+    {
+        object GetConnConfig();
+    }
+}

+ 60 - 0
SuperAdmin/SuperAdmin/Repositories/SuperAdminRepo.cs

@@ -0,0 +1,60 @@
+using Dapper;
+using Microsoft.Extensions.Configuration;
+using Oracle.ManagedDataAccess.Client;
+using SuperAdmin.Controllers;
+using SuperAdmin.Oracle;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace SuperCms.Repositories
+{
+    public class SuperAdminRepo : ISuperAdminRepo
+    {
+        IConfiguration configuration;
+        public SuperAdminRepo(IConfiguration _configuration)
+        {
+            configuration = _configuration;
+        }
+        public IDbConnection GetConnection()
+        {
+            var connectionString = configuration.GetSection("Connection").Value;
+            var conn = new OracleConnection(connectionString);
+            return conn;
+        }
+
+        public object GetConnConfig()
+        {
+            object result = null;
+            var conn = this.GetConnection();
+            try
+            {
+                var dyParam = new OracleDynamicParameters();
+                dyParam.Add("sc_cursor", OracleDbType.RefCursor, ParameterDirection.Output);
+
+                if (conn.State == ConnectionState.Closed)
+                {
+                    conn.Open();
+                }
+
+                if (conn.State == ConnectionState.Open)
+                {
+                    var query = "GETCONNCONFIG";
+                    result = SqlMapper.Query(conn, query, param: dyParam, commandType: CommandType.StoredProcedure);
+                }
+            }
+            catch (Exception ex)
+            {
+                throw ex;
+            }
+            finally
+            {
+                conn.Close();
+            }
+            return result;
+        }
+
+    }
+}

+ 225 - 0
SuperAdmin/SuperAdmin/Source/LumilotoUtils.cs

@@ -0,0 +1,225 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using SuperAdmin.Controllers;
+using SuperAdmin.Models.Http;
+
+namespace SuperAdmin.Source
+{
+    public class LumilotoUtils
+    {
+        private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(Program));
+        
+        public class GameIds
+        {
+            public const string LUCKY_POWER = "1";
+            public const string LUCKY_DAY = "2";
+            public const string LUCKY_PLUS = "3";
+            public const string SINGAPORE = "4";
+        }
+        public class ResultOrder
+        {
+            public static String asc = "asc";
+            public static String desc = "desc";
+        }
+
+        //1: lấy các term đang cho phép mia ticket
+        //2: lấy các term đã khóa, không cho mua ticket, đang đợi quay thưởng hoặc nhập giải thưởng(LuckyPower)
+        //3: đã chấp nhận kết quả 
+        //4: kế quả bị từ chối, đợi nhập lại
+        //5:. đã nhập kết quả và đợi phê duyệt kết quả
+        public class GetTermStatus
+        {
+            public const string available = "1";
+            public const string waitResult = "2";
+            public const string accepted = "3";
+            public const string rejected = "4";
+            public const string waitApproved = "5";
+        }
+
+        public class PaidStatus
+        {
+            public const string notYetPaid = "0";
+            public const string alreadyPaid = "1";
+            public const string paying = "2";
+            public const string paidError = "3"; 
+        }
+
+        public class ExportActionType
+        {
+            //0=delete data,1=start upload data,2=finish upload data xong, doi duyet,3=reject,4= delete export;5=duyệt
+            public const string deleteData = "0";
+            public const string startUpload = "1";
+            public const string finishUpload = "2";
+            public const string rejected = "3";
+            public const string deleted = "4";
+            public const string approved = "5";
+        }
+
+        public class ExportStatus
+        {
+            //<option value = "0" > Draft </ option >
+            // < option value="1">Uploading</option>
+            // <option value = "2" > Finish upload</option>
+            // <option value = "3" > Rejected </ option >
+            // < option value="4">Deleted</option>
+            // <option value = "5" > Approved </ option >
+            public const string draft = "0";
+            public const string startUpload = "1";
+            public const string finishUpload = "2";
+            public const string rejected = "3";
+            public const string deleted = "4";
+            public const string approved = "5";
+            public const string addingMoney = "6";
+            public const string finishAddMoney = "7";
+        }
+
+        public class LuckyPowerResultStatus
+        {
+            public const string waitApprove = "0";
+            public const string rejected = "1";
+            public const string approved = "2";
+        }
+        public class ExportType
+        {
+            //1=Lấy danh sách người trúng thưởng từ hệ thống ,
+            //2=lấy danh sách từ file upload
+            //3=lấy danh sách người trúng thưởng có trong hệ thống mà ko có trong file import
+            //4=lấy danh sách có trong file import mà ko có trong hệ thống
+            public static string fromSystem = "1";
+            public static string fromUploadFile = "2";
+            public static string sysWithoutImport = "3";
+            public static string importWithoutSys = "4";
+
+        }
+        public class RequestCommand
+        {
+
+            public static String CustomerSync = "CustomerSync";
+            public static String bet = "bet";
+            public static String getTernList = "getTernList";
+            public static String checkPin = "checkPin";
+            public static String sendOtp = "sendOtp";
+            public static String confirmCus = "confirmCus";
+            public static String confirmOtp = "confirmOtp";
+            public static String getParam = "getParam";
+        }
+
+        public class WsType
+        {
+            public const String ExportGetList = "wsExportGetList";
+            public const String ExportInsertData = "wsExportInsertData";
+            public const String GetTermList = "wsGetTermList";
+            public const String LkpwResultUpdate = "wsLkpwResultUpdate";
+            public const String LkpwResultGetHis = "wsLkpwResultGetHis";
+            public const String ExportCreated = "wsExportCreated";
+            public const String ExportAction = "wsExportAction";
+            public const String ExportWinnerGetData = "wsExportWinnerGetData";
+            public const String ExportWinnerGetDataById = "wsExportWinnerGetDataById";
+            public const String ExportGetHis = "wsExportGetHis";
+            public const String BlackInsertData = "wsBlackInsertData";
+            public const String BackListGetList = "wsBackListGetList";
+            public const String TrafficDayGet = "wsTrafficDayGet";
+            public const String TrafficBoletGet = "wsTrafficBoletGet";
+            public const String MsisdnSearch = "wsMsisdnSearch";
+            public const String MsisdnExport = "wsMsisdnExport";
+            public const String TransferSearch = "wsTransferSearch";
+            public const String LockUser = "wsLockUser";
+            public const String GetTicketInfo = "wsGetTicketInfo";
+            public const String GetTrafficTotal = "wsGetTrafficTotal";
+            public const String GetTopPlayer = "wsGetTopPlayer";
+            public const String Executes = "wsExecutes";
+            public const String TermResult = "urlTermresult";
+            public const String ReportByTerm = "urlReportByTerm";
+            public const String RevenueTotal = "urlRevenueTotal";
+            public const String RevenueDetail = "urlRevenueDetail";
+            public const String RewardTotal = "urlRewardTotal";
+            public const String RewardDetail = "urlRewardDetail";
+            public const String MtSearch = "wsMtSearch";
+            // lucky
+            public const String TrafficLuckyGet = "wsTrafficLuckyGet";
+            public const String MsisdnSearchLucky = "wsMsisdnSearchLucky";
+            // blacklist
+            public const String BlacklistUpload = "wsBlacklistUpload";
+            public const String BlacklistSearch = "wsBlacklistSearch";
+            // sub
+            public const String wsSubReportSummary = "wsSubReportSummary";
+            public const String wsSubReportHourly = "wsSubReportHourly";
+            public const String wsSubReportDetail = "wsSubReportDetail";
+            public const String wsSubReportRegCancel = "wsSubReportRegCancel";
+            //bill order
+            public const String rpSearchTotallBuyOder = "rpSearchTotallBuyOder";
+            public const String rpSearchDetailBuyOder = "rpSearchDetailBuyOder";
+        }
+
+        public static String GetGameName(string gameId)
+        {
+            switch (gameId)
+            {
+                case GameIds.LUCKY_DAY:
+                    return "Lucky Day";
+                case GameIds.LUCKY_POWER:
+                    return "Lucky Power";
+                case GameIds.LUCKY_PLUS:
+                    return "Lucky Plus";
+                case GameIds.SINGAPORE:
+                    return "Singapore";
+                case "-1":
+                    return "All games";
+            }
+            return "";
+        }
+
+        public static String GetStatusExportName(string status)
+        {
+            switch (status)
+            {
+                case ExportActionType.deleteData:
+                    return "Not upload";
+                case ExportActionType.startUpload:
+                    return "Uploading";
+                case ExportActionType.finishUpload:
+                    return "Wait approving";
+                case ExportActionType.rejected:
+                    return "Rejected";
+                case ExportActionType.deleted:
+                    return "Deleted";
+                case ExportActionType.approved:
+                    return "Approved";
+            }
+            return "";
+        }
+
+        public static String GetStatusPaid(string status)
+        {
+            switch (status)
+            {
+                case PaidStatus.notYetPaid:
+                    return "Not yet paid";
+                case PaidStatus.alreadyPaid:
+                    return "Already paid";
+                case PaidStatus.paying:
+                    return "Paying";
+                case PaidStatus.paidError:
+                    return "PaidError";  
+            }
+            return "";
+        }
+
+        public static String GetGameId(string gameName)
+        {
+            gameName = gameName.ToUpper().Trim();
+            switch (gameName)
+            {
+                case "LUCKY DAY":
+                    return GameIds.LUCKY_DAY;
+                case "LUCKY POWER":
+                    return GameIds.LUCKY_POWER;
+                case "LUCKY PLUS":
+                    return GameIds.LUCKY_PLUS;
+            }
+            return "";
+        }
+    }
+}

+ 105 - 0
SuperAdmin/SuperAdmin/Startup.cs

@@ -0,0 +1,105 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Authentication.Cookies;
+using Microsoft.AspNetCore.Builder;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.HttpsPolicy;
+using Microsoft.AspNetCore.Rewrite;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.FileProviders;
+using Microsoft.Extensions.Hosting;
+using SuperAdmin.Controllers;
+using SuperAdmin.Extensions;
+using SuperCms.Repositories;
+
+namespace SuperAdmin
+{
+    public class Startup
+    {
+        public Startup(IConfiguration configuration)
+        {
+            Configuration = configuration;
+        }
+
+        public IConfiguration Configuration { get; }
+
+        // This method gets called by the runtime. Use this method to add services to the container.
+        public void ConfigureServices(IServiceCollection services)
+        {
+            //services.AddControllersWithViews();
+            services.AddControllersWithViews().AddRazorRuntimeCompilation();
+            services.AddTransient<ISuperAdminRepo, SuperAdminRepo>();
+            services.AddSingleton<IConfiguration>(Configuration);
+            services.AddMvc();
+            //.SetCompatibilityVersion(CompatibilityVersion.Version_2_1)
+            //.AddJsonOptions(options => options.SerializerSettings.ContractResolver = new DefaultContractResolver());
+            services.AddAntiforgery(o => o.HeaderName = "XSRF-TOKEN");
+            services.AddDistributedMemoryCache(); // Adds a default in-memory implementation of IDistributedCache
+            services.AddSession(options =>
+            {
+                options.IdleTimeout = TimeSpan.FromSeconds(600);
+                options.Cookie.HttpOnly = true;
+                options.Cookie.IsEssential = true;
+            });
+            //services.AddSession();
+            services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie();
+            services.AddHttpContextAccessor();
+
+            services.AddMvc(options =>
+            {
+                options.Filters.Add(new ConfigAction(
+                    Configuration.GetSection("MyConfig")
+                ));
+            });
+        }
+
+        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
+        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
+        {
+            if (env.IsDevelopment())
+            {
+                app.UseDeveloperExceptionPage();
+            }
+            else
+            {
+                app.UseExceptionHandler("/Home/Error");
+                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
+                app.UseHsts();
+            }
+            app.UseSession();
+            app.UseCookiePolicy();
+            app.UseHttpsRedirection();
+            app.UseStaticFiles();
+
+            string pathContent = Configuration.GetSection(UtilsController.Constant.PATH_CONTENT).Value;
+            if (pathContent != null && pathContent.Length > 0)
+            {
+                app.UseStaticFiles(new StaticFileOptions()
+                {
+                    FileProvider = new PhysicalFileProvider(Configuration.GetSection(UtilsController.Constant.PATH_OUTSIDE).Value),
+                    RequestPath = new PathString(pathContent)
+                });
+            }
+
+
+            app.UseRouting();
+
+            app.UseAuthorization();
+            String domain = Configuration.GetSection(UtilsController.Constant.SUB_DOMAIN).Value;
+
+            app.UsePathBase(domain == null || domain == "" ? "/" : domain);
+
+            app.UseEndpoints(endpoints =>
+            {
+                endpoints.MapControllerRoute(
+                    name: "default",
+                    pattern: domain + "/{controller=Home}/{action=Index}/{id?}");
+            });
+        }
+    }
+}

+ 57 - 0
SuperAdmin/SuperAdmin/SuperAdmin.csproj

@@ -0,0 +1,57 @@
+<Project Sdk="Microsoft.NET.Sdk.Web">
+
+  <PropertyGroup>
+    <TargetFramework>net5.0</TargetFramework>
+    <UserSecretsId>c3fe1f60-1c9f-4eb7-b25a-1a3892f4a80f</UserSecretsId>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <Compile Remove="wwwroot\superadmin\bk\**" />
+    <Content Remove="wwwroot\superadmin\bk\**" />
+    <EmbeddedResource Remove="wwwroot\superadmin\bk\**" />
+    <None Remove="wwwroot\superadmin\bk\**" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <Compile Remove="Models\Vsa\Vsa.cs" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <Content Remove="Views\ReportSub\SearchHistory.cshtml" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <PackageReference Include="ClosedXML" Version="0.95.4" />
+    <PackageReference Include="Dapper" Version="2.0.78" />
+    <PackageReference Include="EPPlus" Version="5.6.1" />
+    <PackageReference Include="log4net" Version="2.0.12" />
+    <PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
+    <PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="3.1.0" />
+    <PackageReference Include="Microsoft.Extensions.ApiDescription.Client" Version="3.0.0">
+      <PrivateAssets>all</PrivateAssets>
+      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
+    </PackageReference>
+    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.5" />
+    <PackageReference Include="Nancy" Version="2.0.0" />
+    <PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
+    <PackageReference Include="NSwag.ApiDescription.Client" Version="13.0.5">
+      <PrivateAssets>all</PrivateAssets>
+      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
+    </PackageReference>
+    <PackageReference Include="Oracle.ManagedDataAccess.Core" Version="2.19.100" />
+    <PackageReference Include="System.Private.ServiceModel" Version="4.7.0" />
+    <PackageReference Include="System.ServiceModel.Duplex" Version="4.4.*" />
+    <PackageReference Include="System.ServiceModel.Http" Version="4.4.*" />
+    <PackageReference Include="System.ServiceModel.NetTcp" Version="4.4.*" />
+    <PackageReference Include="System.ServiceModel.Security" Version="4.4.*" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <WCFMetadata Include="Connected Services" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <Folder Include="Models\Vsa\" />
+  </ItemGroup>
+
+</Project>

+ 304 - 0
SuperAdmin/SuperAdmin/Views/Admin/BlacklistUpload.cshtml

@@ -0,0 +1,304 @@
+@{
+    ViewBag.Title = "Reward Requests";
+    Layout = "~/Views/Shared/_Layout.cshtml";
+}
+
+@using SuperAdmin.Models;
+@using SuperAdmin.Models.Http;
+@using SuperAdmin.Controllers;
+@using SuperAdmin.Source;
+
+@model ExportGetListRes
+@{
+
+}
+
+<style>
+    img {
+        max-width: 100%;
+    }
+</style>
+
+<input type="hidden" value="@ViewBag.Role" id="role" />
+
+<div class="content-header row">
+    <div class="content-header-left col-md-6 col-xs-12 mb-1">
+        <h2 class="content-header-title">Blacklist Management</h2>
+    </div>
+    <div class="content-header-right breadcrumbs-right breadcrumbs-top col-md-6 col-xs-12">
+        <div class="breadcrumb-wrapper col-xs-12">
+            <ol class="breadcrumb">
+                <li class="breadcrumb-item">
+                    <a href="Index">Admin</a>
+                </li>
+                <li class="breadcrumb-item">
+                    <a href="#">Blacklist Management</a>
+                </li>
+            </ol>
+        </div>
+    </div>
+</div>
+
+<div class="content-body">
+    <!-- Basic form layout section start -->
+    <section id="basic-form-layouts">
+        <div class="row service-height">
+            <div class="col-md-12">
+                <div class="card">
+                    <div class="card-header">
+                        <h4 class="card-title" id="basic-layout-form">Search</h4>
+                        <a class="heading-elements-toggle"><i class="icon-ellipsis font-medium-3"></i></a>
+                        <div class="heading-elements">
+                            <ul class="list-inline mb-0">
+                                <li><a data-action="collapse"><i class="icon-minus4"></i></a></li>
+                                @*<li><a data-action="reload"><i class="icon-reload"></i></a></li>*@
+                                <li><a data-action="expand"><i class="icon-expand2"></i></a></li>
+                                @*<li><a data-action="close"><i class="icon-cross2"></i></a></li>*@
+                            </ul>
+                        </div>
+                    </div>
+                    <div class="card-content collapse show">
+                        <div class="card-body">
+                            <div class="card-block">
+                                <div class="form-body">
+                                    @Html.AntiForgeryToken()
+                                    <div class="row">
+                                        <div class="col-md-3 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>Msisdn</label>
+                                                <input class="form-control" id="msisdnSearch" name="msisdnSearch" />
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="row">
+                                        <div class="col-md-12">
+                                            <button type="button" class="btn btn-primary" onclick="search()" id="btnSearch">
+                                                <i class="icon-search"></i> Search
+                                            </button>
+                                            <button type="button" class="btn btn-success" onclick="add()" id="btnAdd">
+                                                <i class="icon-plus"></i> Upload
+                                            </button>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div class="col-12">
+                <div class="card">
+                    <div class="card-content">
+                        <div class="col-md-12 table-responsive" style="padding-top: 10px">
+                            @Html.Partial("_Blacklist", Model)
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+        </div>
+    </section>
+    <!-- // Basic form layout section end -->
+</div>
+
+<div class="modal fade text-xs-left" id="modal-add-service" tabindex="-1" role="dialog" aria-labelledby="myModalLabel17" style="display: none;" aria-hidden="true">
+    <div class="modal-dialog modal-lg" role="document">
+        <div class="modal-content">
+            <div class="modal-header">
+                <h4 class="modal-title" id="modalLabelService">Evoucher upload</h4>
+                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+                    <span aria-hidden="true">×</span>
+                </button>
+            </div>
+            <input type="hidden" id="id" />
+            <div class="modal-body"> 
+                <div class="row" id="div-action">
+                    <div class="col-12">
+                        @*<label id="btnImportData" for="importFile" class="btn btn-outline-success" style="margin: 0 0 0 0;">Choose file</label>*@
+                        <input type="file" id="importFile" name="importFile" class="shifted" accept=".xls,.xlsx" />
+                        <button type="button" id="btnSubmit" class="btn btn-outline-danger" onclick="submit()">Submit</button>
+                        <button type="button" class="btn grey btn-outline-secondary" data-dismiss="modal">Close</button>
+                    </div>
+                </div>
+
+            </div>
+            <div class="modal-footer">
+                @*<button type="button" class="btn grey btn-outline-secondary" data-dismiss="modal">Close</button>
+                    <button type="button" id="btnAdd" class="btn btn-outline-primary" onclick="addUpdateAction()">Add</button>
+                    <button type="button" id="btnUpdate" class="btn btn-outline-primary" onclick="addUpdateAction()">Save Info</button>*@
+
+            </div>
+        </div>
+    </div>
+</div>
+
+
+
+@section Scripts {
+    <script>
+
+        $(document).ready(function () {
+         
+
+            search();
+        });
+
+        var tableReq;
+
+        function resetTableReq() {
+            tableReq = $("#grid_detail").DataTable({});
+        }
+
+
+        function clearTable(table) {
+            if (table != null && table != undefined) {
+                table
+                    .clear()
+                    .destroy();
+            }
+        }
+        resetTableReq();
+
+        function remove(msisdn) {
+            console.log("Remove");  
+            $.ajax({
+                url: urlConfig("/Admin/BlacklistDelete"),
+                data: {
+                    msisdn: msisdn
+                },
+                type: "POST",
+                success: function (data) { 
+                    console.log(data);
+                    if (data.error != "0" && data.error != "1") {
+                        showModal('message-dialog');
+                        $('#message-content').html(data.content.split("\n").join("<br />"));
+                    } else {
+                        Swal.fire({
+                            title: data.content
+                        }).then((result) => {
+                            hideModal("modal-add-service");
+                        })
+                        search();
+                    }
+                },
+                error: function (data) {
+                    stopSpinner('btnSearch');
+                    console.log(data.error);
+                }
+            })
+        }
+
+        // voucher search
+        function search() {
+            console.log("Search");
+            startSpinner('btnSearch');
+            clearTable(tableReq);
+            $.ajax({
+                url: urlConfig("/Admin/BlacklistSearch"),
+                data: {
+                    msisdn: $("#msisdnSearch").val()
+                },
+                type: "POST",
+                success: function (data) {
+                    stopSpinner('btnSearch');
+                    console.log(data);
+                    if (data.error != "0" && data.error != "1") {
+                        showModal('message-dialog');
+                        $('#message-content').html(data.content.split("\n").join("<br />"));
+                    } else {
+                        updateGridData(data.data);
+                        resetTableReq();
+                    }
+                },
+                error: function (data) {
+                    stopSpinner('btnSearch');
+                    console.log(data.error);
+                }
+            })
+        }
+
+        function add() { 
+            // show modal
+            showModal("modal-add-service");
+        }
+
+
+        $('#modal-add-service').on('hidden.bs.modal', function () {
+            search();
+        });
+
+        function updateGridData(val) {
+            console.log(val);
+            $("#gridbody").html("");
+            var html = "";
+            if (val != undefined) {
+                for (var i = 0; i < val.length; i++) {
+                    var service = val[i];
+                    html += "<tr>";
+                    html += "<td scope='row'>" + (i + 1) + "</td>";
+                    html += "<td class='text-left'>" + (service.msisdn) + "</td>";
+                    html += "<td class='text-center'>" + (service.sysdate) + "</td>";
+                    html += "<td class='text-center'><span class='fa fa-remove cursor-pointer' onclick='remove(\"" + service.msisdn + "\")'></span></td >";
+                    html += "</tr>";
+                }
+            }
+            $("#gridbody").html(html);
+        }
+
+
+        function submit() {
+            Swal.fire({
+                title: 'Do you want to upload blacklist?',
+                showDenyButton: false,
+                showCancelButton: true,
+                confirmButtonText: `Yes`,
+                denyButtonText: `No`,
+            }).then((result) => {
+                /* Read more about isConfirmed, isDenied below */
+                if (result.isConfirmed) {
+                    importFile();
+                } else if (result.isDenied) {
+                    //Swal.fire('Changes are not saved', '', 'info')
+                }
+            })
+        }
+
+
+        function importFile() {
+            var id = $("#id").val();
+            console.log(id);
+            // get service info
+            var formData = new FormData();
+
+            var importFile = $("#importFile").get(0);
+            if (importFile.files.length > 0) {
+                formData.append("importFile", importFile.files[0]); 
+
+                fetch(urlConfig("/Admin/BlacklistImportData"), {
+                    method: "POST",
+                    body: formData
+                })
+                    .then(response => response.json())
+                    .then(data => {
+                        console.log(data);
+                        if (data.error != "0") {
+                            setTimeout(function () {
+                                showModal('message-dialog');
+                                $('#message-content').html(data.content.split("\n").join("<br />"));
+                            }, 1000);
+                        } else {
+                            $("#importFile").val("");
+                            Swal.fire({
+                                title: data.content
+                            }).then((result) => {
+                                hideModal("modal-add-service");
+                            })
+                        }
+                    });
+            }
+        }
+
+
+    </script>
+}

+ 428 - 0
SuperAdmin/SuperAdmin/Views/Admin/Dashboard.cshtml

@@ -0,0 +1,428 @@
+@{
+    ViewData["Title"] = "Home Page";
+}
+
+@using SuperAdmin.Models.Http;
+@using SuperAdmin.Controllers;
+@inject IJsonHelper Json;
+@model DashboardModel
+@{
+    float pcMoney1 = 0;
+    float pcMoney2 = 0;
+    float pcMoney3 = 0;
+    float pcWin1 = 0;
+    float pcWin2 = 0;
+    float pcWin3 = 0;
+    float totalMoney = 0;
+    float totalMoneyWin = 0;
+    int size = 1;
+    String chartXAxis = "";
+    String chartUser = "";
+    String chartRevenue1 = "";
+    String chartPaid1 = "";
+    String chartRevenue2 = "";
+    String chartPaid2 = "";
+    String chartRevenue3 = "";
+    String chartPaid3 = "";
+
+    if (Model != null)
+    {
+        totalMoney = float.Parse(Model.revenueTotal.totalMoney);
+        totalMoneyWin = float.Parse(Model.revenueTotal.totalMoneyWin);
+        if (totalMoney > 0)
+        {
+            pcMoney1 = float.Parse(Model.revenueLuckyPower.totalMoney) * 100 / totalMoney;
+            pcMoney2 = float.Parse(Model.revenueLuckyDay.totalMoney) * 100 / totalMoney;
+            pcMoney3 = float.Parse(Model.revenueLuckyPlus.totalMoney) * 100 / totalMoney;
+        }
+        if (totalMoneyWin > 0)
+        {
+            pcWin1 = float.Parse(Model.revenueLuckyPower.totalMoneyWin) * 100 / totalMoneyWin;
+            pcWin2 = float.Parse(Model.revenueLuckyDay.totalMoneyWin) * 100 / totalMoneyWin;
+            pcWin3 = float.Parse(Model.revenueLuckyPlus.totalMoneyWin) * 100 / totalMoneyWin;
+        }
+
+        //var totalUsers = Newtonsoft.Json.JsonConvert.SerializeObject(myObj) as String;
+
+        size = Model.listRevenueTotal.Count;
+        var xAxis1 = new String[size];
+        var totalRevenue1 = new long[xAxis1.Length];
+        var totalPaid1 = new long[xAxis1.Length];
+        var totalRevenue2 = new long[xAxis1.Length];
+        var totalPaid2 = new long[xAxis1.Length];
+        var totalRevenue3 = new long[xAxis1.Length];
+        var totalPaid3 = new long[xAxis1.Length];
+        // sub
+        var totalSub = new long[xAxis1.Length];
+        //var totalNewReg = new long[xAxis1.Length];
+
+        var totalHourly = new long[24];
+
+        for (int i = 0; i < size; i++)
+        {
+            xAxis1[i] = Model.listRevenueTotal[i].date.Substring(0, 5);
+        }
+
+        for (int i = size - 1; i >= 0; i--)
+        {
+            totalSub[xAxis1.Length - (size - i)] = long.Parse(Model.listRevenueTotal[i].totalUser);
+        }
+
+
+        for (int i = size - 1; i >= 0; i--)
+        {
+            totalRevenue1[xAxis1.Length - (size - i)] = long.Parse(Model.listRevenuePower[i].totalMoney);
+            totalPaid1[xAxis1.Length - (size - i)] = long.Parse(Model.listRevenuePower[i].totalMoneyWin);
+            ////totalNewReg[xAxis1.Length - (Model.listRevenueTotal.Count - i)] = Model.listRevenueTotal[i].totalUser;
+        }
+
+        for (int i = size - 1; i >= 0; i--)
+        {
+            totalRevenue2[xAxis1.Length - (size - i)] = long.Parse(Model.listRevenueDay[i].totalMoney);
+            totalPaid2[xAxis1.Length - (size - i)] = long.Parse(Model.listRevenueDay[i].totalMoneyWin);
+        }
+
+        for (int i = size - 1; i >= 0; i--)
+        {
+            totalRevenue3[xAxis1.Length - (size - i)] = long.Parse(Model.listRevenuePlus[i].totalMoney);
+            totalPaid3[xAxis1.Length - (size - i)] = long.Parse(Model.listRevenuePlus[i].totalMoneyWin);
+        }
+
+        chartRevenue1 = Newtonsoft.Json.JsonConvert.SerializeObject(totalRevenue1) as String;
+        chartPaid1 = Newtonsoft.Json.JsonConvert.SerializeObject(totalPaid1) as String;
+
+        chartRevenue2 = Newtonsoft.Json.JsonConvert.SerializeObject(totalRevenue2) as String;
+        chartPaid2 = Newtonsoft.Json.JsonConvert.SerializeObject(totalPaid2) as String;
+
+        chartRevenue3 = Newtonsoft.Json.JsonConvert.SerializeObject(totalRevenue3) as String;
+        chartPaid3 = Newtonsoft.Json.JsonConvert.SerializeObject(totalPaid3) as String;
+
+        chartUser = Newtonsoft.Json.JsonConvert.SerializeObject(totalSub) as String;
+        chartXAxis = Newtonsoft.Json.JsonConvert.SerializeObject(xAxis1) as String;
+    }
+}
+
+@if (Model != null)
+{
+<div class="content-body">
+    <div class="row">
+        <div class="col-12">
+            <div class="card">
+                <div class="card-content">
+                    <div class="card-body">
+                        <form action="/Admin/Index">
+                            <div class="row">
+                                <div class="col-md-4">
+                                    <div class="form-group row">
+                                        <label class=" label-control" style="padding-top: 10px; min-width: 100px" for="fromDate">From date</label>
+                                        <div class="col-md-6">
+                                            <input type="text" id="fromDate" class="form-control border-primary fromDate" placeholder="From Date" name="fromDate" value="@Model.fromDate">
+                                        </div>
+                                    </div>
+                                </div>
+                                <div class="col-md-4">
+                                    <div class="form-group row">
+                                        <label class=" label-control" style="padding-top: 10px; min-width: 100px" for="toDate">To date</label>
+                                        <div class="col-md-6">
+                                            <input type="text" id="toDate" class="form-control border-primary toDate" placeholder="To Date" name="toDate" value="@Model.toDate">
+                                        </div>
+                                    </div>
+                                </div>
+                                <div class="col-md-4">
+                                    <div class="form-group row">
+                                        <div class="col-md-9">
+                                            <button type="submit" id="btnSearch" class="btn btn-success">Search</button>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </form>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+
+    @*<div id="partial-content">
+            @Html.Partial("_Dashboard", Model)
+        </div>*@
+    <div id="partial-content">
+        @*<input type="hidden" value='@Html.Raw(chartXAxis)' id="chartXAxis" />
+            <input type="hidden" value='@Html.Raw(chartUser)' id="chartUser" />
+            <input type="hidden" value='@Html.Raw(chartRevenue1)' id="chartRevenue1" />
+            <input type="hidden" value='@Html.Raw(chartPaid1)' id="chartPaid1" />
+            <input type="hidden" value='@Html.Raw(chartRevenue2)' id="chartRevenue2" />
+            <input type="hidden" value='@Html.Raw(chartPaid2)' id="chartPaid2" />
+            <input type="hidden" value='@Html.Raw(chartRevenue3)' id="chartRevenue3" />
+            <input type="hidden" value='@Html.Raw(chartPaid3)' id="chartPaid3" />*@
+        <div class="row">
+            <div class="col-12">
+                <div class="card">
+                    <div class="card-content">
+                        <div class="card-body">
+                            <div class="row">
+                                <div class="col-lg-4 col-sm-12 border-right-blue-grey border-right-lighten-5">
+                                    <div class="pb-1">
+                                        <div class="clearfix mb-1">
+                                            <span class="icon-user font-large-1 blue-grey float-left mt-1"> <span style="font-family:sans-serif">Total users</span></span>
+                                            <span class="font-large-2 text-bold-300 danger float-right">@BaseController.FormatNumber(Model.revenueTotal.uniqueUsers)</span>
+                                        </div>
+                                        @*<div class="clearfix">
+                                                <span class="text-muted">App android</span>
+                                                <span class="danger float-right"><i class="ft-arrow-up danger"></i> 5.14%</span>
+                                            </div>*@
+                                    </div>
+                                    @*<div class="progress mb-0" style="height: 7px;">
+                                            <div class="progress-bar bg-danger" role="progressbar" style="width: 45%" aria-valuenow="45" aria-valuemin="0" aria-valuemax="100"></div>
+                                        </div>*@
+                                </div>
+                                <div class="col-lg-4 col-sm-12 border-right-blue-grey border-right-lighten-5">
+                                    <div class="pb-1">
+                                        <div class="clearfix mb-1">
+                                            <span class="icon-shuffle font-large-1 blue-grey float-left mt-1"> <span style="font-family:sans-serif">Total revenue</span></span>
+                                            <span class="font-large-2 text-bold-300 success float-right">@BaseController.FormatNumber(Model.revenueTotal.totalMoney)</span>
+                                        </div>
+                                        <div class="clearfix">
+                                            <span class="text-muted">Lucky power</span>
+                                            <span class="success float-right">@*<i class="ft-arrow-down success"></i>*@ @BaseController.FormatNumber(Model.revenueLuckyPower.totalMoney)</span>
+                                        </div>
+                                        <div class="clearfix">
+                                            <span class="text-muted">Lucky day</span>
+                                            <span class="warning float-right">@*<i class="ft-arrow-down warning"></i>*@ @BaseController.FormatNumber(Model.revenueLuckyDay.totalMoney)</span>
+                                        </div>
+                                        <div class="clearfix">
+                                            <span class="text-muted">Lucky plus</span>
+                                            <span class="info float-right">@*<i class="ft-arrow-down info"></i>*@ @BaseController.FormatNumber(Model.revenueLuckyPlus.totalMoney)</span>
+                                        </div>
+                                    </div>
+                                    <div class="progress mb-0" style="height: 7px;">
+                                        <div class="progress-bar bg-success" role="progressbar" style="width: @(pcMoney1)%" aria-valuenow="@pcMoney1" aria-valuemin="0" aria-valuemax="100"></div>
+                                        <div class="progress-bar bg-warning" role="progressbar" style="width: @(pcMoney2)%" aria-valuenow="@pcMoney2" aria-valuemin="0" aria-valuemax="100"></div>
+                                        <div class="progress-bar bg-info" role="progressbar" style="width: @(pcMoney3)%" aria-valuenow="@pcMoney3" aria-valuemin="0" aria-valuemax="100"></div>
+                                    </div>
+                                </div>
+                                <div class="col-lg-4 col-sm-12">
+                                    <div class="pb-1">
+                                        <div class="clearfix mb-1">
+                                            <span class="icon-wallet font-large-1 blue-grey float-left mt-1"> <span style="font-family:sans-serif">Total win money</span></span>
+                                            <span class="font-large-2 text-bold-300 warning float-right">@BaseController.FormatNumber(Model.revenueTotal.totalMoneyWin)</span>
+                                        </div>
+                                        <div class="clearfix">
+                                            <span class="text-muted">Lucky power</span>
+                                            <span class="success float-right">@*<i class="ft-arrow-down success"></i>*@ @BaseController.FormatNumber(Model.revenueLuckyPower.totalMoneyWin)</span>
+                                        </div>
+                                        <div class="clearfix">
+                                            <span class="text-muted">Lucky day</span>
+                                            <span class="warning float-right">@*<i class="ft-arrow-down warning"></i>*@ @BaseController.FormatNumber(Model.revenueLuckyDay.totalMoneyWin)</span>
+                                        </div>
+                                        <div class="clearfix">
+                                            <span class="text-muted">Lucky plus</span>
+                                            <span class="info float-right">@*<i class="ft-arrow-down info"></i>*@ @BaseController.FormatNumber(Model.revenueLuckyPlus.totalMoneyWin)</span>
+                                        </div>
+                                    </div>
+                                    <div class="progress mb-0" style="height: 7px;">
+                                        <div class="progress-bar bg-success" role="progressbar" style="width: @(pcWin1)%" aria-valuenow="@pcWin1" aria-valuemin="0" aria-valuemax="100"></div>
+                                        <div class="progress-bar bg-warning" role="progressbar" style="width: @(pcWin2)%" aria-valuenow="@pcWin2" aria-valuemin="0" aria-valuemax="100"></div>
+                                        <div class="progress-bar bg-info" role="progressbar" style="width: @(pcWin3)%" aria-valuenow="@pcWin3" aria-valuemin="0" aria-valuemax="100"></div>
+                                    </div>
+                                </div>
+
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <!--/ Sales stats -->
+        <!-- Sales by Campaigns & Year -->
+        <div class="row">
+
+            <div class="col-xl-6 col-lg-12">
+                <div class="card">
+                    <div class="card-header">
+                        <h4 class="card-title">Total user report</h4>
+                    </div>
+                    <div class="card-content">
+                        <div class="card-body sales-growth-chart">
+                            <canvas id="chart-users" class="height-300"></canvas>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div class="col-xl-6 col-lg-12">
+                <div class="card">
+                    <div class="card-header">
+                        <h4 class="card-title">Lucky Power Revenue Report</h4>
+                    </div>
+                    <div class="card-content">
+                        <div class="card-body sales-growth-chart">
+                            <canvas id="chart-revenue1" class="height-300"></canvas>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+
+        <div class="row">
+            <div class="col-xl-6 col-lg-12">
+                <div class="card">
+                    <div class="card-header">
+                        <h4 class="card-title">Lucky Day Revenue Report</h4>
+                    </div>
+                    <div class="card-content">
+                        <div class="card-body sales-growth-chart">
+                            <canvas id="chart-revenue2" class="height-300"></canvas>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div class="col-xl-6 col-lg-12">
+                <div class="card">
+                    <div class="card-header">
+                        <h4 class="card-title">Lucky Plus Revenue Report</h4>
+                    </div>
+                    <div class="card-content">
+                        <div class="card-body sales-growth-chart">
+                            <canvas id="chart-revenue3" class="height-300"></canvas>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+
+        <div class="row">
+            <div class="col-xl-6 col-lg-12 col-md-12">
+                <div class="card" style="height: 489px;">
+                    <div class="card-header">
+                        <h4 class="card-title">Top buy ticket (FBU)</h4>
+                        <a class="heading-elements-toggle"><i class="ft-more-horizontal font-medium-3"></i></a>
+                        <div class="heading-elements">
+                            <ul class="list-inline mb-0">
+                                <li><a data-action="reload"><i class="ft-rotate-cw"></i></a></li>
+                            </ul>
+                        </div>
+                    </div>
+                    <div class="card-content">
+                        <div class="friends-activity media-list height-400 position-relative">
+                            @if(Model.topPlay.listLotoCusTop != null) {
+                             for (int i = 0; i < Model.topPlay.listLotoCusTop.Count; i++)
+                                {
+                                    LotoCusTop player = Model.topPlay.listLotoCusTop[i];
+                            <a class="media active">
+                                <div class="media-left">
+                                    <i class="@("feather icon-user " + (i == 0 ? "warning" : i == 1 ? "" : i == 2 ? "danger" : "primary"))" style="font-size:1.5rem"></i>
+                                </div>
+                                <div class="media-body">
+                                    <h5 class="list-group-item-heading">@(player.subName == null || player.subName == "" ? player.isdn : player.subName) <span class="font-medium-4 float-right">@BaseController.FormatNumber(player.money)</span></h5>
+                                </div>
+                            </a>
+                                }
+                            }
+                        </div>
+                    </div>
+                </div>
+            </div>
+            <div class="col-xl-6 col-lg-12 col-md-12">
+                <div class="card" style="height: 489px;">
+                    <div class="card-header">
+                        <h4 class="card-title">Top winner (FBU)</h4>
+                        <a class="heading-elements-toggle"><i class="ft-more-horizontal font-medium-3"></i></a>
+                        <div class="heading-elements">
+                            <ul class="list-inline mb-0">
+                                <li><a data-action="reload"><i class="ft-rotate-cw"></i></a></li>
+                            </ul>
+                        </div>
+                    </div>
+                    <div class="card-content">
+                        <div class="friends-activity media-list height-400 position-relative">
+                            @if (Model.topWin.listLotoCusTop != null)
+                            {
+                                for (int i = 0; i < Model.topWin.listLotoCusTop.Count; i++)
+                                {
+                                    LotoCusTop player = Model.topWin.listLotoCusTop[i];
+                            <a class="media active">
+                                <div class="media-left">
+                                    <i class="@("feather icon-user " + (i == 0 ? "warning" : i == 1 ? "" : i == 2 ? "danger" : "primary"))" style="font-size:1.5rem"></i>
+                                </div>
+                                <div class="media-body">
+                                    <h5 class="list-group-item-heading">@(player.subName == null || player.subName == "" ? player.isdn : player.subName) <span class="font-medium-4 float-right">@BaseController.FormatNumber(player.money)</span></h5>
+                                </div>
+                            </a>
+                                }
+                            }
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+
+        </div>
+
+    </div>
+</div>
+}
+
+
+@section Scripts{
+
+    <script src="@ViewBag.MyConfig.MyValue/js/js/chart-dashboard.js"></script>
+    <script src="@ViewBag.MyConfig.MyValue/js/vendors/chart.min.js"></script>
+
+    <script>
+        $(document).ready(function () {
+            $(".fromDate").datetimepicker({
+                format: "DD/MM/YYYY",
+                defaultDate: moment().add(-15, 'days')
+            });
+
+            $(".toDate").datetimepicker({
+                format: "DD/MM/YYYY",
+                defaultDate: moment().endOf('day')
+            });
+
+            $(".friends-activity").perfectScrollbar({
+                    wheelPropagation: !0
+            });
+
+            try {
+                load_chart_users(@Html.Raw(chartXAxis), @Html.Raw(chartUser));
+                //
+                load_chart_revenue("chart-revenue1", @Html.Raw(chartXAxis), @Html.Raw(chartRevenue1),@Html.Raw(chartPaid1));
+                load_chart_revenue("chart-revenue2", @Html.Raw(chartXAxis), @Html.Raw(chartRevenue2), @Html.Raw(chartPaid2));
+                load_chart_revenue("chart-revenue3", @Html.Raw(chartXAxis), @Html.Raw(chartRevenue3), @Html.Raw(chartPaid3));
+            } catch (err) { }
+        });
+
+        function search() {
+            startSpinner('btnSearch');
+            $.ajax({
+                url: "/Admin/Dashboard",
+                data: {
+                    fromDate: $("#fromDate").val(),
+                    toDate: $("#toDate").val()
+                },
+                type: "POST",
+                success: function (data) {
+                    stopSpinner('btnSearch');
+
+                    $("#partial-content").html(data);
+                    console.log($("#chartXAxis").val());
+                    console.log($("#chartUser").val());
+                    //
+                    load_chart_users(@Html.Raw(chartXAxis), @Html.Raw(chartUser));
+                    //
+                    //load_chart_revenue("chart-revenue1", $("#chartXAxis").val(), $("#chartRevenue1").val(), $("#chartPaid1").val());
+                    //load_chart_revenue("chart-revenue2", $("#chartXAxis").val(), $("#(chartRevenue2").val(), $("#chartPaid2").val());
+                    //load_chart_revenue("chart-revenue3", $("#chartXAxis").val(), $("#chartRevenue3").val(), $("#chartPaid3").val());
+
+                },
+                error: function (data) {
+                    stopSpinner('btnSearch');
+                    console.log(data.error);
+                }
+            })
+        }
+    </script>
+}

+ 7 - 0
SuperAdmin/SuperAdmin/Views/Admin/Index.cshtml

@@ -0,0 +1,7 @@
+@{
+    ViewData["Title"] = "Home Page";
+}
+
+@using SuperAdmin.Models.Http;
+@using SuperAdmin.Controllers;
+@inject IJsonHelper Json;

+ 200 - 0
SuperAdmin/SuperAdmin/Views/Admin/PlayerExport.cshtml

@@ -0,0 +1,200 @@
+@{
+    ViewBag.Title = "Statistics";
+    Layout = "~/Views/Shared/_Layout.cshtml";
+}
+
+@using SuperAdmin.Models;
+@using SuperAdmin.Models.Http;
+@using SuperAdmin.Controllers;
+@using SuperAdmin.Source;
+
+@model SearchMsisdnRes
+@{
+
+}
+
+<style>
+    img {
+        max-width: 100%;
+    }
+</style>
+
+<div class="content-header row">
+    <div class="content-header-left col-md-6 col-xs-12 mb-1">
+        <h2 class="content-header-title">Player Export</h2>
+    </div>
+    <div class="content-header-right breadcrumbs-right breadcrumbs-top col-md-6 col-xs-12">
+        <div class="breadcrumb-wrapper col-xs-12">
+            <ol class="breadcrumb">
+                <li class="breadcrumb-item">
+                    <a href="Index">Admin</a>
+                </li>
+                <li class="breadcrumb-item">
+                    <a href="#">Player Export</a>
+                </li>
+            </ol>
+        </div>
+    </div>
+</div>
+
+<div class="content-body">
+    <!-- Basic form layout section start -->
+    <section id="basic-form-layouts">
+        <div class="row service-height">
+            <div class="col-md-12">
+                <div class="card">
+                    <div class="card-header">
+                        <h4 class="card-title" id="basic-layout-form">Search</h4>
+                        <a class="heading-elements-toggle"><i class="icon-ellipsis font-medium-3"></i></a>
+                        <div class="heading-elements">
+                            <ul class="list-inline mb-0">
+                                <li><a data-action="collapse"><i class="icon-minus4"></i></a></li>
+                                <li><a data-action="expand"><i class="icon-expand2"></i></a></li>
+                            </ul>
+                        </div>
+                    </div>
+                    <div class="card-content collapse show">
+                        <div class="card-body">
+                            <div class="card-block">
+                                <div class="form-body">
+                                    @Html.AntiForgeryToken()
+                                    <div class="row">
+
+
+                                        <div class="col-md-3 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>Game</label>
+                                                <select class="form-control" id="gameId" name="gameId">
+                                                    <option value="-1" selected>-- All --</option>
+                                                    <option value="4">Direct 4D</option>
+                                                    <option value="5">Direct 3D</option>
+                                                    <option value="6">Direct 2D</option>
+                                                    <option value="7">Ibet 4D</option>
+                                                    <option value="8">Ibet 3D</option>
+                                                    <option value="9">Ibet 2D </option>
+                                                </select>
+                                            </div>
+                                        </div> 
+
+                                        <div class="col-md-3 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>Select</label>
+                                                <select class="form-control" id="isWin" name="isWin"> 
+                                                    <option value="-1">Player</option>
+                                                    <option value="1">Winner</option> 
+                                                </select>
+                                            </div>
+                                        </div>
+
+                                        <div class="col-md-3 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>From Date</label>
+                                                <div class='input-group'>
+                                                    <input type="text" class="form-control fromDate" id="fromDate" name="fromDate">
+                                                </div>
+                                            </div>
+                                        </div>
+                                        <div class="col-md-3 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>To date</label>
+                                                <div class='input-group'>
+                                                    <input type="text" class="form-control toDate" id="toDate" name="toDate">
+                                                </div>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="row">
+                                        <div class="col-md-12">
+                                            <button type="button" class="btn btn-warning" onclick="exportExcel()" id="btnExportExcel">
+                                                <i class="icon-export"></i> Export Excel
+                                            </button>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+
+        </div>
+    </section>
+    <!-- // Basic form layout section end -->
+</div>
+
+
+
+@section Scripts {
+    <script>
+        $(document).ready(function () {
+
+            $(".fromDate").datetimepicker({
+                format: "DD/MM/YYYY",
+                defaultDate: moment().add(-9, 'days')
+            });
+
+            $(".toDate").datetimepicker({
+                format: "DD/MM/YYYY",
+                defaultDate: moment().endOf('day')
+            });
+
+            //search();
+        });
+
+        function exportExcel() {
+            console.log("Export data");
+            startSpinner('btnExportExcel');
+            $.ajax({
+                url: "@ViewBag.MyConfig.MyValue/Admin/PlayerExportAction",
+                data: {
+                    gameId: $("#gameId").val(),
+                    fromDate: $("#fromDate").val(),
+                    toDate: $("#toDate").val(),
+                    isWin: $("#isWin").val()
+                },
+                type: "POST",
+                xhr: function () {
+                    var xhr = new XMLHttpRequest();
+                    xhr.onreadystatechange = function () {
+                        if (xhr.readyState == 2) {
+                            if (xhr.status == 200) {
+                                xhr.responseType = "blob";
+                                console.log("blob");
+                            } else {
+                                xhr.responseType = "text";
+                                console.log("text");
+                            }
+                        }
+                    };
+                    return xhr;
+                },
+                success: function (data, status, xhr) {
+
+                    stopSpinner('btnExportExcel');
+                    let filename = "";
+                    let disposition = xhr.getResponseHeader('Content-Disposition');
+                    if (disposition && disposition.indexOf('attachment') !== -1) {
+                        let filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
+                        let matches = filenameRegex.exec(disposition);
+                        if (matches != null && matches[1]) filename = matches[1].replace(/['"]/g, '');
+                    }
+                    let a = document.createElement('a');
+                    let url = window.URL.createObjectURL(data);
+                    a.href = url;
+                    a.download = filename.replace('UTF-8', '');;
+                    document.body.append(a);
+                    a.click();
+                    a.remove();
+                    window.URL.revokeObjectURL(url);
+                    $("#overlay").fadeOut(300);
+                },
+                error: function (data) {
+                    stopSpinner('btnExportExcel');
+                    console.log(data.error);
+                }
+            })
+        }
+    </script>
+}
+

+ 266 - 0
SuperAdmin/SuperAdmin/Views/Admin/PlayerMt.cshtml

@@ -0,0 +1,266 @@
+@{
+    ViewBag.Title = "Statistics";
+    Layout = "~/Views/Shared/_Layout.cshtml";
+}
+
+@using SuperAdmin.Models;
+@using SuperAdmin.Models.Http;
+@using SuperAdmin.Controllers;
+@using SuperAdmin.Source;
+
+@model SearchMsisdnRes
+@{
+
+}
+
+<style>
+    img {
+        max-width: 100%;
+    }
+</style>
+
+<div class="content-header row">
+    <div class="content-header-left col-md-6 col-xs-12 mb-1">
+        <h2 class="content-header-title">Player MT</h2>
+    </div>
+    <div class="content-header-right breadcrumbs-right breadcrumbs-top col-md-6 col-xs-12">
+        <div class="breadcrumb-wrapper col-xs-12">
+            <ol class="breadcrumb">
+                <li class="breadcrumb-item">
+                    <a href="Index">Admin</a>
+                </li>
+                <li class="breadcrumb-item">
+                    <a href="#">Player MT</a>
+                </li>
+            </ol>
+        </div>
+    </div>
+</div>
+
+<div class="content-body">
+    <!-- Basic form layout section start -->
+    <section id="basic-form-layouts">
+        <div class="row service-height">
+            <div class="col-md-12">
+                <div class="card">
+                    <div class="card-header">
+                        <h4 class="card-title" id="basic-layout-form">Search</h4>
+                        <a class="heading-elements-toggle"><i class="icon-ellipsis font-medium-3"></i></a>
+                        <div class="heading-elements">
+                            <ul class="list-inline mb-0">
+                                <li><a data-action="collapse"><i class="icon-minus4"></i></a></li>
+                                <li><a data-action="expand"><i class="icon-expand2"></i></a></li>
+                            </ul>
+                        </div>
+                    </div>
+                    <div class="card-content collapse show">
+                        <div class="card-body">
+                            <div class="card-block">
+                                <div class="form-body">
+                                    @Html.AntiForgeryToken()
+                                    <div class="row">
+
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>Phone number</label>
+                                                <div class='input-group'>
+                                                    <input type="text" class="form-control" id="msisdn" name="msisdn">
+                                                </div>
+                                            </div>
+                                        </div> 
+
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>From Date</label>
+                                                <div class='input-group'>
+                                                    <input type="text" class="form-control fromDate" id="fromDate" name="fromDate">
+                                                </div>
+                                            </div>
+                                        </div>
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>To date</label>
+                                                <div class='input-group'>
+                                                    <input type="text" class="form-control toDate" id="toDate" name="toDate">
+                                                </div>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="row">
+                                        <div class="col-md-12">
+                                            <button type="button" class="btn btn-primary" onclick="search()" id="btnSearch">
+                                                <i class="icon-search"></i> Search
+                                            </button>
+
+                                            <button type="button" class="btn btn-warning" onclick="exportExcel()" id="btnExportExcel">
+                                                <i class="icon-export"></i> Export Excel
+                                            </button>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div class="col-12">
+                <div class="card">
+                    <div class="card-content">
+                        <div class="col-md-12 table-responsive" style="padding-top: 10px">
+                            @Html.Partial("_PlayerMt", Model)
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+
+        </div>
+    </section>
+    <!-- // Basic form layout section end -->
+</div>
+
+
+
+@section Scripts {
+    <script>
+
+        var tableDetail;
+
+        $(document).ready(function () {
+
+            $(".fromDate").datetimepicker({
+                format: "DD/MM/YYYY",
+                defaultDate: moment().add(-9, 'days')
+            });
+
+            $(".toDate").datetimepicker({
+                format: "DD/MM/YYYY",
+                defaultDate: moment().endOf('day')
+            });
+
+            //search();
+        });
+
+
+        function resetTableDetail() {
+            tableDetail = $("#grid_detail").DataTable({
+                orderCellsTop: true,
+                fixedHeader: true
+            });
+        }
+
+        function clearTable(table) {
+            if (table != null && table != undefined) {
+                table
+                    .clear()
+                    .destroy();
+            }
+        }
+        resetTableDetail();
+
+        function search() {
+            console.log("Search data");
+            startSpinner('btnSearch');
+            clearTable(tableDetail);
+            $.ajax({
+                url: "@ViewBag.MyConfig.MyValue/Admin/PlayerMtSearch",
+                data: {
+                    fromDate: $("#fromDate").val(),
+                    toDate: $("#toDate").val(),
+                    msisdn: $("#msisdn").val()
+                },
+                type: "POST",
+                success: function (data) {
+                    stopSpinner('btnSearch');
+                    console.log(data);
+                    if (data.error != "0" && data.error != "1") {
+                        showModal('message-dialog');
+                        $('#message-content').html(data.content.split("\n").join("<br />"));
+                    } else {
+                        updateGridDataDetail(data.data);
+                        resetTableDetail();
+                    }
+                },
+                error: function (data) {
+                    stopSpinner('btnSearch');
+                    console.log(data.error);
+                }
+            })
+        }
+
+
+        function exportExcel() {
+            console.log("Export data");
+            startSpinner('btnExportExcel');
+            $.ajax({
+                url: "@ViewBag.MyConfig.MyValue/Admin/PlayerMtExport",
+                data: {
+                    fromDate: $("#fromDate").val(),
+                    toDate: $("#toDate").val(),
+                    msisdn: $("#msisdn").val()
+                },
+                type: "POST",
+                xhr: function () {
+                    var xhr = new XMLHttpRequest();
+                    xhr.onreadystatechange = function () {
+                        if (xhr.readyState == 2) {
+                            if (xhr.status == 200) {
+                                xhr.responseType = "blob";
+                                console.log("blob");
+                            } else {
+                                xhr.responseType = "text";
+                                console.log("text");
+                            }
+                        }
+                    };
+                    return xhr;
+                },
+                success: function (data, status, xhr) {
+
+                    stopSpinner('btnExportExcel');
+                    let filename = "";
+                    let disposition = xhr.getResponseHeader('Content-Disposition');
+                    if (disposition && disposition.indexOf('attachment') !== -1) {
+                        let filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
+                        let matches = filenameRegex.exec(disposition);
+                        if (matches != null && matches[1]) filename = matches[1].replace(/['"]/g, '');
+                    }
+                    let a = document.createElement('a');
+                    let url = window.URL.createObjectURL(data);
+                    a.href = url;
+                    a.download = filename.replace('UTF-8', '');;
+                    document.body.append(a);
+                    a.click();
+                    a.remove();
+                    window.URL.revokeObjectURL(url);
+                    $("#overlay").fadeOut(300);
+                },
+                error: function (data) {
+                    stopSpinner('btnExportExcel');
+                    console.log(data.error);
+                }
+            })
+        }
+
+        function updateGridDataDetail(val) {
+            console.log(val);
+            $("#gridbody_detail").html("");
+            var html = "";
+            if (val != undefined) {
+                for (var i = 0; i < val.length; i++) {
+                    var service = val[i];
+                    html += "<tr>";
+                    html += "<td scope='row'>" + (i + 1) + "</td>";
+                    html += "<td class='text-left'>" + (service.msisdn) + "</td>";
+                    html += "<td class='text-left'>" + (service.message) + "</td>";
+                    html += "<td class='text-center'>" + (service.sendTime) + "</td>";
+                    html += "</tr>";
+                }
+            }
+            $("#gridbody_detail").html(html);
+        }
+
+    </script>
+}
+

+ 333 - 0
SuperAdmin/SuperAdmin/Views/Admin/PlayerTicket.cshtml

@@ -0,0 +1,333 @@
+@{
+    ViewBag.Title = "Statistics";
+    Layout = "~/Views/Shared/_Layout.cshtml";
+}
+
+@using SuperAdmin.Models;
+@using SuperAdmin.Models.Http;
+@using SuperAdmin.Controllers;
+@using SuperAdmin.Source;
+
+@model SearchMsisdnRes
+@{
+
+}
+
+<style>
+    img {
+        max-width: 100%;
+    }
+</style>
+
+<div class="content-header row">
+    <div class="content-header-left col-md-6 col-xs-12 mb-1">
+        <h2 class="content-header-title">Player</h2>
+    </div>
+    <div class="content-header-right breadcrumbs-right breadcrumbs-top col-md-6 col-xs-12">
+        <div class="breadcrumb-wrapper col-xs-12">
+            <ol class="breadcrumb">
+                <li class="breadcrumb-item">
+                    <a href="Index">Admin</a>
+                </li>
+                <li class="breadcrumb-item">
+                    <a href="#">Player</a>
+                </li>
+            </ol>
+        </div>
+    </div>
+</div>
+
+<div class="content-body">
+    <!-- Basic form layout section start -->
+    <section id="basic-form-layouts">
+        <div class="row service-height">
+            <div class="col-md-12">
+                <div class="card">
+                    <div class="card-header">
+                        <h4 class="card-title" id="basic-layout-form">Search</h4>
+                        <a class="heading-elements-toggle"><i class="icon-ellipsis font-medium-3"></i></a>
+                        <div class="heading-elements">
+                            <ul class="list-inline mb-0">
+                                <li><a data-action="collapse"><i class="icon-minus4"></i></a></li>
+                                <li><a data-action="expand"><i class="icon-expand2"></i></a></li>
+                            </ul>
+                        </div>
+                    </div>
+                    <div class="card-content collapse show">
+                        <div class="card-body">
+                            <div class="card-block">
+                                <div class="form-body">
+                                    @Html.AntiForgeryToken()
+                                    <div class="row">
+
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>Phone number</label>
+                                                <div class='input-group'>
+                                                    <input type="text" class="form-control" id="msisdn" name="msisdn">
+                                                </div>
+                                            </div>
+                                        </div>
+
+
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>Game</label>
+                                                <select class="form-control" id="gameId" name="gameId">
+                                                    <option value="-1" selected>-- All --</option>
+                                                    <option value="4">4D Singapore Direct</option>
+                                                    <option value="5">3D Singapore Direct</option>
+                                                    <option value="6">2D Singapore Direct</option>
+                                                </select>
+                                            </div>
+                                        </div>
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>Lottery</label>
+                                                <select class="form-control" id="gameType" name="gameType">
+                                                    <option value="-1" selected>-- All --</option>
+                                                    <option value="1">Singapore Lottery</option>
+                                                </select>
+                                            </div>
+                                        </div>
+
+
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>From Date</label>
+                                                <div class='input-group'>
+                                                    <input type="text" class="form-control fromDate" id="fromDate" name="fromDate">
+                                                </div>
+                                            </div>
+                                        </div>
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>To date</label>
+                                                <div class='input-group'>
+                                                    <input type="text" class="form-control toDate" id="toDate" name="toDate">
+                                                </div>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="row">
+                                        <div class="col-md-12">
+                                            <button type="button" class="btn btn-primary" onclick="search()" id="btnSearch">
+                                                <i class="icon-search"></i> Search
+                                            </button>
+
+                                            <button type="button" class="btn btn-warning" onclick="exportExcel()" id="btnExportExcel">
+                                                <i class="icon-export"></i> Export Excel
+                                            </button>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div class="col-12">
+                <div class="card">
+                    <div class="card-content">
+                        <div class="col-md-12 table-responsive" style="padding-top: 10px" id="partial-content">
+                            @Html.Partial("_PlayerHistory", Model)
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+
+        </div>
+    </section>
+    <!-- // Basic form layout section end -->
+</div>
+
+
+
+@section Scripts {
+    <script>
+
+        var tableDetail;
+
+        $(document).ready(function () {
+
+            $(".fromDate").datetimepicker({
+                format: "DD/MM/YYYY",
+                defaultDate: moment().add(-9, 'days')
+            });
+
+            $(".toDate").datetimepicker({
+                format: "DD/MM/YYYY",
+                defaultDate: moment().endOf('day')
+            });
+
+            //search();
+        });
+
+
+        function resetTableDetail() {
+            tableDetail = $("#grid_detail").DataTable({
+                orderCellsTop: true,
+                fixedHeader: true,
+                "footerCallback": function (row, data, start, end, display) {
+                    var api = this.api(), data;
+
+                    // Remove the formatting to get integer data for summation
+                    var intVal = function (i) {
+                        return typeof i === 'string' ?
+                            i.replace(/[\$.]/g, '') * 1 :
+                            typeof i === 'number' ?
+                                i : 0;
+                    };
+
+                    // Total over all pages
+                    var total7 = api
+                        .column(7)
+                        .data()
+                        .reduce(function (a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+                    var total11 = api
+                        .column(11)
+                        .data()
+                        .reduce(function (a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+                    // Update footer
+                    $(api.column(7).footer()).html(formatNumber(total7));
+                    $(api.column(11).footer()).html(formatNumber(total11));
+                }
+            });
+        }
+
+        function clearTable(table) {
+            if (table != null && table != undefined) {
+                table
+                    .clear()
+                    .destroy();
+            }
+        }
+        resetTableDetail();
+
+        function search() {
+            console.log("Search data");
+            startSpinner('btnSearch');
+            clearTable(tableDetail);
+            $.ajax({
+                url: "@ViewBag.MyConfig.MyValue/Admin/PlayerTicketSearch",
+                data: {
+                    fromDate: $("#fromDate").val(),
+                    toDate: $("#toDate").val(),
+                    gameId: $("#gameId").val(),
+                    gameType: $("#gameType").val(),
+                    isEvening: $("#isEvening").val(),
+                    channelPayment: $("#channelPayment").val(),
+                    msisdn: $("#msisdn").val()
+                },
+                type: "POST",
+                success: function (data) {
+                    stopSpinner('btnSearch');
+                    if (data.error != null) {
+                        showModal('message-dialog');
+                        $('#message-content').html(data.content.split("\n").join("<br />"));
+                    } else {
+                        // updateGridDataDetail(data.data);
+                        $("#partial-content").html(data);
+                        resetTableDetail();
+                    }
+                },
+                error: function (data) {
+                    stopSpinner('btnSearch');
+                    console.log(data.error);
+                }
+            })
+        }
+
+
+        function exportExcel() {
+            console.log("Export data");
+            startSpinner('btnExportExcel');
+            $.ajax({
+                url: "@ViewBag.MyConfig.MyValue/Admin/PlayerTicketExport",
+                data: {
+                    fromDate: $("#fromDate").val(),
+                    toDate: $("#toDate").val(),
+                    gameId: $("#gameId").val(),
+                    gameType: $("#gameType").val(),
+                    isEvening: $("#isEvening").val(),
+                    channelPayment: $("#channelPayment").val(),
+                    msisdn: $("#msisdn").val()
+                },
+                type: "POST",
+                xhr: function () {
+                    var xhr = new XMLHttpRequest();
+                    xhr.onreadystatechange = function () {
+                        if (xhr.readyState == 2) {
+                            if (xhr.status == 200) {
+                                xhr.responseType = "blob";
+                                console.log("blob");
+                            } else {
+                                xhr.responseType = "text";
+                                console.log("text");
+                            }
+                        }
+                    };
+                    return xhr;
+                },
+                success: function (data, status, xhr) {
+
+                    stopSpinner('btnExportExcel');
+                    let filename = "";
+                    let disposition = xhr.getResponseHeader('Content-Disposition');
+                    if (disposition && disposition.indexOf('attachment') !== -1) {
+                        let filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
+                        let matches = filenameRegex.exec(disposition);
+                        if (matches != null && matches[1]) filename = matches[1].replace(/['"]/g, '');
+                    }
+                    let a = document.createElement('a');
+                    let url = window.URL.createObjectURL(data);
+                    a.href = url;
+                    a.download = filename.replace('UTF-8', '');;
+                    document.body.append(a);
+                    a.click();
+                    a.remove();
+                    window.URL.revokeObjectURL(url);
+                    $("#overlay").fadeOut(300);
+                },
+                error: function (data) {
+                    stopSpinner('btnExportExcel');
+                    console.log(data.error);
+                }
+            })
+        }
+
+        // function updateGridDataDetail(val) {
+        //     console.log(val);
+        //     $("#gridbody_detail").html("");
+        //     var html = "";
+        //     if (val != undefined) {
+        //         for (var i = 0; i < val.length; i++) {
+        //             var service = val[i];
+        //             html += "<tr>";
+        //             html += "<td scope='row'>" + (i + 1) + "</td>";
+        //             html += "<td class='text-left'>" + (service.msisdn) + "</td>";
+        //             html += "<td class='text-center'>" + (service.lottery) + "</td>";
+        //             html += "<td class='text-center'>" + (service.game) + "</td>";
+        //             html += "<td class='text-center'>" + (service.channel) + "</td>";
+        //             html += "<td class='text-right'>" + (service.ticketId) + "</td>";
+        //             html += "<td class='text-left'>" + (service.ticketCode) + "</td>";
+        //             html += "<td class='text-right'>" + formatNumber(service.money) + "</td>";
+        //             html += "<td class='text-center'>" + (service.buyTime) + "</td>";
+        //             html += "<td class='text-center'>" + (service.drawTime) + "</td>";
+        //             html += "<td class='text-center'>" + (service.result) + "</td>";
+        //             html += "<td class='text-right'>" + formatNumber(service.moneyWin) + "</td>";
+        //             html += "</tr>";
+        //         }
+        //     }
+        //     $("#gridbody_detail").html(html);
+        // }
+
+    </script>
+}
+

+ 383 - 0
SuperAdmin/SuperAdmin/Views/Admin/PlayerTransfer.cshtml

@@ -0,0 +1,383 @@
+@{
+    ViewBag.Title = "Statistics";
+    Layout = "~/Views/Shared/_Layout.cshtml";
+}
+
+@using SuperAdmin.Models;
+@using SuperAdmin.Models.Http;
+@using SuperAdmin.Controllers;
+@using SuperAdmin.Source;
+
+@model SearchMsisdnRes
+@{
+
+}
+
+<style>
+    img {
+        max-width: 100%;
+    }
+</style>
+
+<div class="content-header row">
+    <div class="content-header-left col-md-6 col-xs-12 mb-1">
+        <h2 class="content-header-title">Player Transfer</h2>
+    </div>
+    <div class="content-header-right breadcrumbs-right breadcrumbs-top col-md-6 col-xs-12">
+        <div class="breadcrumb-wrapper col-xs-12">
+            <ol class="breadcrumb">
+                <li class="breadcrumb-item">
+                    <a href="Index">Admin</a>
+                </li>
+                <li class="breadcrumb-item">
+                    <a href="#">Player Transfer</a>
+                </li>
+            </ol>
+        </div>
+    </div>
+</div>
+
+<div class="content-body">
+    <!-- Basic form layout section start -->
+    <section id="basic-form-layouts">
+        <div class="row service-height">
+            <div class="col-md-12">
+                <div class="card">
+                    <div class="card-header">
+                        <h4 class="card-title" id="basic-layout-form">Search</h4>
+                        <a class="heading-elements-toggle"><i class="icon-ellipsis font-medium-3"></i></a>
+                        <div class="heading-elements">
+                            <ul class="list-inline mb-0">
+                                <li><a data-action="collapse"><i class="icon-minus4"></i></a></li>
+                                <li><a data-action="expand"><i class="icon-expand2"></i></a></li>
+                            </ul>
+                        </div>
+                    </div>
+                    <div class="card-content collapse show">
+                        <div class="card-body">
+                            <div class="card-block">
+                                <div class="form-body">
+                                    @Html.AntiForgeryToken()
+                                    <div class="row">
+
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>Phone number</label>
+                                                <div class='input-group'>
+                                                    <input type="text" class="form-control" id="msisdn" name="msisdn">
+                                                </div>
+                                            </div>
+                                        </div>
+
+
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>Transfer Type</label>
+                                                <select class="form-control" id="channelPayment" name="channelPayment">
+                                                    <option value="-1" selected>-- All --</option>
+                                                    <option value="1">Basic account</option>
+                                                    <option value="2">Mosan</option>
+                                                </select>
+                                            </div>
+                                        </div>
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>Status</label>
+                                                <select class="form-control" id="type" name="type">
+                                                    <option value="-1" selected>-- All --</option>
+                                                    <option value="0">Wating Confirm</option>
+                                                    <option value="1">Wating Approve</option>
+                                                    <option value="2">Approved</option>
+                                                    <option value="3">Success</option>
+                                                    <option value="3">Revert</option>
+                                                </select>
+                                            </div>
+                                        </div>
+
+
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>From Date</label>
+                                                <div class='input-group'>
+                                                    <input type="text" class="form-control fromDate" id="fromDate" name="fromDate">
+                                                </div>
+                                            </div>
+                                        </div>
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>To date</label>
+                                                <div class='input-group'>
+                                                    <input type="text" class="form-control toDate" id="toDate" name="toDate">
+                                                </div>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="row">
+                                        <div class="col-md-12">
+                                            <button type="button" class="btn btn-primary" onclick="search()" id="btnSearch">
+                                                <i class="icon-search"></i> Search
+                                            </button>
+
+                                            <button type="button" class="btn btn-warning" onclick="exportExcel()" id="btnExportExcel">
+                                                <i class="icon-export"></i> Export Excel
+                                            </button>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div class="col-12">
+                <div class="card">
+                    <div class="card-content">
+                        <div class="col-md-12 table-responsive" style="padding-top: 10px" id="partial-content">
+                            @Html.Partial("_PlayerTransfer", Model)
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+
+        </div>
+    </section>
+    <!-- // Basic form layout section end -->
+</div>
+
+@* <div class="modal fade" id="myContentDetail" tabindex="-1" role="dialog" style=""
+     aria-labelledby="myModalLabel">
+    <div class="modal-dialog fault-dialog model-style content-model">
+        <div id='detailModalContent'>
+        </div>
+    </div>
+</div> *@
+
+<div class="modal fade text-xs-left" id="myContentDetail" tabindex="-1" role="dialog" data-bs-backdrop="static" data-bs-keyboard="false" style="display: none;">
+    <div class="modal-dialog modal-xl" role="document">
+        <div class="modal-content">
+            <div class="modal-header">
+                <h4 class="modal-title" id="modalLabelService">Detail log</h4>
+                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+                    <span aria-hidden="true">×</span>
+                </button>
+            </div> 
+            <div class="modal-body" id="detailModalContent">
+                 
+            </div> 
+        </div>
+    </div>
+</div>
+
+@section Scripts {
+    <script>
+
+        var tableDetail;
+
+        $(document).ready(function () {
+
+            $(".fromDate").datetimepicker({
+                format: "DD/MM/YYYY",
+                defaultDate: moment().add(-9, 'days')
+            });
+
+            $(".toDate").datetimepicker({
+                format: "DD/MM/YYYY",
+                defaultDate: moment().endOf('day')
+            });
+
+            //search();
+        });
+
+
+
+        function resetTableDetail() {
+            tableDetail = $("#grid_detail").DataTable({
+                orderCellsTop: true,
+                fixedHeader: true,
+                "footerCallback": function (row, data, start, end, display) {
+                    var api = this.api(), data;
+
+                    // Remove the formatting to get integer data for summation
+                    var intVal = function (i) {
+                        return typeof i === 'string' ?
+                            i.replace(/[\$.]/g, '') * 1 :
+                            typeof i === 'number' ?
+                                i : 0;
+                    };
+
+                    // Total over all pages
+                    var total6 = api
+                        .column(6)
+                        .data()
+                        .reduce(function (a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+                    // Update footer
+                    $(api.column(6).footer()).html(formatNumber(total6));
+                }
+            });
+        }
+
+        function clearTable(table) {
+            if (table != null && table != undefined) {
+                table
+                    .clear()
+                    .destroy();
+            }
+        }
+        resetTableDetail();
+
+        function search() {
+            console.log("Search data");
+            startSpinner('btnSearch');
+            clearTable(tableDetail);
+            $.ajax({
+                url: "@ViewBag.MyConfig.MyValue/Admin/PlayerTransferSearch",
+                data: {
+                    fromDate: $("#fromDate").val(),
+                    toDate: $("#toDate").val(),
+                    type: $("#type").val(),
+                    channelPayment: $("#channelPayment").val(),
+                    msisdn: $("#msisdn").val(),
+                    getDetail: '0'
+                },
+                type: "POST",
+                success: function (data) {
+                    stopSpinner('btnSearch');
+                    console.log(data);
+                    if (data.error != null) {
+                        showModal('message-dialog');
+                        $('#message-content').html(data.content.split("\n").join("<br />"));
+                    } else {
+                        //updateGridDataDetail(data.data);
+                        $("#partial-content").html(data);
+                        resetTableDetail();
+                    }
+                },
+                error: function (data) {
+                    stopSpinner('btnSearch');
+                    console.log(data.error);
+                }
+            })
+        }
+
+        function showDetail(id) {
+            console.log("showDetail data");
+            startSpinner('btnDetail-' + id); 
+            $.ajax({
+                url: "@ViewBag.MyConfig.MyValue/Admin/PlayerTransferDetailSearch",
+                data: {
+                    id: id,
+                    getDetail: '1'
+                },
+                type: "POST",
+                success: function (data) {
+                    stopSpinner('btnDetail-' + id);
+                    console.log(data);
+                    if (data.error != null) {
+                        showModal('message-dialog');
+                        $('#message-content').html(data.content.split("\n").join("<br />"));
+                    } else {
+                        //updateGridDataDetail(data.data);
+                        //resetTableDetail();
+                        $("#detailModalContent").html(data);
+                        //showModal("myContentDetail");
+
+                        $('#myContentDetail').modal({
+                          backdrop: 'static',
+                          keyboard: false
+                        });
+                    }
+                },
+                error: function (data) {
+                    stopSpinner('btnDetail-' + id);
+                    console.log(data.error);
+                }
+            })
+        }
+
+
+        function exportExcel() {
+            console.log("Export data");
+            startSpinner('btnExportExcel');
+            $.ajax({
+                url: "@ViewBag.MyConfig.MyValue/Admin/PlayerTransferExport",
+                data: {
+                    fromDate: $("#fromDate").val(),
+                    toDate: $("#toDate").val(),
+                    type: $("#type").val(),
+                    channelPayment: $("#channelPayment").val(),
+                    msisdn: $("#msisdn").val()
+                },
+                type: "POST",
+                xhr: function () {
+                    var xhr = new XMLHttpRequest();
+                    xhr.onreadystatechange = function () {
+                        if (xhr.readyState == 2) {
+                            if (xhr.status == 200) {
+                                xhr.responseType = "blob";
+                                console.log("blob");
+                            } else {
+                                xhr.responseType = "text";
+                                console.log("text");
+                            }
+                        }
+                    };
+                    return xhr;
+                },
+                success: function (data, status, xhr) {
+
+                    stopSpinner('btnExportExcel');
+                    let filename = "";
+                    let disposition = xhr.getResponseHeader('Content-Disposition');
+                    if (disposition && disposition.indexOf('attachment') !== -1) {
+                        let filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
+                        let matches = filenameRegex.exec(disposition);
+                        if (matches != null && matches[1]) filename = matches[1].replace(/['"]/g, '');
+                    }
+                    let a = document.createElement('a');
+                    let url = window.URL.createObjectURL(data);
+                    a.href = url;
+                    a.download = filename.replace('UTF-8', '');;
+                    document.body.append(a);
+                    a.click();
+                    a.remove();
+                    window.URL.revokeObjectURL(url);
+                    $("#overlay").fadeOut(300);
+                },
+                error: function (data) {
+                    stopSpinner('btnExportExcel');
+                    console.log(data.error);
+                }
+            })
+        }
+
+        function updateGridDataDetail(val) {
+            console.log(val);
+            $("#gridbody_detail").html("");
+            var html = "";
+            if (val != undefined) {
+                for (var i = 0; i < val.length; i++) {
+                    var service = val[i];
+                    html += "<tr>";
+                    html += "<td scope='row'>" + (i + 1) + "</td>";
+                    html += "<td class='text-center'>" + (service.timeRequest) + "</td>";
+                    html += "<td class='text-center'>" + (service.acountSend) + "</td>";
+                    html += "<td class='text-left'>" + (service.reqeustId) + "</td>";
+                    html += "<td class='text-left'>" + (service.responseId) + "</td>";
+                    html += "<td class='text-center'>" + (service.acountRecieve) + "</td>";
+                    html += "<td class='text-left'>" + formatTransferType(service.channelPayment) + "</td>";
+                    html += "<td class='text-right'>" + formatNumber(service.money) + "</td>";
+                    html += "<td class='text-center'>" + formatStatus(service.status) + "</td>";
+                    html += "<td class='text-center'>" + (service.errCode) + " - " + (service.errMsg) + "</td>";
+                    html += "</tr>";
+                }
+            }
+            $("#gridbody_detail").html(html);
+        }
+
+    </script>
+}
+

+ 306 - 0
SuperAdmin/SuperAdmin/Views/Admin/ReportBillOrderDetail.cshtml

@@ -0,0 +1,306 @@
+@{
+    ViewBag.Title = "Statistics";
+    Layout = "~/Views/Shared/_Layout.cshtml";
+}
+
+@using SuperAdmin.Models;
+@using SuperAdmin.Models.Http;
+@using SuperAdmin.Controllers;
+@using SuperAdmin.Source;
+@using Microsoft.AspNetCore.Http;
+@using SuperCms.Extensions;
+ 
+@{
+    var subDomain = Context.Session.GetString("subDomain");
+}
+
+<style>
+    img {
+        max-width: 100%;
+    }
+</style>
+
+<div class="content-header row">
+    <div class="content-header-left col-md-6 col-xs-12 mb-1">
+        <h2 class="content-header-title">Report Summary</h2>
+    </div>
+    <div class="content-header-right breadcrumbs-right breadcrumbs-top col-md-6 col-xs-12">
+        <div class="breadcrumb-wrapper col-xs-12">
+            <ol class="breadcrumb">
+                <li class="breadcrumb-item">
+                    <a href="Index">Admin</a>
+                </li>
+                <li class="breadcrumb-item">
+                    <a href="#">Report Bill Order</a>
+                </li>
+                <li class="breadcrumb-item">
+                    <a href="#">Report Detail</a>
+                </li>
+            </ol>
+        </div>
+    </div>
+</div>
+
+<div class="content-body">
+    <section id="basic-form-layouts">
+        <div class="row service-height">
+            <div class="col-md-12">
+                <div class="card">
+                    <div class="card-header">
+                        <h4 class="card-title" id="basic-layout-form">Search</h4>
+                        <a class="heading-elements-toggle"><i class="icon-ellipsis font-medium-3"></i></a>
+                        <div class="heading-elements">
+                            <ul class="list-inline mb-0">
+                                <li><a data-action="collapse"><i class="icon-minus4"></i></a></li>
+                                <li><a data-action="expand"><i class="icon-expand2"></i></a></li>
+                            </ul>
+                        </div>
+                    </div>
+                    <div class="card-content collapse show">
+                        <div class="card-body">
+                            <div class="card-block">
+                                <div class="form-body">
+                                    @Html.AntiForgeryToken()
+                                    <div class="row">
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>From Date</label>
+                                                <div class='input-group'>
+                                                    <input type="text" class="form-control fromDate" id="fromDate" name="fromDate">
+                                                </div>
+                                            </div>
+                                        </div>
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>To date</label>
+                                                <div class='input-group'>
+                                                    <input type="text" class="form-control toDate" id="toDate" name="toDate">
+                                                </div>
+                                            </div>
+                                        </div> 
+                                    </div>
+                                    <div class="row">
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>Phone number</label>
+                                                <div class='input-group'>
+                                                    <input type="text" class="form-control" id="msisdn" name="msisdn">
+                                                </div>
+                                            </div>
+                                        </div>
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>Game</label>
+                                                <select class="form-control" id="gameId" name="gameId">
+                                                    <option value="-1" selected>-- All --</option>
+                                                    <option value="4">4D Singapore Direct</option>
+                                                    <option value="5">3D Singapore Direct</option>
+                                                    <option value="6">2D Singapore Direct</option>
+                                                </select>
+                                            </div>
+                                        </div> 
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>Channel</label>
+                                                <select class="form-control" id="channelPayment" name="channelPayment">
+                                                    <option value="-1" selected>-- All --</option>
+                                                    <option value="USSD">USSD</option>
+                                                    <option value="WEB">WEB</option>
+                                                    <option value="WALLET">WALLET</option>
+                                                </select>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="row">
+                                        <div class="col-md-12">
+                                            <button type="button" class="btn btn-primary" onclick="search()" id="btnSearch">
+                                                <i class="icon-search"></i> Search
+                                            </button>
+                                            <button type="button" class="btn btn-warning" onclick="exportExcel()" id="btnExportExcel">
+                                                <i class="icon-export"></i> Export Excel
+                                            </button>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div class="col-12">
+                <div class="card">
+                    <div class="card-content">
+                        <div class="col-md-12 table-responsive" style="padding-top: 10px" id="partial-content">
+                          
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+        </div>
+    </section>
+    <!-- // Basic form layout section end -->
+</div>
+
+
+@section Scripts {
+    <script>
+
+        var tableDetail;
+
+        $(document).ready(function () {
+
+            $(".fromDate").datetimepicker({
+                format: "DD/MM/YYYY",
+                defaultDate: moment().add(-9, 'days')
+            });
+
+            $(".toDate").datetimepicker({
+                format: "DD/MM/YYYY",
+                defaultDate: moment().endOf('day')
+            }); 
+
+            search();
+        });
+         
+
+        function resetTableDetail() {
+            console.log("reset table");
+            tableDetail = $("#grid_detail").DataTable({
+                orderCellsTop: true,
+                fixedHeader: true,
+                "footerCallback": function (row, data, start, end, display) {
+                    var api = this.api(), data;
+
+                    // Remove the formatting to get integer data for summation
+                    var intVal = function (i) {
+                        return typeof i === 'string' ?
+                            i.replace(/[\$.]/g, '').replace(/[\$,]/g, '') * 1 :
+                            typeof i === 'number' ?
+                                i : 0;
+                    };
+                    // Total over all pages
+                    var total0 = api
+                        .column(4)
+                        .data()
+                        .reduce(function (a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+                    var total1 = api
+                        .column(5)
+                        .data()
+                        .reduce(function (a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+                    var total2 = api
+                        .column(9)
+                        .data()
+                        .reduce(function (a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+                    // // Update footer 
+                    $(api.column(4).footer()).html(formatNumber(total0));
+                    $(api.column(5).footer()).html(formatNumber(total1));
+                    $(api.column(9).footer()).html(formatNumber(total2));
+                }
+            });
+        }
+
+        function clearTable(table) {
+            if (table != null && table != undefined) {
+                table
+                    .clear()
+                    .destroy();
+            }
+        }
+        //resetTableDetail();
+
+        function search() {
+            console.log("Search data");
+            startSpinner('btnSearch');
+            clearTable(tableDetail);
+            $.ajax({
+                url: urlConfig("/Admin/ReportBillOrderDetailSearch"),
+                data: {
+                    gameId: $("#gameId").val(),
+                    msisdn: $("#msisdn").val(),
+                    fromDate: $("#fromDate").val(),
+                    toDate: $("#toDate").val(),
+                    channelBuy: $("#channelPayment").val()
+                },
+                type: "POST",
+                success: function (data) {
+                    stopSpinner('btnSearch');
+                    console.log(data);
+                    if (data.error != null) {
+                        showModal('message-dialog');
+                        $('#message-content').html(data.content.split("\n").join("<br />"));
+                    } else {
+                        $("#partial-content").html(data);
+                        //resetTableDetail();
+                    }
+                },
+                error: function (data) {
+                    stopSpinner('btnSearch');
+                    console.log(data.error);
+                }
+            })
+        }
+
+        function exportExcel() {
+            console.log("Export data");
+            startSpinner('btnExportExcel');
+            $.ajax({
+                url: urlConfig("/Admin/ReportBillOrderDetailExport"),
+                data: {
+                    gameId: $("#gameId").val(),
+                    msisdn: $("#msisdn").val(),
+                    fromDate: $("#fromDate").val(),
+                    toDate: $("#toDate").val(),
+                    channelBuy: $("#channelPayment").val()
+                },
+                type: "POST",
+                xhr: function () {
+                    var xhr = new XMLHttpRequest();
+                    xhr.onreadystatechange = function () {
+                        if (xhr.readyState == 2) {
+                            if (xhr.status == 200) {
+                                xhr.responseType = "blob";
+                                console.log("blob");
+                            } else {
+                                xhr.responseType = "text";
+                                console.log("text");
+                            }
+                        }
+                    };
+                    return xhr;
+                },
+                success: function (data, status, xhr) {
+
+                    stopSpinner('btnExportExcel');
+                    let filename = "";
+                    let disposition = xhr.getResponseHeader('Content-Disposition');
+                    if (disposition && disposition.indexOf('attachment') !== -1) {
+                        let filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
+                        let matches = filenameRegex.exec(disposition);
+                        if (matches != null && matches[1]) filename = matches[1].replace(/['"]/g, '');
+                    }
+                    let a = document.createElement('a');
+                    let url = window.URL.createObjectURL(data);
+                    a.href = url;
+                    a.download = filename.replace('UTF-8', '');;
+                    document.body.append(a);
+                    a.click();
+                    a.remove();
+                    window.URL.revokeObjectURL(url);
+                    $("#overlay").fadeOut(300);
+                },
+                error: function (data) {
+                    stopSpinner('btnExportExcel');
+                    console.log(data.error);
+                }
+            })
+        }
+    </script>
+}

+ 311 - 0
SuperAdmin/SuperAdmin/Views/Admin/ReportBillOrderSummary.cshtml

@@ -0,0 +1,311 @@
+@{
+    ViewBag.Title = "Statistics";
+    Layout = "~/Views/Shared/_Layout.cshtml";
+}
+
+@using SuperAdmin.Models;
+@using SuperAdmin.Models.Http;
+@using SuperAdmin.Controllers;
+@using SuperAdmin.Source;
+@using Microsoft.AspNetCore.Http;
+@using SuperCms.Extensions;
+ 
+@{
+    var subDomain = Context.Session.GetString("subDomain");
+}
+
+<style>
+    img {
+        max-width: 100%;
+    }
+</style>
+
+<div class="content-header row">
+    <div class="content-header-left col-md-6 col-xs-12 mb-1">
+        <h2 class="content-header-title">Report Summary</h2>
+    </div>
+    <div class="content-header-right breadcrumbs-right breadcrumbs-top col-md-6 col-xs-12">
+        <div class="breadcrumb-wrapper col-xs-12">
+            <ol class="breadcrumb">
+                <li class="breadcrumb-item">
+                    <a href="Index">Admin</a>
+                </li>
+                <li class="breadcrumb-item">
+                    <a href="#">Report Bill Order</a>
+                </li>
+                <li class="breadcrumb-item">
+                    <a href="#">Report Summary</a>
+                </li>
+            </ol>
+        </div>
+    </div>
+</div>
+
+<div class="content-body">
+    <section id="basic-form-layouts">
+        <div class="row service-height">
+            <div class="col-md-12">
+                <div class="card">
+                    <div class="card-header">
+                        <h4 class="card-title" id="basic-layout-form">Search</h4>
+                        <a class="heading-elements-toggle"><i class="icon-ellipsis font-medium-3"></i></a>
+                        <div class="heading-elements">
+                            <ul class="list-inline mb-0">
+                                <li><a data-action="collapse"><i class="icon-minus4"></i></a></li>
+                                <li><a data-action="expand"><i class="icon-expand2"></i></a></li>
+                            </ul>
+                        </div>
+                    </div>
+                    <div class="card-content collapse show">
+                        <div class="card-body">
+                            <div class="card-block">
+                                <div class="form-body">
+                                    @Html.AntiForgeryToken()
+                                    <div class="row">
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>From Date</label>
+                                                <div class='input-group'>
+                                                    <input type="text" class="form-control fromDate" id="fromDate" name="fromDate">
+                                                </div>
+                                            </div>
+                                        </div>
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>To date</label>
+                                                <div class='input-group'>
+                                                    <input type="text" class="form-control toDate" id="toDate" name="toDate">
+                                                </div>
+                                            </div>
+                                        </div> 
+                                    </div>
+                                    <div class="row">
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>Game</label>
+                                                <select class="form-control" id="gameId" name="gameId">
+                                                    <option value="-1" selected>-- All --</option>
+                                                    <option value="4">4D Singapore Direct</option>
+                                                    <option value="5">3D Singapore Direct</option>
+                                                    <option value="6">2D Singapore Direct</option>
+                                                </select>
+                                            </div>
+                                        </div> 
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>Channel</label>
+                                                <select class="form-control" id="channelPayment" name="channelPayment">
+                                                    <option value="-1" selected>-- All --</option>
+                                                    <option value="USSD">USSD</option>
+                                                    <option value="WEB">WEB</option>
+                                                    <option value="WALLET">WALLET</option>
+                                                </select>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="row">
+                                        <div class="col-md-12">
+                                            <button type="button" class="btn btn-primary" onclick="search()" id="btnSearch">
+                                                <i class="icon-search"></i> Search
+                                            </button>
+                                            <button type="button" class="btn btn-warning" onclick="exportExcel()" id="btnExportExcel">
+                                                <i class="icon-export"></i> Export Excel
+                                            </button>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div class="col-12">
+                <div class="card">
+                    <div class="card-content">
+                        <div class="col-md-12 table-responsive" style="padding-top: 10px" id="partial-content">
+                          
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+        </div>
+    </section>
+    <!-- // Basic form layout section end -->
+</div>
+
+
+@section Scripts {
+    <script>
+
+        var tableDetail;
+
+        $(document).ready(function () {
+
+            $(".fromDate").datetimepicker({
+                format: "DD/MM/YYYY",
+                defaultDate: moment().add(-9, 'days')
+            });
+
+            $(".toDate").datetimepicker({
+                format: "DD/MM/YYYY",
+                defaultDate: moment().endOf('day')
+            }); 
+
+            search();
+        });
+         
+
+        function resetTableDetail() {
+            tableDetail = $("#grid_detail").DataTable({
+                orderCellsTop: true,
+                fixedHeader: true,
+                "footerCallback": function (row, data, start, end, display) {
+                    var api = this.api(), data;
+
+                    // Remove the formatting to get integer data for summation
+                    var intVal = function (i) {
+                        return typeof i === 'string' ?
+                            i.replace(/[\$.]/g, '').replace(/[\$,]/g, '') * 1 :
+                            typeof i === 'number' ?
+                                i : 0;
+                    };
+
+                    // Total over all pages
+                    var total0 = api
+                        .column(2)
+                        .data()
+                        .reduce(function (a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+                    var total1 = api
+                        .column(3)
+                        .data()
+                        .reduce(function (a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+                    var total2 = api
+                        .column(4)
+                        .data()
+                        .reduce(function (a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+                    var total3 = api
+                        .column(5)
+                        .data()
+                        .reduce(function (a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+                    var total4 = api
+                        .column(6)
+                        .data()
+                        .reduce(function (a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0); 
+                    // Update footer 
+                    $(api.column(2).footer()).html(formatNumber(total0));
+                    $(api.column(3).footer()).html(formatNumber(total1));
+                    $(api.column(4).footer()).html(formatNumber(total2));
+                    $(api.column(5).footer()).html(formatNumber(total3));
+                    $(api.column(6).footer()).html(formatNumber(total4));
+                }
+            });
+        }
+
+        function clearTable(table) {
+            if (table != null && table != undefined) {
+                table
+                    .clear()
+                    .destroy();
+            }
+        }
+        resetTableDetail();
+
+        function search() {
+            console.log("Search data");
+            startSpinner('btnSearch');
+            clearTable(tableDetail);
+            console.log("@subDomain");
+            $.ajax({
+                url: urlConfig("/Admin/ReportBillOrderSummarySearch"),
+                data: {
+                    gameId: $("#gameId").val(),
+                    fromDate: $("#fromDate").val(),
+                    toDate: $("#toDate").val(),
+                    channelBuy: $("#channelPayment").val()
+                },
+                type: "POST",
+                success: function (data) {
+                    stopSpinner('btnSearch');
+                    console.log(data);
+                    if (data.error != null) {
+                        showModal('message-dialog');
+                        $('#message-content').html(data.content.split("\n").join("<br />"));
+                    } else {
+                        $("#partial-content").html(data);
+                        resetTableDetail();
+                    }
+                },
+                error: function (data) {
+                    stopSpinner('btnSearch');
+                    console.log(data.error);
+                }
+            })
+        }
+
+        function exportExcel() {
+            console.log("Export data");
+            startSpinner('btnExportExcel');
+            $.ajax({
+                url: urlConfig("/Admin/ReportBillOrderSummaryExport"),
+                data: {
+                    gameId: $("#gameId").val(),
+                    fromDate: $("#fromDate").val(),
+                    toDate: $("#toDate").val(),
+                    channelBuy: $("#channelPayment").val()
+                },
+                type: "POST",
+                xhr: function () {
+                    var xhr = new XMLHttpRequest();
+                    xhr.onreadystatechange = function () {
+                        if (xhr.readyState == 2) {
+                            if (xhr.status == 200) {
+                                xhr.responseType = "blob";
+                                console.log("blob");
+                            } else {
+                                xhr.responseType = "text";
+                                console.log("text");
+                            }
+                        }
+                    };
+                    return xhr;
+                },
+                success: function (data, status, xhr) {
+
+                    stopSpinner('btnExportExcel');
+                    let filename = "";
+                    let disposition = xhr.getResponseHeader('Content-Disposition');
+                    if (disposition && disposition.indexOf('attachment') !== -1) {
+                        let filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
+                        let matches = filenameRegex.exec(disposition);
+                        if (matches != null && matches[1]) filename = matches[1].replace(/['"]/g, '');
+                    }
+                    let a = document.createElement('a');
+                    let url = window.URL.createObjectURL(data);
+                    a.href = url;
+                    a.download = filename.replace('UTF-8', '');;
+                    document.body.append(a);
+                    a.click();
+                    a.remove();
+                    window.URL.revokeObjectURL(url);
+                    $("#overlay").fadeOut(300);
+                },
+                error: function (data) {
+                    stopSpinner('btnExportExcel');
+                    console.log(data.error);
+                }
+            })
+        }
+    </script>
+}

+ 322 - 0
SuperAdmin/SuperAdmin/Views/Admin/ReportByTerm.cshtml

@@ -0,0 +1,322 @@
+@{
+    ViewBag.Title = "Report By Term";
+    Layout = "~/Views/Shared/_Layout.cshtml";
+}
+
+@using SuperAdmin.Models;
+@using SuperAdmin.Models.Http;
+@using SuperAdmin.Controllers;
+@using SuperAdmin.Source;
+
+@model TrafficTermRes
+@{
+
+}
+
+<style>
+    img {
+        max-width: 100%;
+    }
+</style>
+
+<div class="content-header row">
+    <div class="content-header-left col-md-6 col-xs-12 mb-1">
+        <h2 class="content-header-title">Report by term</h2>
+    </div>
+    <div class="content-header-right breadcrumbs-right breadcrumbs-top col-md-6 col-xs-12">
+        <div class="breadcrumb-wrapper col-xs-12">
+            <ol class="breadcrumb">
+                <li class="breadcrumb-item">
+                    <a href="Index">Admin</a>
+                </li>
+                <li class="breadcrumb-item">
+                    <a href="#">Report by term</a>
+                </li>
+            </ol>
+        </div>
+    </div>
+</div>
+
+<div class="content-body">
+    <!-- Basic form layout section start -->
+    <section id="basic-form-layouts">
+        <div class="row service-height">
+            <div class="col-md-12">
+                <div class="card">
+                    <div class="card-header">
+                        <h4 class="card-title" id="basic-layout-form">Search</h4>
+                        <a class="heading-elements-toggle"><i class="icon-ellipsis font-medium-3"></i></a>
+                        <div class="heading-elements">
+                            <ul class="list-inline mb-0">
+                                <li><a data-action="collapse"><i class="icon-minus4"></i></a></li>
+                                <li><a data-action="expand"><i class="icon-expand2"></i></a></li>
+                            </ul>
+                        </div>
+                    </div>
+                    <div class="card-content collapse show">
+                        <div class="card-body">
+                            <div class="card-block">
+                                <div class="form-body">
+                                    @Html.AntiForgeryToken()
+                                    <div class="row">
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>From Date</label>
+                                                <div class='input-group'>
+                                                    <input type="text" class="form-control fromDate" id="fromDate" name="fromDate">
+                                                </div>
+                                            </div>
+                                        </div>
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>To date</label>
+                                                <div class='input-group'>
+                                                    <input type="text" class="form-control toDate" id="toDate" name="toDate">
+                                                </div>
+                                            </div>
+                                        </div>
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>Game</label>
+                                                <select class="form-control" id="gameId" name="gameId">
+                                                    <option value="1">Lucky power</option>
+                                                    <option value="2">Lucky day</option>
+                                                    <option value="3" selected>Lucky plus</option>
+                                                </select>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="row">
+                                        <div class="col-md-12">
+                                            <button type="button" class="btn btn-primary" onclick="search()" id="btnSearch">
+                                                <i class="icon-search"></i> Search
+                                            </button>
+                                            <button type="button" class="btn btn-warning" onclick="exportExcel()" id="btnExportExcel">
+                                                <i class="icon-export"></i> Export Excel
+                                            </button>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div class="col-12">
+                <div class="card">
+                    <div class="card-content">
+                        <div class="col-md-12 table-responsive" style="padding-top: 10px">
+                            @Html.Partial("_ReportByTermList", Model)
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+        </div>
+    </section>
+    <!-- // Basic form layout section end -->
+</div>
+
+
+@section Scripts {
+    <script>
+
+        var tableDetail;
+
+        $(document).ready(function () {
+
+            $(".fromDate").datetimepicker({
+                format: "DD/MM/YYYY",
+                defaultDate: moment().add(-9, 'days')
+            });
+
+            $(".toDate").datetimepicker({
+                format: "DD/MM/YYYY",
+                defaultDate: moment().endOf('day')
+            });
+
+            //$('#grid_reward_detail thead tr').clone(true).appendTo('#grid_reward_detail thead');
+
+            //$('#grid_reward_detail thead tr:eq(1) th').each(function (i) {
+            //    var title = $(this).text();
+            //    if (title != undefined && title != "") {
+            //        $(this).html('<input type="text" placeholder="Search ' + title + '" />');
+
+            //        $('input', this).on('keyup change', function () {
+            //            if (tableDetail.column(i).search() !== this.value) {
+            //                tableDetail
+            //                    .column(i)
+            //                    .search(this.value)
+            //                    .draw();
+            //            }
+            //        });
+            //    }
+            //});
+
+            search();
+        });
+
+
+
+        function resetTableDetail() {
+            tableDetail = $("#grid_detail").DataTable({
+                orderCellsTop: true,
+                fixedHeader: true,
+                "footerCallback": function (row, data, start, end, display) {
+                    var api = this.api(), data;
+
+                    // Remove the formatting to get integer data for summation
+                    var intVal = function (i) {
+                        return typeof i === 'string' ?
+                            i.replace(/[\$.]/g, '') * 1 :
+                            typeof i === 'number' ?
+                                i : 0;
+                    };
+
+                    // Total over all pages
+                    var total0 = api
+                        .column(6)
+                        .data()
+                        .reduce(function (a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+                    var total1 = api
+                        .column(7)
+                        .data()
+                        .reduce(function (a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+                    var total2 = api
+                        .column(8)
+                        .data()
+                        .reduce(function (a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+
+                    console.log(total0);
+                    console.log(total1);
+                    console.log(total2);
+                    // Update footer
+                    $(api.column(6).footer()).html(formatNumber(total0));
+                    $(api.column(7).footer()).html(formatNumber(total1));
+                    $(api.column(8).footer()).html(total0 == 0 ? "NaN" : formatNumber(Math.round((total1 * 100 / total0))));
+                }
+            });
+        }
+
+        function clearTable(table) {
+            if (table != null && table != undefined) {
+                table
+                    .clear()
+                    .destroy();
+            }
+        }
+        resetTableDetail();
+
+        function search() {
+            console.log("Search data");
+            startSpinner('btnSearch');
+            clearTable(tableDetail);
+            $.ajax({
+                url: "/Admin/ReportByTermSearch",
+                data: {
+                    gameId: $("#gameId").val(),
+                    fromDate: $("#fromDate").val(),
+                    toDate: $("#toDate").val()
+                },
+                type: "POST",
+                success: function (data) {
+                    stopSpinner('btnSearch');
+                    console.log(data);
+                    if (data.error != "0" && data.error != "1") {
+                        showModal('message-dialog');
+                        $('#message-content').html(data.content.split("\n").join("<br />"));
+                    } else {
+                        updateGridDataDetail(data.data);
+                        resetTableDetail();
+                    }
+                },
+                error: function (data) {
+                    stopSpinner('btnSearch');
+                    console.log(data.error);
+                }
+            })
+        }
+
+        function updateGridDataDetail(val) {
+            $("#gridbody_detail").html("");
+            var html = "";
+            if (val != undefined) {
+                for (var i = 0; i < val.length; i++) {
+                    var service = val[i];
+                    html += "<tr>";
+                    html += "<td scope='row'>" + (i + 1) + "</td>";
+                    html += "<td class='text-center'>" + service.randomId + "</td>";
+                    html += "<td class='text-center'>" + service.startDate + "</td>";
+                    html += "<td class='text-center'>" + service.endDate + "</td>";
+                    html += "<td class='text-left'>" + TicketVisible(service.result, $("#gameId").val()) + "</td>";
+                    html += "<td class='text-center'>" + service.status + "</td>";
+                    html += "<td class='text-right'>" + formatNumber(service.money) + "</td>";
+                    html += "<td class='text-right'>" + formatNumber(service.moneyWin) + "</td>";
+                    html += "<td class='text-right'>" + formatNumber(service.rate) + "</td>";
+                    html += "</tr>";
+                }
+            }
+            $("#gridbody_detail").html(html);
+        }
+
+        function exportExcel() {
+            console.log("Export data");
+            startSpinner('btnExportExcel');
+            $.ajax({
+                url: "/Admin/ReportByTermExport",
+                data: {
+                    gameId: $("#gameId").val(),
+                    fromDate: $("#fromDate").val(),
+                    toDate: $("#toDate").val()
+                },
+                type: "POST",
+                xhr: function () {
+                    var xhr = new XMLHttpRequest();
+                    xhr.onreadystatechange = function () {
+                        if (xhr.readyState == 2) {
+                            if (xhr.status == 200) {
+                                xhr.responseType = "blob";
+                                console.log("blob");
+                            } else {
+                                xhr.responseType = "text";
+                                console.log("text");
+                            }
+                        }
+                    };
+                    return xhr;
+                },
+                success: function (data, status, xhr) {
+
+                    stopSpinner('btnExportExcel');
+                    let filename = "";
+                    let disposition = xhr.getResponseHeader('Content-Disposition');
+                    if (disposition && disposition.indexOf('attachment') !== -1) {
+                        let filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
+                        let matches = filenameRegex.exec(disposition);
+                        if (matches != null && matches[1]) filename = matches[1].replace(/['"]/g, '');
+                    }
+                    let a = document.createElement('a');
+                    let url = window.URL.createObjectURL(data);
+                    a.href = url;
+                    a.download = filename.replace('UTF-8', '');;
+                    document.body.append(a);
+                    a.click();
+                    a.remove();
+                    window.URL.revokeObjectURL(url);
+                    $("#overlay").fadeOut(300);
+                },
+                error: function (data) {
+                    stopSpinner('btnExportExcel');
+                    console.log(data.error);
+                }
+            })
+        }
+    </script>
+}

+ 373 - 0
SuperAdmin/SuperAdmin/Views/Admin/ReportCompact.cshtml

@@ -0,0 +1,373 @@
+@{
+    ViewBag.Title = "Statistics";
+    Layout = "~/Views/Shared/_Layout.cshtml";
+}
+
+@using SuperAdmin.Models;
+@using SuperAdmin.Models.Http;
+@using SuperAdmin.Controllers;
+@using SuperAdmin.Source;
+
+@model TrafficDayRes
+@{
+
+}
+
+<style>
+    img {
+        max-width: 100%;
+    }
+</style>
+
+<div class="content-header row">
+    <div class="content-header-left col-md-6 col-xs-12 mb-1">
+        <h2 class="content-header-title">Report Compact</h2>
+    </div>
+    <div class="content-header-right breadcrumbs-right breadcrumbs-top col-md-6 col-xs-12">
+        <div class="breadcrumb-wrapper col-xs-12">
+            <ol class="breadcrumb">
+                <li class="breadcrumb-item">
+                    <a href="Index">Admin</a>
+                </li>
+                <li class="breadcrumb-item">
+                    <a href="#">Report Compact</a>
+                </li>
+            </ol>
+        </div>
+    </div>
+</div>
+
+<div class="content-body">
+    <!-- Basic form layout section start -->
+    <section id="basic-form-layouts">
+        <div class="row service-height">
+            <div class="col-md-12">
+                <div class="card">
+                    <div class="card-header">
+                        <h4 class="card-title" id="basic-layout-form">Search</h4>
+                        <a class="heading-elements-toggle"><i class="icon-ellipsis font-medium-3"></i></a>
+                        <div class="heading-elements">
+                            <ul class="list-inline mb-0">
+                                <li><a data-action="collapse"><i class="icon-minus4"></i></a></li>
+                                <li><a data-action="expand"><i class="icon-expand2"></i></a></li>
+                            </ul>
+                        </div>
+                    </div>
+                    <div class="card-content collapse show">
+                        <div class="card-body">
+                            <div class="card-block">
+                                <div class="form-body">
+                                    @Html.AntiForgeryToken()
+                                    <div class="row">
+                                        <div class="col-md-3 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>From Date</label>
+                                                <div class='input-group'>
+                                                    <input type="text" class="form-control fromDate" id="fromDate" name="fromDate">
+                                                </div>
+                                            </div>
+                                        </div>
+                                        <div class="col-md-3 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>To date</label>
+                                                <div class='input-group'>
+                                                    <input type="text" class="form-control toDate" id="toDate" name="toDate">
+                                                </div>
+                                            </div>
+                                        </div>
+                                        @*<div class="col-md-4 col-sm-4 col-6">
+                                                <div class="form-group">
+                                                    <label>Midday/Evening</label>
+                                                    <select class="form-control" id="isEvening" name="isEvening">
+                                                        <option value="-1" selected>-- All --</option>
+                                                        <option value="0">Midday</option>
+                                                        <option value="1">Evening</option>
+                                                    </select>
+                                                </div>
+                                            </div>*@
+                                        <div class="col-md-3 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>Game</label>
+                                                <select class="form-control" id="gameId" name="gameId">
+                                                    <option value="-1" selected>-- All --</option>
+                                                    <option value="4">BOLET New York</option>
+                                                    <option value="5">MAYRAJ New York</option>
+                                                    <option value="6">LOTTO3 New York</option>
+                                                    <option value="7">BOLET Florida </option>
+                                                    <option value="8">MAYRAJ Florida </option>
+                                                    <option value="9">LOTTO3 Florida </option>
+                                                </select>
+                                            </div>
+                                        </div>
+                                        <div class="col-md-3 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>Lottery</label>
+                                                <select class="form-control" id="gameType" name="gameType">
+                                                    <option value="-1" selected>-- All --</option>
+                                                    <option value="1">New York</option>
+                                                    <option value="2">Florida</option>
+                                                </select>
+                                            </div>
+                                        </div>
+                                        @*<div class="col-md-4 col-sm-4 col-6">
+                                                <div class="form-group">
+                                                    <label>Channel</label>
+                                                    <select class="form-control" id="channelPayment" name="channelPayment">
+                                                        <option value="-1" selected>-- All --</option>
+                                                        <option value="USSD">USSD</option>
+                                                        <option value="WEB">WEB</option>
+                                                        <option value="WALLET">WALLET</option>
+                                                    </select>
+                                                </div>
+                                            </div>*@
+                                    </div>
+                                    <div class="row">
+                                        <div class="col-md-12">
+                                            <button type="button" class="btn btn-primary" onclick="search()" id="btnSearch">
+                                                <i class="icon-search"></i> Search
+                                            </button>
+                                            <button type="button" class="btn btn-warning" onclick="exportExcel()" id="btnExportExcel">
+                                                <i class="icon-export"></i> Export Excel
+                                            </button>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div class="col-12">
+                <div class="card">
+                    <div class="card-content">
+                        <div class="col-md-12 table-responsive" style="padding-top: 10px">
+                            @Html.Partial("_ReportCompact", Model)
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+        </div>
+    </section>
+    <!-- // Basic form layout section end -->
+</div>
+
+
+@section Scripts {
+    <script>
+
+        var tableDetail;
+
+        $(document).ready(function () {
+
+            $(".fromDate").datetimepicker({
+                format: "DD/MM/YYYY",
+                defaultDate: moment().add(-9, 'days')
+            });
+
+            $(".toDate").datetimepicker({
+                format: "DD/MM/YYYY",
+                defaultDate: moment().endOf('day')
+            });
+
+            //$('#grid_reward_detail thead tr').clone(true).appendTo('#grid_reward_detail thead');
+
+            //$('#grid_reward_detail thead tr:eq(1) th').each(function (i) {
+            //    var title = $(this).text();
+            //    if (title != undefined && title != "") {
+            //        $(this).html('<input type="text" placeholder="Search ' + title + '" />');
+
+            //        $('input', this).on('keyup change', function () {
+            //            if (tableDetail.column(i).search() !== this.value) {
+            //                tableDetail
+            //                    .column(i)
+            //                    .search(this.value)
+            //                    .draw();
+            //            }
+            //        });
+            //    }
+            //});
+
+            search();
+        });
+
+
+
+        function resetTableDetail() {
+            tableDetail = $("#grid_detail").DataTable({
+                orderCellsTop: true,
+                fixedHeader: true,
+                "footerCallback": function (row, data, start, end, display) {
+                    var api = this.api(), data;
+
+                    // Remove the formatting to get integer data for summation
+                    var intVal = function (i) {
+                        return typeof i === 'string' ?
+                            i.replace(/[\$.]/g, '') * 1 :
+                            typeof i === 'number' ?
+                                i : 0;
+                    };
+
+                    // Total over all pages
+                    var total0 = api
+                        .column(3)
+                        .data()
+                        .reduce(function (a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+                    var total1 = api
+                        .column(4)
+                        .data()
+                        .reduce(function (a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+                    var total2 = api
+                        .column(5)
+                        .data()
+                        .reduce(function (a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+                    var total3 = api
+                        .column(6)
+                        .data()
+                        .reduce(function (a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+
+                    var total6 = api
+                        .column(2)
+                        .data()
+                        .reduce(function (a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+                    // Update footer
+                    $(api.column(2).footer()).html(formatNumber(total6));
+                    $(api.column(3).footer()).html(formatNumber(total0));
+                    $(api.column(4).footer()).html(formatNumber(total1));
+                    $(api.column(5).footer()).html(formatNumber(total2));
+                    $(api.column(6).footer()).html(formatNumber(total3));
+                }
+            });
+        }
+
+        function clearTable(table) {
+            if (table != null && table != undefined) {
+                table
+                    .clear()
+                    .destroy();
+            }
+        }
+        resetTableDetail();
+
+        function search() {
+            console.log("Search data");
+            startSpinner('btnSearch');
+            clearTable(tableDetail);
+            $.ajax({
+                url: urlConfig("/Admin/ReportCompactSearch"),
+                data: {
+                    gameId: $("#gameId").val(),
+                    fromDate: $("#fromDate").val(),
+                    toDate: $("#toDate").val(),
+                    gameType: $("#gameType").val(),
+                    isEvening: "-1",
+                    channelPayment: "-1"
+                },
+                type: "POST",
+                success: function (data) {
+                    stopSpinner('btnSearch');
+                    console.log(data);
+                    if (data.error != "0" && data.error != "1") {
+                        showModal('message-dialog');
+                        $('#message-content').html(data.content.split("\n").join("<br />"));
+                    } else {
+                        updateGridDataDetail(data.data);
+                        resetTableDetail();
+                    }
+                },
+                error: function (data) {
+                    stopSpinner('btnSearch');
+                    console.log(data.error);
+                }
+            })
+        }
+
+        function updateGridDataDetail(val) {
+            console.log(val);
+            $("#gridbody_detail").html("");
+            var html = "";
+            if (val != undefined) {
+                for (var i = 0; i < val.length; i++) {
+                    var service = val[i];
+                    html += "<tr>";
+                    html += "<td scope='row'>" + (i + 1) + "</td>";
+                    html += "<td class='text-center'>" + service.date + "</td>";
+                    html += "<td class='text-right'>" + formatNumber(service.player) + "</td>";
+                    html += "<td class='text-right'>" + formatNumber(service.money) + "</td>";
+                    html += "<td class='text-right'>" + formatNumber(service.moneyWin) + "</td>";
+                    html += "<td class='text-right'>" + formatNumber(service.benefit) + "</td>";
+                    html += "<td class='text-right'>" + formatNumber(service.sharing) + "</td>";
+                    html += "</tr>";
+                }
+            }
+            $("#gridbody_detail").html(html);
+        }
+
+        function exportExcel() {
+            console.log("Export data");
+            startSpinner('btnExportExcel');
+            $.ajax({
+                url: urlConfig("/Admin/ReportCompactExport"),
+                data: {
+                    gameId: $("#gameId").val(),
+                    fromDate: $("#fromDate").val(),
+                    toDate: $("#toDate").val(),
+                    gameType: $("#gameType").val(),
+                    isEvening: "-1",
+                    channelPayment: "-1"
+                },
+                type: "POST",
+                xhr: function () {
+                    var xhr = new XMLHttpRequest();
+                    xhr.onreadystatechange = function () {
+                        if (xhr.readyState == 2) {
+                            if (xhr.status == 200) {
+                                xhr.responseType = "blob";
+                                console.log("blob");
+                            } else {
+                                xhr.responseType = "text";
+                                console.log("text");
+                            }
+                        }
+                    };
+                    return xhr;
+                },
+                success: function (data, status, xhr) {
+
+                    stopSpinner('btnExportExcel');
+                    let filename = "";
+                    let disposition = xhr.getResponseHeader('Content-Disposition');
+                    if (disposition && disposition.indexOf('attachment') !== -1) {
+                        let filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
+                        let matches = filenameRegex.exec(disposition);
+                        if (matches != null && matches[1]) filename = matches[1].replace(/['"]/g, '');
+                    }
+                    let a = document.createElement('a');
+                    let url = window.URL.createObjectURL(data);
+                    a.href = url;
+                    a.download = filename.replace('UTF-8', '');;
+                    document.body.append(a);
+                    a.click();
+                    a.remove();
+                    window.URL.revokeObjectURL(url);
+                    $("#overlay").fadeOut(300);
+                },
+                error: function (data) {
+                    stopSpinner('btnExportExcel');
+                    console.log(data.error);
+                }
+            })
+        }
+    </script>
+}

+ 510 - 0
SuperAdmin/SuperAdmin/Views/Admin/ReportFinance.cshtml

@@ -0,0 +1,510 @@
+@{
+    ViewBag.Title = "Report By Term";
+    Layout = "~/Views/Shared/_Layout.cshtml";
+}
+
+@using SuperAdmin.Models;
+@using SuperAdmin.Models.Http;
+@using SuperAdmin.Controllers;
+@using SuperAdmin.Source;
+
+@{
+    string reportName = "";
+    var type = ViewBag.type;
+    switch (type) {
+        case "1":
+            reportName = "Revenue Summary";
+            break;
+        case "2":
+            reportName = "Revenue Detail";
+            break;
+        case "3":
+            reportName = "Reward Summary";
+            break;
+        case "4":
+            reportName = "Reward Detail";
+            break;
+    }
+}
+@model FinanceDetailRes
+<style>
+    img {
+        max-width: 100%;
+    }
+</style>
+
+<div class="content-header row">
+    <div class="content-header-left col-md-6 col-xs-12 mb-1">
+        <h2 class="content-header-title">@reportName</h2>
+    </div>
+    <div class="content-header-right breadcrumbs-right breadcrumbs-top col-md-6 col-xs-12">
+        <div class="breadcrumb-wrapper col-xs-12">
+            <ol class="breadcrumb">
+                <li class="breadcrumb-item">
+                    <a href="Index">Admin</a>
+                </li>
+                <li class="breadcrumb-item">
+                    <a href="#">Finance Report</a>
+                </li>
+                <li class="breadcrumb-item">
+                    <a href="#">@reportName</a>
+                </li>
+            </ol>
+        </div>
+    </div>
+</div>
+
+<div class="content-body">
+    <!-- Basic form layout section start -->
+    <section id="basic-form-layouts">
+        <div class="row service-height">
+            <div class="col-md-12">
+                <div class="card">
+                    <div class="card-header">
+                        <h4 class="card-title" id="basic-layout-form">Search</h4>
+                        <a class="heading-elements-toggle"><i class="icon-ellipsis font-medium-3"></i></a>
+                        <div class="heading-elements">
+                            <ul class="list-inline mb-0">
+                                <li><a data-action="collapse"><i class="icon-minus4"></i></a></li>
+                                <li><a data-action="expand"><i class="icon-expand2"></i></a></li>
+                            </ul>
+                        </div>
+                    </div>
+                    <div class="card-content collapse show">
+                        <div class="card-body">
+                            <div class="card-block">
+                                <div class="form-body">
+                                    @Html.AntiForgeryToken()
+                                    <div class="row">
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>From Date</label>
+                                                <div class='input-group'>
+                                                    <input type="text" class="form-control fromDate" id="fromDate" name="fromDate">
+                                                </div>
+                                            </div>
+                                        </div>
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>To date</label>
+                                                <div class='input-group'>
+                                                    <input type="text" class="form-control toDate" id="toDate" name="toDate">
+                                                </div>
+                                            </div>
+                                        </div>
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>Game</label>
+                                                <select class="form-control" id="gameId" name="gameId">
+                                                    <option value="-1" selected>-- All --</option>
+                                                    <option value="1">Lucky power</option>
+                                                    <option value="2">Lucky day</option>
+                                                    <option value="3">Lucky plus</option>
+                                                </select>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="row">
+                                        <div class="col-md-12">
+                                            <button type="button" class="btn btn-primary" onclick="search()" id="btnSearch">
+                                                <i class="icon-search"></i> Search
+                                            </button>
+                                            <button type="button" class="btn btn-warning" onclick="exportExcel()" id="btnExportExcel">
+                                                <i class="icon-export"></i> Export Excel
+                                            </button>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div class="col-12">
+                <div class="card">
+                    <div class="card-content">
+                        <div class="col-md-12 table-responsive" style="padding-top: 10px">
+
+                            @if (type == "1") {
+                            @Html.Partial("_FinanceRevenueSummary", Model);
+                            } else if (type == "2") {
+                            @Html.Partial("_FinanceRevenueDetail", Model);
+                            } else if (type == "3") {
+                            @Html.Partial("_FinanceRewardSummary", Model);
+                            } else if (type == "4") {
+                            @Html.Partial("_FinanceRewardDetail", Model);
+                            } else {
+                            @Html.Partial("_Result1");
+                            }
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+        </div>
+    </section>
+    <!-- // Basic form layout section end -->
+</div>
+
+
+@section Scripts {
+    <script>
+
+        var tableDetail;
+        var type = "@type";
+
+        $(document).ready(function () {
+
+            $(".fromDate").datetimepicker({
+                format: "DD/MM/YYYY",
+                defaultDate: moment().add(-9, 'days')
+            });
+
+            $(".toDate").datetimepicker({
+                format: "DD/MM/YYYY",
+                defaultDate: moment().endOf('day')
+            });
+
+            //$('#grid_reward_detail thead tr').clone(true).appendTo('#grid_reward_detail thead');
+
+            //$('#grid_reward_detail thead tr:eq(1) th').each(function (i) {
+            //    var title = $(this).text();
+            //    if (title != undefined && title != "") {
+            //        $(this).html('<input type="text" placeholder="Search ' + title + '" />');
+
+            //        $('input', this).on('keyup change', function () {
+            //            if (tableDetail.column(i).search() !== this.value) {
+            //                tableDetail
+            //                    .column(i)
+            //                    .search(this.value)
+            //                    .draw();
+            //            }
+            //        });
+            //    }
+            //});
+
+            search();
+        });
+
+
+
+        function resetTableDetail() {
+            tableDetail = $("#grid_detail").DataTable({
+                orderCellsTop: true,
+                fixedHeader: true,
+                "footerCallback": function (row, data, start, end, display) {
+                    var api = this.api(), data;
+
+                    // Remove the formatting to get integer data for summation
+                    var intVal = function (i) {
+                        return typeof i === 'string' ?
+                            i.replace(/[\$.]/g, '') * 1 :
+                            typeof i === 'number' ?
+                                i : 0;
+                    };
+                    if (type == '1') {
+                        // Total over all pages
+                        var total0 = api
+                            .column(2)
+                            .data()
+                            .reduce(function (a, b) {
+                                return intVal(a) + intVal(b);
+                            }, 0);
+                        var total1 = api
+                            .column(3)
+                            .data()
+                            .reduce(function (a, b) {
+                                return intVal(a) + intVal(b);
+                            }, 0);
+                        var total2 = api
+                            .column(5)
+                            .data()
+                            .reduce(function (a, b) {
+                                return intVal(a) + intVal(b);
+                            }, 0);
+                        var total3 = api
+                            .column(6)
+                            .data()
+                            .reduce(function (a, b) {
+                                return intVal(a) + intVal(b);
+                            }, 0);
+                        // Update footer
+                        $(api.column(2).footer()).html(formatNumber(total0));
+                        $(api.column(3).footer()).html(formatNumber(total1));
+                        $(api.column(5).footer()).html(formatNumber(total2));
+                        $(api.column(6).footer()).html(formatNumber(total3));
+                    } else if (type == '2') {
+                        // Total over all pages
+                        var total0 = api
+                            .column(7)
+                            .data()
+                            .reduce(function (a, b) {
+                                return intVal(a) + intVal(b);
+                            }, 0);
+                        var total1 = api
+                            .column(9)
+                            .data()
+                            .reduce(function (a, b) {
+                                return intVal(a) + intVal(b);
+                            }, 0);
+                        var total2 = api
+                            .column(10)
+                            .data()
+                            .reduce(function (a, b) {
+                                return intVal(a) + intVal(b);
+                            }, 0);
+                        var total3 = api
+                            .column(12)
+                            .data()
+                            .reduce(function (a, b) {
+                                return intVal(a) + intVal(b);
+                            }, 0);
+
+                        console.log(total0);
+                        console.log(total1);
+                        console.log(total2);
+                        // Update footer
+                        $(api.column(7).footer()).html(formatNumber(total0));
+                        $(api.column(9).footer()).html(formatNumber(total1));
+                        $(api.column(10).footer()).html(formatNumber(total2));
+                        $(api.column(12).footer()).html(formatNumber(total3));
+                    } else if (type == '3') {
+                        // Total over all pages
+                        var total0 = api
+                            .column(2)
+                            .data()
+                            .reduce(function (a, b) {
+                                return intVal(a) + intVal(b);
+                            }, 0);
+                        var total1 = api
+                            .column(3)
+                            .data()
+                            .reduce(function (a, b) {
+                                return intVal(a) + intVal(b);
+                            }, 0);
+                        var total2 = api
+                            .column(4)
+                            .data()
+                            .reduce(function (a, b) {
+                                return intVal(a) + intVal(b);
+                            }, 0);
+                        var total3 = api
+                            .column(6)
+                            .data()
+                            .reduce(function (a, b) {
+                                return intVal(a) + intVal(b);
+                            }, 0);
+                        // Update footer
+                        $(api.column(2).footer()).html(formatNumber(total0));
+                        $(api.column(3).footer()).html(formatNumber(total1));
+                        $(api.column(4).footer()).html(formatNumber(total2));
+                        $(api.column(6).footer()).html(formatNumber(total3));
+                    } else if (type == '4') {
+                        // Total over all pages
+                        var total0 = api
+                            .column(6)
+                            .data()
+                            .reduce(function (a, b) {
+                                return intVal(a) + intVal(b);
+                            }, 0);
+                        var total1 = api
+                            .column(8)
+                            .data()
+                            .reduce(function (a, b) {
+                                return intVal(a) + intVal(b);
+                            }, 0);
+                        var total2 = api
+                            .column(10)
+                            .data()
+                            .reduce(function (a, b) {
+                                return intVal(a) + intVal(b);
+                            }, 0);
+                        var total3 = api
+                            .column(11)
+                            .data()
+                            .reduce(function (a, b) {
+                                return intVal(a) + intVal(b);
+                            }, 0);
+
+                        // Update footer
+                        $(api.column(6).footer()).html(formatNumber(total0));
+                        $(api.column(8).footer()).html(formatNumber(total1));
+                        $(api.column(10).footer()).html(formatNumber(total2));
+                        $(api.column(11).footer()).html(formatNumber(total3));
+                    }
+                }
+            });
+        }
+
+        function clearTable(table) {
+            if (table != null && table != undefined) {
+                table
+                    .clear()
+                    .destroy();
+            }
+        }
+        resetTableDetail();
+
+        function search() {
+            console.log("Search data");
+            startSpinner('btnSearch');
+            clearTable(tableDetail);
+
+            $.ajax({
+                url: "/Admin/ReportFinanceSearch",
+                data: {
+                    type: type,
+                    gameId: $("#gameId").val(),
+                    fromDate: $("#fromDate").val(),
+                    toDate: $("#toDate").val()
+                },
+                type: "POST",
+                success: function (data) {
+                    stopSpinner('btnSearch');
+                    console.log(data);
+                    if (data.error != "0" && data.error != "1") {
+                        showModal('message-dialog');
+                        $('#message-content').html(data.content.split("\n").join("<br />"));
+                    } else {
+                        updateGridDataDetail(data.data, type);
+                        resetTableDetail();
+                    }
+                },
+                error: function (data) {
+                    stopSpinner('btnSearch');
+                    console.log(data.error);
+                }
+            })
+        }
+
+        function updateGridDataDetail(val) {
+            $("#gridbody_detail").html("");
+            console.log(val);
+            var html = "";
+            if (val != undefined) {
+                if (type == '1') {
+                    for (var i = 0; i < val.length; i++) {
+                        var service = val[i];
+                        html += "<tr>";
+                        html += "<td scope='row'>" + (i + 1) + "</td>";
+                        html += "<td class='text-center'>" + service.gameName + "</td>";
+                        html += "<td class='text-right'>" + service.total + "</td>";
+                        html += "<td class='text-right'>" + service.moneyAfterTax + "</td>";
+                        html += "<td class='text-right'>" + service.moneyBeforeTax + "</td>";
+                        html += "<td class='text-right'>" + service.tax + "</td>";
+                        html += "<td class='text-right'>" + service.moneyTax + "</td>";
+                        html += "</tr>";
+                    }
+                } else if (type == '2') {
+                    for (var i = 0; i < val.length; i++) {
+                        var service = val[i];
+                        html += "<tr>";
+                        html += "<td scope='row'>" + (i + 1) + "</td>";
+                        html += "<td class='text-left'>" + service.billCode + "</td>";
+                        html += "<td class='text-left'>" + service.tranCode + "</td>";
+                        html += "<td class='text-center'>" + service.date + "</td>";
+                        html += "<td class='text-center'>" + service.gameName + "</td>";
+                        html += "<td class='text-left'>" + service.cusName + "</td>";
+                        html += "<td class='text-left'>" + service.msisdn + "</td>";
+                        html += "<td class='text-right'>" + service.quantity + "</td>";
+                        html += "<td class='text-right'>" + service.price + "</td>";
+                        html += "<td class='text-right'>" + service.moneyAfterTax + "</td>";
+                        html += "<td class='text-right'>" + service.moneyBeforeTax + "</td>";
+                        html += "<td class='text-right'>" + service.tax + "</td>";
+                        html += "<td class='text-right'>" + service.moneyTax + "</td>";
+                        html += "</tr>";
+                    }
+                } else if (type == '3') {
+                    for (var i = 0; i < val.length; i++) {
+                        var service = val[i];
+                        html += "<tr>";
+                        html += "<td scope='row'>" + (i + 1) + "</td>";
+                        html += "<td class='text-center'>" + service.gameName + "</td>";
+                        html += "<td class='text-right'>" + service.total + "</td>";
+                        html += "<td class='text-right'>" + service.moneyBeforeTax + "</td>";
+                        html += "<td class='text-right'>" + service.tax + "</td>";
+                        html += "<td class='text-right'>" + service.moneyTax + "</td>";
+                        html += "<td class='text-right'>" + service.moneyAfterTax + "</td>";
+                        html += "</tr>";
+                    }
+                } else if (type == '4') {
+                    for (var i = 0; i < val.length; i++) {
+                        var service = val[i];
+                        html += "<tr>";
+                        html += "<td scope='row'>" + (i + 1) + "</td>";
+                        html += "<td class='text-left'>" + service.tranCode + "</td>";
+                        html += "<td class='text-center'>" + service.date + "</td>";
+                        html += "<td class='text-center'>" + service.gameName + "</td>";
+                        html += "<td class='text-left'>" + service.cusName + "</td>";
+                        html += "<td class='text-left'>" + service.msisdn + "</td>";
+                        html += "<td class='text-right'>" + service.quantity + "</td>";
+                        html += "<td class='text-right'>" + service.price + "</td>";
+                        html += "<td class='text-right'>" + service.moneyBeforeTax + "</td>";
+                        html += "<td class='text-right'>" + service.tax + "</td>";
+                        html += "<td class='text-right'>" + service.moneyTax + "</td>";
+                        html += "<td class='text-right'>" + service.moneyAfterTax + "</td>";
+                        html += "</tr>";
+                    }
+                } else {
+                    console.log("Unknown type");
+                }
+            }
+            $("#gridbody_detail").html(html);
+        }
+
+        function exportExcel() {
+            console.log("Export data");
+            startSpinner('btnExportExcel');
+            $.ajax({
+                url: "/Admin/ReportFinanceExport",
+                data: {
+                    type: "@type",
+                    gameId: $("#gameId").val(),
+                    fromDate: $("#fromDate").val(),
+                    toDate: $("#toDate").val()
+                },
+                type: "POST",
+                xhr: function () {
+                    var xhr = new XMLHttpRequest();
+                    xhr.onreadystatechange = function () {
+                        if (xhr.readyState == 2) {
+                            if (xhr.status == 200) {
+                                xhr.responseType = "blob";
+                                console.log("blob");
+                            } else {
+                                xhr.responseType = "text";
+                                console.log("text");
+                            }
+                        }
+                    };
+                    return xhr;
+                },
+                success: function (data, status, xhr) {
+
+                    stopSpinner('btnExportExcel');
+                    let filename = "";
+                    let disposition = xhr.getResponseHeader('Content-Disposition');
+                    if (disposition && disposition.indexOf('attachment') !== -1) {
+                        let filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
+                        let matches = filenameRegex.exec(disposition);
+                        if (matches != null && matches[1]) filename = matches[1].replace(/['"]/g, '');
+                    }
+                    let a = document.createElement('a');
+                    let url = window.URL.createObjectURL(data);
+                    a.href = url;
+                    a.download = filename.replace('UTF-8', '');;
+                    document.body.append(a);
+                    a.click();
+                    a.remove();
+                    window.URL.revokeObjectURL(url);
+                    $("#overlay").fadeOut(300);
+                },
+                error: function (data) {
+                    stopSpinner('btnExportExcel');
+                    console.log(data.error);
+                }
+            })
+        }
+    </script>
+}

+ 302 - 0
SuperAdmin/SuperAdmin/Views/Admin/ReportLuckyDetail.cshtml

@@ -0,0 +1,302 @@
+@{
+    ViewBag.Title = "Statistics";
+    Layout = "~/Views/Shared/_Layout.cshtml";
+}
+
+@using SuperAdmin.Models;
+@using SuperAdmin.Models.Http;
+@using SuperAdmin.Controllers;
+@using SuperAdmin.Source;
+
+@model SearchMsisdnRes
+@{
+
+}
+
+<style>
+    img {
+        max-width: 100%;
+    }
+</style>
+
+<div class="content-header row">
+    <div class="content-header-left col-md-6 col-xs-12 mb-1">
+        <h2 class="content-header-title">Player</h2>
+    </div>
+    <div class="content-header-right breadcrumbs-right breadcrumbs-top col-md-6 col-xs-12">
+        <div class="breadcrumb-wrapper col-xs-12">
+            <ol class="breadcrumb">
+                <li class="breadcrumb-item">
+                    <a href="Index">Admin</a>
+                </li>
+                <li class="breadcrumb-item">
+                    <a href="#">Player</a>
+                </li>
+            </ol>
+        </div>
+    </div>
+</div>
+
+<div class="content-body">
+    <!-- Basic form layout section start -->
+    <section id="basic-form-layouts">
+        <div class="row service-height">
+            <div class="col-md-12">
+                <div class="card">
+                    <div class="card-header">
+                        <h4 class="card-title" id="basic-layout-form">Search</h4>
+                        <a class="heading-elements-toggle"><i class="icon-ellipsis font-medium-3"></i></a>
+                        <div class="heading-elements">
+                            <ul class="list-inline mb-0">
+                                <li><a data-action="collapse"><i class="icon-minus4"></i></a></li>
+                                <li><a data-action="expand"><i class="icon-expand2"></i></a></li>
+                            </ul>
+                        </div>
+                    </div>
+                    <div class="card-content collapse show">
+                        <div class="card-body">
+                            <div class="card-block">
+                                <div class="form-body">
+                                    @Html.AntiForgeryToken()
+                                    <div class="row">
+
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>Phone number</label>
+                                                <div class='input-group'>
+                                                    <input type="text" class="form-control" id="msisdn" name="msisdn">
+                                                </div>
+                                            </div>
+                                        </div>
+
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>From Date</label>
+                                                <div class='input-group'>
+                                                    <input type="text" class="form-control fromDate" id="fromDate" name="fromDate">
+                                                </div>
+                                            </div>
+                                        </div>
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>To date</label>
+                                                <div class='input-group'>
+                                                    <input type="text" class="form-control toDate" id="toDate" name="toDate">
+                                                </div>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="row">
+                                        <div class="col-md-12">
+                                            <button type="button" class="btn btn-primary" onclick="search()" id="btnSearch">
+                                                <i class="icon-search"></i> Search
+                                            </button>
+
+                                            <button type="button" class="btn btn-warning" onclick="exportExcel()" id="btnExportExcel">
+                                                <i class="icon-export"></i> Export Excel
+                                            </button>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div class="col-12">
+                <div class="card">
+                    <div class="card-content">
+                        <div class="col-md-12 table-responsive" style="padding-top: 10px">
+                            @Html.Partial("_ReportLuckyDetail", Model)
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+
+        </div>
+    </section>
+    <!-- // Basic form layout section end -->
+</div>
+
+
+
+@section Scripts {
+    <script>
+
+        var tableDetail;
+
+        $(document).ready(function () {
+
+            $(".fromDate").datetimepicker({
+                format: "DD/MM/YYYY",
+                defaultDate: moment().add(-9, 'days')
+            });
+
+            $(".toDate").datetimepicker({
+                format: "DD/MM/YYYY",
+                defaultDate: moment().endOf('day')
+            });
+
+            //search();
+        });
+
+
+        function resetTableDetail() {
+            tableDetail = $("#grid_detail").DataTable({
+                orderCellsTop: true,
+                fixedHeader: true,
+                "footerCallback": function (row, data, start, end, display) {
+                    var api = this.api(), data;
+
+                    // Remove the formatting to get integer data for summation
+                    var intVal = function (i) {
+                        return typeof i === 'string' ?
+                            i.replace(/[\$.]/g, '') * 1 :
+                            typeof i === 'number' ?
+                                i : 0;
+                    };
+
+                    // Total over all pages
+                    var total5 = api
+                        .column(5)
+                        .data()
+                        .reduce(function (a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+                    var total9 = api
+                        .column(9)
+                        .data()
+                        .reduce(function (a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+                    // Update footer
+                    $(api.column(5).footer()).html(formatNumber(total5));
+                    $(api.column(9).footer()).html(formatNumber(total9));
+                }
+            });
+        }
+
+        function clearTable(table) {
+            if (table != null && table != undefined) {
+                table
+                    .clear()
+                    .destroy();
+            }
+        }
+        resetTableDetail();
+
+        function search() {
+            console.log("Search data");
+            startSpinner('btnSearch');
+            clearTable(tableDetail);
+            $.ajax({
+                url: "@ViewBag.MyConfig.MyValue/Admin/ReportLuckyDetailSearch",
+                data: {
+                    fromDate: $("#fromDate").val(),
+                    toDate: $("#toDate").val(),
+                    channelPayment: $("#channelPayment").val(),
+                    msisdn: $("#msisdn").val()
+                },
+                type: "POST",
+                success: function (data) {
+                    stopSpinner('btnSearch');
+                    console.log(data);
+                    if (data.error != "0" && data.error != "1") {
+                        showModal('message-dialog');
+                        $('#message-content').html(data.content.split("\n").join("<br />"));
+                    } else {
+                        updateGridDataDetail(data.data);
+                        resetTableDetail();
+                    }
+                },
+                error: function (data) {
+                    stopSpinner('btnSearch');
+                    console.log(data.error);
+                }
+            })
+        }
+
+
+        function exportExcel() {
+            console.log("Export data");
+            startSpinner('btnExportExcel');
+            $.ajax({
+                url: "@ViewBag.MyConfig.MyValue/Admin/ReportLuckyDetailExport",
+                data: {
+                    fromDate: $("#fromDate").val(),
+                    toDate: $("#toDate").val(),
+                    channelPayment: $("#channelPayment").val(),
+                    msisdn: $("#msisdn").val()
+                },
+                type: "POST",
+                xhr: function () {
+                    var xhr = new XMLHttpRequest();
+                    xhr.onreadystatechange = function () {
+                        if (xhr.readyState == 2) {
+                            if (xhr.status == 200) {
+                                xhr.responseType = "blob";
+                                console.log("blob");
+                            } else {
+                                xhr.responseType = "text";
+                                console.log("text");
+                            }
+                        }
+                    };
+                    return xhr;
+                },
+                success: function (data, status, xhr) {
+
+                    stopSpinner('btnExportExcel');
+                    let filename = "";
+                    let disposition = xhr.getResponseHeader('Content-Disposition');
+                    if (disposition && disposition.indexOf('attachment') !== -1) {
+                        let filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
+                        let matches = filenameRegex.exec(disposition);
+                        if (matches != null && matches[1]) filename = matches[1].replace(/['"]/g, '');
+                    }
+                    let a = document.createElement('a');
+                    let url = window.URL.createObjectURL(data);
+                    a.href = url;
+                    a.download = filename.replace('UTF-8', '');;
+                    document.body.append(a);
+                    a.click();
+                    a.remove();
+                    window.URL.revokeObjectURL(url);
+                    $("#overlay").fadeOut(300);
+                },
+                error: function (data) {
+                    stopSpinner('btnExportExcel');
+                    console.log(data.error);
+                }
+            })
+        }
+
+        function updateGridDataDetail(val) {
+            console.log(val);
+            $("#gridbody_detail").html("");
+            var html = "";
+            if (val != undefined) {
+                for (var i = 0; i < val.length; i++) {
+                    var service = val[i];
+                    html += "<tr>";
+                    html += "<td scope='row'>" + (i + 1) + "</td>";
+                    html += "<td class='text-left'>" + (service.msisdn) + "</td>";
+                    html += "<td class='text-center'>" + (service.channel) + "</td>";
+                    html += "<td class='text-right'>" + (service.ticketId) + "</td>";
+                    html += "<td class='text-left'>" + (service.ticketCode) + "</td>";
+                    html += "<td class='text-right'>" + formatNumber(service.money) + "</td>";
+                    html += "<td class='text-center'>" + (service.buyTime) + "</td>";
+                    html += "<td class='text-center'>" + (service.drawTime) + "</td>";
+                    html += "<td class='text-center'>" + (service.result) + "</td>";
+                    html += "<td class='text-right'>" + formatNumber(service.moneyWin) + "</td>";
+                    html += "</tr>";
+                }
+            }
+            $("#gridbody_detail").html(html);
+        }
+
+    </script>
+}
+

+ 390 - 0
SuperAdmin/SuperAdmin/Views/Admin/ReportSummary.cshtml

@@ -0,0 +1,390 @@
+@{
+    ViewBag.Title = "Statistics";
+    Layout = "~/Views/Shared/_Layout.cshtml";
+}
+
+@using SuperAdmin.Models;
+@using SuperAdmin.Models.Http;
+@using SuperAdmin.Controllers;
+@using SuperAdmin.Source;
+@using Microsoft.AspNetCore.Http;
+@using SuperCms.Extensions;
+
+@model TrafficDayRes
+@{
+    var subDomain = Context.Session.GetString("subDomain");
+}
+
+<style>
+    img {
+        max-width: 100%;
+    }
+</style>
+
+<div class="content-header row">
+    <div class="content-header-left col-md-6 col-xs-12 mb-1">
+        <h2 class="content-header-title">Report Summary</h2>
+    </div>
+    <div class="content-header-right breadcrumbs-right breadcrumbs-top col-md-6 col-xs-12">
+        <div class="breadcrumb-wrapper col-xs-12">
+            <ol class="breadcrumb">
+                <li class="breadcrumb-item">
+                    <a href="Index">Admin</a>
+                </li>
+                <li class="breadcrumb-item">
+                    <a href="#">Report Summary</a>
+                </li>
+            </ol>
+        </div>
+    </div>
+</div>
+
+<div class="content-body">
+    <section id="basic-form-layouts">
+        <div class="row service-height">
+            <div class="col-md-12">
+                <div class="card">
+                    <div class="card-header">
+                        <h4 class="card-title" id="basic-layout-form">Search</h4>
+                        <a class="heading-elements-toggle"><i class="icon-ellipsis font-medium-3"></i></a>
+                        <div class="heading-elements">
+                            <ul class="list-inline mb-0">
+                                <li><a data-action="collapse"><i class="icon-minus4"></i></a></li>
+                                <li><a data-action="expand"><i class="icon-expand2"></i></a></li>
+                            </ul>
+                        </div>
+                    </div>
+                    <div class="card-content collapse show">
+                        <div class="card-body">
+                            <div class="card-block">
+                                <div class="form-body">
+                                    @Html.AntiForgeryToken()
+                                    <div class="row">
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>From Date</label>
+                                                <div class='input-group'>
+                                                    <input type="text" class="form-control fromDate" id="fromDate" name="fromDate">
+                                                </div>
+                                            </div>
+                                        </div>
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>To date</label>
+                                                <div class='input-group'>
+                                                    <input type="text" class="form-control toDate" id="toDate" name="toDate">
+                                                </div>
+                                            </div>
+                                        </div>
+                                        @* <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>Period</label>
+                                                <select class="form-control" id="isEvening" name="isEvening">
+                                                    <option value="-1" selected>-- All --</option>
+                                                    <option value="0">18:30</option>
+                                                </select>
+                                            </div>
+                                        </div> *@
+                                    </div>
+                                    <div class="row">
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>Game</label>
+                                                <select class="form-control" id="gameId" name="gameId">
+                                                    <option value="-1" selected>-- All --</option>
+                                                    <option value="4">4D Singapore Direct</option>
+                                                    <option value="5">3D Singapore Direct</option>
+                                                    <option value="6">2D Singapore Direct</option>
+                                                </select>
+                                            </div>
+                                        </div>
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>Lottery</label>
+                                                <select class="form-control" id="gameType" name="gameType">
+                                                    <option value="-1" selected>-- All --</option>
+                                                    <option value="1">Singapore Lottery</option>
+                                                </select>
+                                            </div>
+                                        </div>
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>Channel</label>
+                                                <select class="form-control" id="channelPayment" name="channelPayment">
+                                                    <option value="-1" selected>-- All --</option>
+                                                    <option value="USSD">USSD</option>
+                                                    <option value="WEB">WEB</option>
+                                                    <option value="WALLET">WALLET</option>
+                                                </select>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="row">
+                                        <div class="col-md-12">
+                                            <button type="button" class="btn btn-primary" onclick="search()" id="btnSearch">
+                                                <i class="icon-search"></i> Search
+                                            </button>
+                                            <button type="button" class="btn btn-warning" onclick="exportExcel()" id="btnExportExcel">
+                                                <i class="icon-export"></i> Export Excel
+                                            </button>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div class="col-12">
+                <div class="card">
+                    <div class="card-content">
+                        <div class="col-md-12 table-responsive" style="padding-top: 10px">
+                            @Html.Partial("_ReportSummary", Model)
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+        </div>
+    </section>
+    <!-- // Basic form layout section end -->
+</div>
+
+
+@section Scripts {
+    <script>
+
+        var tableDetail;
+
+        $(document).ready(function () {
+
+            $(".fromDate").datetimepicker({
+                format: "DD/MM/YYYY",
+                defaultDate: moment().add(-9, 'days')
+            });
+
+            $(".toDate").datetimepicker({
+                format: "DD/MM/YYYY",
+                defaultDate: moment().endOf('day')
+            });
+
+            //$('#grid_reward_detail thead tr').clone(true).appendTo('#grid_reward_detail thead');
+
+            //$('#grid_reward_detail thead tr:eq(1) th').each(function (i) {
+            //    var title = $(this).text();
+            //    if (title != undefined && title != "") {
+            //        $(this).html('<input type="text" placeholder="Search ' + title + '" />');
+
+            //        $('input', this).on('keyup change', function () {
+            //            if (tableDetail.column(i).search() !== this.value) {
+            //                tableDetail
+            //                    .column(i)
+            //                    .search(this.value)
+            //                    .draw();
+            //            }
+            //        });
+            //    }
+            //});
+
+            search();
+        });
+
+
+
+        function resetTableDetail() {
+            tableDetail = $("#grid_detail").DataTable({
+                orderCellsTop: true,
+                fixedHeader: true,
+                "footerCallback": function (row, data, start, end, display) {
+                    var api = this.api(), data;
+
+                    // Remove the formatting to get integer data for summation
+                    var intVal = function (i) {
+                        return typeof i === 'string' ?
+                            i.replace(/[\$.]/g, '') * 1 :
+                            typeof i === 'number' ?
+                                i : 0;
+                    };
+
+                    // Total over all pages
+                    var total0 = api
+                        .column(3)
+                        .data()
+                        .reduce(function (a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+                    var total1 = api
+                        .column(4)
+                        .data()
+                        .reduce(function (a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+                    var total2 = api
+                        .column(5)
+                        .data()
+                        .reduce(function (a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+                    var total3 = api
+                        .column(6)
+                        .data()
+                        .reduce(function (a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+                    var total4 = api
+                        .column(7)
+                        .data()
+                        .reduce(function (a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+                    var total5 = api
+                        .column(8)
+                        .data()
+                        .reduce(function (a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+                    var total6 = api
+                        .column(2)
+                        .data()
+                        .reduce(function (a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+                    console.log(total0);
+                    console.log(total1);
+                    console.log(total2);
+                    // Update footer
+                    $(api.column(2).footer()).html(formatNumber(total6));
+                    $(api.column(3).footer()).html(formatNumber(total0));
+                    $(api.column(4).footer()).html(formatNumber(total1));
+                    $(api.column(5).footer()).html(formatNumber(total2));
+                    $(api.column(6).footer()).html(formatNumber(total3));
+                    $(api.column(7).footer()).html(formatNumber(total4));
+                    $(api.column(8).footer()).html(formatNumber(total5));
+                }
+            });
+        }
+
+        function clearTable(table) {
+            if (table != null && table != undefined) {
+                table
+                    .clear()
+                    .destroy();
+            }
+        }
+        resetTableDetail();
+
+        function search() {
+            console.log("Search data");
+            startSpinner('btnSearch');
+            clearTable(tableDetail);
+            console.log("@subDomain");
+            $.ajax({
+                url: urlConfig("/Admin/ReportSummarySearch"),
+                data: {
+                    gameId: $("#gameId").val(),
+                    fromDate: $("#fromDate").val(),
+                    toDate: $("#toDate").val(),
+                    gameType: $("#gameType").val(),
+                    isEvening: $("#isEvening").val(),
+                    channelPayment: $("#channelPayment").val()
+                },
+                type: "POST",
+                success: function (data) {
+                    stopSpinner('btnSearch');
+                    console.log(data);
+                    if (data.error != "0" && data.error != "1") {
+                        showModal('message-dialog');
+                        $('#message-content').html(data.content.split("\n").join("<br />"));
+                    } else {
+                        updateGridDataDetail(data.data);
+                        resetTableDetail();
+                    }
+                },
+                error: function (data) {
+                    stopSpinner('btnSearch');
+                    console.log(data.error);
+                }
+            })
+        }
+
+        function updateGridDataDetail(val) {
+            console.log(val);
+            $("#gridbody_detail").html("");
+            var html = "";
+            if (val != undefined) {
+                for (var i = 0; i < val.length; i++) {
+                    var service = val[i];
+                    html += "<tr>";
+                    html += "<td scope='row'>" + (i + 1) + "</td>";
+                    html += "<td class='text-center'>" + service.date + "</td>";
+                    html += "<td class='text-right'>" + formatNumber(service.player) + "</td>";
+                    html += "<td class='text-right'>" + formatNumber(service.ticket) + "</td>";
+                    html += "<td class='text-right'>" + formatNumber(service.money) + "</td>";
+                    html += "<td class='text-right'>" + formatNumber(service.palyerWin) + "</td>";
+                    html += "<td class='text-right'>" + formatNumber(service.ticketWin) + "</td>";
+                    html += "<td class='text-right'>" + formatNumber(service.moneyWin) + "</td>";
+                    html += "<td class='text-right'>" + formatNumber(service.benefit) + "</td>";
+                    html += "</tr>";
+                }
+            }
+            $("#gridbody_detail").html(html);
+        }
+
+        function exportExcel() {
+            console.log("Export data");
+            startSpinner('btnExportExcel');
+            $.ajax({
+                url: urlConfig("/Admin/ReportSummaryExport"),
+                data: {
+                    gameId: $("#gameId").val(),
+                    fromDate: $("#fromDate").val(),
+                    toDate: $("#toDate").val(),
+                    gameType: $("#gameType").val(),
+                    isEvening: $("#isEvening").val(),
+                    channelPayment: $("#channelPayment").val()
+                },
+                type: "POST",
+                xhr: function () {
+                    var xhr = new XMLHttpRequest();
+                    xhr.onreadystatechange = function () {
+                        if (xhr.readyState == 2) {
+                            if (xhr.status == 200) {
+                                xhr.responseType = "blob";
+                                console.log("blob");
+                            } else {
+                                xhr.responseType = "text";
+                                console.log("text");
+                            }
+                        }
+                    };
+                    return xhr;
+                },
+                success: function (data, status, xhr) {
+
+                    stopSpinner('btnExportExcel');
+                    let filename = "";
+                    let disposition = xhr.getResponseHeader('Content-Disposition');
+                    if (disposition && disposition.indexOf('attachment') !== -1) {
+                        let filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
+                        let matches = filenameRegex.exec(disposition);
+                        if (matches != null && matches[1]) filename = matches[1].replace(/['"]/g, '');
+                    }
+                    let a = document.createElement('a');
+                    let url = window.URL.createObjectURL(data);
+                    a.href = url;
+                    a.download = filename.replace('UTF-8', '');;
+                    document.body.append(a);
+                    a.click();
+                    a.remove();
+                    window.URL.revokeObjectURL(url);
+                    $("#overlay").fadeOut(300);
+                },
+                error: function (data) {
+                    stopSpinner('btnExportExcel');
+                    console.log(data.error);
+                }
+            })
+        }
+    </script>
+}

+ 400 - 0
SuperAdmin/SuperAdmin/Views/Admin/ReportSummaryBolet.cshtml

@@ -0,0 +1,400 @@
+@{
+    ViewBag.Title = "Statistics";
+    Layout = "~/Views/Shared/_Layout.cshtml";
+}
+
+@using SuperAdmin.Models;
+@using SuperAdmin.Models.Http;
+@using SuperAdmin.Controllers;
+@using SuperAdmin.Source;
+
+@model TrafficDayRes
+@{
+
+}
+
+<style>
+    img {
+        max-width: 100%;
+    }
+</style>
+
+<div class="content-header row">
+    <div class="content-header-left col-md-6 col-xs-12 mb-1">
+        <h2 class="content-header-title">Report Summary BOLET</h2>
+    </div>
+    <div class="content-header-right breadcrumbs-right breadcrumbs-top col-md-6 col-xs-12">
+        <div class="breadcrumb-wrapper col-xs-12">
+            <ol class="breadcrumb">
+                <li class="breadcrumb-item">
+                    <a href="Index">Admin</a>
+                </li>
+                <li class="breadcrumb-item">
+                    <a href="#">Report Summary BOLET</a>
+                </li>
+            </ol>
+        </div>
+    </div>
+</div>
+
+<div class="content-body">
+    <!-- Basic form layout section start -->
+    <section id="basic-form-layouts">
+        <div class="row service-height">
+            <div class="col-md-12">
+                <div class="card">
+                    <div class="card-header">
+                        <h4 class="card-title" id="basic-layout-form">Search</h4>
+                        <a class="heading-elements-toggle"><i class="icon-ellipsis font-medium-3"></i></a>
+                        <div class="heading-elements">
+                            <ul class="list-inline mb-0">
+                                <li><a data-action="collapse"><i class="icon-minus4"></i></a></li>
+                                <li><a data-action="expand"><i class="icon-expand2"></i></a></li>
+                            </ul>
+                        </div>
+                    </div>
+                    <div class="card-content collapse show">
+                        <div class="card-body">
+                            <div class="card-block">
+                                <div class="form-body">
+                                    @Html.AntiForgeryToken()
+                                    <div class="row">
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>From Date</label>
+                                                <div class='input-group'>
+                                                    <input type="text" class="form-control fromDate" id="fromDate" name="fromDate">
+                                                </div>
+                                            </div>
+                                        </div>
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>To date</label>
+                                                <div class='input-group'>
+                                                    <input type="text" class="form-control toDate" id="toDate" name="toDate">
+                                                </div>
+                                            </div>
+                                        </div>
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>Midday/Evening</label>
+                                                <select class="form-control" id="isEvening" name="isEvening">
+                                                    <option value="-1" selected>-- All --</option>
+                                                    <option value="0">Midday</option>
+                                                    <option value="1">Evening</option>
+                                                </select>
+                                            </div>
+                                        </div>
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>Lottery</label>
+                                                <select class="form-control" id="gameType" name="gameType">
+                                                    <option value="-1" selected>-- All --</option>
+                                                    <option value="1">New York</option>
+                                                    <option value="2">Florida</option>
+                                                </select>
+                                            </div>
+                                        </div>
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>Channel</label>
+                                                <select class="form-control" id="channelPayment" name="channelPayment">
+                                                    <option value="-1" selected>-- All --</option>
+                                                    <option value="USSD">USSD</option>
+                                                    <option value="WEB">WEB</option>
+                                                    <option value="WALLET">WALLET</option>
+                                                </select>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="row">
+                                        <div class="col-md-12">
+                                            <button type="button" class="btn btn-primary" onclick="search()" id="btnSearch">
+                                                <i class="icon-search"></i> Search
+                                            </button>
+                                            <button type="button" class="btn btn-warning" onclick="exportExcel()" id="btnExportExcel">
+                                                <i class="icon-export"></i> Export Excel
+                                            </button>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div class="col-12">
+                <div class="card">
+                    <div class="card-content">
+                        <div class="col-md-12 table-responsive" style="padding-top: 10px">
+                            @Html.Partial("_ReportSummaryBolet", Model)
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+        </div>
+    </section>
+    <!-- // Basic form layout section end -->
+</div>
+
+
+@section Scripts {
+    <script>
+
+        var tableDetail;
+
+        $(document).ready(function () {
+
+            $(".fromDate").datetimepicker({
+                format: "DD/MM/YYYY",
+                defaultDate: moment().add(-9, 'days')
+            });
+
+            $(".toDate").datetimepicker({
+                format: "DD/MM/YYYY",
+                defaultDate: moment().endOf('day')
+            });
+
+            //$('#grid_reward_detail thead tr').clone(true).appendTo('#grid_reward_detail thead');
+
+            //$('#grid_reward_detail thead tr:eq(1) th').each(function (i) {
+            //    var title = $(this).text();
+            //    if (title != undefined && title != "") {
+            //        $(this).html('<input type="text" placeholder="Search ' + title + '" />');
+
+            //        $('input', this).on('keyup change', function () {
+            //            if (tableDetail.column(i).search() !== this.value) {
+            //                tableDetail
+            //                    .column(i)
+            //                    .search(this.value)
+            //                    .draw();
+            //            }
+            //        });
+            //    }
+            //});
+
+            search();
+        });
+
+
+
+        function resetTableDetail() {
+            tableDetail = $("#grid_detail").DataTable({
+                orderCellsTop: true,
+                fixedHeader: true,
+                "footerCallback": function (row, data, start, end, display) {
+                    var api = this.api(), data;
+
+                    // Remove the formatting to get integer data for summation
+                    var intVal = function (i) {
+                        return typeof i === 'string' ?
+                            i.replace(/[\$.]/g, '') * 1 :
+                            typeof i === 'number' ?
+                                i : 0;
+                    };
+
+                    // Total over all pages
+                    var total0 = api
+                        .column(3)
+                        .data()
+                        .reduce(function (a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+                    var total1 = api
+                        .column(4)
+                        .data()
+                        .reduce(function (a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+                    var total2 = api
+                        .column(5)
+                        .data()
+                        .reduce(function (a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+                    var total3 = api
+                        .column(6)
+                        .data()
+                        .reduce(function (a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+                    var total4 = api
+                        .column(7)
+                        .data()
+                        .reduce(function (a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+                    var total5 = api
+                        .column(8)
+                        .data()
+                        .reduce(function (a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+                    var total6 = api
+                        .column(2)
+                        .data()
+                        .reduce(function (a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+
+                    var total7 = api
+                        .column(9)
+                        .data()
+                        .reduce(function (a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+
+                    var total8 = api
+                        .column(10)
+                        .data()
+                        .reduce(function (a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+
+                    var total9 = api
+                        .column(11)
+                        .data()
+                        .reduce(function (a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+
+                    // Update footer
+                    $(api.column(2).footer()).html(formatNumber(total6));
+                    $(api.column(3).footer()).html(formatNumber(total0));
+                    $(api.column(4).footer()).html(formatNumber(total1));
+                    $(api.column(5).footer()).html(formatNumber(total2));
+                    $(api.column(6).footer()).html(formatNumber(total3));
+                    $(api.column(7).footer()).html(formatNumber(total4));
+                    $(api.column(8).footer()).html(formatNumber(total5));
+                    $(api.column(9).footer()).html(formatNumber(total7));
+                    $(api.column(10).footer()).html(formatNumber(total8));
+                    $(api.column(11).footer()).html(formatNumber(total9));
+                }
+            });
+        }
+
+        function clearTable(table) {
+            if (table != null && table != undefined) {
+                table
+                    .clear()
+                    .destroy();
+            }
+        }
+        resetTableDetail();
+
+        function search() {
+            console.log("Search data");
+            startSpinner('btnSearch');
+            clearTable(tableDetail);
+            $.ajax({
+                url: urlConfig("/Admin/ReportSummaryBoletSearch"),
+                data: {
+                    fromDate: $("#fromDate").val(),
+                    toDate: $("#toDate").val(),
+                    gameType: $("#gameType").val(),
+                    isEvening: $("#isEvening").val(),
+                    channelPayment: $("#channelPayment").val()
+                },
+                type: "POST",
+                success: function (data) {
+                    stopSpinner('btnSearch');
+                    console.log(data);
+                    if (data.error != "0" && data.error != "1") {
+                        showModal('message-dialog');
+                        $('#message-content').html(data.content.split("\n").join("<br />"));
+                    } else {
+                        updateGridDataDetail(data.data);
+                        resetTableDetail();
+                    }
+                },
+                error: function (data) {
+                    stopSpinner('btnSearch');
+                    console.log(data.error);
+                }
+            })
+        }
+
+        function updateGridDataDetail(val) {
+            console.log(val);
+            $("#gridbody_detail").html("");
+            var html = "";
+            if (val != undefined) {
+                for (var i = 0; i < val.length; i++) {
+                    var service = val[i];
+                    html += "<tr>";
+                    html += "<td scope='row'>" + (i + 1) + "</td>";
+                    html += "<td class='text-center'>" + service.date + "</td>";
+                    html += "<td class='text-right'>" + formatNumber(service.player) + "</td>";
+                    html += "<td class='text-right'>" + formatNumber(service.ticket) + "</td>";
+                    html += "<td class='text-right'>" + formatNumber(service.money) + "</td>";
+                    html += "<td class='text-right'>" + formatNumber(service.moneyWin) + "</td>";
+                    html += "<td class='text-right'>" + formatNumber(service.ticketWinLot1) + "</td>";
+                    html += "<td class='text-right'>" + formatNumber(service.moneyWinLot1) + "</td>";
+                    html += "<td class='text-right'>" + formatNumber(service.ticketWinLot2) + "</td>";
+                    html += "<td class='text-right'>" + formatNumber(service.moneyWinLot2) + "</td>";
+                    html += "<td class='text-right'>" + formatNumber(service.ticketWinLot3) + "</td>";
+                    html += "<td class='text-right'>" + formatNumber(service.moneyWinLot3) + "</td>";
+                    html += "</tr>";
+                }
+            }
+            $("#gridbody_detail").html(html);
+        }
+
+        function exportExcel() {
+            console.log("Export data");
+            startSpinner('btnExportExcel');
+            $.ajax({
+                url: urlConfig("/Admin/ReportSummaryBoletExport"),
+                data: {
+                    fromDate: $("#fromDate").val(),
+                    toDate: $("#toDate").val(),
+                    gameType: $("#gameType").val(),
+                    isEvening: $("#isEvening").val(),
+                    channelPayment: $("#channelPayment").val()
+                },
+                type: "POST",
+                xhr: function () {
+                    var xhr = new XMLHttpRequest();
+                    xhr.onreadystatechange = function () {
+                        if (xhr.readyState == 2) {
+                            if (xhr.status == 200) {
+                                xhr.responseType = "blob";
+                                console.log("blob");
+                            } else {
+                                xhr.responseType = "text";
+                                console.log("text");
+                            }
+                        }
+                    };
+                    return xhr;
+                },
+                success: function (data, status, xhr) {
+
+                    stopSpinner('btnExportExcel');
+                    let filename = "";
+                    let disposition = xhr.getResponseHeader('Content-Disposition');
+                    if (disposition && disposition.indexOf('attachment') !== -1) {
+                        let filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
+                        let matches = filenameRegex.exec(disposition);
+                        if (matches != null && matches[1]) filename = matches[1].replace(/['"]/g, '');
+                    }
+                    let a = document.createElement('a');
+                    let url = window.URL.createObjectURL(data);
+                    a.href = url;
+                    a.download = filename.replace('UTF-8', '');;
+                    document.body.append(a);
+                    a.click();
+                    a.remove();
+                    window.URL.revokeObjectURL(url);
+                    $("#overlay").fadeOut(300);
+                },
+                error: function (data) {
+                    stopSpinner('btnExportExcel');
+                    console.log(data.error);
+                }
+            })
+        }
+    </script>
+}

+ 336 - 0
SuperAdmin/SuperAdmin/Views/Admin/ReportSummaryLucky.cshtml

@@ -0,0 +1,336 @@
+@{
+    ViewBag.Title = "Statistics";
+    Layout = "~/Views/Shared/_Layout.cshtml";
+}
+
+@using SuperAdmin.Models;
+@using SuperAdmin.Models.Http;
+@using SuperAdmin.Controllers;
+@using SuperAdmin.Source;
+@using Microsoft.AspNetCore.Http;
+@using SuperCms.Extensions;
+
+@model TrafficDayRes
+@{
+    var subDomain = Context.Session.GetString("subDomain");
+}
+
+<style>
+    img {
+        max-width: 100%;
+    }
+</style>
+
+<div class="content-header row">
+    <div class="content-header-left col-md-6 col-xs-12 mb-1">
+        <h2 class="content-header-title">Report Summary</h2>
+    </div>
+    <div class="content-header-right breadcrumbs-right breadcrumbs-top col-md-6 col-xs-12">
+        <div class="breadcrumb-wrapper col-xs-12">
+            <ol class="breadcrumb">
+                <li class="breadcrumb-item">
+                    <a href="Index">Admin</a>
+                </li>
+                <li class="breadcrumb-item">
+                    <a href="#">Report Summary Lucky Loto</a>
+                </li>
+            </ol>
+        </div>
+    </div>
+</div>
+
+<div class="content-body">
+    <!-- Basic form layout section start -->
+    <section id="basic-form-layouts">
+        <div class="row service-height">
+            <div class="col-md-12">
+                <div class="card">
+                    <div class="card-header">
+                        <h4 class="card-title" id="basic-layout-form">Search</h4>
+                        <a class="heading-elements-toggle"><i class="icon-ellipsis font-medium-3"></i></a>
+                        <div class="heading-elements">
+                            <ul class="list-inline mb-0">
+                                <li><a data-action="collapse"><i class="icon-minus4"></i></a></li>
+                                <li><a data-action="expand"><i class="icon-expand2"></i></a></li>
+                            </ul>
+                        </div>
+                    </div>
+                    <div class="card-content collapse show">
+                        <div class="card-body">
+                            <div class="card-block">
+                                <div class="form-body">
+                                    @Html.AntiForgeryToken()
+                                    <div class="row">
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>From Date</label>
+                                                <div class='input-group'>
+                                                    <input type="text" class="form-control fromDate" id="fromDate" name="fromDate">
+                                                </div>
+                                            </div>
+                                        </div>
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>To date</label>
+                                                <div class='input-group'>
+                                                    <input type="text" class="form-control toDate" id="toDate" name="toDate">
+                                                </div>
+                                            </div>
+                                        </div>
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>Channel</label>
+                                                <select class="form-control" id="channelPayment" name="channelPayment">
+                                                    <option value="-1" selected>-- All --</option>
+                                                    <option value="USSD">USSD</option>
+                                                    <option value="WEB">WEB</option>
+                                                    <option value="WALLET">WALLET</option>
+                                                </select>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="row">
+                                        <div class="col-md-12">
+                                            <button type="button" class="btn btn-primary" onclick="search()" id="btnSearch">
+                                                <i class="icon-search"></i> Search
+                                            </button>
+                                            <button type="button" class="btn btn-warning" onclick="exportExcel()" id="btnExportExcel">
+                                                <i class="icon-export"></i> Export Excel
+                                            </button>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div class="col-12">
+                <div class="card">
+                    <div class="card-content">
+                        <div class="col-md-12 table-responsive" style="padding-top: 10px">
+                            @Html.Partial("_ReportSummaryLucky", Model)
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+        </div>
+    </section>
+    <!-- // Basic form layout section end -->
+</div>
+
+
+@section Scripts {
+    <script>
+
+        var tableDetail;
+
+        $(document).ready(function() {
+
+            $(".fromDate").datetimepicker({
+                format: "DD/MM/YYYY",
+                defaultDate: moment().add(-9, 'days')
+            });
+
+            $(".toDate").datetimepicker({
+                format: "DD/MM/YYYY",
+                defaultDate: moment().endOf('day')
+            }); 
+
+            search();
+        });
+
+
+
+        function resetTableDetail() {
+            tableDetail = $("#grid_detail").DataTable({
+                orderCellsTop: true,
+                fixedHeader: true,
+                "footerCallback": function(row, data, start, end, display) {
+                    var api = this.api(), data;
+
+                    // Remove the formatting to get integer data for summation
+                    var intVal = function(i) {
+                        return typeof i === 'string' ?
+                            i.replace(/[\$.]/g, '') * 1 :
+                            typeof i === 'number' ?
+                                i : 0;
+                    };
+
+                    // Total over all pages
+                    var total0 = api
+                        .column(3)
+                        .data()
+                        .reduce(function(a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+                    var total1 = api
+                        .column(4)
+                        .data()
+                        .reduce(function(a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+                    var total2 = api
+                        .column(5)
+                        .data()
+                        .reduce(function(a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+                    var total3 = api
+                        .column(6)
+                        .data()
+                        .reduce(function(a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+                    var total4 = api
+                        .column(7)
+                        .data()
+                        .reduce(function(a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+                    var total5 = api
+                        .column(8)
+                        .data()
+                        .reduce(function(a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+                    var total6 = api
+                        .column(2)
+                        .data()
+                        .reduce(function(a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+                    console.log(total0);
+                    console.log(total1);
+                    console.log(total2);
+                    // Update footer
+                    $(api.column(2).footer()).html(formatNumber(total6));
+                    $(api.column(3).footer()).html(formatNumber(total0));
+                    $(api.column(4).footer()).html(formatNumber(total1));
+                    $(api.column(5).footer()).html(formatNumber(total2));
+                    $(api.column(6).footer()).html(formatNumber(total3));
+                    $(api.column(7).footer()).html(formatNumber(total4));
+                    $(api.column(8).footer()).html(formatNumber(total5));
+                }
+            });
+        }
+
+        function clearTable(table) {
+            if (table != null && table != undefined) {
+                table
+                    .clear()
+                    .destroy();
+            }
+        }
+        resetTableDetail();
+
+        function search() {
+            console.log("Search data");
+            startSpinner('btnSearch');
+            clearTable(tableDetail);
+            console.log("@subDomain");
+            $.ajax({
+                url: urlConfig("/Admin/ReportSummaryLuckySearch"),
+                data: {
+                    fromDate: $("#fromDate").val(),
+                    toDate: $("#toDate").val(),
+                    channelPayment: $("#channelPayment").val()
+                },
+                type: "POST",
+                success: function(data) {
+                    stopSpinner('btnSearch');
+                    console.log(data);
+                    if (data.error != "0" && data.error != "1") {
+                        showModal('message-dialog');
+                        $('#message-content').html(data.content.split("\n").join("<br />"));
+                    } else {
+                        updateGridDataDetail(data.data);
+                        resetTableDetail();
+                    }
+                },
+                error: function(data) {
+                    stopSpinner('btnSearch');
+                    console.log(data.error);
+                }
+            })
+        }
+
+        function updateGridDataDetail(val) {
+            console.log(val);
+            $("#gridbody_detail").html("");
+            var html = "";
+            if (val != undefined) {
+                for (var i = 0; i < val.length; i++) {
+                    var service = val[i];
+                    html += "<tr>";
+                    html += "<td scope='row'>" + (i + 1) + "</td>";
+                    html += "<td class='text-center'>" + service.date + "</td>";
+                    html += "<td class='text-right'>" + formatNumber(service.player) + "</td>";
+                    html += "<td class='text-right'>" + formatNumber(service.ticket) + "</td>";
+                    html += "<td class='text-right'>" + formatNumber(service.money) + "</td>";
+                    html += "<td class='text-right'>" + formatNumber(service.palyerWin) + "</td>";
+                    html += "<td class='text-right'>" + formatNumber(service.ticketWin) + "</td>";
+                    html += "<td class='text-right'>" + formatNumber(service.moneyWin) + "</td>";
+                    html += "<td class='text-right'>" + formatNumber(service.benefit) + "</td>";
+                    html += "</tr>";
+                }
+            }
+            $("#gridbody_detail").html(html);
+        }
+
+        function exportExcel() {
+            console.log("Export data");
+            startSpinner('btnExportExcel');
+            $.ajax({
+                url: urlConfig("/Admin/ReportSummaryLuckyExport"),
+                data: {
+                    fromDate: $("#fromDate").val(),
+                    toDate: $("#toDate").val(),
+                    channelPayment: $("#channelPayment").val()
+                },
+                type: "POST",
+                xhr: function() {
+                    var xhr = new XMLHttpRequest();
+                    xhr.onreadystatechange = function() {
+                        if (xhr.readyState == 2) {
+                            if (xhr.status == 200) {
+                                xhr.responseType = "blob";
+                                console.log("blob");
+                            } else {
+                                xhr.responseType = "text";
+                                console.log("text");
+                            }
+                        }
+                    };
+                    return xhr;
+                },
+                success: function(data, status, xhr) {
+
+                    stopSpinner('btnExportExcel');
+                    let filename = "";
+                    let disposition = xhr.getResponseHeader('Content-Disposition');
+                    if (disposition && disposition.indexOf('attachment') !== -1) {
+                        let filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
+                        let matches = filenameRegex.exec(disposition);
+                        if (matches != null && matches[1]) filename = matches[1].replace(/['"]/g, '');
+                    }
+                    let a = document.createElement('a');
+                    let url = window.URL.createObjectURL(data);
+                    a.href = url;
+                    a.download = filename.replace('UTF-8', '');;
+                    document.body.append(a);
+                    a.click();
+                    a.remove();
+                    window.URL.revokeObjectURL(url);
+                    $("#overlay").fadeOut(300);
+                },
+                error: function(data) {
+                    stopSpinner('btnExportExcel');
+                    console.log(data.error);
+                }
+            })
+        }
+    </script>
+}

+ 592 - 0
SuperAdmin/SuperAdmin/Views/Admin/Results.cshtml

@@ -0,0 +1,592 @@
+@{
+    ViewBag.Title = "Lucky Power Results";
+    Layout = "~/Views/Shared/_Layout.cshtml";
+}
+
+@using SuperAdmin.Models;
+@using SuperAdmin.Models.Http;
+@using SuperAdmin.Controllers;
+@using SuperAdmin.Source;
+
+@model TermGetListRes
+@{
+    //string gameId = ViewBag.gameId;
+}
+
+<style>
+    img {
+        max-width: 100%;
+    }
+</style>
+@*<input type="hidden" value="@gameId" id="gameId" />*@
+<div class="content-header row">
+    <div class="content-header-left col-md-6 col-xs-12 mb-1">
+        <h2 class="content-header-title">Results</h2>
+    </div>
+    <div class="content-header-right breadcrumbs-right breadcrumbs-top col-md-6 col-xs-12">
+        <div class="breadcrumb-wrapper col-xs-12">
+            <ol class="breadcrumb">
+                <li class="breadcrumb-item">
+                    <a href="/Admin/Index">Admin</a>
+                </li>
+                <li class="breadcrumb-item">
+                    <a href="#">Results</a>
+                </li>
+            </ol>
+        </div>
+    </div>
+</div>
+
+<div class="content-body">
+    <!-- Basic form layout section start -->
+    <section id="basic-form-layouts">
+        <div class="row service-height">
+            <div class="col-md-12">
+                <div class="card">
+                    <div class="card-header">
+                        <h4 class="card-title" id="basic-layout-form">Search</h4>
+                        <a class="heading-elements-toggle"><i class="icon-ellipsis font-medium-3"></i></a>
+                        <div class="heading-elements">
+                            <ul class="list-inline mb-0">
+                                <li><a data-action="collapse"><i class="icon-minus4"></i></a></li>
+                                <li><a data-action="expand"><i class="icon-expand2"></i></a></li>
+                            </ul>
+                        </div>
+                    </div>
+                    <div class="card-content collapse show">
+                        <div class="card-body">
+                            <div class="card-block">
+                                <div class="form-body">
+                                    @Html.AntiForgeryToken()
+                                    <div class="row">
+                                        <div class="col-md-3 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>From Date</label>
+                                                <div class='input-group'>
+                                                    <input type="text" class="form-control fromDate" id="fromDateSearch" name="fromDateSearch">
+                                                </div>
+                                            </div>
+                                        </div>
+                                        <div class="col-md-3 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>To date</label>
+                                                <div class='input-group'>
+                                                    <input type="text" class="form-control toDate" id="toDateSearch" name="toDateSearch">
+                                                </div>
+                                            </div>
+                                        </div>
+                                        <div class="col-md-3 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>Status</label>
+                                                <select class="form-control" id="type" name="type">
+                                                    <option value="-1" selected>-- All --</option>
+                                                    <option value="0">Not yet result</option>
+                                                    <option value="1">Already result</option>
+                                                </select>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="row">
+                                        <div class="col-md-12">
+                                            <button type="button" class="btn btn-primary" onclick="search()" id="btnSearch">
+                                                <i class="icon-search"></i> Search
+                                            </button>
+                                            @*<button type="button" class="btn btn-warning" onclick="exportData()" id="btnExport">
+                                                    <i class="icon-call-out"></i> Export
+                                                </button>*@
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div class="col-12">
+                <div class="card">
+                    <div class="card-content">
+                        <div class="col-md-12 table-responsive" style="padding-top: 10px" id="partial-content">
+                            @Html.Partial("_Result", Model)
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+        </div>
+    </section>
+    <!-- // Basic form layout section end -->
+</div>
+
+<div class="modal fade text-xs-left" id="modal-add-service" tabindex="-1" role="dialog" aria-labelledby="myModalLabel17" style="display: none;" aria-hidden="true">
+    <div class="modal-dialog modal-lg" role="document">
+        <div class="modal-content">
+            <div class="modal-header">
+                <h4 class="modal-title" id="modalLabelService">Update result manual</h4>
+                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+                    <span aria-hidden="true">×</span>
+                </button>
+            </div>
+            <input type="hidden" id="id" />
+            <div class="modal-body">
+                <div class="row" id="div-info">
+                    <div class="col-md-4">
+                        <div class="form-group">
+                            <label for="date">Date</label>
+                            <input type="text" class="form-control fromDateTime" id="date_random" name="date_random" autocomplete="off" readonly>
+                        </div>
+                    </div>
+                    <div class="col-md-4">
+                        <div class="form-group">
+                            <label for="wsName">Lottery</label>
+                            <select class="form-control" id="gameId" name="gameId" disabled>
+                                <option value="4">Singapore</option>
+                            </select>
+                        </div>
+                    </div>
+                    <div class="col-md-4">
+                        <div class="form-group">
+                            <label for="wsdl">Drawn time</label>
+                            <input type="text" class="form-control" id="time_random" name="time_random" autocomplete="off" readonly>
+                        </div>
+                    </div>
+                    <input type="hidden" name="result" id="result" />
+                    <div class="row col-12" id="div-result">
+                        <div class="col-md-4">
+                            <div class="form-group">
+                                <label for="result1" id="lblResult1">1st Prize</label>
+                                <div class="input-group">
+                                    <input type="text" class="form-control text-danger" id="result1" name="result1" maxlength="4" min="0000" />
+                                </div>
+                            </div>
+                        </div>
+                        <div class="col-md-4">
+                            <div class="form-group">
+                                <label for="result2" id="lblResult2">2nd Prize</label>
+                                <div class="input-group">
+                                    <input type="text" class="form-control text-danger" id="result2" name="result2" maxlength="4" min="0000" />
+                                </div>
+                            </div>
+                        </div>
+                        <div class="col-md-4">
+                            <div class="form-group">
+                                <label for="result3" id="lblResult3">3st Prize</label>
+                                <div class="input-group">
+                                    <input type="text" class="form-control text-danger" id="result3" name="result3" maxlength="4" min="0000" />
+                                </div>
+                            </div>
+                        </div>
+                        <div class="col-md-12">
+                            <div class="form-group">
+                                <label for="result4" id="lblResult4">Starter Prize</label>
+                                <div class="input-group">
+                                    <input type="text" class="form-control text-danger" id="result4" name="result4" />
+                                </div>
+                            </div>
+                        </div>
+                        <div class="col-md-12">
+                            <div class="form-group">
+                                <label for="result5" id="lblResult5">Consolation Prize</label>
+                                <div class="input-group">
+                                    <input type="text" class="form-control text-danger" id="result5" name="result5"/>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="row" id="div-action">
+                    <div class="col-12">
+                        <label id="lblWarning" class="text-danger"></label>
+                    </div>
+                    <div class="col-12" style="text-align: right">
+                        <button type="button" id="btnAddUpdate" class="btn btn-outline-primary" onclick="addUpdateAction()">Submit result</button>
+                        <button type="button" class="btn grey btn-outline-secondary" data-dismiss="modal">Close</button>
+                    </div>
+                </div>
+                @*<div class="row" id="div-approve">
+                    @if (!BaseController.UsingVsa() || ViewBag.Role == BaseController.RoleAdminSale)
+                    {
+                        <div class="col-md-12">
+                            <div class="form-group">
+                                <label for="wsdl">Note</label>
+                                <input type="text" class="form-control" id="note" name="note" autocomplete="off">
+                            </div>
+                        </div>
+                        <div class="col-md-12">
+                            <button type="button" id="btnApprove" class="btn btn-outline-success" onclick="approve()">Approve</button>
+                            <button type="button" id="btnReject" class="btn btn-outline-danger" onclick="reject()">Reject</button>
+                            <button type="button" class="btn grey btn-outline-secondary" data-dismiss="modal">Close</button>
+                        </div>
+                    }*@
+            </div>
+
+            @*<div class="row">
+                    <div class="col-12" style="padding-top: 10px">
+                        Change history
+                    </div>
+                    <div class="col-12" style="padding-top: 10px">
+                        @Html.Partial("_ResultHis")
+                    </div>
+                </div>*@
+        </div>
+        <div class="modal-footer">
+            @*<button type="button" class="btn grey btn-outline-secondary" data-dismiss="modal">Close</button>
+                <button type="button" id="btnAdd" class="btn btn-outline-primary" onclick="addUpdateAction()">Add</button>
+                <button type="button" id="btnUpdate" class="btn btn-outline-primary" onclick="addUpdateAction()">Save Info</button>*@
+
+        </div>
+    </div>
+</div>
+</div>
+
+
+
+@section Scripts {
+    <script>
+
+        $(document).ready(function () {
+
+            $(".fromDate").datetimepicker({
+                format: "DD/MM/YYYY",
+                defaultDate: moment().add(-30, 'days')
+            });
+
+            $(".toDate").datetimepicker({
+                format: "DD/MM/YYYY",
+                defaultDate: moment().endOf('day')
+            });
+
+            $(".fromDateTime").datetimepicker({
+                format: "DD/MM/YYYY HH:mm:ss",
+                defaultDate: moment().add(-30, 'days')
+            });
+
+            $(".toDateTime").datetimepicker({
+                format: "DD/MM/YYYY  HH:mm:ss",
+                defaultDate: moment().endOf('day')
+            });
+
+            search();
+        });
+
+        var tableReq;
+        var tableDetail;
+
+        function resetTableReq() {
+            tableReq = $("#grid").DataTable({});
+        }
+
+        //function resetTableDetail() {
+        //    tableDetail = $("#grid_his").DataTable({
+        //        paging: 0,
+        //        searching: false,
+        //        search: false
+        //    });
+        //}
+
+        function clearTable(table) {
+            if (table != null && table != undefined) {
+                table
+                    .clear()
+                    .destroy();
+            }
+        }
+        resetTableReq();
+        //resetTableDetail();
+
+
+
+        // result terms
+        function search() {
+            console.log("Search");
+            startSpinner('btnSearch');
+            clearTable(tableReq);
+            //var gameId = $("#gameId").val();
+            $.ajax({
+                url: "@ViewBag.MyConfig.MyValue/Admin/ResultsSearch",
+                data: {
+                    fromDate: $("#fromDateSearch").val(),
+                    toDate: $("#toDateSearch").val(),
+                    gameId: "-2",
+                    type: $("#type").val()
+                },
+                type: "POST",
+                success: function (data) {
+                    stopSpinner('btnSearch');
+                    console.log(data);
+                    if (data.error != null) {
+                        showModal('message-dialog');
+                        $('#message-content').html(data.content.split("\n").join("<br />"));
+                    } else {
+                        //updateGridData(data.data.listTerm);
+                        $("#partial-content").html(data);
+                        resetTableReq();
+                    }
+                },
+                error: function (data) {
+                    stopSpinner('btnSearch');
+                    console.log(data.error);
+                }
+            })
+        }
+
+        function addUpdateAction() {
+            // Checking whether FormData is available in browser
+            if (window.FormData !== undefined) {
+                var result = $("#result1").val() + "-" + $("#result2").val() + "-" + $("#result3").val() + "$" + $("#result4").val() + "$" + $("#result4").val();
+                console.log("result " + result);
+                // Create FormData object
+                //var formData = new FormData();
+                // Adding one more key to FormData object
+                //formData.append('id', $("#id").val());
+                //formData.append('termId', $("#id").val());
+                //formData.append('result', result);
+                //formData.append('note', $("#note").val());
+                //formData.append('action', "0");
+                $.ajax({
+                    url: urlConfig('/Admin/ResultsAddUpdate'),
+                    type: "POST",
+                    data: {
+                        termId: $("#id").val(),
+                        result: result
+                    },
+                    success: function (result) {
+                        console.log("result: ");
+                        console.log(result);
+                        if (result.error == '0') {
+                            Swal.fire("Success!", "Success!", "success").
+                                then((result) => {
+                                    hideModal("modal-add-service");
+                                    search();
+                                });
+                        } else {
+                            Swal.fire("Failed!", result.content, "error");
+                            //alert('Import failed: ' + result.content);
+                        }
+                    },
+                    error: function (err) {
+                        Swal.fire("Failed!", err.statusText, "error");
+                        //alert(err.statusText);
+                    }
+                });
+            } else {
+                Swal.fire("Failed!", "FormData is not supported.", "error");
+                //alert("FormData is not supported.");
+            }
+        }
+
+        function edit(id) {
+            console.log(id);
+            $("#randomId").hide();
+            // div
+            $("#btnAddUpdate").hide();
+            //$("#div-approve").hide();
+            $("#div-result").show();
+            //
+            $("#result").val("");
+            $("#result1").val("");
+            $("#result2").val("");
+            $("#result3").val("");
+            $("#result4").val("");
+            $("#result5").val("");
+
+            $("#lblWarning").html("");
+            // get service info
+            $.ajax({
+                url: "@ViewBag.MyConfig.MyValue/Admin/ResultsGetById",
+                data: {
+                    id: id,
+                    gameId: "-2"
+                },
+                type: "POST",
+                success: function (data) {
+                    console.log(data);
+                    if (data.error != "0" && data.error != "1") {
+                        setTimeout(function () {
+                            showModal('message-dialog');
+                            $('#message-content').html(data.content.split("\n").join("<br />"));
+                        }, 1000);
+                    } else {
+                        var customer = data.data;
+                        console.log(customer);
+                        // change data
+                        $("#id").val(id);
+                        $("#date_random").val(customer.date_random);
+                        $("#time_random").val(customer.date_random.substring(10));
+                        $("#gameId").val(customer.gameId);
+                        $("#status").val(customer.status);
+                        $("#result").val(customer.result);
+                        if (customer.result != null) { 
+                            var top3 = customer.result.split("$")[0];
+                            var starter = customer.result.split("$")[1];
+                            var consolation = customer.result.split("$")[2];
+
+                            $("#result1").val(top3.split("-")[0]);
+                            $("#result2").val(top3.split("-")[1]);
+                            $("#result3").val(top3.split("-")[2]);
+                            $("#result4").val(starter);
+                            $("#result5").val(consolation);
+
+                        } 
+
+                        // check status
+                        if (customer.status == @LumilotoUtils.GetTermStatus.available) {
+                            $("#div-result").hide();
+                            $("#lblWarning").html("Game is playing. Can not update result");
+                        } else if (customer.status == @LumilotoUtils.GetTermStatus.waitResult || customer.status == @LumilotoUtils.GetTermStatus.rejected) {
+                            $("#btnAddUpdate").show();
+                        } else if (customer.status == @LumilotoUtils.GetTermStatus.accepted ) {
+                            $("#lblWarning").html("Game is finished. Can not update result");
+                        }
+
+                        //$("#div-action").show();
+                        // result
+                        //var rs = customer.result.split("|");
+                        //var rs2 = rs[0].split("$");
+                        //rs2.forEach(function (item, index) {
+                        //    console.log(index);
+                        //    $("#result-" + index).val(rs2[index]);
+                        //});
+                        //$("#result-6").val(rs[1]);
+
+                        //viewData();
+
+                        // show modal
+                        showModal("modal-add-service", 1);
+                    }
+                },
+                error: function (data) {
+                    console.log(data.error);
+                }
+            })
+        }
+
+        function updateStatus(status) {
+            var id = $("#id").val();
+            console.log(id);
+            // get service info
+            $.ajax({
+                url: "@ViewBag.MyConfig.MyValue/Admin/ResultsUpdateStatus",
+                data: {
+                    randomId: id,
+                    action: status,
+                    note: $("#note").val()
+                },
+                type: "POST",
+                success: function (data) {
+                    console.log(data);
+                    if (data.error != "0") {
+                        Swal.fire('Error!', data.content, 'error');
+                    } else {
+                        if (status == '@LumilotoUtils.LuckyPowerResultStatus.rejected') {
+                            Swal.fire('Result rejected!', '', 'success').then((result) => {
+                                hideModal("modal-add-service");
+                                search();
+                            });
+                        } else if (status == '@LumilotoUtils.LuckyPowerResultStatus.approved') {
+                            Swal.fire('Result approved!', '', 'success').then((result) => {
+                                hideModal("modal-add-service");
+                                search();
+                            });
+                        }
+                    }
+                },
+                error: function (data) {
+                    console.log(data.error);
+                }
+            })
+        }
+         
+
+
+        function exportData() {
+            var gameId = $("#gameId").val();
+            console.log(gameId);
+            // get service info
+            $.ajax({
+                url: urlConfig("/Admin/ResultsExport"),
+                data: {
+                    fromDate: $("#fromDateSearch").val(),
+                    toDate: $("#toDateSearch").val(),
+                    gameId: gameId,
+                    status: $("#statusSearch").val()
+                },
+                type: "POST",
+                xhr: function () {
+                    var xhr = new XMLHttpRequest();
+                    xhr.onreadystatechange = function () {
+                        if (xhr.readyState == 2) {
+                            if (xhr.status == 200) {
+                                xhr.responseType = "blob";
+                                console.log("blob");
+                            } else {
+                                xhr.responseType = "text";
+                                console.log("text");
+                            }
+                        }
+                    };
+                    return xhr;
+                },
+                success: function (data, status, xhr) {
+                    let filename = "";
+                    let disposition = xhr.getResponseHeader('Content-Disposition');
+                    if (disposition && disposition.indexOf('attachment') !== -1) {
+                        let filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
+                        let matches = filenameRegex.exec(disposition);
+                        if (matches != null && matches[1]) filename = matches[1].replace(/['"]/g, '');
+                    }
+                    let a = document.createElement('a');
+                    let url = window.URL.createObjectURL(data);
+                    a.href = url;
+                    a.download = filename.replace('UTF-8', '');;
+                    document.body.append(a);
+                    a.click();
+                    a.remove();
+                    window.URL.revokeObjectURL(url);
+                    $("#overlay").fadeOut(300);
+                },
+                error: function (data) {
+                    console.log(data.error);
+                }
+            })
+        }
+
+    </script>
+
+    <script>
+        function loadTermNeedResult() {
+            console.log("loadTermNeedResult");
+            $("$randomId").html("");
+            $.ajax({
+                url: urlConfig("/Admin/ResultsGet"),
+                data: {
+                    gameId: "1",
+                    status: "2,4",
+                    rowsOnPage: "1000",
+                    seqPage: "1"
+                },
+                type: "POST",
+                success: function (data) {
+                    console.log(data);
+                    if (data.error != "0" && data.error != "1") {
+                        showModal('message-dialog');
+                        $('#message-content').html(data.content.split("\n").join("<br />"));
+                    } else {
+                        if (data.data.listTerm != null) {
+                            var listTerm = data.data.listTerm;
+                            for (let i = 0; i < listTerm; i++) {
+                                $("#randomId").html.append('<option value="' + listTerm[i].randomId + (i == 0 ? ' selected' : '') + '">' + listTerm[i].randomId + '</option>');
+                            }
+                        }
+                    }
+                },
+                error: function (data) {
+                    stopSpinner('btnSearch');
+                    console.log(data.error);
+                }
+            })
+        }
+
+
+    </script>
+}

+ 324 - 0
SuperAdmin/SuperAdmin/Views/Admin/RewardListSearch.cshtml

@@ -0,0 +1,324 @@
+@{
+    ViewBag.Title = "Reward List Detail";
+    Layout = "~/Views/Shared/_Layout.cshtml";
+}
+
+@using SuperAdmin.Models;
+@using SuperAdmin.Models.Http;
+@using SuperAdmin.Controllers;
+@using SuperAdmin.Source;
+
+@model ExportGetListRes
+@{
+
+}
+
+<style>
+    img {
+        max-width: 100%;
+    }
+</style>
+
+<div class="content-header row">
+    <div class="content-header-left col-md-6 col-xs-12 mb-1">
+        <h2 class="content-header-title">Reward list detail</h2>
+    </div>
+    <div class="content-header-right breadcrumbs-right breadcrumbs-top col-md-6 col-xs-12">
+        <div class="breadcrumb-wrapper col-xs-12">
+            <ol class="breadcrumb">
+                <li class="breadcrumb-item">
+                    <a href="Index">Admin</a>
+                </li>
+                <li class="breadcrumb-item">
+                    <a href="#">Reward list detail</a>
+                </li>
+            </ol>
+        </div>
+    </div>
+</div>
+
+<div class="content-body">
+    <!-- Basic form layout section start -->
+    <section id="basic-form-layouts">
+        <div class="row service-height">
+            <div class="col-md-12">
+                <div class="card">
+                    <div class="card-header">
+                        <h4 class="card-title" id="basic-layout-form">Search</h4>
+                        <a class="heading-elements-toggle"><i class="icon-ellipsis font-medium-3"></i></a>
+                        <div class="heading-elements">
+                            <ul class="list-inline mb-0">
+                                <li><a data-action="collapse"><i class="icon-minus4"></i></a></li>
+                                <li><a data-action="expand"><i class="icon-expand2"></i></a></li>
+                            </ul>
+                        </div>
+                    </div>
+                    <div class="card-content collapse show">
+                        <div class="card-body">
+                            <div class="card-block">
+                                <div class="form-body">
+                                    @Html.AntiForgeryToken()
+                                    <div class="row">
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>From Date</label>
+                                                <div class='input-group'>
+                                                    <input type="text" class="form-control fromDate" id="fromDate" name="fromDate">
+                                                </div>
+                                            </div>
+                                        </div>
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>To date</label>
+                                                <div class='input-group'>
+                                                    <input type="text" class="form-control toDate" id="toDate" name="toDate">
+                                                </div>
+                                            </div>
+                                        </div>
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>Paid status</label>
+                                                <div class='input-group'>
+                                                    <select class="form-control" id="isPayType" name="isPayType">
+                                                        <option value="-1" selected>-- All --</option>
+                                                        <option value="0">Not yet paid</option>
+                                                        <option value="1">Already paid</option>
+                                                        <option value="2">Paying</option>
+                                                        <option value="3">Paid error</option>
+                                                    </select>
+                                                </div>
+                                            </div>
+                                        </div>
+                                        @*<div class="col-md-4 col-sm-4 col-6">
+                                                <div class="form-group">
+                                                    <label>Game</label>
+                                                    <select class="form-control" id="gameId" name="gameId">
+                                                        <option value="-1" selected>-- All --</option>
+                                                        <option value="1">Lucky power</option>
+                                                        <option value="2">Lucky day</option>
+                                                        <option value="3">Lucky plus</option>
+                                                    </select>
+                                                </div>
+                                            </div>
+                                            <div class="col-md-4 col-sm-4 col-6">
+                                                <div class="form-group">
+                                                    <label>Pay type</label>
+                                                    <select class="form-control" id="isPayOnline" name="isPayOnline">
+                                                        <option value="-1" selected>-- All --</option>
+                                                        <option value="0">Offline</option>
+                                                        <option value="1">Online</option>
+                                                    </select>
+                                                </div>
+                                            </div>*@
+                                        @*<div class="col-md-4 col-sm-4 col-6">
+                                                <div class="form-group">
+                                                    <label>Is Paid</label>
+                                                    <select class="form-control" id="isPaySearch" name="isPaySearch">
+                                                        <option value="-1" selected>-- All --</option>
+                                                        <option value="0">Not yet paid</option>
+                                                        <option value="1">Already paid</option>
+                                                    </select>
+                                                </div>
+                                            </div>*@
+                                    </div>
+                                    <div class="row">
+                                        <div class="col-md-12">
+                                            <button type="button" class="btn btn-primary" onclick="search()" id="btnSearch">
+                                                <i class="icon-search"></i> Search
+                                            </button>
+                                            <button type="button" class="btn btn-warning" onclick="exportExcel()" id="btnExportExcel">
+                                                <i class="icon-export"></i> Export Excel
+                                            </button>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div class="col-12">
+                <div class="card">
+                    <div class="card-content">
+                        <div class="col-md-12 table-responsive" style="padding-top: 10px">
+                            @Html.Partial("_RewardList", Model)
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+        </div>
+    </section>
+    <!-- // Basic form layout section end -->
+</div>
+
+
+@section Scripts {
+    <script>
+
+        var tableDetail;
+
+        $(document).ready(function () {
+
+            $(".fromDate").datetimepicker({
+                format: "DD/MM/YYYY",
+                defaultDate: moment().add(-30, 'days')
+            });
+
+            $(".toDate").datetimepicker({
+                format: "DD/MM/YYYY",
+                defaultDate: moment().endOf('day')
+            });
+
+            //$('#grid_reward_detail thead tr').clone(true).appendTo('#grid_reward_detail thead');
+            $('#grid_reward_detail thead tr:eq(1) th').each(function (i) {
+                var title = $(this).text();
+                if (title != undefined && title != "") {
+                    $(this).html('<input type="text" placeholder="Search ' + title + '" />');
+
+                    $('input', this).on('keyup change', function () {
+                        if (tableDetail.column(i).search() !== this.value) {
+                            tableDetail
+                                .column(i)
+                                .search(this.value)
+                                .draw();
+                        }
+                    });
+                }
+            });
+
+            search();
+        });
+
+
+        function resetTableDetail() {
+            tableDetail = $("#grid_reward_detail").DataTable({
+                orderCellsTop: true,
+                fixedHeader: true
+            });
+        }
+
+        function clearTable(table) {
+            if (table != null && table != undefined) {
+                table
+                    .clear()
+                    .destroy();
+            }
+        }
+        resetTableDetail();
+
+        function search() {
+            console.log("Search data");
+            startSpinner('btnSearch');
+            clearTable(tableDetail);
+            $.ajax({
+                url: "/Admin/RewardGetListWinner",
+                data: {
+                    usersName: $("#usersName").val(),
+                    gameId: $("#gameId").val(),
+                    fromDate: $("#fromDate").val(),
+                    toDate: $("#toDate").val(),
+                    isPayOnline: $("#isPayOnline").val(),
+                    isPayType: $("#isPayType").val()
+                },
+                type: "POST",
+                success: function (data) {
+                    stopSpinner('btnSearch');
+                    console.log(data);
+                    if (data.error != "0" && data.error != "1") {
+                        showModal('message-dialog');
+                        $('#message-content').html(data.content.split("\n").join("<br />"));
+                    } else {
+                        updateGridDataDetail(data.data.listLotoExportData);
+                        resetTableDetail();
+                    }
+                },
+                error: function (data) {
+                    stopSpinner('btnSearch');
+                    console.log(data.error);
+                }
+            })
+        }
+
+        function updateGridDataDetail(val) {
+            console.log(val);
+            $("#gridbody_detail").html("");
+            var html = "";
+            if (val != undefined) {
+                for (var i = 0; i < val.length; i++) {
+                    var service = val[i];
+                    html += "<tr>";
+                    html += "<td scope='row'>" + (i + 1) + "</td>";
+                    html += "<td class='text-right'>" + service.winnerId + "</td>";
+                    html += "<td class='text-left'>" + service.msisdn + "</td>";
+                    html += "<td class='text-left'>" + GetGameName(service.gameId) + "</td>";
+                    html += "<td class='text-right'>" + service.randomId + "</td>";
+                    html += "<td class='text-left'>" + service.date + "</td>";
+                    html += "<td class='text-left'>" + service.prizeName + "</td>";
+                    html += "<td class='text-right'>" + formatNumber(service.money) + "</td>";
+                    html += "<td class='text-center'>" + (service.isPayOnline == "1" ? "Online" : "Offline") + "</td>";
+                    html += "<td class='text-left'>" + PaidStatus(service.isPay) + "</td>";
+                    html += "</tr>";
+                }
+            }
+            $("#gridbody_detail").html(html);
+        }
+
+        function exportExcel() {
+            console.log("Export data");
+            startSpinner('btnExportExcel');
+            $.ajax({
+                url: "/Admin/ExportWinner",
+                data: {
+                    usersName: $("#usersName").val(),
+                    gameId: $("#gameId").val(),
+                    fromDate: $("#fromDate").val(),
+                    toDate: $("#toDate").val(),
+                    isPayOnline: $("#isPayOnline").val(),
+                    isPayType: $("#isPayType").val()
+                },
+                type: "POST",
+                xhr: function () {
+                    var xhr = new XMLHttpRequest();
+                    xhr.onreadystatechange = function () {
+                        if (xhr.readyState == 2) {
+                            if (xhr.status == 200) {
+                                xhr.responseType = "blob";
+                                console.log("blob");
+                            } else {
+                                xhr.responseType = "text";
+                                console.log("text");
+                            }
+                        }
+                    };
+                    return xhr;
+                },
+                success: function (data, status, xhr) {
+
+                    stopSpinner('btnExportExcel');
+                    let filename = "";
+                    let disposition = xhr.getResponseHeader('Content-Disposition');
+                    if (disposition && disposition.indexOf('attachment') !== -1) {
+                        let filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
+                        let matches = filenameRegex.exec(disposition);
+                        if (matches != null && matches[1]) filename = matches[1].replace(/['"]/g, '');
+                    }
+                    let a = document.createElement('a');
+                    let url = window.URL.createObjectURL(data);
+                    a.href = url;
+                    a.download = filename.replace('UTF-8', '');;
+                    document.body.append(a);
+                    a.click();
+                    a.remove();
+                    window.URL.revokeObjectURL(url);
+                    $("#overlay").fadeOut(300);
+                },
+                error: function (data) {
+                    stopSpinner('btnExportExcel');
+                    console.log(data.error);
+                }
+            })
+        }
+    </script>
+}

+ 918 - 0
SuperAdmin/SuperAdmin/Views/Admin/RewardReq.cshtml

@@ -0,0 +1,918 @@
+@{
+    ViewBag.Title = "Reward Requests";
+    Layout = "~/Views/Shared/_Layout.cshtml";
+}
+
+@using SuperAdmin.Models;
+@using SuperAdmin.Models.Http;
+@using SuperAdmin.Controllers;
+@using SuperAdmin.Source;
+
+@model ExportGetListRes
+@{
+
+}
+
+<style>
+    img {
+        max-width: 100%;
+    }
+</style>
+
+<input type="hidden" value="@ViewBag.Role" id="role" />
+
+<div class="content-header row">
+    <div class="content-header-left col-md-6 col-xs-12 mb-1">
+        <h2 class="content-header-title">Reward requests</h2>
+    </div>
+    <div class="content-header-right breadcrumbs-right breadcrumbs-top col-md-6 col-xs-12">
+        <div class="breadcrumb-wrapper col-xs-12">
+            <ol class="breadcrumb">
+                <li class="breadcrumb-item">
+                    <a href="Index">Admin</a>
+                </li>
+                <li class="breadcrumb-item">
+                    <a href="#">Reward requests</a>
+                </li>
+            </ol>
+        </div>
+    </div>
+</div>
+
+<div class="content-body">
+    <!-- Basic form layout section start -->
+    <section id="basic-form-layouts">
+        <div class="row service-height">
+            <div class="col-md-12">
+                <div class="card">
+                    <div class="card-header">
+                        <h4 class="card-title" id="basic-layout-form">Search</h4>
+                        <a class="heading-elements-toggle"><i class="icon-ellipsis font-medium-3"></i></a>
+                        <div class="heading-elements">
+                            <ul class="list-inline mb-0">
+                                <li><a data-action="collapse"><i class="icon-minus4"></i></a></li>
+                                @*<li><a data-action="reload"><i class="icon-reload"></i></a></li>*@
+                                <li><a data-action="expand"><i class="icon-expand2"></i></a></li>
+                                @*<li><a data-action="close"><i class="icon-cross2"></i></a></li>*@
+                            </ul>
+                        </div>
+                    </div>
+                    <div class="card-content collapse show">
+                        <div class="card-body">
+                            <div class="card-block">
+                                <div class="form-body">
+                                    @Html.AntiForgeryToken()
+                                    <div class="row">
+                                        <div class="col-md-3 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>From Date</label>
+                                                <div class='input-group'>
+                                                    <input type="text" class="form-control fromDate" id="fromDateSearch" name="fromDateSearch">
+                                                </div>
+                                            </div>
+                                        </div>
+                                        <div class="col-md-3 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>To date</label>
+                                                <div class='input-group'>
+                                                    <input type="text" class="form-control toDate" id="toDateSearch" name="toDateSearch">
+                                                </div>
+                                            </div>
+                                        </div>
+                                        <div class="col-md-3 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>Game</label>
+                                                <select class="form-control" id="gameSearch" name="gameSearch">
+                                                    <option value="-1" selected>-- All --</option>
+                                                    <option value="1">Lucky power</option>
+                                                    <option value="2">Lucky day</option>
+                                                    <option value="3">Lucky plus</option>
+                                                </select>
+                                            </div>
+                                        </div>
+                                        <div class="col-md-3 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>Status</label>
+                                                <select class="form-control" id="statusSearch" name="statusSearch">
+                                                    <option value="-1" selected>-- All --</option>
+                                                    <option value="@LumilotoUtils.ExportStatus.startUpload">Uploading</option>
+                                                    <option value="@LumilotoUtils.ExportStatus.finishUpload">Wait approving</option>
+                                                    <option value="@LumilotoUtils.ExportStatus.rejected">Rejected</option>
+                                                    <option value="@LumilotoUtils.ExportStatus.deleted">Deleted</option>
+                                                    <option value="@LumilotoUtils.ExportStatus.approved">Approved</option>
+                                                    <option value="@LumilotoUtils.ExportStatus.addingMoney">Adding money</option>
+                                                    <option value="@LumilotoUtils.ExportStatus.finishAddMoney">Finish add money</option>
+
+                                                </select>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="row">
+                                        <div class="col-md-12">
+                                            <button type="button" class="btn btn-primary" onclick="search()" id="btnSearch">
+                                                <i class="icon-search"></i> Search
+                                            </button>
+                                            <button type="button" class="btn btn-success" onclick="add()" id="btnAdd">
+                                                <i class="icon-plus"></i> Add
+                                            </button>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div class="col-12">
+                <div class="card">
+                    <div class="card-content">
+                        <div class="col-md-12 table-responsive" style="padding-top: 10px">
+                            @Html.Partial("_RewardReqGrid", Model)
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+        </div>
+    </section>
+    <!-- // Basic form layout section end -->
+</div>
+
+<div class="modal fade text-xs-left" id="modal-add-service" tabindex="-1" role="dialog" aria-labelledby="myModalLabel17" style="display: none;" aria-hidden="true">
+    <div class="modal-dialog modal-xl" role="document">
+        <div class="modal-content">
+            <div class="modal-header">
+                <h4 class="modal-title" id="modalLabelService">Reward Request Information</h4>
+                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+                    <span aria-hidden="true">×</span>
+                </button>
+            </div>
+            <input type="hidden" id="id" />
+            <div class="modal-body">
+                <div class="row" id="div-info">
+                    <div class="col-md-6">
+                        <div class="form-group">
+                            <label for="wsName">From Date</label>
+                            <input type="text" class="form-control fromDateTime" id="fromDate" name="fromDate" autocomplete="off">
+                        </div>
+                    </div>
+                    <div class="col-md-6">
+                        <div class="form-group">
+                            <label for="team1">To Date</label>
+                            <input type="text" class="form-control toDateTime" id="toDate" name="toDate" autocomplete="off">
+                        </div>
+                    </div>
+                    <div class="col-md-6">
+                        <div class="form-group">
+                            <label for="wsdl">Game</label>
+                            <select class="form-control" id="gameId" name="gameId">
+                                <option value="1" selected>Lucky power</option>
+                                <option value="2">Lucky day</option>
+                                <option value="3">Lucky plus</option>
+                            </select>
+                        </div>
+                    </div>
+                    <div class="col-md-6">
+                        <div class="form-group">
+                            <label for="wsdl">Name</label>
+                            <input type="text" class="form-control" id="name" name="name">
+                        </div>
+                    </div>
+                    <div class="col-md-6">
+                        <div class="form-group">
+                            <label for="wsdl">Status</label>
+                            <select class="form-control" type="text" id="status" name="status" disabled>
+                                <option value="@LumilotoUtils.ExportStatus.draft" selected>Draft</option>
+                                <option value="@LumilotoUtils.ExportStatus.startUpload">Uploading</option>
+                                <option value="@LumilotoUtils.ExportStatus.finishUpload">Finish upload</option>
+                                <option value="@LumilotoUtils.ExportStatus.rejected">Rejected</option>
+                                <option value="@LumilotoUtils.ExportStatus.deleted">Deleted</option>
+                                <option value="@LumilotoUtils.ExportStatus.approved">Approved</option>
+                                <option value="@LumilotoUtils.ExportStatus.addingMoney">Adding money</option>
+                                <option value="@LumilotoUtils.ExportStatus.finishAddMoney">Finish add money</option>
+                            </select>
+                        </div>
+                    </div>
+                </div>
+                <div class="row" id="div-action">
+                    <div class="col-12">
+                        <button type="button" id="btnAddUpdate" class="btn btn-outline-primary" onclick="addUpdateAction()">Create Request</button>
+                        @*<button type="button" id="btnUpdate" class="btn btn-outline-primary" onclick="addUpdateAction()">Save Request</button>*@
+                        <button type="button" id="btnGetData" class="btn btn-outline-success" onclick="viewData()">View data</button>
+                        <button type="button" id="btnDeleteData" class="btn btn-outline-success" onclick="deleteData()">Delete data</button>
+                        <button type="button" id="btnExportSystem" class="btn btn-outline-success" onclick="exportSystem()">Export system</button>
+                        <button type="button" id="btnExportData" class="btn btn-outline-success" onclick="exportData()">Export Excel</button>
+                        @*<form   enctype="multipart/form-data" method="POST" action="/Admin/RewardImportData" style="display: inline-block">*@
+                        <label id="btnImportData" for="importFile" class="btn btn-outline-success" style="margin: 0 0 0 0;">Import data</label>
+                        <input type="file" id="importFile" name="importFile" class="shifted" style="display: none" accept=".xls,.xlsx" onchange="importFile()" />
+                        @*</form>*@
+                        @*<button type="button" id="btnImportData" class="btn btn-outline-success" onclick="importFile()">Import data</button>
+                            <input id="importFile" type="file" name="importFile" style="display: none;" />*@
+                        <button type="button" id="btnSubmit" class="btn btn-outline-danger" onclick="submit()">Submit</button>
+                    </div>
+                </div>
+                <div class="row">
+                    <div class="col-12" style="padding-top: 10px" id="div_detail">
+                        @Html.Partial("_RewardDetailGrid", Model)
+                    </div>
+                </div>
+                <div class="row" id="div-approve">
+                    @if (!BaseController.UsingVsa() || ViewBag.Role == BaseController.RoleAdminSale)
+                    {
+                        <div class="col-md-12">
+                            <div class="form-group">
+                                <label for="wsdl">Note</label>
+                                <input type="text" class="form-control" id="note" name="note" autocomplete="off">
+                            </div>
+                        </div>
+                        <div class="col-md-12">
+                            <button type="button" id="btnExportList" class="btn btn-outline-info" onclick="exportData()">Export</button>
+                            <button type="button" id="btnApprove" class="btn btn-outline-success" onclick="approve()">Approve</button>
+                            <button type="button" id="btnReject" class="btn btn-outline-danger" onclick="reject()">Reject</button>
+                            <button type="button" class="btn grey btn-outline-secondary" data-dismiss="modal">Close</button>
+                        </div>
+                    }
+                </div>
+            </div>
+            <div class="modal-footer">
+                @*<button type="button" class="btn grey btn-outline-secondary" data-dismiss="modal">Close</button>
+                    <button type="button" id="btnAdd" class="btn btn-outline-primary" onclick="addUpdateAction()">Add</button>
+                    <button type="button" id="btnUpdate" class="btn btn-outline-primary" onclick="addUpdateAction()">Save Info</button>*@
+
+            </div>
+        </div>
+    </div>
+</div>
+
+
+
+@section Scripts {
+    <script>
+
+        $(document).ready(function () {
+
+            $(".fromDate").datetimepicker({
+                format: "DD/MM/YYYY",
+                defaultDate: moment().add(-30, 'days')
+            });
+
+            $(".toDate").datetimepicker({
+                format: "DD/MM/YYYY",
+                defaultDate: moment().endOf('day')
+            });
+
+            $(".fromDateTime").datetimepicker({
+                format: "DD/MM/YYYY HH:mm:ss",
+                defaultDate: moment().add(-30, 'days')
+            });
+
+            $(".toDateTime").datetimepicker({
+                format: "DD/MM/YYYY  HH:mm:ss",
+                defaultDate: moment().endOf('day')
+            });
+
+            search();
+        });
+
+        var tableReq;
+        var tableDetail;
+
+        function resetTableReq() {
+            tableReq = $("#grid_reward").DataTable({});
+        }
+
+        function resetTableDetail() {
+            tableDetail = $("#grid_reward_detail").DataTable({});
+        }
+
+        function clearTable(table) {
+            if (table != null && table != undefined) {
+                table
+                    .clear()
+                    .destroy();
+            }
+        }
+        resetTableReq();
+        resetTableDetail();
+
+
+
+        // reward request
+        function search() {
+            console.log("Search");
+            startSpinner('btnSearch');
+            clearTable(tableReq);
+            $.ajax({
+                url: "/Admin/RewardReqSearch",
+                data: {
+                    fromDate: $("#fromDateSearch").val(),
+                    toDate: $("#toDateSearch").val(),
+                    gameId: $("#gameSearch").val(),
+                    status: $("#statusSearch").val()
+                },
+                type: "POST",
+                success: function (data) {
+                    stopSpinner('btnSearch');
+                    console.log(data);
+                    if (data.error != "0" && data.error != "1") {
+                        showModal('message-dialog');
+                        $('#message-content').html(data.content.split("\n").join("<br />"));
+                    } else {
+                        updateGridData(data.data.listLotoExportGet);
+                        resetTableReq();
+                    }
+                },
+                error: function (data) {
+                    stopSpinner('btnSearch');
+                    console.log(data.error);
+                }
+            })
+        }
+
+        function addUpdateAction() {
+
+            // Checking whether FormData is available in browser
+            if (window.FormData !== undefined) {
+                // Create FormData object
+                var formData = new FormData();
+                console.log(moment($("#ngaykichhoatthe").val(), "DD/MM/YYYY HH:mm:ss"));
+                // Adding one more key to FormData object
+                formData.append('id', $("#id").val());
+                formData.append('name', $("#name").val());
+                formData.append('fromDate', $("#fromDate").val());
+                formData.append('toDate', $("#toDate").val());
+                formData.append('gameId', $("#gameId").val());
+                //formData.append('ngaykichhoatthe', moment($("#ngaykichhoatthe").val(), "DD/MM/YYYY HH:mm:ss").format("YYYY-MM-DD HH:mm:ss"));
+                formData.append('status', $("#status").val());
+                formData.append('action', 'add');
+
+                $.ajax({
+                    url: urlConfig('/Admin/RewardReqAddUpdate'),
+                    type: "POST",
+                    contentType: false, // Not to set any content header
+                    processData: false, // Not to process data
+                    data: formData,
+                    success: function (result) {
+                        if (result.error == '0') {
+                            Swal.fire("Success!", "Success!", "success").
+                                then((result) => {
+                                    hideModal("modal-add-service");
+                                    //search();
+                                });
+                            //alert('Import success: ' + result.content);
+                        } else {
+                            Swal.fire("Failed!", result.content, "error");
+                            //alert('Import failed: ' + result.content);
+                        }
+                    },
+                    error: function (err) {
+                        swal("Failed!", err.statusText, "error");
+                        //alert(err.statusText);
+                    }
+                });
+            } else {
+                Swal.fire("Failed!", "FormData is not supported.", "error");
+                //alert("FormData is not supported.");
+            }
+        }
+
+        function add() {
+            // clear data
+            $("#id").val("");
+            $("#fromDate").val(moment().startOf('month').format("DD/MM/YYYY HH:mm:ss"));
+            $("#toDate").val(moment().endOf('month').format("DD/MM/YYYY HH:mm:ss"));
+            $("#name").val("");
+            $("#note").val("");
+            $("#status").val("@LumilotoUtils.ExportStatus.draft");
+            // button
+            $("#btnAddUpdate").show();
+            $("#btnGetData").hide();
+            $("#btnExportData").hide();
+            $("#btnExportSystem").show();
+            $("#btnSubmit").hide();
+            $("#btnImportData").hide();
+            $("#btnDeleteData").hide();
+            // div
+            $("#div-approve").hide();
+            // clear table
+            clearTable(tableDetail);
+            resetTableDetail();
+            $("#div_detail").hide();
+            // show modal
+            showModal("modal-add-service");
+        }
+
+        function edit(id) {
+            console.log(id);
+            $("#btnAddUpdate").hide();
+            $("#btnGetData").hide();
+            $("#btnImportData").hide();
+            $("#btnSubmit").hide();
+            $("#btnDeleteData").hide();
+            $("#btnExportData").hide();
+            $("#btnExportSystem").hide();
+            $("#btnApprove").hide();
+            $("#btnReject").hide();
+            $("#div_detail").hide();
+            // get service info
+            $.ajax({
+                url: "/Admin/RewardReqGetById",
+                data: {
+                    id: id
+                },
+                type: "POST",
+                success: function (data) {
+                    console.log(data);
+                    if (data.error != "0" && data.error != "1") {
+                        setTimeout(function () {
+                            showModal('message-dialog');
+                            $('#message-content').html(data.content.split("\n").join("<br />"));
+                        }, 1000);
+                    } else {
+                        var customer = data.data;
+                        console.log("status : " + customer.status);
+                        // change data
+                        $("#id").val(id);
+                        $("#name").val(customer.name);
+                        $("#fromDate").val(customer.fromDate);
+                        $("#toDate").val(customer.toDate);
+                        $("#gameId").val(customer.gameId);
+                        $("#status").val(customer.status);
+                        $("#note").val(customer.note);
+
+                        if (customer.status == "@LumilotoUtils.ExportStatus.draft") {
+                            $("#btnGetData").hide();
+                            $("#btnImportData").show();
+                            $("#btnExportSystem").show();
+                            $("#div_detail").hide();
+                        } else {
+                            $("#div_detail").show();
+                        }
+                        if (customer.status == "@LumilotoUtils.ExportStatus.startUpload") {
+                            $("#btnGetData").show();
+                            $("#btnDeleteData").show();
+                            $("#btnSubmit").show();
+                            $("#btnImportData").show();
+                            $("#btnExportSystem").show();
+                            $("#div_detail").show();
+                        }
+                        if (customer.status == "@LumilotoUtils.ExportStatus.finishUpload") {
+                            $("#div_detail").show();
+                            $("#btnExportData").show();
+                        }
+                        if (customer.status != "@LumilotoUtils.ExportStatus.approved" && customer.status != "@LumilotoUtils.ExportStatus.rejected"
+                        && customer.status != "@LumilotoUtils.ExportStatus.addingMoney" && customer.status != "@LumilotoUtils.ExportStatus.finishAddMoney") {
+                            $("#btnApprove").show();
+                            $("#btnReject").show();
+                        }
+                        //$("#btnUpdate").show();
+                        //search();
+
+                        viewData();
+
+                        // show modal
+                        showModal("modal-add-service");
+                    }
+                },
+                error: function (data) {
+                    console.log(data.error);
+                }
+            })
+        }
+
+        function updateStatus(status) {
+            var id = $("#id").val();
+            console.log(id);
+            // get service info
+            $.ajax({
+                url: "/Admin/RewardReqAddUpdate",
+                data: {
+                    exportId: id,
+                    type: status,
+                    action: 'update'
+                },
+                type: "POST",
+                success: function (data) {
+                    console.log(data);
+                    if (data.error != "0") {
+                        setTimeout(function () {
+                            showModal('message-dialog');
+                            $('#message-content').html(data.content.split("\n").join("<br />"));
+                        }, 1000);
+                    } else {
+                        if (status == '@LumilotoUtils.ExportActionType.deleted') {
+                            Swal.fire('Removed!', '', 'success').then((result) => {
+                                hideModal("modal-add-service");
+                                search();
+                            });
+                        } else if (status == '@LumilotoUtils.ExportActionType.deleteData') {
+                            Swal.fire('Data deleted!', '', 'success').then((result) => {
+                                search();
+                            });
+                        } else if (status == '@LumilotoUtils.ExportActionType.finishUpload') {
+                            edit(id);
+                            Swal.fire('Request submited!', '', 'success').then((result) => {
+                                search();
+                            });
+                        }
+                    }
+                },
+                error: function (data) {
+                    console.log(data.error);
+                }
+            })
+        }
+
+        function process(status) {
+            var id = $("#id").val();
+            console.log(id);
+            // get service info
+            $.ajax({
+                url: "/Admin/RewardReqProcess",
+                data: {
+                    exportId: id,
+                    type: status
+                },
+                type: "POST",
+                success: function (data) {
+                    console.log(data);
+                    if (data.error != "0") {
+                        setTimeout(function () {
+                            showModal('message-dialog');
+                            $('#message-content').html(data.content.split("\n").join("<br />"));
+                        }, 1000);
+                    } else {
+                        if (status == '@LumilotoUtils.ExportActionType.rejected') {
+                            Swal.fire('Request rejected!', '', 'success').then((result) => {
+                                hideModal("modal-add-service");
+                                //search();
+                            });
+                        } else if (status == '@LumilotoUtils.ExportActionType.approved') {
+                            Swal.fire('Request approved!', '', 'success').then((result) => {
+                                hideModal("modal-add-service");
+                                //search();
+                            });
+                        }
+                    }
+                },
+                error: function (data) {
+                    console.log(data.error);
+                }
+            })
+        }
+
+        $('#modal-add-service').on('hidden.bs.modal', function () {
+            search();
+        });
+
+        function updateGridData(val) {
+            console.log(val);
+            $("#gridbody").html("");
+            var html = "";
+            if (val != undefined) {
+                for (var i = 0; i < val.length; i++) {
+                    var service = val[i];
+                    html += "<tr>";
+                    html += "<td scope='row'>" + (i + 1) + "</td>";
+                    html += "<td class='text-center'><span class='fa fa-edit cursor-pointer' onclick='edit(\"" + service.id + "\")'></span> "
+                        + (service.status == '1' || service.status == '0' ? "<span class='fa fa-remove  text-danger cursor-pointer' onclick='remove(\"" + service.id + "\")'></span></td >" : "");
+                        //+ (service.status == '2' ? "<span class='fa fa-play text-primary cursor-pointer' onclick='process(\"" + service.id + "\")'></span></td >" : "");
+                    //html += "<td class='text-left'>" + service.code + "</td>";
+                    html += "<td class='text-left'>" + service.name + "</td>";
+                    html += "<td class='text-left'>" + service.fromDate + "</td>";
+                    html += "<td class='text-left'>" + service.toDate + "</td>";
+                    html += "<td class='text-left'>" + GetGameName(service.gameId) + "</td>";
+                    html += "<td class='text-left'>" + service.createUsers + "</td>";
+                    html += "<td class='text-left'>" + service.createDate + "</td>";
+                    html += "<td class='text-center'>" + GetStatusExportName(service.status) + "</td>";
+                    html += "<td class='text-right'>" + formatNumber(service.moneySystem) + "</td>";
+                    html += "<td class='text-right'>" + formatNumber(service.moneyImport) + "</td>";
+                    html += "<td class='text-right'>" + formatNumber(service.moneyNotImport) + "</td>";
+                    html += "<td class='text-right'>" + formatNumber(service.moneyNotSys) + "</td>";
+                    html += "<td class='text-left'>" + service.acceptUsers + "</td>";
+                    html += "<td class='text-left'>" + service.acceptDate + "</td>";
+                    html += "</tr>";
+                }
+            }
+            $("#gridbody").html(html);
+        }
+
+        function reject() {
+            Swal.fire({
+                title: 'Do you want to reject this request?',
+                showDenyButton: false,
+                showCancelButton: true,
+                confirmButtonText: `Yes`,
+                denyButtonText: `No`,
+            }).then((result) => {
+                /* Read more about isConfirmed, isDenied below */
+                if (result.isConfirmed) {
+                    //Swal.fire('Saved!', '', 'success')
+                    process('@LumilotoUtils.ExportActionType.rejected');
+                    //edit($("#id").val());
+                    //Swal.fire('Data deleted!', '', 'success')
+                } else if (result.isDenied) {
+                    //Swal.fire('Changes are not saved', '', 'info')
+                }
+            })
+        }
+
+        function approve() {
+            Swal.fire({
+                title: 'Do you want to approve this request?',
+                showDenyButton: false,
+                showCancelButton: true,
+                confirmButtonText: `Yes`,
+                denyButtonText: `No`,
+            }).then((result) => {
+                /* Read more about isConfirmed, isDenied below */
+                if (result.isConfirmed) {
+                    //Swal.fire('Saved!', '', 'success')
+                    process('@LumilotoUtils.ExportActionType.approved');
+                    //edit($("#id").val());
+                    //Swal.fire('Data deleted!', '', 'success')
+                } else if (result.isDenied) {
+                    //Swal.fire('Changes are not saved', '', 'info')
+                }
+            })
+        }
+
+        function deleteData() {
+            Swal.fire({
+                title: 'Do you want to delete data of this request?',
+                showDenyButton: false,
+                showCancelButton: true,
+                confirmButtonText: `Yes`,
+                denyButtonText: `No`,
+            }).then((result) => {
+                /* Read more about isConfirmed, isDenied below */
+                if (result.isConfirmed) {
+                    //Swal.fire('Saved!', '', 'success')
+                    updateStatus('@LumilotoUtils.ExportActionType.deleteData');
+                    edit($("#id").val());
+                    //Swal.fire('Data deleted!', '', 'success')
+                } else if (result.isDenied) {
+                    //Swal.fire('Changes are not saved', '', 'info')
+                }
+            })
+        }
+
+        function remove(id) {
+            console.log("remove "  + id);
+            $("#id").val(id);
+            Swal.fire({
+                title: 'Do you want to remove this request?',
+                showDenyButton: false,
+                showCancelButton: true,
+                confirmButtonText: `Yes`,
+                denyButtonText: `No`,
+            }).then((result) => {
+                /* Read more about isConfirmed, isDenied below */
+                if (result.isConfirmed) {
+                    //Swal.fire('Saved!', '', 'success')
+                    updateStatus('@LumilotoUtils.ExportActionType.deleted');
+                    //Swal.fire('Removed!', '', 'success')
+                } else if (result.isDenied) {
+                    //Swal.fire('Changes are not saved', '', 'info')
+                }
+            })
+        }
+
+        function submit() {
+            Swal.fire({
+                title: 'Do you want to submit this request?',
+                showDenyButton: false,
+                showCancelButton: true,
+                confirmButtonText: `Yes`,
+                denyButtonText: `No`,
+            }).then((result) => {
+                /* Read more about isConfirmed, isDenied below */
+                if (result.isConfirmed) {
+                    //Swal.fire('Saved!', '', 'success')
+                    updateStatus('@LumilotoUtils.ExportActionType.finishUpload');
+                    edit($("#id").val());
+                    //Swal.fire('Request submited!', '', 'success')
+                } else if (result.isDenied) {
+                    //Swal.fire('Changes are not saved', '', 'info')
+                }
+            })
+        }
+
+
+        function importFile() {
+            var id = $("#id").val();
+            console.log(id);
+            // get service info
+            var formData = new FormData();
+
+            var importFile = $("#importFile").get(0);
+            if (importFile.files.length > 0) {
+                formData.append("importFile", importFile.files[0]);
+                formData.append("exportId", $("#id").val());
+
+                fetch("/Admin/RewardImportData", {
+                    method: "POST",
+                    body: formData
+                })
+                    .then(response => response.json())
+                    .then(data => {
+                        console.log(data);
+                        if (data.error != "0") {
+                            setTimeout(function () {
+                                showModal('message-dialog');
+                                $('#message-content').html(data.content.split("\n").join("<br />"));
+                            }, 1000);
+                        } else {
+                            $("#importFile").val("");
+                            edit($("#id").val());
+                        }
+                    });
+
+                //$.ajax({
+                //    url: "/Admin/RewardImportData",
+                //    data: formData,
+                //    type: "POST",
+                //    success: function (data) {
+                //        console.log(data);
+                //        if (data.error != "0") {
+                //            setTimeout(function () {
+                //                showModal('message-dialog');
+                //                $('#message-content').html(data.content.split("\n").join("<br />"));
+                //            }, 1000);
+                //        } else {
+                //            viewData();
+                //        }
+                //    },
+                //    error: function (data) {
+                //        console.log(data.error);
+                //    }
+                //});
+            }
+        }
+
+        function exportSystem() {
+            var id = $("#id").val();
+            console.log(id);
+            // get service info
+            $.ajax({
+                url: "/Admin/ExportWinner",
+                data: {
+                    gameId: $("#gameId").val(),
+                    fromDate: $("#fromDate").val(),
+                    toDate: $("#toDate").val(),
+                    isPayOnline: "0"
+                },
+                type: "POST",
+                xhr: function () {
+                    var xhr = new XMLHttpRequest();
+                    xhr.onreadystatechange = function () {
+                        if (xhr.readyState == 2) {
+                            if (xhr.status == 200) {
+                                xhr.responseType = "blob";
+                                console.log("blob");
+                            } else {
+                                xhr.responseType = "text";
+                                console.log("text");
+                            }
+                        }
+                    };
+                    return xhr;
+                },
+                success: function (data, status, xhr) {
+                    let filename = "";
+                    let disposition = xhr.getResponseHeader('Content-Disposition');
+                    if (disposition && disposition.indexOf('attachment') !== -1) {
+                        let filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
+                        let matches = filenameRegex.exec(disposition);
+                        if (matches != null && matches[1]) filename = matches[1].replace(/['"]/g, '');
+                    }
+                    let a = document.createElement('a');
+                    let url = window.URL.createObjectURL(data);
+                    a.href = url;
+                    a.download = filename.replace('UTF-8', '');;
+                    document.body.append(a);
+                    a.click();
+                    a.remove();
+                    window.URL.revokeObjectURL(url);
+                    $("#overlay").fadeOut(300);
+                },
+                error: function (data) {
+                    console.log(data.error);
+                }
+            })
+        }
+
+        function exportData() {
+            var id = $("#id").val();
+            console.log(id);
+            // get service info
+            $.ajax({
+                url: "/Admin/ExportWinner",
+                data: {
+                    exportId: id,
+                    type: "2"
+                },
+                type: "POST",
+                xhr: function () {
+                    var xhr = new XMLHttpRequest();
+                    xhr.onreadystatechange = function () {
+                        if (xhr.readyState == 2) {
+                            if (xhr.status == 200) {
+                                xhr.responseType = "blob";
+                                console.log("blob");
+                            } else {
+                                xhr.responseType = "text";
+                                console.log("text");
+                            }
+                        }
+                    };
+                    return xhr;
+                },
+                success: function (data, status, xhr) {
+                    let filename = "";
+                    let disposition = xhr.getResponseHeader('Content-Disposition');
+                    if (disposition && disposition.indexOf('attachment') !== -1) {
+                        let filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
+                        let matches = filenameRegex.exec(disposition);
+                        if (matches != null && matches[1]) filename = matches[1].replace(/['"]/g, '');
+                    }
+                    let a = document.createElement('a');
+                    let url = window.URL.createObjectURL(data);
+                    a.href = url;
+                    a.download = filename.replace('UTF-8', '');;
+                    document.body.append(a);
+                    a.click();
+                    a.remove();
+                    window.URL.revokeObjectURL(url);
+                    $("#overlay").fadeOut(300);
+                },
+                error: function (data) {
+                    console.log(data.error);
+                }
+            })
+        }
+
+    </script>
+
+    <script>
+        function viewData() {
+            console.log("Search data");
+            startSpinner('btnViewData');
+            var exportId = $("#id").val();
+            console.log("exportId " + exportId);
+            //clearTable(tableDetail);
+            $.ajax({
+                url: "/Admin/RewardGetListWinner",
+                data: {
+                    exportId: $("#id").val(),
+                    type: "2"
+                },
+                type: "POST",
+                success: function (data) {
+                    stopSpinner('btnViewData');
+                    console.log(data);
+                    if (data.error != "0" && data.error != "1") {
+                        showModal('message-dialog');
+                        $('#message-content').html(data.content.split("\n").join("<br />"));
+                    } else {
+                        updateGridDataDetail(data.data.listLotoExportData);
+                        //resetTableDetail();
+                    }
+                },
+                error: function (data) {
+                    stopSpinner('btnViewData');
+                    console.log(data.error);
+                }
+            })
+        }
+
+        function updateGridDataDetail(val) {
+            console.log(val);
+            $("#gridbody_detail").html("");
+            var html = "";
+            if (val != undefined) {
+                for (var i = 0; i < val.length; i++) {
+                    var service = val[i];
+                    //<th scope="col" class="text-center">Phone</th>
+                    //    <th scope="col" class="text-center">Game</th>
+                    //    <th scope="col" class="text-center">Term</th>
+                    //    <th scope="col" class="text-center">Date</th>
+                    //    <th scope="col" class="text-center">Prize</th>
+                    //    <th scope="col" class="text-center">Paid</th>
+                    html += "<tr>";
+                    html += "<td scope='row'>" + (i + 1) + "</td>";
+                    html += "<td class='text-left'>" + service.msisdn + "</td>";
+                    html += "<td class='text-left'>" + GetGameName(service.gameId) + "</td>";
+                    html += "<td class='text-left'>" + service.randomId + "</td>";
+                    html += "<td class='text-left'>" + service.date + "</td>";
+                    html += "<td class='text-left'>" + service.winnerName + "</td>";
+                    html += "<td class='text-left'>" + formatNumber(service.money) + "</td>";
+                    html += "<td class='text-left'>" + (service.isPay == '0' ? 'Not yet' : 'Already') + "</td>";
+                    html += "</tr>";
+                }
+            }
+            $("#gridbody_detail").html(html);
+        }
+    </script>
+}

+ 344 - 0
SuperAdmin/SuperAdmin/Views/Admin/Statistics.cshtml

@@ -0,0 +1,344 @@
+@{
+    ViewBag.Title = "Statistics";
+    Layout = "~/Views/Shared/_Layout.cshtml";
+}
+
+@using SuperAdmin.Models;
+@using SuperAdmin.Models.Http;
+@using SuperAdmin.Controllers;
+@using SuperAdmin.Source;
+
+@model TrafficDayRes
+@{
+
+}
+
+<style>
+    img {
+        max-width: 100%;
+    }
+</style>
+
+<div class="content-header row">
+    <div class="content-header-left col-md-6 col-xs-12 mb-1">
+        <h2 class="content-header-title">Statistics</h2>
+    </div>
+    <div class="content-header-right breadcrumbs-right breadcrumbs-top col-md-6 col-xs-12">
+        <div class="breadcrumb-wrapper col-xs-12">
+            <ol class="breadcrumb">
+                <li class="breadcrumb-item">
+                    <a href="Index">Admin</a>
+                </li>
+                <li class="breadcrumb-item">
+                    <a href="#">Statistics</a>
+                </li>
+            </ol>
+        </div>
+    </div>
+</div>
+
+<div class="content-body">
+    <!-- Basic form layout section start -->
+    <section id="basic-form-layouts">
+        <div class="row service-height">
+            <div class="col-md-12">
+                <div class="card">
+                    <div class="card-header">
+                        <h4 class="card-title" id="basic-layout-form">Search</h4>
+                        <a class="heading-elements-toggle"><i class="icon-ellipsis font-medium-3"></i></a>
+                        <div class="heading-elements">
+                            <ul class="list-inline mb-0">
+                                <li><a data-action="collapse"><i class="icon-minus4"></i></a></li>
+                                <li><a data-action="expand"><i class="icon-expand2"></i></a></li>
+                            </ul>
+                        </div>
+                    </div>
+                    <div class="card-content collapse show">
+                        <div class="card-body">
+                            <div class="card-block">
+                                <div class="form-body">
+                                    @Html.AntiForgeryToken()
+                                    <div class="row">
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>From Date</label>
+                                                <div class='input-group'>
+                                                    <input type="text" class="form-control fromDate" id="fromDate" name="fromDate">
+                                                </div>
+                                            </div>
+                                        </div>
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>To date</label>
+                                                <div class='input-group'>
+                                                    <input type="text" class="form-control toDate" id="toDate" name="toDate">
+                                                </div>
+                                            </div>
+                                        </div>
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>Game</label>
+                                                <select class="form-control" id="gameId" name="gameId">
+                                                    <option value="-1">-- All --</option>
+                                                    <option value="1">Lucky power</option>
+                                                    <option value="2">Lucky day</option>
+                                                    <option value="3" selected>Lucky plus</option>
+                                                </select>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="row">
+                                        <div class="col-md-12">
+                                            <button type="button" class="btn btn-primary" onclick="search()" id="btnSearch">
+                                                <i class="icon-search"></i> Search
+                                            </button>
+                                            <button type="button" class="btn btn-warning" onclick="exportExcel()" id="btnExportExcel">
+                                                <i class="icon-export"></i> Export Excel
+                                            </button>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div class="col-12">
+                <div class="card">
+                    <div class="card-content">
+                        <div class="col-md-12 table-responsive" style="padding-top: 10px">
+                            @Html.Partial("_StatisticsList", Model)
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+        </div>
+    </section>
+    <!-- // Basic form layout section end -->
+</div>
+
+
+@section Scripts {
+    <script>
+
+        var tableDetail;
+
+        $(document).ready(function () {
+
+            $(".fromDate").datetimepicker({
+                format: "DD/MM/YYYY",
+                defaultDate: moment().add(-9, 'days')
+            });
+
+            $(".toDate").datetimepicker({
+                format: "DD/MM/YYYY",
+                defaultDate: moment().endOf('day')
+            });
+
+            //$('#grid_reward_detail thead tr').clone(true).appendTo('#grid_reward_detail thead');
+
+            //$('#grid_reward_detail thead tr:eq(1) th').each(function (i) {
+            //    var title = $(this).text();
+            //    if (title != undefined && title != "") {
+            //        $(this).html('<input type="text" placeholder="Search ' + title + '" />');
+
+            //        $('input', this).on('keyup change', function () {
+            //            if (tableDetail.column(i).search() !== this.value) {
+            //                tableDetail
+            //                    .column(i)
+            //                    .search(this.value)
+            //                    .draw();
+            //            }
+            //        });
+            //    }
+            //});
+
+            search();
+        });
+
+
+
+        function resetTableDetail() {
+            tableDetail = $("#grid_detail").DataTable({
+                orderCellsTop: true,
+                fixedHeader: true,
+                "footerCallback": function (row, data, start, end, display) {
+                    var api = this.api(), data;
+
+                    // Remove the formatting to get integer data for summation
+                    var intVal = function (i) {
+                        return typeof i === 'string' ?
+                            i.replace(/[\$.]/g, '') * 1 :
+                            typeof i === 'number' ?
+                                i : 0;
+                    };
+
+                    // Total over all pages
+                    var total0 = api
+                        .column(3)
+                        .data()
+                        .reduce(function (a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+                    var total1 = api
+                        .column(4)
+                        .data()
+                        .reduce(function (a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+                    var total2 = api
+                        .column(5)
+                        .data()
+                        .reduce(function (a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+                    var total3 = api
+                        .column(6)
+                        .data()
+                        .reduce(function (a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+                    var total4 = api
+                        .column(7)
+                        .data()
+                        .reduce(function (a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+                    var total5 = api
+                        .column(8)
+                        .data()
+                        .reduce(function (a, b) {
+                            return intVal(a) + intVal(b);
+                        }, 0);
+                    console.log(total0);
+                    console.log(total1);
+                    console.log(total2);
+                    // Update footer
+                    $(api.column(3).footer()).html(formatNumber(total0));
+                    $(api.column(4).footer()).html(formatNumber(total1));
+                    $(api.column(5).footer()).html(formatNumber(total2));
+                    $(api.column(6).footer()).html(formatNumber(total3));
+                    $(api.column(7).footer()).html(formatNumber(total4));
+                    $(api.column(8).footer()).html(formatNumber(total5));
+                }
+            });
+        }
+
+        function clearTable(table) {
+            if (table != null && table != undefined) {
+                table
+                    .clear()
+                    .destroy();
+            }
+        }
+        resetTableDetail();
+
+        function search() {
+            console.log("Search data");
+            startSpinner('btnSearch');
+            clearTable(tableDetail);
+            $.ajax({
+                url: "/Admin/StatisticsSearch",
+                data: {
+                    gameId: $("#gameId").val(),
+                    fromDate: $("#fromDate").val(),
+                    toDate: $("#toDate").val()
+                },
+                type: "POST",
+                success: function (data) {
+                    stopSpinner('btnSearch');
+                    console.log(data);
+                    if (data.error != "0" && data.error != "1") {
+                        showModal('message-dialog');
+                        $('#message-content').html(data.content.split("\n").join("<br />"));
+                    } else {
+                        updateGridDataDetail(data.data.listRevenue);
+                        resetTableDetail();
+                    }
+                },
+                error: function (data) {
+                    stopSpinner('btnSearch');
+                    console.log(data.error);
+                }
+            })
+        }
+
+        function updateGridDataDetail(val) {
+            console.log(val);
+            $("#gridbody_detail").html("");
+            var html = "";
+            if (val != undefined) {
+                for (var i = 0; i < val.length; i++) {
+                    var service = val[i];
+                    html += "<tr>";
+                    html += "<td scope='row'>" + (i + 1) + "</td>";
+                    html += "<td class='text-center'>" + service.date + "</td>";
+                    html += "<td class='text-center'>" + GetGameName(service.gameId) + "</td>";
+                    html += "<td class='text-right'>" + formatNumber(service.totalUser) + "</td>";
+                    html += "<td class='text-right'>" + formatNumber(service.totalTicket) + "</td>";
+                    html += "<td class='text-right'>" + formatNumber(service.totalMoney) + "</td>";
+                    html += "<td class='text-right'>" + formatNumber(service.totalTicketWin) + "</td>";
+                    html += "<td class='text-right'>" + formatNumber(service.totalMoneyWin) + "</td>";
+                    html += "<td class='text-right'>" + formatNumber(service.rate) + "</td>";
+                    html += "</tr>";
+                }
+            }
+            $("#gridbody_detail").html(html);
+        }
+
+        function exportExcel() {
+            console.log("Export data");
+            startSpinner('btnExportExcel'); 
+            $.ajax({
+                url: "/Admin/StatisticsExport",
+                data: {
+                    gameId: $("#gameId").val(),
+                    fromDate: $("#fromDate").val(),
+                    toDate: $("#toDate").val()
+                },
+                type: "POST",
+                xhr: function () {
+                    var xhr = new XMLHttpRequest();
+                    xhr.onreadystatechange = function () {
+                        if (xhr.readyState == 2) {
+                            if (xhr.status == 200) {
+                                xhr.responseType = "blob";
+                                console.log("blob");
+                            } else {
+                                xhr.responseType = "text";
+                                console.log("text");
+                            }
+                        }
+                    };
+                    return xhr;
+                },
+                success: function (data, status, xhr) {
+
+                    stopSpinner('btnExportExcel'); 
+                    let filename = "";
+                    let disposition = xhr.getResponseHeader('Content-Disposition');
+                    if (disposition && disposition.indexOf('attachment') !== -1) {
+                        let filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
+                        let matches = filenameRegex.exec(disposition);
+                        if (matches != null && matches[1]) filename = matches[1].replace(/['"]/g, '');
+                    }
+                    let a = document.createElement('a');
+                    let url = window.URL.createObjectURL(data);
+                    a.href = url;
+                    a.download = filename.replace('UTF-8', '');;
+                    document.body.append(a);
+                    a.click();
+                    a.remove();
+                    window.URL.revokeObjectURL(url);
+                    $("#overlay").fadeOut(300);
+                },
+                error: function (data) {
+                    stopSpinner('btnExportExcel'); 
+                    console.log(data.error);
+                }
+            })
+        }
+    </script>
+}

+ 295 - 0
SuperAdmin/SuperAdmin/Views/Admin/Trade.cshtml

@@ -0,0 +1,295 @@
+@{
+    ViewBag.Title = "Trade";
+    Layout = "~/Views/Shared/_Layout.cshtml";
+}
+
+@using SuperAdmin.Models;
+@using SuperAdmin.Models.Http;
+@using SuperAdmin.Controllers;
+@using SuperAdmin.Source;
+
+@model TrafficDayRes
+@{
+
+}
+
+<style>
+    img {
+        max-width: 100%;
+    }
+</style>
+
+<div class="content-header row">
+    <div class="content-header-left col-md-6 col-xs-12 mb-1">
+        <h2 class="content-header-title">Ticket Buying Trans</h2>
+    </div>
+    <div class="content-header-right breadcrumbs-right breadcrumbs-top col-md-6 col-xs-12">
+        <div class="breadcrumb-wrapper col-xs-12">
+            <ol class="breadcrumb">
+                <li class="breadcrumb-item">
+                    <a href="Index">Admin</a>
+                </li>
+                <li class="breadcrumb-item">
+                    <a href="#">Ticket Buying Trans</a>
+                </li>
+            </ol>
+        </div>
+    </div>
+</div>
+
+<div class="content-body">
+    <!-- Basic form layout section start -->
+    <section id="basic-form-layouts">
+        <div class="row service-height">
+            <div class="col-md-12">
+                <div class="card">
+                    <div class="card-header">
+                        <h4 class="card-title" id="basic-layout-form">Search</h4>
+                        <a class="heading-elements-toggle"><i class="icon-ellipsis font-medium-3"></i></a>
+                        <div class="heading-elements">
+                            <ul class="list-inline mb-0">
+                                <li><a data-action="collapse"><i class="icon-minus4"></i></a></li>
+                                <li><a data-action="expand"><i class="icon-expand2"></i></a></li>
+                            </ul>
+                        </div>
+                    </div>
+                    <div class="card-content collapse show">
+                        <div class="card-body">
+                            <div class="card-block">
+                                <div class="form-body">
+                                    @Html.AntiForgeryToken()
+                                    <div class="row">
+                                        <div class="col-md-3 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>Phone number</label>
+                                                <div class='input-group'>
+                                                    <input type="text" class="form-control" id="msisdn" name="msisdn">
+                                                </div>
+                                            </div>
+                                        </div>
+                                        <div class="col-md-3 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>Buying from date</label>
+                                                <div class='input-group'>
+                                                    <input type="text" class="form-control fromDate" id="fromDate" name="fromDate">
+                                                </div>
+                                            </div>
+                                        </div>
+                                        <div class="col-md-3 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>Buying to date</label>
+                                                <div class='input-group'>
+                                                    <input type="text" class="form-control toDate" id="toDate" name="toDate">
+                                                </div>
+                                            </div>
+                                        </div>
+                                        <div class="col-md-3 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>Game</label>
+                                                <select class="form-control" id="gameId" name="gameId">
+                                                    <option value="-1" selected>-- All --</option>
+                                                    <option value="1">Lucky power</option>
+                                                    <option value="2">Lucky day</option>
+                                                    <option value="3" >Lucky plus</option>
+                                                </select>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="row">
+                                        <div class="col-md-12">
+                                            <button type="button" class="btn btn-primary" onclick="search()" id="btnSearch">
+                                                <i class="icon-search"></i> Search
+                                            </button>
+                                            <button type="button" class="btn btn-warning" onclick="exportExcel()" id="btnExportExcel">
+                                                <i class="icon-export"></i> Export Excel
+                                            </button>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div class="col-12">
+                <div class="card">
+                    <div class="card-content">
+                        <div class="col-md-12 table-responsive" style="padding-top: 10px">
+                            @Html.Partial("_TradeList", Model)
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+        </div>
+    </section>
+    <!-- // Basic form layout section end -->
+</div>
+
+
+@section Scripts {
+    <script>
+
+        var tableDetail;
+
+        $(document).ready(function () {
+
+            $(".fromDate").datetimepicker({
+                format: "DD/MM/YYYY",
+                defaultDate: moment().add(-30, 'days')
+            });
+
+            $(".toDate").datetimepicker({
+                format: "DD/MM/YYYY",
+                defaultDate: moment().endOf('day')
+            });
+
+            //$('#grid_reward_detail thead tr').clone(true).appendTo('#grid_reward_detail thead');
+
+            //$('#grid_reward_detail thead tr:eq(1) th').each(function (i) {
+            //    var title = $(this).text();
+            //    if (title != undefined && title != "") {
+            //        $(this).html('<input type="text" placeholder="Search ' + title + '" />');
+
+            //        $('input', this).on('keyup change', function () {
+            //            if (tableDetail.column(i).search() !== this.value) {
+            //                tableDetail
+            //                    .column(i)
+            //                    .search(this.value)
+            //                    .draw();
+            //            }
+            //        });
+            //    }
+            //});
+
+            //search();
+        });
+
+
+
+        function resetTableDetail() {
+            tableDetail = $("#grid_detail").DataTable({
+                orderCellsTop: true,
+                fixedHeader: true
+            });
+        }
+
+        function clearTable(table) {
+            if (table != null && table != undefined) {
+                table
+                    .clear()
+                    .destroy();
+            }
+        }
+        resetTableDetail();
+
+        function search() {
+            console.log("Search data");
+            startSpinner('btnSearch');
+            clearTable(tableDetail);
+            $.ajax({
+                url: "/Admin/TradeSearch",
+                data: {
+                    msisdn: $("#msisdn").val(),
+                    gameId: $("#gameId").val(),
+                    fromDate: $("#fromDate").val(),
+                    toDate: $("#toDate").val()
+                },
+                type: "POST",
+                success: function (data) {
+                    stopSpinner('btnSearch');
+                    console.log(data);
+                    if (data.error != "0" && data.error != "1") {
+                        showModal('message-dialog');
+                        $('#message-content').html(data.content.split("\n").join("<br />"));
+                    } else {
+                        updateGridDataDetail(data.data.listTicketInfo);
+                        resetTableDetail();
+                    }
+                },
+                error: function (data) {
+                    stopSpinner('btnSearch');
+                    console.log(data.error);
+                }
+            })
+        }
+
+        function updateGridDataDetail(val) {
+            console.log(val);
+            $("#gridbody_detail").html("");
+            var html = "";
+            if (val != undefined) {
+                for (var i = 0; i < val.length; i++) {
+                    var service = val[i];
+                    html += "<tr>";
+                    html += "<td scope='row'>" + (i + 1) + "</td>";
+                    html += "<td class='text-center'>" + service.date + "</td>";
+                    html += "<td class='text-left'>" + service.billCode + "</td>";
+                    html += "<td class='text-left'>" + service.subId + "</td>";
+                    html += "<td class='text-left'>" + service.users + "</td>";
+                    html += "<td class='text-center'>" + GetGameName(service.gameId) + "</td>";
+                    html += "<td class='text-left'>" + service.randomId + "</td>";
+                    html += "<td class='text-right'>" + formatNumber(service.money) + "</td>";
+                    html += "<td class='text-left'>" + TicketVisible(service.ticket) + "</td>"; 
+                    html += "</tr>";
+                }
+            }
+            $("#gridbody_detail").html(html);
+        }
+
+        function exportExcel() {
+            console.log("Export data");
+            startSpinner('btnExportExcel');
+            $.ajax({
+                url: "/Admin/TradeExport",
+                data: {
+                    msisdn: $("#msisdn").val(),
+                    gameId: $("#gameId").val(),
+                    fromDate: $("#fromDate").val(),
+                    toDate: $("#toDate").val()
+                },
+                type: "POST",
+                xhr: function () {
+                    var xhr = new XMLHttpRequest();
+                    xhr.onreadystatechange = function () {
+                        if (xhr.readyState == 2) {
+                            if (xhr.status == 200) {
+                                xhr.responseType = "blob";
+                                console.log("blob");
+                            } else {
+                                xhr.responseType = "text";
+                                console.log("text");
+                            }
+                        }
+                    };
+                    return xhr;
+                },
+                success: function (data, status, xhr) {
+
+                    stopSpinner('btnExportExcel');
+                    let filename = "";
+                    let disposition = xhr.getResponseHeader('Content-Disposition');
+                    if (disposition && disposition.indexOf('attachment') !== -1) {
+                        let filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
+                        let matches = filenameRegex.exec(disposition);
+                        if (matches != null && matches[1]) filename = matches[1].replace(/['"]/g, '');
+                    }
+                    let a = document.createElement('a');
+                    let url = window.URL.createObjectURL(data);
+                    a.href = url;
+                    a.download = filename.replace('UTF-8', '');;
+                    document.body.append(a);
+                    a.click();
+                    a.remove();
+                    window.URL.revokeObjectURL(url);
+                    $("#overlay").fadeOut(300);
+                },
+                error: function (data) {
+                    stopSpinner('btnExportExcel');
+                    console.log(data.error);
+                }
+            })
+        }
+    </script>
+}

+ 32 - 0
SuperAdmin/SuperAdmin/Views/Admin/_Blacklist.cshtml

@@ -0,0 +1,32 @@
+@using SuperAdmin.Models;
+@using SuperAdmin.Models.Http;
+@using SuperAdmin.Controllers;
+@using SuperAdmin.Source;
+
+@model BlacklistSearchRes
+
+<table class="table table-striped table-bordered zero-configuration" id="grid_detail">
+    <thead class="thead-inverse">
+        <tr>
+            <th scope="col">#</th>
+            <th scope="col" class="text-center" style="vertical-align:middle">Phone number</th>
+            <th scope="col" class="text-center" style="vertical-align:middle">Import date</th>
+            <th scope="col" class="text-center" style="vertical-align:middle">Delete</th>
+        </tr>
+    </thead>
+    <tbody id="gridbody">
+        @if (Model != null && Model.list != null)
+        {
+            for (int i = 0; i < Model.list.Count; i++)
+            {
+                BlacklistDetail ws = Model.list[@i];
+                <tr>
+                    <td scope="row">@(i + 1)</td>
+                    <td class="text-left">@ws.msisdn</td>
+                    <td class="text-left">@ws.sysdate</td>
+                    <td class='text-center'><span class='fa fa-remove cursor-pointer' onclick='remove("@ws.msisdn")'></span></td>
+                </tr>
+            }
+        }
+    </tbody>
+</table>

+ 84 - 0
SuperAdmin/SuperAdmin/Views/Admin/_Dashboard.cshtml

@@ -0,0 +1,84 @@
+@using SuperAdmin.Models.Http;
+@inject IJsonHelper Json;
+@model DashboardModel
+
+@{
+    float pcMoney1 = 0;
+    float pcMoney2 = 0;
+    float pcMoney3 = 0;
+    float pcWin1 = 0;
+    float pcWin2 = 0;
+    float pcWin3 = 0;
+    float totalMoney = float.Parse(Model.revenueTotal.totalMoney);
+    float totalMoneyWin = float.Parse(Model.revenueTotal.totalMoneyWin);
+    if (totalMoney > 0)
+    {
+        pcMoney1 = float.Parse(Model.revenueLuckyPower.totalMoney) * 100 / totalMoney;
+        pcMoney2 = float.Parse(Model.revenueLuckyDay.totalMoney) * 100 / totalMoney;
+        pcMoney3 = float.Parse(Model.revenueLuckyPlus.totalMoney) * 100 / totalMoney;
+    }
+    if (totalMoneyWin > 0)
+    {
+        pcWin1 = float.Parse(Model.revenueLuckyPower.totalMoneyWin) * 100 / totalMoneyWin;
+        pcWin2 = float.Parse(Model.revenueLuckyDay.totalMoneyWin) * 100 / totalMoneyWin;
+        pcWin3 = float.Parse(Model.revenueLuckyPlus.totalMoneyWin) * 100 / totalMoneyWin;
+    }
+
+    //var totalUsers = Newtonsoft.Json.JsonConvert.SerializeObject(myObj) as String;
+
+    int size = Model.listRevenueTotal.Count;
+    var xAxis1 = new String[size];
+    var totalRevenue1 = new long[xAxis1.Length];
+    var totalPaid1 = new long[xAxis1.Length];
+    var totalRevenue2 = new long[xAxis1.Length];
+    var totalPaid2 = new long[xAxis1.Length];
+    var totalRevenue3 = new long[xAxis1.Length];
+    var totalPaid3 = new long[xAxis1.Length];
+    // sub
+    var totalSub = new long[xAxis1.Length];
+    //var totalNewReg = new long[xAxis1.Length];
+
+    var totalHourly = new long[24];
+
+    for (int i = 0; i < size; i++)
+    {
+        xAxis1[i] = Model.listRevenueTotal[i].date.Substring(0, 5);
+    }
+
+    for (int i = size - 1; i >= 0; i--)
+    {
+        totalSub[xAxis1.Length - (size - i)] = long.Parse(Model.listRevenueTotal[i].totalUser);
+    }
+
+
+    for (int i = size - 1; i >= 0; i--)
+    {
+        totalRevenue1[xAxis1.Length - (size - i)] = long.Parse(Model.listRevenuePower[i].totalMoney);
+        totalPaid1[xAxis1.Length - (size - i)] = long.Parse(Model.listRevenuePower[i].totalMoneyWin);
+        ////totalNewReg[xAxis1.Length - (Model.listRevenueTotal.Count - i)] = Model.listRevenueTotal[i].totalUser;
+    }
+
+    for (int i = size - 1; i >= 0; i--)
+    {
+        totalRevenue2[xAxis1.Length - (size - i)] = long.Parse(Model.listRevenueDay[i].totalMoney);
+        totalPaid2[xAxis1.Length - (size - i)] = long.Parse(Model.listRevenueDay[i].totalMoneyWin);
+    }
+
+    for (int i = size - 1; i >= 0; i--)
+    {
+        totalRevenue3[xAxis1.Length - (size - i)] = long.Parse(Model.listRevenuePlus[i].totalMoney);
+        totalPaid3[xAxis1.Length - (size - i)] = long.Parse(Model.listRevenuePlus[i].totalMoneyWin);
+    }
+
+    var chartRevenue1 = Newtonsoft.Json.JsonConvert.SerializeObject(totalRevenue1) as String;
+    var chartPaid1 = Newtonsoft.Json.JsonConvert.SerializeObject(totalPaid1) as String;
+
+    var chartRevenue2 = Newtonsoft.Json.JsonConvert.SerializeObject(totalRevenue2) as String;
+    var chartPaid2 = Newtonsoft.Json.JsonConvert.SerializeObject(totalPaid2) as String;
+
+    var chartRevenue3 = Newtonsoft.Json.JsonConvert.SerializeObject(totalRevenue3) as String;
+    var chartPaid3 = Newtonsoft.Json.JsonConvert.SerializeObject(totalPaid3) as String;
+
+    var chartUser = Newtonsoft.Json.JsonConvert.SerializeObject(totalSub) as String;
+    var chartXAxis = Newtonsoft.Json.JsonConvert.SerializeObject(xAxis1) as String;
+}

+ 39 - 0
SuperAdmin/SuperAdmin/Views/Admin/_FinanceRevenueDetail.cshtml

@@ -0,0 +1,39 @@
+@using SuperAdmin.Models;
+@using SuperAdmin.Models.Http;
+@using SuperAdmin.Controllers;
+@using SuperAdmin.Source;
+
+@model FinanceDetailRes
+
+<table class="table table-striped table-bordered zero-configuration" id="grid_detail">
+    <thead class="thead-inverse">
+        <tr>
+            <th scope="col">#</th>
+            <th scope="col" class="text-center">Bill code</th>
+            <th scope="col" class="text-center">Transaction code</th>
+            <th scope="col" class="text-center">Date</th>
+            <th scope="col" class="text-center">Game</th>
+            <th scope="col" class="text-center">Customer name</th>
+            <th scope="col" class="text-center">Phone number</th>
+            <th scope="col" class="text-center">Quantity</th>
+            <th scope="col" class="text-center">Price</th>
+            <th scope="col" class="text-center">Total amount</th>
+            <th scope="col" class="text-center">Amount before tax</th>
+            <th scope="col" class="text-center">Tax (%)</th>
+            <th scope="col" class="text-center">Amount tax</th>
+        </tr>
+    </thead>
+    <tbody id="gridbody_detail">
+    </tbody>
+    <tfoot>
+        <tr>
+            <th colspan="7" class="text-right">Total:</th>
+            <th class="text-right"></th>
+            <th class="text-right"></th>
+            <th class="text-right"></th>
+            <th class="text-right"></th>
+            <th class="text-right"></th>
+            <th class="text-right"></th>
+        </tr>
+    </tfoot>
+</table>

+ 33 - 0
SuperAdmin/SuperAdmin/Views/Admin/_FinanceRevenueSummary.cshtml

@@ -0,0 +1,33 @@
+@using SuperAdmin.Models;
+@using SuperAdmin.Models.Http;
+@using SuperAdmin.Controllers;
+@using SuperAdmin.Source;
+@model FinanceDetailRes
+
+
+<table class="table table-striped table-bordered zero-configuration" id="grid_detail">
+    <thead class="thead-inverse">
+        <tr>
+            <th scope="col">#</th>
+            <th scope="col" class="text-center">Game</th>
+            <th scope="col" class="text-center">Quantity</th>
+            <th scope="col" class="text-center">Total amount</th>
+            <th scope="col" class="text-center">Amount before tax</th>
+            <th scope="col" class="text-center">Tax (%)</th>
+            <th scope="col" class="text-center">Amount tax</th>
+        </tr>
+    </thead>
+    <tbody id="gridbody_detail">
+    </tbody>
+
+    <tfoot>
+        <tr>
+            <th colspan="2" class="text-right">Total:</th>
+            <th class="text-right"></th>
+            <th class="text-right"></th>
+            <th class="text-right"></th>
+            <th class="text-right"></th>
+            <th class="text-right"></th>
+        </tr>
+    </tfoot>
+</table>

+ 38 - 0
SuperAdmin/SuperAdmin/Views/Admin/_FinanceRewardDetail.cshtml

@@ -0,0 +1,38 @@
+@using SuperAdmin.Models;
+@using SuperAdmin.Models.Http;
+@using SuperAdmin.Controllers;
+@using SuperAdmin.Source;
+
+@model FinanceDetailRes
+
+<table class="table table-striped table-bordered zero-configuration" id="grid_detail">
+    <thead class="thead-inverse">
+        <tr>
+            <th scope="col">#</th>
+            <th scope="col" class="text-center">Transaction code</th>
+            <th scope="col" class="text-center">Date</th>
+            <th scope="col" class="text-center">Game</th>
+            <th scope="col" class="text-center">Customer name</th>
+            <th scope="col" class="text-center">Phone number</th>
+            <th scope="col" class="text-center">Quantity</th>
+            <th scope="col" class="text-center">Price</th>
+            <th scope="col" class="text-center">Sub total</th>
+            <th scope="col" class="text-center">Tax (%)</th>
+            <th scope="col" class="text-center">Amount tax</th>
+            <th scope="col" class="text-center">Total fee</th>
+        </tr>
+    </thead>
+    <tbody id="gridbody_detail">
+    </tbody>
+    <tfoot>
+        <tr>
+            <th colspan="6" class="text-right">Total:</th>
+            <th class="text-right"></th>
+            <th class="text-right"></th>
+            <th class="text-right"></th>
+            <th class="text-right"></th>
+            <th class="text-right"></th>
+            <th class="text-right"></th>
+        </tr>
+    </tfoot>
+</table>

+ 32 - 0
SuperAdmin/SuperAdmin/Views/Admin/_FinanceRewardSummary.cshtml

@@ -0,0 +1,32 @@
+@using SuperAdmin.Models;
+@using SuperAdmin.Models.Http;
+@using SuperAdmin.Controllers;
+@using SuperAdmin.Source;
+@model FinanceDetailRes
+
+<table class="table table-striped table-bordered zero-configuration" id="grid_detail">
+    <thead class="thead-inverse">
+        <tr>
+            <th scope="col">#</th>
+            <th scope="col" class="text-center">Game</th>
+            <th scope="col" class="text-center">Quantity</th>
+            <th scope="col" class="text-center">Total amount</th>
+            <th scope="col" class="text-center">Tax (%)</th>
+            <th scope="col" class="text-center">Amount tax</th>
+            <th scope="col" class="text-center">Total fee</th>
+        </tr>
+    </thead>
+    <tbody id="gridbody_detail">
+    </tbody>
+
+    <tfoot>
+        <tr>
+            <th colspan="2" class="text-right">Total:</th>
+            <th class="text-right"></th>
+            <th class="text-right"></th>
+            <th class="text-right"></th>
+            <th class="text-right"></th>
+            <th class="text-right"></th>
+        </tr>
+    </tfoot>
+</table>

+ 29 - 0
SuperAdmin/SuperAdmin/Views/Admin/_PlayerExport.cshtml

@@ -0,0 +1,29 @@
+@using SuperAdmin.Models;
+@using SuperAdmin.Models.Http;
+@using SuperAdmin.Controllers;
+@using SuperAdmin.Source;
+
+@model SearchMsisdnRes
+
+<table class="table table-striped table-bordered zero-configuration" id="grid_detail">
+    <thead class="thead-inverse">
+        <tr>
+            <th scope="col">#</th>
+            <th scope="col" class="text-center" style="vertical-align:middle">Phone number</th>
+        </tr>
+    </thead>
+    <tbody id="gridbody_detail">
+        @if (Model != null && Model.list != null)
+        {
+            for (int i = 0; i < Model.list.Count; i++)
+            {
+                TicketMsisdn ws = Model.list[@i];
+                <tr>
+                    <td scope="row">@(i + 1)</td>
+                    <td class="text-left">@ws.msisdn</td>
+
+                </tr>
+            }
+        }
+    </tbody>
+</table>

+ 89 - 0
SuperAdmin/SuperAdmin/Views/Admin/_PlayerHistory.cshtml

@@ -0,0 +1,89 @@
+@using SuperAdmin.Models;
+@using SuperAdmin.Models.Http;
+@using SuperAdmin.Controllers;
+@using SuperAdmin.Source;
+
+@model SearchMsisdnRes
+
+<table class="table table-striped table-bordered zero-configuration" id="grid_detail">
+    <thead class="thead-inverse">
+        <tr>
+            <th scope="col">#</th>
+            <th scope="col" class="text-center" style="vertical-align:middle">Phone number</th>
+            <th scope="col" class="text-center" style="vertical-align:middle">Lottery</th>
+            <th scope="col" class="text-center" style="vertical-align:middle">Game</th>
+            <th scope="col" class="text-center" style="vertical-align:middle">Channel Play</th>
+            <th scope="col" class="text-center" style="vertical-align:middle">Ticket ID</th>
+            <th scope="col" class="text-center" style="vertical-align:middle">Bet number</th>
+            <th scope="col" class="text-center" style="vertical-align:middle">Bet Money<br /> (Cent)</th>
+            <th scope="col" class="text-center" style="vertical-align:middle">Buy time</th>
+            <th scope="col" class="text-center" style="vertical-align:middle">Drawn time</th>
+            <th scope="col" class="text-center" style="min-width: 80px; vertical-align: middle">Result</th>
+            <th scope="col" class="text-center" style="vertical-align:middle">Win Money <br />(Cent)</th>
+        </tr>
+    </thead>
+    <tbody id="gridbody_detail">
+        @if (Model != null && Model.list != null)
+        {
+            for (int i = 0; i < Model.list.Count; i++)
+            {
+                TicketMsisdn ws = Model.list[@i];
+                <tr>
+                    <td scope="row">@(i + 1)</td>
+                    <td class="text-left">@ws.msisdn</td>
+                    <td class="text-left">@ws.lottery</td>
+                    <td class="text-left">@ws.game</td>
+                    <td class="text-left">@ws.channel</td>
+                    <td class="text-left">@ws.ticketId</td>
+                    <td class="text-left">@ws.ticketCode</td>
+                    <td class="text-right">@ws.money</td>
+                    <td class="text-center">@ws.buyTime</td>
+                    <td class="text-center">@ws.drawTime</td>
+                    <td class="text-left">
+                        @{
+                            var rs = ws.result;
+                            if (rs != null && rs.Length > 0 && rs.Split("$").Length >= 3)
+                            {
+                                var top3 = rs.Split("$")[0];
+                                var starter = rs.Split("$")[1];
+                                var consolation = rs.Split("$")[2];
+                                <div>
+                                    <b>1st Prize: </b> @top3.Split("-")[0]
+                                </div>
+                                <div>
+                                    <b>2nd Prize: </b> @top3.Split("-")[1]
+                                </div>
+                                <div>
+                                    <b>3rd Prize: </b> @top3.Split("-")[2]
+                                </div>
+                                <div>
+                                    <b>Starter Prize: </b> @starter
+                                </div>
+                                <div>
+                                    <b>Consolation Prize: </b> @consolation
+                                </div>
+                            }
+                        }
+                    </td>
+                    <td class="text-right">@ws.moneyWin</td>
+
+                </tr>
+            }
+        }
+    </tbody>
+    <tfoot>
+        <tr>
+            <th colspan="2" class="text-right">Total:</th>
+            <th class="text-right"></th>
+            <th class="text-right"></th>
+            <th class="text-right"></th>
+            <th class="text-right"></th>
+            <th class="text-right"></th>
+            <th class="text-right"></th>
+            <th class="text-right"></th>
+            <th class="text-right"></th>
+            <th class="text-right"></th>
+            <th class="text-right"></th>
+        </tr>
+    </tfoot>
+</table>

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini