student 2 dní pred
rodič
commit
d7b171a28c
100 zmenil súbory, kde vykonal 12862 pridanie a 0 odobranie
  1. 1 0
      ReportCMS/.gitignore
  2. BIN
      ReportCMS/ReportCMS/References/feather.woff
  3. 25 0
      ReportCMS/ReportCMS/Report_cms.sln
  4. 12 0
      ReportCMS/ReportCMS/SuperAdmin/.config/dotnet-tools.json
  5. 1155 0
      ReportCMS/ReportCMS/SuperAdmin/Controllers/AdminController.cs
  6. 598 0
      ReportCMS/ReportCMS/SuperAdmin/Controllers/BaseController.cs
  7. 1256 0
      ReportCMS/ReportCMS/SuperAdmin/Controllers/ConfigController.cs
  8. 30 0
      ReportCMS/ReportCMS/SuperAdmin/Controllers/EventController.cs
  9. 351 0
      ReportCMS/ReportCMS/SuperAdmin/Controllers/HomeController.cs
  10. 46 0
      ReportCMS/ReportCMS/SuperAdmin/Controllers/PartialController.cs
  11. 16 0
      ReportCMS/ReportCMS/SuperAdmin/Controllers/ProcedureController.cs
  12. 30 0
      ReportCMS/ReportCMS/SuperAdmin/Controllers/RolesController.cs
  13. 1391 0
      ReportCMS/ReportCMS/SuperAdmin/Controllers/TreeController.cs
  14. 259 0
      ReportCMS/ReportCMS/SuperAdmin/Controllers/UtilsController.cs
  15. 31 0
      ReportCMS/ReportCMS/SuperAdmin/Extensions/ConfigAction.cs
  16. 29 0
      ReportCMS/ReportCMS/SuperAdmin/Extensions/RewriteSubdomainRule.cs
  17. 29 0
      ReportCMS/ReportCMS/SuperAdmin/Extensions/SessionExtensions.cs
  18. 11 0
      ReportCMS/ReportCMS/SuperAdmin/Models/ErrorViewModel.cs
  19. 55 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Http/ActionRequest.cs
  20. 35 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Http/AddSourceReq.cs
  21. 75 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Http/AppRequest.cs
  22. 51 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Http/AppResponse.cs
  23. 34 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Http/CategoryRes.cs
  24. 60 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Http/ChargeRegisterReq.cs
  25. 67 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Http/ContentFaq.cs
  26. 67 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Http/ContentParam.cs
  27. 94 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Http/DashboardModel.cs
  28. 85 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Http/DashboardPartnerModel.cs
  29. 47 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Http/DataTypeOneRequest.cs
  30. 90 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Http/Evoucher.cs
  31. 42 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Http/GetArticlesReq.cs
  32. 62 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Http/GetCodePrizeRes.cs
  33. 35 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Http/GetQuestionsGroupRes.cs
  34. 91 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Http/GetRandom.cs
  35. 55 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Http/GetRankingPrizesReq.cs
  36. 37 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Http/GetRequest.cs
  37. 42 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Http/GetSongRes.cs
  38. 40 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Http/GetSourceReq.cs
  39. 33 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Http/GetUserTurnReq.cs
  40. 39 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Http/HistoryPlayRes.cs
  41. 32 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Http/InsertArticles.cs
  42. 37 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Http/InsertCodePrizeRes.cs
  43. 42 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Http/InsertSong.cs
  44. 56 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Http/InsertToPicRes.cs
  45. 49 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Http/LoadRankingPrizesReq.cs
  46. 27 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Http/LoginRequest.cs
  47. 46 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Http/PrizesReq.cs
  48. 45 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Http/RankingRes.cs
  49. 48 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Http/ReportDailyRes.cs
  50. 60 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Http/ReportMoneyHourlyRes.cs
  51. 22 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Http/SetCodePrizeForUserRes.cs
  52. 21 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Http/SetPrizeReq.cs
  53. 46 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Http/SetToPicRes.cs
  54. 35 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Http/SubmitPayRewardsReq.cs
  55. 22 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Http/SubmitPrizeReq.cs
  56. 32 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Http/UpdateCodePrizeRes.cs
  57. 74 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Http/UpdatePrizesReq.cs
  58. 36 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Http/UpdateSourceReq.cs
  59. 58 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Http/UpdateToPicRes.cs
  60. 29 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Http/UserPrizeReq.cs
  61. 54 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Http/WinnerReq.cs
  62. 39 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Http/loadPredictTermIdRes.cs
  63. 43 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Http/loadPrizeIdReq.cs
  64. 18 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Object/Account.cs
  65. 42 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Object/Charging.cs
  66. 55 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Object/Posting.cs
  67. 55 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Object/Province.cs
  68. 36 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Object/RolesObj.cs
  69. 219 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Object/RowStructure.cs
  70. 55 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Object/Topic.cs
  71. 112 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Object/UserProfile.cs
  72. 130 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Object/UserRoles.cs
  73. 23 0
      ReportCMS/ReportCMS/SuperAdmin/Models/View/CommonModel.cs
  74. 26 0
      ReportCMS/ReportCMS/SuperAdmin/Models/View/EnewsViewModel.cs
  75. 27 0
      ReportCMS/ReportCMS/SuperAdmin/Models/View/EventViewModel.cs
  76. 21 0
      ReportCMS/ReportCMS/SuperAdmin/Models/View/PartialViewModel.cs
  77. 14 0
      ReportCMS/ReportCMS/SuperAdmin/Models/View/TreeViewModel.cs
  78. 280 0
      ReportCMS/ReportCMS/SuperAdmin/Models/Vsa/Vsa.cs
  79. 78 0
      ReportCMS/ReportCMS/SuperAdmin/Oracle/OracleDynamicParameters.cs
  80. 40 0
      ReportCMS/ReportCMS/SuperAdmin/Program.cs
  81. 22 0
      ReportCMS/ReportCMS/SuperAdmin/Properties/PublishProfiles/FolderProfile.pubxml
  82. 22 0
      ReportCMS/ReportCMS/SuperAdmin/Properties/PublishProfiles/FolderProfile1.pubxml
  83. 22 0
      ReportCMS/ReportCMS/SuperAdmin/Properties/PublishProfiles/FolderProfile2.pubxml
  84. 21 0
      ReportCMS/ReportCMS/SuperAdmin/Properties/PublishProfiles/FolderProfile3.pubxml
  85. 17 0
      ReportCMS/ReportCMS/SuperAdmin/Properties/PublishProfiles/FolderProfile4.pubxml
  86. 30 0
      ReportCMS/ReportCMS/SuperAdmin/Properties/launchSettings.json
  87. 85 0
      ReportCMS/ReportCMS/SuperAdmin/Report_cms.csproj
  88. 16 0
      ReportCMS/ReportCMS/SuperAdmin/Repositories/ISuperAdminRepo.cs
  89. 60 0
      ReportCMS/ReportCMS/SuperAdmin/Repositories/SuperAdminRepo.cs
  90. 306 0
      ReportCMS/ReportCMS/SuperAdmin/Source/LumilotoUtils.cs
  91. 127 0
      ReportCMS/ReportCMS/SuperAdmin/Startup.cs
  92. 24 0
      ReportCMS/ReportCMS/SuperAdmin/SuperAdmin.sln
  93. 638 0
      ReportCMS/ReportCMS/SuperAdmin/Views/Admin/Dashboard.cshtml
  94. 420 0
      ReportCMS/ReportCMS/SuperAdmin/Views/Admin/DashboardPartner.cshtml
  95. 472 0
      ReportCMS/ReportCMS/SuperAdmin/Views/Admin/GetArticles.cshtml
  96. 484 0
      ReportCMS/ReportCMS/SuperAdmin/Views/Admin/GetPrizes.cshtml
  97. 507 0
      ReportCMS/ReportCMS/SuperAdmin/Views/Admin/GetSong.cshtml
  98. 680 0
      ReportCMS/ReportCMS/SuperAdmin/Views/Admin/GetSource.cshtml
  99. 7 0
      ReportCMS/ReportCMS/SuperAdmin/Views/Admin/Index.cshtml
  100. 212 0
      ReportCMS/ReportCMS/SuperAdmin/Views/Admin/SetCodePrizeForUser.cshtml

+ 1 - 0
ReportCMS/.gitignore

@@ -0,0 +1 @@
+.andromity/

BIN
ReportCMS/ReportCMS/References/feather.woff


+ 25 - 0
ReportCMS/ReportCMS/Report_cms.sln

@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.6.33815.320
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Report_cms", "SuperAdmin\Report_cms.csproj", "{000A9A28-EE22-4214-887D-108273A43763}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{000A9A28-EE22-4214-887D-108273A43763}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{000A9A28-EE22-4214-887D-108273A43763}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{000A9A28-EE22-4214-887D-108273A43763}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{000A9A28-EE22-4214-887D-108273A43763}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {2C70B5F6-A06E-4B2E-B67F-FC1AB5F48C1E}
+	EndGlobalSection
+EndGlobal

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

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

+ 1155 - 0
ReportCMS/ReportCMS/SuperAdmin/Controllers/AdminController.cs

@@ -0,0 +1,1155 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Configuration;
+using SuperAdmin.Models.Http;
+using SuperCms.Extensions;
+using SuperAdmin.Source;
+using Microsoft.AspNetCore.Http;
+using ClosedXML.Excel;
+using System.IO;
+using OfficeOpenXml;
+using SuperAdmin.Models.Object;
+using Microsoft.AspNetCore.Http.Extensions;
+using static SuperAdmin.Source.LumilotoUtils;
+using DocumentFormat.OpenXml.Office2010.Excel;
+using log4net;
+using DocumentFormat.OpenXml.Spreadsheet;
+using DocumentFormat.OpenXml.InkML;
+using System.Text;
+using Newtonsoft.Json;
+using Microsoft.Extensions.Hosting.Internal;
+using DocumentFormat.OpenXml.Wordprocessing;
+
+namespace SuperAdmin.Controllers
+{
+    public class AdminController : BaseController
+    {
+        private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(AdminController));
+
+        public AdminController(IConfiguration _configuration, IWebHostEnvironment hostEnvironment) : base(_configuration, hostEnvironment)
+        {
+            //_uploadsFolder = Path.Combine("E:\\Code\\KungCang\\ReportKungkang\\SuperAdmin\\wwwroot\\img");
+            //_uploadsFolder = Path.Combine("\\u01\\kankaung\\website\\publish\\wwwroot\\assets\\images\\predict_sources");
+
+        }
+
+        public IActionResult Index()
+        {
+            try
+            {
+                if (!CheckAuthToken())
+                {
+                    return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+                }
+                else
+                {
+                    LoginData loginData = HttpContext.Session.GetComplexData<LoginData>("userInfo");
+                    return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Admin/Dashboard");
+                }
+
+
+                return View();
+            }
+            catch (Exception ex)
+            {
+                log.Error("Error admin index: " + ex.Message, ex);
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+            }
+        }
+
+        public IActionResult Dashboard(DailyDataReq req)
+        {
+            try
+            {
+                if (!CheckAuthToken())
+                {
+                    return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Admin/Index");
+                }
+
+                //DashboardModel model = LoadDashboard(req);
+
+
+                return View();
+            }
+            catch (Exception ex)
+            {
+                log.Error("Error admin index: " + ex.Message, ex);
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+            }
+        }
+
+
+        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;
+        }
+        public IActionResult DashboardPartner(String Partner)
+        {
+            if (!CheckAuthToken())
+            {
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+            }
+           
+
+            if (Partner == null)
+            {
+                Partner = "-1";
+            }
+            HttpContext.Session.SetString("partner", Partner);
+
+            return View();
+            
+        }
+
+        public IActionResult DashboardPartners(DailyDataReq req)
+        {
+            try
+            {
+                if (!CheckAuthToken())
+                {
+                    return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Admin/DashboardPartner");
+                }
+
+                return View();
+            }
+            catch (Exception ex)
+            {
+                log.Error("Error admin index: " + ex.Message, ex);
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+            }
+        }
+
+        // SetCodePrizeForUser
+        public IActionResult SetCodePrizeForUser()
+        {
+            if (!CheckAuthToken())
+            {
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+            }
+
+            return View();
+        }
+        [ValidateAntiForgeryToken]
+        private IActionResult SetCodePrizeForUserSearch(SetCodePrizeForUserReq req)
+        {
+
+            if (req.msisdn == null)
+            {
+                return Json(new
+                {
+                    error = "3",
+                    message = "Msisdn is required"
+                });
+            }
+            if (req.code == null)
+            {
+                return Json(new
+                {
+                    error = "3",
+                    message = "Code is required"
+                });
+            }
+            string url = GetParameter(LumilotoUtils.WsType.Config.SetCodePrizeForUser);
+            string sdt = null;
+            if (req.msisdn != null)
+            {
+                sdt = BaseController.ValidateMsisdn(req.msisdn);
+            }
+            req.msisdn = sdt;
+            req.code = req.code;
+
+            string result = SendPost(req, url, true);
+            SetCodePrizeForUserRes res = SetCodePrizeForUserRes.Parse(result);
+            if (res != null && res.errorCode == "0")
+            {
+                return Json(new
+                {
+                    success = res.errorCode,
+                    message = "Success! " + res.message
+                }); ;
+            }
+            else
+            {
+                return Json(new
+                {
+                    error = res.errorCode,
+                    message = "Error! " + res.message
+                }); ;
+            }
+
+        }
+        [HttpPost]
+
+        public IActionResult SetCodePrizeForUserSearch1(SetCodePrizeForUserReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    message = "Not allow"
+                });
+            }
+
+            return SetCodePrizeForUserSearch(req);
+        }
+
+        //GetCodePrize
+        public IActionResult GetSong()
+        {
+            if (!CheckAuthToken())
+            {
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+            }
+
+            return View();
+        }
+
+        [ValidateAntiForgeryToken]
+        private IActionResult GetSongSearch(GetSongReq req)
+        {
+            string url = GetParameter(LumilotoUtils.WsType.Config.GetSong);
+            req.status = req.status;
+            req.pageNumber = req.pageNumber;
+            req.pageSize = req.pageSize;
+            string result = SendPost(req, url, true);
+            GetSongRes res = GetSongRes.Parse(result);
+
+            if (res != null && res.data != null)
+            {
+                HttpContext.Session.SetComplexData("CodePrizeRes", result);
+                string BaseAudioLink = GetParameter(LumilotoUtils.WsType.BaseAudioLink);
+                ViewBag.BaseAudioLink = BaseAudioLink;
+                return PartialView("../Admin/_GetSong", res);
+            }
+
+            return PartialView("../Admin/_GetSong");
+        }
+        [HttpPost]
+        public IActionResult GetSongSearch1(GetSongReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    message = "Not allow"
+                });
+            }
+
+            return GetSongSearch(req);
+        }
+
+            [HttpPost]
+            [ValidateAntiForgeryToken] 
+            public IActionResult AddSong(IFormFile file)
+            {
+                if (file == null || file.Length == 0)
+                {
+                    return Json(new
+                    {
+                        error = true,
+                        message = "No file selected or the file is empty."
+                    });
+                }
+
+            try
+            {
+                var insertSongReq = new InsertSongReq { Songs = new List<Songs>() };
+
+                using (var memoryStream = new MemoryStream())
+                {
+                    file.CopyTo(memoryStream);
+                    memoryStream.Position = 0;
+
+                    using (var workbook = new XLWorkbook(memoryStream))
+                    {
+                        var worksheet = workbook.Worksheet(1);
+                        var rowCount = worksheet.RowsUsed().Count();
+
+                        for (int row = 2; row <= rowCount; row++)
+                        {
+                            var song = new Songs
+                            {
+                                questionName = worksheet.Cell(row, 2).GetValue<string>(),
+                                questionDescription = worksheet.Cell(row, 3).GetValue<string>(),
+                                questionContent = worksheet.Cell(row, 4).GetValue<string>(),
+                                questionLink = worksheet.Cell(row, 5).GetValue<string>(),
+                                questionPriority = worksheet.Cell(row, 6).GetValue<string>(),
+                                category = worksheet.Cell(row, 7).GetValue<string>(),
+                                categoryImage = worksheet.Cell(row, 8).GetValue<string>(),
+                                categoryPriority = worksheet.Cell(row, 9).GetValue<string>(),
+                                answerInsert = new List<AnswerInsert>()
+                            };
+
+                            // Cột 14 chứa số đáp án đúng (1–4)
+                            int correctIndex = int.TryParse(worksheet.Cell(row, 14).GetValue<string>(), out var index) ? index : 0;
+
+                            // Cột 10 → 13 là nội dung các đáp án
+                            for (int i = 0; i < 4; i++)
+                            {
+                                var answer = new AnswerInsert
+                                {
+                                    answerName = worksheet.Cell(row, 10 + i).GetValue<string>(), 
+                                    answerDescription = worksheet.Cell(row, 10 + i).GetValue<string>(),
+                                    answerPriority = i + 1,
+                                    answerContent = worksheet.Cell(row, 10 + i).GetValue<string>(),
+                                    isRight = (i + 1 == correctIndex) ? "TRUE" : "FALSE"
+                                };
+
+                                song.answerInsert.Add(answer);
+                            }
+
+                            insertSongReq.Songs.Add(song);
+                        }
+                    }
+                }
+
+                var jsonResult = JsonConvert.SerializeObject(insertSongReq);
+
+                string url = GetParameter(LumilotoUtils.WsType.Config.InsertSong);
+
+                string result = SendPost(insertSongReq, url, true);
+                AddToPicRes res = AddToPicRes.Parse(result);
+
+                if (res != null && res.errorCode == "0")
+                {
+                    return Json(new
+                    {
+                        success = res.errorCode,
+                        message = "Success! " + res.message,
+                        data = res.data
+                    }); ;
+                }
+                else
+                {
+                    return Json(new
+                    {
+                        error = res.errorCode,
+                        message = "Error! " + res.message
+                    }); ;
+                }
+            }
+            catch (Exception ex)
+                {
+                    return Json(new
+                    {
+                        error = true,
+                        message = $"An error occurred: {ex.Message}"
+                    });
+                }
+            }
+
+        [HttpPost]
+        [Produces("application/json")]
+        [Consumes("multipart/form-data")]
+        public async Task<IActionResult> UploadFile(List<IFormFile> files)
+        {
+            if (files == null || files.Count == 0)
+            {
+                return Json(new { error = true, message = "No files uploaded!" });
+            }
+
+            try
+            {
+                // Thư mục riêng biệt cho ảnh và nhạc
+                string imageFolder = GetParameter(UtilsController.Constant.PATH_IMAGE);
+                string musicFolder = GetParameter(UtilsController.Constant.PATH_AUDIO);
+
+                log.Debug("imageFolder: " + imageFolder);
+                log.Debug("musicFolder: " + musicFolder);
+
+                // Kiểm tra tồn tại
+                if (!Directory.Exists(imageFolder))
+                {
+                    Directory.CreateDirectory(imageFolder);
+                }
+                if (!Directory.Exists(musicFolder))
+                {
+                    Directory.CreateDirectory(musicFolder);
+                }
+
+                foreach (var file in files)
+                {
+                    if (file.Length > 0)
+                    {
+                        string processedFileName = file.FileName.Trim().Replace(" ", "_");
+                        string extension = Path.GetExtension(processedFileName).ToLower();
+
+                        string targetFolder = (extension == ".jpg" || extension == ".jpeg" || extension == ".png" || extension == ".gif")
+                            ? imageFolder
+                            : (extension == ".mp3" || extension == ".wav" || extension == ".m4a")
+                            ? musicFolder
+                            : null;
+
+                        if (targetFolder == null)
+                        {
+                            log.Debug("Bỏ qua file không hợp lệ: " + processedFileName);
+                            continue;
+                        }
+
+                        string filePath = Path.Combine(targetFolder, processedFileName);
+                        log.Debug("filePath: " + filePath);
+
+                        using (var stream = new FileStream(filePath, FileMode.Create))
+                        {
+                            await file.CopyToAsync(stream);
+                        }
+                    }
+                }
+
+
+                return Json(new { error = false, message = "Files uploaded and categorized successfully!" });
+            }
+            catch (Exception ex)
+            {
+				log.Debug("Exception: " + ex);
+				return Json(new { error = true, message = $"An error occurred: {ex.Message}" });
+            }
+        }
+
+        [ValidateAntiForgeryToken]
+        public IActionResult AddToPic([FromBody] AddToPicReq codeReq)
+        {
+            foreach (var termStores in codeReq.termStores)
+            {
+                if (termStores.name == null || termStores.name == "")
+                {
+                    return Json(new
+                    {
+                        error = "3",
+                        message = "name Is required"
+                    });
+                }
+                if (termStores.type == null || termStores.type == "")
+                {
+                    termStores.type = "POINT";
+                }
+                if (termStores.description == null || termStores.description == "")
+                {
+                    return Json(new
+                    {
+                        error = "3",
+                        message = "description Is required"
+                    });
+                }
+                if (termStores.fromTime == null || termStores.fromTime == "")
+                {
+                    return Json(new
+                    {
+                        error = "3",
+                        message = "fromTime Is required"
+                    });
+                }
+                if (termStores.toTime == null || termStores.toTime == "")
+                {
+                    return Json(new
+                    {
+                        error = "3",
+                        message = "toTime Is required"
+                    });
+
+                }
+                if (termStores.timeDraw == null || termStores.timeDraw == "")
+                {
+                    return Json(new
+                    {
+                        error = "3",
+                        message = "timeDraw Is required"
+                    });
+                }
+                if (termStores.picture == null || termStores.picture == "")
+                {
+                    return Json(new
+                    {
+                        error = "3",
+                        message = "picture Is required"
+                    });
+                }
+                if (termStores.dayRun == null || termStores.dayRun == "")
+                {
+                    return Json(new
+                    {
+                        error = "3",
+                        message = "dayRun Is required"
+                    });
+                }
+
+            }
+            string url = GetParameter(LumilotoUtils.WsType.Config.InsertToPic);
+            AddToPicReq req = new AddToPicReq();
+
+            req.termStores = codeReq.termStores;
+
+            string result = SendPost(req, url, true);
+            AddToPicRes res = AddToPicRes.Parse(result);
+
+            if (res != null && res.errorCode == "0")
+            {
+                return Json(new
+                {
+                    success = res.errorCode,
+                    message = "Success! " + res.message,
+                    data = res.data
+                }); ;
+            }
+            else
+            {
+                return Json(new
+                {
+                    error = res.errorCode,
+                    message = "Error! " + res.message
+                }); ;
+            }
+        }
+        [HttpPost]
+        public IActionResult AddToPic1([FromBody] AddToPicReq codeReq)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    message = "Not allow"
+                });
+            }
+
+            return AddToPic(codeReq);
+        }
+        [ValidateAntiForgeryToken]
+        public IActionResult AddSource([FromBody] AddSourceReq SourceReq)
+        {
+            string url = GetParameter(LumilotoUtils.WsType.Config.InsertSource);
+            AddSourceReq req = new AddSourceReq();
+            req.termStoreId = SourceReq.termStoreId;
+            req.sources = SourceReq.sources;
+            string result = SendPost(req, url, true);
+            AddSourceRes res = AddSourceRes.Parse(result);
+
+            if (res != null && res.errorCode == "0")
+            {
+                return Json(new
+                {
+                    success = res.errorCode,
+                    message = "Success! " + res.message
+                }); ;
+            }
+            else
+            {
+                return Json(new
+                {
+                    error = res.errorCode,
+                    message = "Error! " + res.message
+                }); ;
+            }
+        }
+        [HttpPost]
+        public IActionResult AddSource1([FromBody] AddSourceReq SourceReq)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    message = "Not allow"
+                });
+            }
+
+            return AddSource(SourceReq);
+        }
+
+        //Source
+        public IActionResult GetSource()
+        {
+            if (!CheckAuthToken())
+            {
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+            }
+
+            return View();
+        }
+        [ValidateAntiForgeryToken]
+        private IActionResult GetSource(GetSourceReq req)
+        {
+            string url = GetParameter(LumilotoUtils.WsType.Config.GetSource);
+            req.predictTermId = req.predictTermId;
+            req.termStoreId = req.termStoreId;
+            req.status = req.status;
+            req.pageNumber = req.pageNumber;
+            req.pageSize = req.pageSize;
+            string result = SendPost(req, url, true);
+            GetSourceRes res = GetSourceRes.Parse(result);
+
+            if (res != null && res.data != null)
+            {
+
+                return PartialView("../Admin/_GetSource", res);
+            }
+
+            return PartialView("../Admin/_GetSource");
+        }
+        [HttpPost]
+        public IActionResult GetSource1(GetSourceReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    message = "Not allow"
+                });
+            }
+
+            return GetSource(req);
+        }
+
+        [ValidateAntiForgeryToken]
+        public IActionResult UpdateSource([FromBody] UpdateSourceReq SourceReq)
+        {
+            string url = GetParameter(LumilotoUtils.WsType.Config.UpdateSource);
+            UpdateSourceReq req = new UpdateSourceReq();
+
+            req.termStoreId = SourceReq.termStoreId;
+            req.sources = SourceReq.sources;
+            string result = SendPost(req, url, true);
+            UpdateSourceRes res = UpdateSourceRes.Parse(result);
+
+            if (res != null && res.errorCode == "0")
+            {
+                return Json(new
+                {
+                    success = res.errorCode,
+                    message = "Success! " + res.message,
+                }); ;
+            }
+            else
+            {
+                return Json(new
+                {
+                    error = res.errorCode,
+                    message = "Error! " + res.message
+                }); ;
+            }
+        }
+        [HttpPost]
+        public IActionResult UpdateSource1([FromBody] UpdateSourceReq updateSourceReq)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    message = "Not allow"
+                });
+            }
+
+            return UpdateSource(updateSourceReq);
+        }
+
+
+        //GetPrizes
+        public IActionResult GetPrizes()
+        {
+            if (!CheckAuthToken())
+            {
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+            }
+
+            return View();
+        }
+        [ValidateAntiForgeryToken]
+        private IActionResult GetPrizes(PrizesReq req)
+        {
+            string url = GetParameter(LumilotoUtils.WsType.Config.GetPrizes);
+            //req.predictTermId = req.predictTermId;
+            req.termStoreId = req.termStoreId;
+            req.status = req.status;
+            req.pageNumber = req.pageNumber;
+            req.pageSize = req.pageSize;
+            string result = SendPost(req, url, true);
+            PrizeRes res = PrizeRes.Parse(result);
+
+            if (res != null && res.data != null)
+            {
+
+                return PartialView("../Admin/_GetPrizes", res);
+            }
+
+            return PartialView("../Admin/_GetPrizes");
+        }
+        [HttpPost]
+        public IActionResult GetPrizes1(PrizesReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    message = "Not allow"
+                });
+            }
+
+            return GetPrizes(req);
+        }
+        public JsonResult loadPrizeBox(PrizesReq req)
+        {
+            string url = GetParameter(LumilotoUtils.WsType.Config.GetPrizes);
+            string result = SendPost(req, url, true);
+            SetToPicRes res = SetToPicRes.Parse(result);
+
+            if (res != null && res.data != null)
+            {
+                return Json(new
+                {
+                    error = "0",
+                    data = res.data
+                });
+            }
+
+            return Json(new
+            {
+                error = "1",
+                message = "Not found"
+            });
+        }
+
+        [HttpPost]
+        public IActionResult PrizeBox()
+        {
+            PrizesReq req = new PrizesReq();
+            req.status = "ACTIVE";
+            req.pageNumber = 0;
+            req.pageSize = 100000;
+            string url = GetParameter(LumilotoUtils.WsType.Config.GetPrizes);
+            string result = SendPost(req, url, true);
+            PrizeRes res = PrizeRes.Parse(result);
+
+            if (res != null && res.data != null)
+            {
+                HttpContext.Session.SetComplexData("PrizeData", res.data.termStores);
+                return Json(new
+                {
+                    error = "0",
+                    data = res.data
+                });
+            }
+
+            return Json(new
+            {
+                error = "1",
+                message = "Not found"
+            });
+
+        }
+        [HttpPost]
+        public IActionResult UpdatePrizes(int termStoreId, int[] listPrizes)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    message = "Not allow"
+                });
+            }
+            if (termStoreId == 0)
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    message = "TermStoreId Is Required"
+                });
+
+            }
+            string url = GetParameter(LumilotoUtils.WsType.Config.UpdatePrizes);
+            UpdatePrizesReq req = new UpdatePrizesReq();
+            req.termStoreId = termStoreId;
+            req.prizes = listPrizes;
+            string result = SendPost(req, url);
+            UpdatePrizesRes res = UpdatePrizesRes.Parse(result);
+            return Json(new
+            {
+                error = res.status,
+                message = res.message
+            });
+        }
+
+        [HttpPost]
+        public async Task<IActionResult> UploadImages()
+        {
+            try
+            {
+                var filesAdd = Request.Form.Files.GetFiles("filesAdd");
+                var uploadsAddFolder = GetParameter(UtilsController.Constant.PATH_IMAGE);
+
+                if (filesAdd != null && filesAdd.Count > 0)
+                {
+                    var uploadedFilePaths = new List<string>();
+
+                    // Tạo thư mục nếu chưa tồn tại
+                    if (!Directory.Exists(uploadsAddFolder))
+                        Directory.CreateDirectory(uploadsAddFolder);
+
+                    foreach (var file in filesAdd)
+                    {
+                        var fileName = file.FileName.Trim().Replace(" ", "_");
+                        var filePath = Path.Combine(uploadsAddFolder, fileName);
+
+                        // Nếu không muốn ghi đè, có thể thêm kiểm tra tại đây
+                        using (var fileStream = new FileStream(filePath, FileMode.Create))
+                        {
+                            await file.CopyToAsync(fileStream);
+                        }
+
+                        uploadedFilePaths.Add(filePath);
+                    }
+
+                    log.Info("Uploaded to: " + uploadsAddFolder);
+                    return Ok(new { uploadedToImageFolder = uploadedFilePaths });
+                }
+                else
+                {
+                    return BadRequest("Không có tệp nào được tải lên.");
+                }
+            }
+            catch (Exception ex)
+            {
+                log.Error("Lỗi UploadImages", ex);
+                return StatusCode(500, $"Lỗi máy chủ nội bộ: {ex.Message}");
+            }
+        }
+
+
+        [ValidateAntiForgeryToken]
+        private IActionResult SetPrize1(SetPrizeReq req)
+        {
+
+            if (req.predictWinnerId <= 0)
+            {
+                return Json(new
+                {
+                    error = "3",
+                    message = "predictWinnerId is required"
+                });
+            }
+            string url = GetParameter(LumilotoUtils.WsType.Config.ReRunPrizeForUser);
+            
+            req.predictWinnerId = req.predictWinnerId;
+
+            string result = SendPost(req, url, true);
+            SetPrizeRes res = SetPrizeRes.Parse(result);
+            if (res != null && res.errorCode == "0")
+            {
+                return Json(new
+                {
+                    success = res.errorCode,
+                    message = "Success! " + res.message
+                }); ;
+            }
+            else
+            {
+                return Json(new
+                {
+                    error = res.errorCode,
+                    message = "Error! " + res.message
+                }); ;
+            }
+
+        }
+        [HttpPost]
+
+        public IActionResult SetPrize(SetPrizeReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    message = "Not allow"
+                });
+            }
+
+            return SetPrize1(req);
+        }
+
+        [HttpPost]
+        public IActionResult DeleteSong(DeleteSongReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    message = "Not allow"
+                });
+            }
+
+            string url = GetParameter(LumilotoUtils.WsType.Config.DeleteSong);
+            string result = SendPost(req, url, true);
+            GetSongRes res = GetSongRes.Parse(result);
+            if (res != null && res.errorCode == "0")
+            {
+                return Json(new
+                {
+                    success = res.errorCode,
+                    message = "Success! " + res.message,
+                    data = res.data
+                }); ;
+            }
+            else
+            {
+                return Json(new
+                {
+                    error = res.errorCode,
+                    message = "Error! " + res.message
+                }); ;
+            }
+        }
+
+        [HttpPost]
+        public IActionResult GetQuestionsGroup()
+        {
+            GetQuestionsGroupReq req = new GetQuestionsGroupReq();
+            req.pageNumber = 0;
+            req.pageSize = 100000;
+            string url = GetParameter(LumilotoUtils.WsType.Config.GetQuestionsGroup);
+            string result = SendPost(req, url, true);
+            GetQuestionsGroupRes res = GetQuestionsGroupRes.Parse(result);
+
+            if (res != null && res.data != null)
+            {
+                HttpContext.Session.SetComplexData("QuestionsGroupData", res.data.questionGroups);
+                return Json(new
+                {
+                    error = "0",
+                    data = res.data
+                });
+            }
+
+            return Json(new
+            {
+                error = "1",
+                message = "Not found"
+            });
+
+        }
+
+        [HttpPost]
+        public IActionResult Getcategory()
+        {
+            CategoryReq req = new CategoryReq();
+            req.pageNumber = 0;
+            req.pageSize = 100000;
+            string url = GetParameter(LumilotoUtils.WsType.Config.Getcategory);
+            string result = SendPost(req, url, true);
+            GetCategoryRes res = GetCategoryRes.Parse(result);
+
+            if (res != null && res.data != null)
+            {
+                HttpContext.Session.SetComplexData("CategoryData", res.data.category);
+                return Json(new
+                {
+                    error = "0",
+                    data = res.data
+                });
+            }
+
+            return Json(new
+            {
+                error = "1",
+                message = "Not found"
+            });
+
+        }
+
+
+        public IActionResult GetArticles()
+        {
+            if (!CheckAuthToken())
+            {
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+            }
+
+            return View();
+        }
+
+        [ValidateAntiForgeryToken]
+        private IActionResult GetArticlesSearch(GetArticlesReq req)
+        {
+            string url = GetParameter(LumilotoUtils.WsType.Config.GetArticle);
+            req.status = req.status;
+            req.pageNumber = req.pageNumber;
+            req.pageSize = req.pageSize;
+            string result = SendPost(req, url, true);
+            GetArticlesRes res = GetArticlesRes.Parse(result);
+
+            if (res != null && res.data != null)
+            {
+                string BaseAudioLink = GetParameter(LumilotoUtils.WsType.BaseAudioLink);
+                ViewBag.BaseAudioLink = BaseAudioLink;
+                return PartialView("../Admin/_GetArticles", res);
+            }
+
+            return PartialView("../Admin/_GetArticles");
+        }
+        [HttpPost]
+        public IActionResult GetArticlesSearch1(GetArticlesReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    message = "Not allow"
+                });
+            }
+
+            return GetArticlesSearch(req);
+        }
+
+        [HttpPost]
+        [ValidateAntiForgeryToken]
+        public IActionResult AddArticles(IFormFile file)
+        {
+            if (file == null || file.Length == 0)
+            {
+                return Json(new
+                {
+                    error = true,
+                    message = "No file selected or the file is empty."
+                });
+            }
+
+            try
+            {
+                var insertSongReq = new InsertArticlesReq { ArticleList = new List<ArticleDataInsert>() };
+
+                using (var memoryStream = new MemoryStream())
+                {
+                    file.CopyTo(memoryStream);
+                    memoryStream.Position = 0;
+
+                    using (var workbook = new XLWorkbook(memoryStream))
+                    {
+                        var worksheet = workbook.Worksheet(1);
+                        var rowCount = worksheet.RowsUsed().Count();
+
+                        for (int row = 2; row <= rowCount; row++)
+                        {
+                            var articleData = new ArticleDataInsert
+                            {
+                                categoryName = worksheet.Cell(row, 2).GetValue<string>(),
+                                categoryName_local = worksheet.Cell(row, 3).GetValue<string>(),
+                                title = worksheet.Cell(row, 4).GetValue<string>(),
+                                title_local = worksheet.Cell(row, 5).GetValue<string>(),
+                                content = worksheet.Cell(row, 6).GetValue<string>(),
+                                content_local = worksheet.Cell(row, 7).GetValue<string>(),
+                                image = worksheet.Cell(row, 8).GetValue<string>(),
+                                publish_date = worksheet.Cell(row, 9).GetValue<string>(),
+                                expire_date = worksheet.Cell(row, 10).GetValue<string>()
+                            };
+
+                            insertSongReq.ArticleList.Add(articleData);
+                        }
+                    }
+                }
+
+                var jsonResult = JsonConvert.SerializeObject(insertSongReq);
+
+                string url = GetParameter(LumilotoUtils.WsType.Config.InsertArticle);
+
+                string result = SendPost(insertSongReq, url, true);
+                AddToPicRes res = AddToPicRes.Parse(result);
+
+                if (res != null && res.errorCode == "0")
+                {
+                    return Json(new
+                    {
+                        success = res.errorCode,
+                        message = "Success! " + res.message,
+                        data = res.data
+                    });
+                }
+                else
+                {
+                    return Json(new
+                    {
+                        error = res.errorCode,
+                        message = "Error! " + res.message
+                    }); ;
+                }
+            }
+            catch (Exception ex)
+            {
+                return Json(new
+                {
+                    error = true,
+                    message = $"An error occurred: {ex.Message}"
+                });
+            }
+        }
+
+        [HttpPost]
+        public IActionResult submitPrize(submitPrizeReq Req)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    message = "Not allow"
+                });
+            }
+
+            return submitPrize1(Req);
+        }
+
+        [ValidateAntiForgeryToken]
+        public IActionResult submitPrize1(submitPrizeReq SourceReq)
+        {
+            string url = GetParameter(LumilotoUtils.WsType.Config.SubmitPrize);
+
+            string result = SendPost(SourceReq, url, true);
+            GrandPrizesRes res = GrandPrizesRes.Parse(result);
+            if (res != null && res.errorCode == "0")
+            {
+                return Json(new
+                {
+                    success = res.errorCode,
+                    message = "Success! " + res.message
+                }); ;
+            }
+            else
+            {
+                return Json(new
+                {
+                    error = res.errorCode,
+                    message = "Error! " + res.message
+                }); ;
+            }
+        }
+
+    }
+}
+
+

+ 598 - 0
ReportCMS/ReportCMS/SuperAdmin/Controllers/BaseController.cs

@@ -0,0 +1,598 @@
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Net;
+using System.Net.Http;
+using System.Net.Http.Headers;
+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;
+using static SuperAdmin.Source.LumilotoUtils;
+
+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 = "258";
+        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;
+        }
+        
+        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 "";
+        }
+
+        [HttpPost]
+        public JsonResult GetSource()
+        {
+
+            GetSourceReq rq = new GetSourceReq();
+            rq.pageNumber = 0;
+            rq.pageSize = 100;
+            rq.status = "ACTIVE";
+            rq.predictTermId = null;
+            rq.termStoreId = null;
+            string result = SendPost(rq, GetParameter(LumilotoUtils.WsType.Config.GetSource),true);
+            GetSourceRes res = GetSourceRes.Parse(result);
+
+            if (res != null && res.data != null)
+            {
+                HttpContext.Session.SetComplexData("GetSource", res.data);
+                string urlImail = GetParameter(UtilsController.Constant.urlImail);
+                HttpContext.Session.SetComplexData("urlImail", urlImail);
+                return Json(new
+                {
+                    error = "0",
+                    data = res.data
+                });
+            }
+
+            return Json(new
+            {
+                error = "1",
+                content = "Not found"
+            });
+        }
+        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 url, bool checkToken)
+        {
+            return SendPost(obj, ServiceId, url, checkToken, false);
+
+        }
+
+        public System.Net.HttpStatusCode ReloadToken(String account, String refreshToken)
+        {
+            ReloadTokenReq request = new ReloadTokenReq();
+            request.username = account;
+            request.refreshToken = refreshToken;
+
+            String rs = SendPost(request, ServiceId, GetParameter(WsType.Customer.wsReloadToken), true, true);
+            LoginResponse res = LoginResponse.Parse(rs);
+            if (res.errorCode == UtilsController.Constant.SUCCESS)
+            {
+                //CreateAuthToken(account, res.data);
+                LoginData vsa = HttpContext.Session.GetComplexData<LoginData>("userInfo");
+                vsa.token = res.data.token;
+                vsa.refreshToken = res.data.refreshToken;
+                HttpContext.Session.SetComplexData("userInfo", vsa);
+                return System.Net.HttpStatusCode.OK;
+
+            }
+            else
+            {
+                return System.Net.HttpStatusCode.Unauthorized;
+            }
+        }
+        public String SendPost(Posting obj, String serviceId, String url, bool checkToken)
+        {
+            return SendPost(obj, serviceId, url, checkToken, false);
+        }
+
+        public String SendPost(Posting obj, String serviceId, String url, bool checkToken, bool isRetry)
+        {
+            //obj.serviceId = serviceId;
+            //obj.SV_ID = serviceId;
+            //obj.service_id = serviceId;
+            //obj.key = GetParameter("keyPost"); 
+            using (var client = new HttpClient())
+            {
+
+                log.Debug("POST: " + url + ", checkToken: " + checkToken);
+                if (checkToken)
+                {
+                    LoginData vsa = HttpContext.Session.GetComplexData<LoginData>("userInfo");
+                    if (vsa == null)
+                    {
+                        log.Debug("Session timeout");
+                        return null;
+                    }
+
+                    // add header 
+                    //String account = HttpContext.Session.GetComplexData<String>("account");
+                    //client.DefaultRequestHeaders.Add("Consumer-Account", account);
+                    client.DefaultRequestHeaders.Add("Authorization", "Bearer " + vsa.token);
+
+                    log.Debug("Token: " + vsa.token);
+                    //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("Request: " + json);
+
+                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());
+                    if (!isRetry && response.StatusCode == System.Net.HttpStatusCode.Unauthorized)
+                    {
+                        // reload token if unauthorize
+                        String account = HttpContext.Session.GetComplexData<String>("account");
+                        LoginData vsa = HttpContext.Session.GetComplexData<LoginData>("userInfo");
+                        if (ReloadToken(account, vsa.refreshToken) == HttpStatusCode.OK)
+                        {
+                            // resend
+                            return SendPost(obj, serviceId, url, checkToken, true);
+                        }
+                    }
+                    return response.StatusCode.ToString();
+                }
+            }
+        }
+
+        public String SendPost(Posting obj, String serviceId, String url)
+        {
+            return SendPost(obj, serviceId, url, true, false);
+        }
+
+        public String SendFile(String filePath, String url, bool checkToken, bool isRetry)
+        {
+            //obj.serviceId = serviceId;
+            //obj.SV_ID = serviceId;
+            //obj.service_id = serviceId;
+            //obj.key = GetParameter("keyPost"); 
+            using (var client = new HttpClient())
+            {
+
+                log.Debug("POST: " + url + ", checkToken: " + checkToken);
+                if (checkToken)
+                {
+                    LoginData vsa = HttpContext.Session.GetComplexData<LoginData>("userInfo");
+                    if (vsa == null)
+                    {
+                        log.Debug("Session timeout");
+                        return null;
+                    }
+
+                    // add header 
+                    String account = HttpContext.Session.GetComplexData<String>("account");
+                    client.DefaultRequestHeaders.Add("Consumer-Account", account);
+                    client.DefaultRequestHeaders.Add("Authorization", "Bearer " + vsa.token);
+
+                    log.Debug("Token: " + vsa.token);
+                    //obj.token = vsa.token;
+                }
+                //var request = new HttpRequestMessage(HttpMethod.Post, url);
+                var content = new MultipartFormDataContent();
+                content.Add(new StreamContent(System.IO.File.OpenRead(filePath)));
+                //content.Headers.ContentType = new MediaTypeHeaderValue("multipart/form-data");
+                //request.Content = content;
+                //request.Headers.Add("Content-Type", "multipart/form-data");
+
+                var response = client.PostAsync(url, content).Result;
+                //response.EnsureSuccessStatusCode();
+
+                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());
+                    if (!isRetry && response.StatusCode == System.Net.HttpStatusCode.Unauthorized)
+                    {
+                        // reload token if unauthorize
+                        String account = HttpContext.Session.GetComplexData<String>("account");
+                        LoginData vsa = HttpContext.Session.GetComplexData<LoginData>("userInfo");
+                        if (ReloadToken(account, vsa.refreshToken) == HttpStatusCode.OK)
+                        {
+                            // resend
+                            return SendFile(filePath, url, checkToken, true);
+                        }
+                    }
+                    return response.StatusCode.ToString();
+                }
+            }
+        }
+
+        public String SendGet(String url)
+        {
+            return SendGet(url, true);
+        }
+
+        public String SendGet(String url, bool checkToken)
+        {
+            using (var client = new HttpClient())
+            {
+                if (checkToken)
+                {
+                    LoginData vsa = HttpContext.Session.GetComplexData<LoginData>("userInfo");
+                    if (vsa == null)
+                    {
+                        log.Debug("Session timeout");
+                        return null;
+                    }
+
+                    // add header 
+                    //String account = HttpContext.Session.GetComplexData<String>("account");
+                    //client.DefaultRequestHeaders.Add("Consumer-Account", account);
+                    //client.DefaultRequestHeaders.Add("Authorization", "Bearer " + vsa.token);
+                }
+
+                log.Debug("GET: " + url);
+
+                var response = client.GetAsync(url).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();
+                }
+            }
+        }
+
+        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");
+            log.Info("sessionValue: " + sessionValue);
+            //CookieOptions option = new CookieOptions
+            //{
+            //    Expires = DateTime.Now.AddMinutes(1)
+            //};
+            //Response.Cookies.Append("Key Name", "Value", option);
+            CookieOptions options = new CookieOptions()
+            {
+                Path = "/",
+                //HttpOnly = true,
+                //Secure = true,
+                //SameSite = SameSiteMode.None,
+                //IsEssential = true,
+                Expires = DateTime.Now.AddHours(5)
+            };
+            HttpContext.Response.Cookies.Append("AuthorizationCookie", authId, options);
+            //string cookieValue = HttpContext.Request.Cookies["AuthorizationCookie"];
+            ///log.Info("Cookie authen: " + cookieValue);
+
+            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.
+                log.Warn("Cookie not match: cookieValue " + cookieValue + ", sessionValue: " + sessionValue);
+                return false;
+            }
+            if (sessionValue == null)
+            {
+                log.Warn("sessionValue null");
+                // Invalidate the session and log out the current user.
+                return false;
+            }
+
+            return true;
+        }
+
+        protected bool ClearCache()
+        {
+            log.Info("Clear cache");
+            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 fileName, String folder)
+        {
+            try
+            {
+                //string uploadsFolder = Path.Combine(webHostEnvironment.WebRootPath, "img");
+                string uploadsFolder = GetParameter(UtilsController.Constant.PATH_OUTSIDE);
+                string uniqueFileName = fileName;
+
+                string folderPath = Path.Combine(uploadsFolder, folder);
+                if (!Directory.Exists(folderPath))
+                {
+                    Directory.CreateDirectory(folderPath);
+                }
+                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 "";
+            }
+        }
+
+
+        //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 string ReadBlobFile(IFormFile file)
+        {
+            using (StreamReader inputStreamReader = new StreamReader(file.OpenReadStream()))
+            {
+                return inputStreamReader.ReadToEnd();
+            }
+        }
+
+        protected string UploadedFile(IFormFile image, String folder)
+        {
+            try
+            {
+                //string uploadsFolder = Path.Combine(webHostEnvironment.WebRootPath, "img");
+                string uploadsFolder = GetParameter(UtilsController.Constant.PATH_OUTSIDE);
+                string uniqueFileName = DateTime.Now.ToString("yyyyMMddHHmmss") + "_" + image.FileName;
+                string folderPath = uploadsFolder + "/" + folder;
+                // Path.Combine(uploadsFolder, folder);
+                if (!Directory.Exists(folderPath))
+                {
+                    Directory.CreateDirectory(folderPath);
+                }
+                string filePath = uploadsFolder + "/" + folder + "/" + uniqueFileName;
+                // Path.Combine(uploadsFolder, folder, uniqueFileName);
+                using (var fileStream = new FileStream(filePath, FileMode.Create))
+                {
+                    image.CopyTo(fileStream);
+                }
+                return GetParameter(UtilsController.Constant.PATH_CONTENT) + "/" + folder + "/" + uniqueFileName;
+                // Path.Combine(GetParameter(UtilsController.Constant.PATH_CONTENT), folder, uniqueFileName);
+            }
+            catch (Exception ex)
+            {
+                log.Error("Exception: " + ex);
+                return "";
+            }
+        }
+
+        
+        //protected VsaValidateResult GetUserInfo()
+        //{
+        //    VsaValidateResult userInfo = HttpContext.Session.GetComplexData<VsaValidateResult>("userInfo");
+        //    return userInfo;
+        //}
+    }
+}

+ 1256 - 0
ReportCMS/ReportCMS/SuperAdmin/Controllers/ConfigController.cs

@@ -0,0 +1,1256 @@
+using ClosedXML.Excel;
+using DocumentFormat.OpenXml.Bibliography;
+using DocumentFormat.OpenXml.Wordprocessing;
+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.Drawing.Printing;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+using static SuperAdmin.Source.LumilotoUtils;
+
+namespace SuperAdmin.Controllers
+{
+    public class ConfigController : BaseController
+    {
+        private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(ConfigController));
+
+        public ConfigController(IConfiguration _configuration, IWebHostEnvironment hostEnvironment) : base(_configuration, hostEnvironment)
+        {
+            // init
+        }
+        // GET: ConfigController
+        public ActionResult Index()
+        {
+            return View();
+        }
+
+        // REPORT Winner
+        public IActionResult Winner()
+        {
+            if (!CheckAuthToken())
+            {
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+            }
+            
+            return View();
+        }
+        [ValidateAntiForgeryToken]
+        private IActionResult WinnerSearch(WinnerReq req)
+        {
+            DateTime fromTime = DateTime.ParseExact(req.fromTime, "yyyy-MM-dd", null);
+            DateTime toTime = DateTime.ParseExact(req.toTime, "yyyy-MM-dd", null);
+            if (fromTime.AddDays(31) < toTime)
+            {
+                return Json(new
+                {
+                    error = "3",
+                    message = "Only allow time range in 31 days"
+                });
+            }
+
+            string url = GetParameter(LumilotoUtils.WsType.Config.Winner);
+             req.fromTime = req.fromTime;
+             req.toTime = req.toTime;
+            string sdt = null;
+            if (req.msisdn != null) {
+                sdt = BaseController.ValidateMsisdn(req.msisdn);
+            }
+            req.msisdn = sdt;
+            req.type = req.type;
+            req.fromTime = fromTime.ToString("yyyy-MM-dd HH:mm:ss");
+            req.toTime = toTime.ToString("yyyy-MM-dd HH:mm:ss");
+            req.pageNumber = req.pageNumber;
+            req.pageSize = req.pageSize;
+            string result = SendPost(req, url,true);
+            WinnerRes res = WinnerRes.Parse(result);
+            if (res != null && res.data != null)
+            {
+                return PartialView("../Config/_Winner", res);
+            }
+
+            return PartialView("../Config/_Winner");
+        }
+
+        [HttpPost]
+        public IActionResult WinnerSearch1(WinnerReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    message = "Not allow"
+                });
+            }
+            
+            return WinnerSearch(req);
+        }
+
+        [HttpPost]
+        public IActionResult WinnerExport1(WinnerReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    message = "Not allow"
+                });
+            }
+
+            DateTime fromTime = DateTime.ParseExact(req.fromTime, "yyyy-MM-dd", null);
+            DateTime toTime = DateTime.ParseExact(req.toTime, "yyyy-MM-dd", null);
+            if (fromTime.AddDays(30) < toTime)
+            {
+                return Json(new
+                {
+                    error = "3",
+                    message = "Only allow time range in 30 days"
+                });
+            }
+            return WinnerExport(req);
+        }
+        private FileContentResult WinnerExport(WinnerReq req)
+        {
+            try
+            {
+                ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
+
+                DateTime fromTime = DateTime.ParseExact(req.fromTime, "yyyy-MM-dd", null);
+                DateTime toTime = DateTime.ParseExact(req.toTime, "yyyy-MM-dd", null);
+               
+                string url = GetParameter(LumilotoUtils.WsType.Config.Winner);
+                req.fromTime = req.fromTime;
+                req.toTime = req.toTime;
+                string sdt = null;
+                if (req.msisdn != null)
+                {
+                    sdt = BaseController.ValidateMsisdn(req.msisdn);
+                }
+                req.msisdn = sdt;
+                req.type = req.type;
+                req.fromTime = fromTime.ToString("yyyy-MM-dd HH:mm:ss");
+                req.toTime = toTime.ToString("yyyy-MM-dd HH:mm:ss");
+                req.pageNumber = req.pageNumber;
+                req.pageSize = req.pageSize;
+                string result = SendPost(req, url, true);
+                WinnerRes res = WinnerRes.Parse(result);
+                WinnerData list = res.data;
+
+                string contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
+                string fileName = "report_winner.xlsx";
+                using (var workbook = new XLWorkbook())
+                {
+                    int i = 1;
+                    IXLWorksheet worksheet = workbook.Worksheets.Add("winner");
+                    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 = "Period";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Prize";
+                    worksheet.Column(i).Width = 50;
+                    worksheet.Cell(1, i++).Value = "Spin Time";
+                    worksheet.Column(i).Width = 50;
+                    worksheet.Cell(1, i++).Value = "Process Time";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Status";
+                    worksheet.Column(i).Width = 50;
+                    worksheet.Cell(1, i++).Value = "Total Points";
+                    
+
+                    // make color
+                    worksheet.Row(1).Style.Font.Bold = true;
+                    worksheet.Row(1).Style.Fill.BackgroundColor = XLColor.Yellow;
+
+                    for (int index = 0; index < list.winners.Count; index++)
+                    {
+                        i = 1;
+                        worksheet.Cell(index + 2, i++).Value = index + 1; // Adjusted index and cell position
+                        worksheet.Cell(index + 2, i++).SetValue(list.winners[index].msisdn);
+                        worksheet.Cell(index + 2, i++).SetValue(list.winners[index].period);
+                        worksheet.Cell(index + 2, i++).SetValue(list.winners[index].prize);
+                        worksheet.Cell(index + 2, i++).SetValue(list.winners[index].spinTime);
+                        worksheet.Cell(index + 2, i++).SetValue(list.winners[index].processTime);
+                        worksheet.Cell(index + 2, i++).SetValue(list.winners[index].status);
+                        //worksheet.Cell(index + 2, i++).SetValue(list.winners[index].T);
+                    }
+
+                    // ...
+                    worksheet.Column(5).Style.DateFormat.Format = "dd/MM/yyyy";
+                    worksheet.Column(6).Style.DateFormat.Format = "dd/MM/yyyy";
+
+                    using (var stream = new MemoryStream())
+                    {
+                        workbook.SaveAs(stream);
+                        var message = stream.ToArray();
+                        return File(message, contentType, fileName);
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                return null;
+            }
+        }
+
+
+
+        // REPORT Charge Register are not exported to Excel
+        public IActionResult ChargeRegister()
+        {
+            if (!CheckAuthToken())
+            {
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+            }
+
+            return View();
+        }
+        [ValidateAntiForgeryToken]
+        private IActionResult ChargeRegisterSearch(ChargeRegisterReq req)
+        {
+            DateTime fromTime = DateTime.ParseExact(req.fromTime, "yyyy-MM-dd", null);
+            DateTime toTime = DateTime.ParseExact(req.toTime, "yyyy-MM-dd", null);
+            if (fromTime.AddDays(31) < toTime)
+            {
+                return Json(new
+                {
+                    error = "3",
+                    message = "Only allow time range in 31 days"
+                });
+            }
+
+            string url = GetParameter(LumilotoUtils.WsType.Config.ChargeRegister);
+            req.fromTime = req.fromTime;
+            req.toTime = req.toTime;
+            string sdt = null;
+            if (req.msisdn != null)
+            {
+                sdt = BaseController.ValidateMsisdn(req.msisdn);
+            }
+            req.msisdn = sdt;
+            req.fromTime = fromTime.ToString("yyyy-MM-dd HH:mm:ss");
+            req.toTime = toTime.ToString("yyyy-MM-dd HH:mm:ss");
+            req.pageNumber = req.pageNumber;
+            req.pageSize = req.pageSize;
+            string result = SendPost(req, url, true);
+            ChargeRegisterRes res = ChargeRegisterRes.Parse(result);
+            HttpContext.Session.SetComplexData("ChargeRegisterRes", res);
+            if (res != null && res.data != null)
+            {
+                return PartialView("../Config/_ChargeRegister", res);
+            }
+
+            return PartialView("../Config/_ChargeRegister");
+        }
+
+        [HttpPost]
+        public IActionResult ChargeRegisterSearch1(ChargeRegisterReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    message = "Not allow"
+                });
+            }
+
+            return ChargeRegisterSearch(req);
+        }
+
+
+        // ReportDaily 
+        public IActionResult ReportDaily()
+        {
+            if (!CheckAuthToken())
+            {
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+            }
+
+            return View();
+        }
+        [ValidateAntiForgeryToken]
+        private IActionResult ReportDailySearch(ReportDailyReq req)
+        {
+            DateTime fromTime = DateTime.ParseExact(req.fromTime, "yyyy-MM-dd", null);
+            DateTime toTime = DateTime.ParseExact(req.toTime, "yyyy-MM-dd", null);
+            //if (fromTime.AddDays(31) < toTime)
+            //{
+            //    return Json(new
+            //    {
+            //        error = "3",
+            //        message = "Only allow time range in 31 days"
+            //    });
+            //}
+
+            string url = GetParameter(LumilotoUtils.WsType.Config.ReportDaily);
+            req.fromTime = req.fromTime;
+            req.toTime = req.toTime;
+            req.type = req.type;
+            req.fromTime = fromTime.ToString("yyyy-MM-dd HH:mm:ss");
+            req.toTime = toTime.ToString("yyyy-MM-dd HH:mm:ss");
+            req.pageNumber = req.pageNumber;
+            req.pageSize = req.pageSize;
+            string result = SendPost(req, url, true);
+            ReportDailyRes res = ReportDailyRes.Parse(result);
+            if (res != null && res.data != null)
+            {
+                return PartialView("../Config/_ReportDaily", res);
+            }
+
+            return PartialView("../Config/_ReportDaily");
+        }
+
+        [HttpPost]
+        
+        public IActionResult ReportDailySearch1(ReportDailyReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    message = "Not allow"
+                });
+            }
+
+            return ReportDailySearch(req);
+        }
+
+        [HttpPost]
+        public IActionResult ReportDailyExport1(ReportDailyReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    message = "Not allow"
+                });
+            }
+
+            DateTime fromTime = DateTime.ParseExact(req.fromTime, "yyyy-MM-dd", null);
+            DateTime toTime = DateTime.ParseExact(req.toTime, "yyyy-MM-dd", null);
+            //if (fromTime.AddDays(30) < toTime)
+            //{
+            //    return Json(new
+            //    {
+            //        error = "3",
+            //        message = "Only allow time range in 30 days"
+            //    });
+            //}
+            return ReportDailyExport(req);
+        }
+        private FileContentResult ReportDailyExport(ReportDailyReq req)
+        {
+            try
+            {
+                ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
+
+                DateTime fromTime = DateTime.ParseExact(req.fromTime, "yyyy-MM-dd", null);
+                DateTime toTime = DateTime.ParseExact(req.toTime, "yyyy-MM-dd", null);
+
+                string url = GetParameter(LumilotoUtils.WsType.Config.ReportDaily);
+                req.fromTime = req.fromTime;
+                req.toTime = req.toTime;
+                req.type = req.type;
+                req.fromTime = fromTime.ToString("yyyy-MM-dd HH:mm:ss");
+                req.toTime = toTime.ToString("yyyy-MM-dd HH:mm:ss");
+                req.pageNumber = req.pageNumber;
+                req.pageSize = req.pageSize;
+                string result = SendPost(req, url, true);
+                ReportDailyRes res = ReportDailyRes.Parse(result);
+                ReportDailyData list = res.data;
+
+                string contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
+                string fileName = "report_ReportDaily.xlsx";
+                using (var workbook = new XLWorkbook())
+                {
+                    int i = 1;
+                    IXLWorksheet worksheet = workbook.Worksheets.Add("ReportDaily");
+                    worksheet.Column(i).Width = 15;
+                    worksheet.Cell(1, i++).Value = "No.";
+                    worksheet.Column(i).Width = 50;
+                    worksheet.Cell(1, i++).Value = "Time Report";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Revenue";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Register On Mps";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Register On Web";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Register Total";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Renew";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Buy On Web";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Buy On Mps";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "User Active";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "User Inactive";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Bonus";
+
+
+                    // make color
+                    worksheet.Row(1).Style.Font.Bold = true;
+                    worksheet.Row(1).Style.Fill.BackgroundColor = XLColor.Yellow;
+
+                    for (int index = 0; index < list.revenue.Count; index++)
+                    {
+                        i = 1;
+                        worksheet.Cell(index + 2, i++).Value = index + 1; // Adjusted index and cell position
+                        worksheet.Cell(index + 2, i++).SetValue(list.revenue[index].timeReport);
+                        worksheet.Cell(index + 2, i++).SetValue(list.revenue[index].revenue);
+                        worksheet.Cell(index + 2, i++).SetValue(list.revenue[index].registerOnMps);
+                        worksheet.Cell(index + 2, i++).SetValue(list.revenue[index].registerOnWeb);
+                        worksheet.Cell(index + 2, i++).SetValue(list.revenue[index].registerTotal);
+                        worksheet.Cell(index + 2, i++).SetValue(list.revenue[index].renew);
+                        worksheet.Cell(index + 2, i++).SetValue(list.revenue[index].buyOnWeb);
+                        worksheet.Cell(index + 2, i++).SetValue(list.revenue[index].buyOnMps);
+                        worksheet.Cell(index + 2, i++).SetValue(list.revenue[index].userActive);
+                        worksheet.Cell(index + 2, i++).SetValue(list.revenue[index].userInactive);
+                        worksheet.Cell(index + 2, i++).SetValue(list.revenue[index].bonus);
+                    }
+
+                    worksheet.Column(2).Style.DateFormat.Format = "dd/MM/yyyy";
+
+                    using (var stream = new MemoryStream())
+                    {
+                        workbook.SaveAs(stream);
+                        var message = stream.ToArray();
+                        return File(message, contentType, fileName);
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                return null;
+            }
+        }
+
+
+        // ReportHourly 
+        public IActionResult ReportHourly()
+        {
+            if (!CheckAuthToken())
+            {
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+            }
+
+            return View();
+        }
+        [ValidateAntiForgeryToken]
+        private IActionResult ReportHourlySearch(ReportDailyReq req)
+        {
+            DateTime fromTime = DateTime.ParseExact(req.fromTime, "yyyy-MM-dd", null);
+            DateTime toTime = DateTime.ParseExact(req.toTime, "yyyy-MM-dd", null);
+            //if (fromTime.AddDays(31) < toTime)
+            //{
+            //    return Json(new
+            //    {
+            //        error = "3",
+            //        message = "Only allow time range in 31 days"
+            //    });
+            //}
+
+            string url = GetParameter(LumilotoUtils.WsType.Config.ReportDaily);
+            req.fromTime = req.fromTime;
+            req.toTime = req.toTime;
+            req.type = req.type;
+            req.fromTime = fromTime.ToString("yyyy-MM-dd HH:mm:ss");
+            req.toTime = toTime.ToString("yyyy-MM-dd HH:mm:ss");
+            req.pageNumber = req.pageNumber;
+            req.pageSize = req.pageSize;
+            string result = SendPost(req, url, true);
+            ReportDailyRes res = ReportDailyRes.Parse(result);
+            if (res != null && res.data != null)
+            {
+                return PartialView("../Config/_ReportHourly", res);
+            }
+
+            return PartialView("../Config/_ReportHourly");
+        }
+
+        [HttpPost]
+        
+        public IActionResult ReportHourlySearch1(ReportDailyReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    message = "Not allow"
+                });
+            }
+
+            return ReportHourlySearch(req);
+        }
+
+        [HttpPost]
+        public IActionResult ReportHourlyExport1(ReportDailyReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    message = "Not allow"
+                });
+            }
+
+            DateTime fromTime = DateTime.ParseExact(req.fromTime, "yyyy-MM-dd", null);
+            DateTime toTime = DateTime.ParseExact(req.toTime, "yyyy-MM-dd", null);
+            //if (fromTime.AddDays(30) < toTime)
+            //{
+            //    return Json(new
+            //    {
+            //        error = "3",
+            //        message = "Only allow time range in 30 days"
+            //    });
+            //}
+            return ReportHourlyExport(req);
+        }
+        private FileContentResult ReportHourlyExport(ReportDailyReq req)
+        {
+            try
+            {
+                ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
+
+                DateTime fromTime = DateTime.ParseExact(req.fromTime, "yyyy-MM-dd", null);
+                DateTime toTime = DateTime.ParseExact(req.toTime, "yyyy-MM-dd", null);
+
+                string url = GetParameter(LumilotoUtils.WsType.Config.ReportDaily);
+                req.fromTime = req.fromTime;
+                req.toTime = req.toTime;
+                req.type = req.type;
+                req.fromTime = fromTime.ToString("yyyy-MM-dd HH:mm:ss");
+                req.toTime = toTime.ToString("yyyy-MM-dd HH:mm:ss");
+                req.pageNumber = req.pageNumber;
+                req.pageSize = req.pageSize;
+                string result = SendPost(req, url, true);
+                ReportDailyRes res = ReportDailyRes.Parse(result);
+                ReportDailyData list = res.data;
+
+                string contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
+                string fileName = "report_ReportHourly.xlsx";
+                using (var workbook = new XLWorkbook())
+                {
+                    int i = 1;
+                    IXLWorksheet worksheet = workbook.Worksheets.Add("ReportDaily");
+                    worksheet.Column(i).Width = 15;
+                    worksheet.Cell(1, i++).Value = "No.";
+                    worksheet.Column(i).Width = 50;
+                    worksheet.Cell(1, i++).Value = "Time Report";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Revenue";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Register On Mps";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Register On Web";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Register Total";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Renew";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Buy On Web";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Buy On Mps";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "User Active";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "User Inactive";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Bonus";
+
+
+                    // make color
+                    worksheet.Row(1).Style.Font.Bold = true;
+                    worksheet.Row(1).Style.Fill.BackgroundColor = XLColor.Yellow;
+
+                    for (int index = 0; index < list.revenue.Count; index++)
+                    {
+                        i = 1;
+                        worksheet.Cell(index + 2, i++).Value = index + 1; // Adjusted index and cell position
+                        worksheet.Cell(index + 2, i++).SetValue(list.revenue[index].timeReport);
+                        worksheet.Cell(index + 2, i++).SetValue(list.revenue[index].revenue);
+                        worksheet.Cell(index + 2, i++).SetValue(list.revenue[index].registerOnMps);
+                        worksheet.Cell(index + 2, i++).SetValue(list.revenue[index].registerOnWeb);
+                        worksheet.Cell(index + 2, i++).SetValue(list.revenue[index].registerTotal);
+                        worksheet.Cell(index + 2, i++).SetValue(list.revenue[index].renew);
+                        worksheet.Cell(index + 2, i++).SetValue(list.revenue[index].buyOnWeb);
+                        worksheet.Cell(index + 2, i++).SetValue(list.revenue[index].buyOnMps);
+                        worksheet.Cell(index + 2, i++).SetValue(list.revenue[index].userActive);
+                        worksheet.Cell(index + 2, i++).SetValue(list.revenue[index].userInactive);
+                        worksheet.Cell(index + 2, i++).SetValue(list.revenue[index].bonus);
+                    }
+
+                    worksheet.Column(2).Style.DateFormat.Format = "dd/MM/yyyy";
+
+                    using (var stream = new MemoryStream())
+                    {
+                        workbook.SaveAs(stream);
+                        var message = stream.ToArray();
+                        return File(message, contentType, fileName);
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                return null;
+            }
+        }
+
+
+
+        // ReportHourly 
+        public IActionResult ReportMoneyHourly()
+        {
+            if (!CheckAuthToken())
+            {
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+            }
+
+            return View();
+        }
+        [ValidateAntiForgeryToken]
+        private IActionResult ReportMoneyHourlySearch(ReportDailyReq req)
+        {
+            DateTime fromTime = DateTime.ParseExact(req.fromTime, "yyyy-MM-dd", null);
+            DateTime toTime = DateTime.ParseExact(req.toTime, "yyyy-MM-dd", null);
+
+            string url = GetParameter(LumilotoUtils.WsType.Config.ReportMoneyHourly);
+            req.fromTime = req.fromTime;
+            req.toTime = req.toTime;
+            req.type = req.type;
+            req.fromTime = fromTime.ToString("yyyy-MM-dd HH:mm:ss");
+            req.toTime = toTime.ToString("yyyy-MM-dd HH:mm:ss");
+            req.pageNumber = req.pageNumber;
+            req.pageSize = req.pageSize;
+            req.serviceName = req.serviceName;
+            string result = SendPost(req, url, true);
+            ReportMoneyHourlyRes res = ReportMoneyHourlyRes.Parse(result);
+            if (res != null && res.data != null)
+            {
+                return PartialView("../Config/_ReportMoneyHourly", res);
+            }
+
+            return PartialView("../Config/_ReportMoneyHourly");
+        }
+
+        [HttpPost]
+
+        public IActionResult ReportMoneyHourlySearch1(ReportDailyReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    message = "Not allow"
+                });
+            }
+
+            return ReportMoneyHourlySearch(req);
+        }
+
+        [HttpPost]
+        public IActionResult ReportMoneyHourlyExport1(ReportDailyReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    message = "Not allow"
+                });
+            }
+
+            DateTime fromTime = DateTime.ParseExact(req.fromTime, "yyyy-MM-dd", null);
+            DateTime toTime = DateTime.ParseExact(req.toTime, "yyyy-MM-dd", null);
+            
+            return ReportMoneyHourlyExport(req);
+        }
+        private FileContentResult ReportMoneyHourlyExport(ReportDailyReq req)
+        {
+            try
+            {
+                ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
+
+                DateTime fromTime = DateTime.ParseExact(req.fromTime, "yyyy-MM-dd", null);
+                DateTime toTime = DateTime.ParseExact(req.toTime, "yyyy-MM-dd", null);
+
+                string url = GetParameter(LumilotoUtils.WsType.Config.ReportDaily);
+                req.fromTime = req.fromTime;
+                req.toTime = req.toTime;
+                req.type = req.type;
+                req.fromTime = fromTime.ToString("yyyy-MM-dd HH:mm:ss");
+                req.toTime = toTime.ToString("yyyy-MM-dd HH:mm:ss");
+                req.pageNumber = req.pageNumber;
+                req.pageSize = req.pageSize;
+                string result = SendPost(req, url, true);
+                ReportDailyRes res = ReportDailyRes.Parse(result);
+                ReportDailyData list = res.data;
+
+                string contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
+                string fileName = "report_ReportMoneyHourly.xlsx";
+                using (var workbook = new XLWorkbook())
+                {
+                    int i = 1;
+                    IXLWorksheet worksheet = workbook.Worksheets.Add("ReportDaily");
+                    worksheet.Column(i).Width = 15;
+                    worksheet.Cell(1, i++).Value = "No.";
+                    worksheet.Column(i).Width = 50;
+                    worksheet.Cell(1, i++).Value = "Time Report";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Revenue";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Register On Mps";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Register On Web";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Register Total";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Renew";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Buy On Web";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Buy On Mps";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "User Active";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "User Inactive";
+                    worksheet.Column(i).Width = 20;
+                    worksheet.Cell(1, i++).Value = "Bonus";
+
+
+                    // make color
+                    worksheet.Row(1).Style.Font.Bold = true;
+                    worksheet.Row(1).Style.Fill.BackgroundColor = XLColor.Yellow;
+
+                    for (int index = 0; index < list.revenue.Count; index++)
+                    {
+                        i = 1;
+                        worksheet.Cell(index + 2, i++).Value = index + 1; // Adjusted index and cell position
+                        worksheet.Cell(index + 2, i++).SetValue(list.revenue[index].timeReport);
+                        worksheet.Cell(index + 2, i++).SetValue(list.revenue[index].revenue);
+                        worksheet.Cell(index + 2, i++).SetValue(list.revenue[index].registerOnMps);
+                        worksheet.Cell(index + 2, i++).SetValue(list.revenue[index].registerOnWeb);
+                        worksheet.Cell(index + 2, i++).SetValue(list.revenue[index].registerTotal);
+                        worksheet.Cell(index + 2, i++).SetValue(list.revenue[index].renew);
+                        worksheet.Cell(index + 2, i++).SetValue(list.revenue[index].buyOnWeb);
+                        worksheet.Cell(index + 2, i++).SetValue(list.revenue[index].buyOnMps);
+                        worksheet.Cell(index + 2, i++).SetValue(list.revenue[index].userActive);
+                        worksheet.Cell(index + 2, i++).SetValue(list.revenue[index].userInactive);
+                        worksheet.Cell(index + 2, i++).SetValue(list.revenue[index].bonus);
+                    }
+
+                    worksheet.Column(2).Style.DateFormat.Format = "dd/MM/yyyy";
+
+                    using (var stream = new MemoryStream())
+                    {
+                        workbook.SaveAs(stream);
+                        var message = stream.ToArray();
+                        return File(message, contentType, fileName);
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                return null;
+            }
+        }
+
+
+
+
+
+
+        // UserPrize 
+        public IActionResult UserPrize()
+        {
+            if (!CheckAuthToken())
+            {
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+            }
+
+            return View();
+        }
+        [ValidateAntiForgeryToken]
+        private IActionResult UserPrizeSearch(UserPrizeReq req)
+        {
+            DateTime fromTime = DateTime.ParseExact(req.fromTime, "yyyy-MM-dd", null);
+            DateTime toTime = DateTime.ParseExact(req.toTime, "yyyy-MM-dd", null);
+
+
+            string url = GetParameter(LumilotoUtils.WsType.Config.UserPrize);
+            req.fromTime = req.fromTime;
+            req.toTime = req.toTime;
+            req.type = req.type;
+            req.fromTime = fromTime.ToString("yyyy-MM-dd HH:mm:ss");
+            req.toTime = toTime.ToString("yyyy-MM-dd HH:mm:ss");
+            req.predictTermId = req.predictTermId;
+            req.pageNumber = req.pageNumber;
+            req.pageSize = req.pageSize;
+            string result = SendPost(req, url, true);
+            UserPrizeRes res = UserPrizeRes.Parse(result);
+            HttpContext.Session.SetComplexData("UserPrizeRes", res);
+            if (res != null && res.data != null)
+            {
+                return PartialView("../Config/_UserPrize", res);
+            }
+
+            return PartialView("../Config/_UserPrize");
+        }
+
+        [HttpPost]
+        
+        public IActionResult UserPrizeSearch1(UserPrizeReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    message = "Not allow"
+                });
+            }
+
+            return UserPrizeSearch(req);
+        }
+
+        
+
+      
+        public IActionResult HistoryPlay()
+        {
+            if (!CheckAuthToken())
+            {
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+            }
+
+            return View();
+        }
+        [HttpPost]
+        public IActionResult HistoryPlaySearch1(HistoryPlayReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    message = "Not allow"
+                });
+            }
+
+            return HistoryPlaySearch(req);
+        }
+
+        [ValidateAntiForgeryToken]
+        private IActionResult HistoryPlaySearch(HistoryPlayReq req)
+        {
+            DateTime fromTime = DateTime.ParseExact(req.fromTime, "yyyy-MM-dd", null);
+            DateTime toTime = DateTime.ParseExact(req.toTime, "yyyy-MM-dd", null);
+            if (fromTime.AddDays(31) < toTime)
+            {
+                return Json(new
+                {
+                    error = "3",
+                    message = "Only allow time range in 31 days"
+                });
+            }
+
+            string url = GetParameter(LumilotoUtils.WsType.Config.HistoryPlay);
+            string sdt = null;
+            if (req.msisdn != null)
+            {
+                sdt = BaseController.ValidateMsisdn(req.msisdn);
+            }
+            req.msisdn = sdt;
+            req.fromTime = fromTime.ToString("yyyy-MM-dd HH:mm:ss");
+            req.toTime = toTime.ToString("yyyy-MM-dd HH:mm:ss");
+            req.pageNumber = req.pageNumber;
+            req.pageSize = req.pageSize;
+            string result = SendPost(req, url, true);
+            HistoryPlayRes res = HistoryPlayRes.Parse(result);
+            if (res != null && res.data != null)
+            {
+                return PartialView("../Config/_HistoryPlay", res);
+            }
+
+            return PartialView("../Config/_HistoryPlay");
+        }
+
+        // Ranking
+        public IActionResult Ranking()
+        {
+            if (!CheckAuthToken())
+            {
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+            }
+
+            return View();
+        }
+
+        [HttpPost]
+        public IActionResult RankingSearch1(RankingReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    message = "Not allow"
+                });
+            }
+
+            return RankingSearch(req);
+        }
+
+        [ValidateAntiForgeryToken]
+        private IActionResult RankingSearch(RankingReq req)
+        {
+            DateTime fromTime = DateTime.ParseExact(req.fromTime, "yyyy-MM-dd", null);
+            DateTime toTime = DateTime.ParseExact(req.toTime, "yyyy-MM-dd", null);
+            if (fromTime.AddDays(93) < toTime)
+            {
+                return Json(new
+                {
+                    error = "3",
+                    message = "Only allow time range in 93 days"
+                });
+            }
+
+            string url = GetParameter(LumilotoUtils.WsType.Config.Ranking);
+            string sdt = null;
+            if (!string.IsNullOrEmpty(req.msisdn))
+            {
+                sdt = BaseController.ValidateMsisdn(req.msisdn);
+            }
+            req.msisdn = sdt;
+            req.rankType = string.IsNullOrEmpty(req.rankType) ? null : req.rankType;
+            req.fromTime = fromTime.ToString("yyyy-MM-dd HH:mm:ss");
+            req.toTime = toTime.AddDays(1).AddSeconds(-1).ToString("yyyy-MM-dd HH:mm:ss");
+            string result = SendPost(req, url, true);
+            RankingRes res = RankingRes.Parse(result);
+            if (res != null && res.data != null)
+            {
+                return PartialView("../Config/_Ranking", res);
+            }
+
+            return PartialView("../Config/_Ranking");
+        }
+
+
+        // REPORT Winner
+        public IActionResult GetUserTurn()
+        {
+            if (!CheckAuthToken())
+            {
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+            }
+
+            return View();
+        }
+        [ValidateAntiForgeryToken]
+        private IActionResult GetUserTurnSearch(GetUserTurnReq req)
+        {
+           
+            if (req.msisdn == null || req.msisdn == "")
+            {
+                return Json(new
+                {
+                    error = "3",
+                    message = "msisdn is required"
+                });
+            }
+
+            string url = GetParameter(LumilotoUtils.WsType.Config.GetUserTurn);
+            string sdt = null;
+            if (req.msisdn != null)
+            {
+                sdt = BaseController.ValidateMsisdn(req.msisdn);
+            }
+            req.msisdn = sdt;
+            string result = SendPost(req, url, true);
+            GetUserTurnRes res = GetUserTurnRes.Parse(result);
+            if (res != null && res.data != null)
+            {
+                return PartialView("../Config/_GetUserTurn", res);
+            }
+
+            return PartialView("../Config/_GetUserTurn");
+        }
+
+        [HttpPost]
+        public IActionResult GetUserTurnSearch1(GetUserTurnReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    message = "Not allow"
+                });
+            }
+
+            return GetUserTurnSearch(req);
+        }
+
+        // ReportSubHourly 
+        public IActionResult ReportSubHourly()
+        {
+            if (!CheckAuthToken())
+            {
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+            }
+
+            return View();
+        }
+        [ValidateAntiForgeryToken]
+        private IActionResult ReportSubHourlySearch(ReportDailyReq req)
+        {
+            DateTime fromTime = DateTime.ParseExact(req.fromTime, "yyyy-MM-dd", null);
+            DateTime toTime = DateTime.ParseExact(req.toTime, "yyyy-MM-dd", null);
+
+            string url = GetParameter(LumilotoUtils.WsType.Config.ReportSubHourly);
+            req.fromTime = req.fromTime;
+            req.toTime = req.toTime;
+            req.type = req.type;
+            req.fromTime = fromTime.ToString("yyyy-MM-dd HH:mm:ss");
+            req.toTime = toTime.ToString("yyyy-MM-dd HH:mm:ss");
+            req.pageNumber = req.pageNumber;
+            req.pageSize = req.pageSize;
+            req.serviceName = req.serviceName;
+            string result = SendPost(req, url, true);
+            ReportMoneyHourlyRes res = ReportMoneyHourlyRes.Parse(result);
+            if (res != null && res.data != null)
+            {
+                return PartialView("../Config/_ReportSubHourly", res);
+            }
+
+            return PartialView("../Config/_ReportSubHourly");
+        }
+
+        [HttpPost]
+
+        public IActionResult ReportSubHourlySearch1(ReportDailyReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    message = "Not allow"
+                });
+            }
+
+            return ReportSubHourlySearch(req);
+        }
+
+
+
+        public IActionResult GetRanking()
+        {
+            if (!CheckAuthToken())
+            {
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+            }
+
+            return View();
+        }
+        [ValidateAntiForgeryToken]
+        private IActionResult GetRankingSearch(WinnerReq req)
+        {
+
+            string url = GetParameter(LumilotoUtils.WsType.Config.GetRanking);
+            string sdt = null;
+            if (req.msisdn != null)
+            {
+                sdt = BaseController.ValidateMsisdn(req.msisdn);
+            }
+            req.pageNumber = req.pageNumber;
+            req.pageSize = req.pageSize;
+            string result = SendPost(req, url, true);
+            GetRankingPrizesRes res = GetRankingPrizesRes.Parse(result);
+            if (res != null && res.data != null)
+            {
+                return PartialView("../Config/_GetRanking", res);
+            }
+
+            return PartialView("../Config/_GetRanking");
+        }
+
+        [HttpPost]
+        public IActionResult GetRankingSearch1(WinnerReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    message = "Not allow"
+                });
+            }
+
+            return GetRankingSearch(req);
+        }
+
+
+        [ValidateAntiForgeryToken]
+        private IActionResult LoadRankingPrizes(LoadRankingPrizesReq req)
+        {
+
+            string url = GetParameter(LumilotoUtils.WsType.Config.GetRankingPrize);
+            
+            req.pageNumber = req.pageNumber;
+            req.pageSize = req.pageSize;
+            string result = SendPost(req, url, true);
+            LoadRankingPrizesRes res = LoadRankingPrizesRes.Parse(result);
+            HttpContext.Session.SetComplexData("RankingPrizes", res);
+
+            //RankingPrizes loginData = HttpContext.Session.GetComplexData<RankingPrizes>("RankingPrizes");
+
+            return Json(new
+            {
+                error = "0",
+                message = ""
+            });
+        }
+
+        [HttpPost]
+        public IActionResult LoadRankingPrizes1(LoadRankingPrizesReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    message = "Not allow"
+                });
+            }
+
+            return LoadRankingPrizes(req);
+        }
+
+        [HttpPost]
+        public IActionResult GetRankingPrizesData()
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    message = "Not allow"
+                });
+            }
+
+            LoadRankingPrizesRes res = HttpContext.Session.GetComplexData<LoadRankingPrizesRes>("RankingPrizes");
+            
+            if (res != null && res.data != null)
+            {
+                return Json(new
+                {
+                    error = "0",
+                    data = res.data.rankingPrizes
+                });
+            }
+
+            // Nếu chưa có trong session, gọi API
+            LoadRankingPrizesReq req = new LoadRankingPrizesReq();
+            req.pageNumber = 0;
+            req.pageSize = 100000;
+            string url = GetParameter(LumilotoUtils.WsType.Config.GetRankingPrize);
+            string result = SendPost(req, url, true);
+            res = LoadRankingPrizesRes.Parse(result);
+            
+            if (res != null && res.data != null)
+            {
+                HttpContext.Session.SetComplexData("RankingPrizes", res);
+                return Json(new
+                {
+                    error = "0",
+                    data = res.data.rankingPrizes
+                });
+            }
+
+            return Json(new
+            {
+                error = "1",
+                message = "Not found"
+            });
+        }
+
+
+        // SubmitPayRewards - Trả thưởng cho người dùng
+        [HttpPost]
+        public IActionResult SubmitPayRewards(SubmitPayRewardsReq req)
+        {
+            if (!CheckAuthToken())
+            {
+                return Json(new
+                {
+                    error = "-1",
+                    message = "Not allow"
+                });
+            }
+
+            try
+            {
+                string url = GetParameter(LumilotoUtils.WsType.Config.SubmitPayRewards);
+                
+                // Validate msisdn
+                string sdt = null;
+                if (req.msisdn != null)
+                {
+                    sdt = BaseController.ValidateMsisdn(req.msisdn);
+                }
+                req.msisdn = sdt;
+                
+                string result = SendPost(req, url, true);
+                SubmitPayRewardsRes res = SubmitPayRewardsRes.Parse(result);
+                
+                if (res != null)
+                {
+                    return Json(new
+                    {
+                        error = res.errorCode ?? "0",
+                        message = res.message ?? "Success",
+                        data = res.data
+                    });
+                }
+
+                return Json(new
+                {
+                    error = "1",
+                    message = "No response from server"
+                });
+            }
+            catch (Exception ex)
+            {
+                return Json(new
+                {
+                    error = "99",
+                    message = "Error: " + ex.Message
+                });
+            }
+        }
+
+    }
+}

+ 30 - 0
ReportCMS/ReportCMS/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
+        }
+
+        
+
+    }
+}

+ 351 - 0
ReportCMS/ReportCMS/SuperAdmin/Controllers/HomeController.cs

@@ -0,0 +1,351 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.ServiceModel;
+using DocumentFormat.OpenXml.EMMA;
+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 static SuperAdmin.Source.LumilotoUtils;
+
+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");
+            }
+
+            RandomModel model = GetNextRandom("1");
+
+            return View(model);
+        }
+
+        public IActionResult DrawNumber(int type)
+        {
+            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");
+            }
+
+            RandomModel model = null;
+
+            if (type == 0)
+            {
+                model = HttpContext.Session.GetComplexData<RandomModel>("RandomModel");
+                if (model != null && model.currentPrize != null && (model.currentPrize.index != 1 || model.currentPrize.randomStatus.Contains("1")))
+                {
+                    //get from session
+                }
+                else
+                {
+                    model = GetNextRandom(type.ToString());
+                    HttpContext.Session.SetComplexData("RandomModel", model);
+                }
+            }
+            else
+            {
+                model = GetNextRandom(type.ToString());
+            }
+            // check status
+            if (model.remainTime > 0)
+            {
+                // error or not yet draw
+                if (type == 1)
+                {
+                    log.Info("Not yet time draw");
+                    return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Index");
+                }
+            }
+
+            return View(model);
+        }
+
+        public IActionResult Result(int type)
+        {
+            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");
+            }
+
+            RandomModel model = HttpContext.Session.GetComplexData<RandomModel>("RandomModel");
+
+            if (model == null || model.listPrize == null)
+            {
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Index");
+            }
+            return View(model);
+        }
+
+        private RandomModel GetNextRandom(string type)
+        {
+            // get next random
+            GetRandomNotDrawReq request = new GetRandomNotDrawReq();
+            request.type = type;
+
+            String rs = SendPost(request, GetParameter(UtilsController.Constant.SERVICE_ID), GetParameter(UtilsController.Constant.GET_RANDOM_NOT_DRAW), true);
+            GetRandomNotDrawRes res = GetRandomNotDrawRes.Parse(rs);
+            RandomModel model = new RandomModel();
+            if (res.responseCode == "0" && res.list != null && res.list.Count > 0)
+            {
+                model.termDraw = res.list[0];
+                DateTime randomDate = DateTime.ParseExact(model.termDraw.randomDate, "dd/MM/yyyy HH:mm:ss", null);
+                model.remainTime = (long)(randomDate - DateTime.Now).TotalSeconds;
+                if (model.remainTime <= 0)
+                {
+                    model.remainTime = 0;
+                }
+                // calculate
+                model.listPrize = new List<PrizeObj>();
+                // 1st
+                PrizeObj prize = new PrizeObj();
+                prize.result = model.termDraw.g1.Split("$")[0];
+                prize.name = model.termDraw.g1.Split("$")[2];
+                prize.prizeValue = model.termDraw.g1.Split("$")[1];
+                prize.randomStatus = model.termDraw.g1Draw;
+                prize.index = 1;
+                // set current prize
+                if (prize.randomStatus.Contains("0") && model.currentPrize == null)
+                {
+                    model.currentPrize = prize;
+                }
+                model.listPrize.Add(prize);
+
+                // 2nd
+                prize = new PrizeObj();
+                prize.result = model.termDraw.g2.Split("$")[0];
+                prize.name = model.termDraw.g2.Split("$")[2];
+                prize.prizeValue = model.termDraw.g2.Split("$")[1];
+                prize.randomStatus = model.termDraw.g2Draw;
+                prize.index = 2;
+                if (prize.randomStatus.Contains("0") && model.currentPrize == null)
+                {
+                    model.currentPrize = prize;
+                }
+                model.listPrize.Add(prize);
+
+                // 3nd
+                prize = new PrizeObj();
+                prize.result = model.termDraw.g3.Split("$")[0];
+                prize.name = model.termDraw.g3.Split("$")[2];
+                prize.prizeValue = model.termDraw.g3.Split("$")[1];
+                prize.randomStatus = model.termDraw.g3Draw;
+                prize.index = 3;
+                if (prize.randomStatus.Contains("0") && model.currentPrize == null)
+                {
+                    model.currentPrize = prize;
+                }
+                model.listPrize.Add(prize);
+
+                // 4nd
+                prize = new PrizeObj();
+                prize.result = model.termDraw.g4.Split("$")[0];
+                prize.name = model.termDraw.g4.Split("$")[2];
+                prize.prizeValue = model.termDraw.g4.Split("$")[1];
+                prize.randomStatus = model.termDraw.g4Draw;
+                prize.index = 4;
+                if (prize.randomStatus.Contains("0") && model.currentPrize == null)
+                {
+                    model.currentPrize = prize;
+                }
+                model.listPrize.Add(prize);
+
+                // 5nd
+                prize = new PrizeObj();
+                prize.result = model.termDraw.g5.Split("$")[0];
+                prize.name = model.termDraw.g5.Split("$")[2];
+                prize.prizeValue = model.termDraw.g5.Split("$")[1];
+                prize.randomStatus = model.termDraw.g5Draw;
+                prize.index = 5;
+                if (prize.randomStatus.Contains("0") && model.currentPrize == null)
+                {
+                    model.currentPrize = prize;
+                }
+                model.listPrize.Add(prize);
+
+                // 6nd
+                prize = new PrizeObj();
+                prize.index = 6;
+                model.listPrize.Add(prize);
+
+                // 7nd
+                prize = new PrizeObj();
+                prize.result = model.termDraw.g7.Split("$")[0];
+                prize.name = model.termDraw.g7.Split("$")[2];
+                prize.prizeValue = model.termDraw.g7.Split("$")[1];
+                prize.randomStatus = model.termDraw.g7Draw;
+                prize.index = 7;
+                if (prize.randomStatus.Contains("0") && model.currentPrize == null)
+                {
+                    model.currentPrize = prize;
+                }
+                model.listPrize.Add(prize);
+
+            }
+            else
+            {
+                model.remainTime = -1;
+            }
+            model.type = int.Parse(type);
+
+            HttpContext.Session.SetComplexData("RandomModel", model);
+            return model;
+        }
+
+
+        [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 ConfirmPassword()
+        {
+            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");
+            }
+
+            //account = ValidateMsisdn(account);
+
+            // login without vsa
+            LoginAdminRequest request = new LoginAdminRequest();
+            request.username = account;
+            request.password = password;
+
+            String rs = SendPost(request, GetParameter(WsType.Customer.wsLogin), false);
+            LoginResponse res = LoginResponse.Parse(rs);
+            if (res.errorCode == UtilsController.Constant.SUCCESS)
+            {
+                // log
+                log.Info("Login success: " + request.username);
+                CreateAuthToken(account, res.data);
+                
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Config/ReportDaily");
+
+            }
+            
+            else
+            {
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+            }
+        }
+
+        [HttpPost]
+        public IActionResult ResetPassword(String userName)
+        {
+            if (userName == null)
+            {
+                return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
+            }
+
+            userName = ValidateMsisdn(userName);
+
+            // login without vsa
+            ResetPasswordReq request = new ResetPasswordReq();
+            request.username = userName;
+
+            String rs = SendPost(request, GetParameter(WsType.Customer.wsResetPassword), false);
+            ResetPasswordResponse res = ResetPasswordResponse.Parse(rs);
+            if (res.errorCode == UtilsController.Constant.SUCCESS)
+            {
+                HttpContext.Session.SetComplexData("ResetPasswordData", res.data);
+                return Json(new
+                {
+                    error = res.errorCode,
+                    content = res.message,
+                    href = "/Home/ConfirmPassword"
+                });
+            }
+            else
+            {
+                return Json(new
+                {
+                    error = res.errorCode,
+                    content = res.message,
+                    href = "/Home/ConfirmPassword"
+                });
+            }
+        }
+
+        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
ReportCMS/ReportCMS/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
ReportCMS/ReportCMS/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();
+        }
+    }
+}

+ 30 - 0
ReportCMS/ReportCMS/SuperAdmin/Controllers/RolesController.cs

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

+ 1391 - 0
ReportCMS/ReportCMS/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"
+                });
+            }
+        }
+    }
+}

+ 259 - 0
ReportCMS/ReportCMS/SuperAdmin/Controllers/UtilsController.cs

@@ -0,0 +1,259 @@
+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";
+            // draw
+            public const String GET_RANDOM_NOT_DRAW = "wsGetRandomNotDraw";
+            public const String UP_RANDOM_NOT_DRAW = "wsUpRandomNotDraw";
+
+
+            public const String PATH_CONTENT = "pathContent";
+            public const String PATH_OUTSIDE = "pathOutside";
+            public const String PATH_AUDIO = "pathAudio";
+            public const String PATH_IMAGE = "pathImage";
+            public const String SERVICE_NAME = "serviceName";
+            public const String SUB_DOMAIN = "subDomain";
+            public const String SUB_DOMAIN_ = "subDomain_";
+            public const String urlImail = "urlImail";
+            
+
+
+            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";
+            public const String OTP_REQUIRED = "1027";
+
+            // 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;
+            }
+        }
+
+        public static string ConvertIsPay(object isPay)
+        {
+            switch (isPay)
+            {
+                case (Int64)0: return "Not Claimed";
+                case (Int64)1: return "Claimed";
+                case (Int64)2: return "Pending";
+                default: return "";
+            }
+        }
+    }
+}

+ 31 - 0
ReportCMS/ReportCMS/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
ReportCMS/ReportCMS/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
ReportCMS/ReportCMS/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
ReportCMS/ReportCMS/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
ReportCMS/ReportCMS/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; }
+    }
+}

+ 35 - 0
ReportCMS/ReportCMS/SuperAdmin/Models/Http/AddSourceReq.cs

@@ -0,0 +1,35 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System.Collections.Generic;
+using System;
+using SuperAdmin.Models.Http;
+
+public class AddSourceReq : Posting
+{
+    public List<AddSource> sources { get; set; }
+    public int termStoreId { get; set; }
+
+
+}
+
+public class AddSource
+{
+    public string name { get; set; }
+    public string description { get; set; }
+    public int priority { get; set; }
+    public string picture { get; set; }
+    public string type { get; set; }
+    public string status { get; set; }
+   
+}
+
+public class AddSourceRes : WsResponse
+{
+    //public UpdateCodeData data { get; set; }
+    public static new AddSourceRes Parse(String json)
+    {
+        return JsonConvert.DeserializeObject<AddSourceRes>(json);
+    }
+}
+
+

+ 75 - 0
ReportCMS/ReportCMS/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
ReportCMS/ReportCMS/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 { }
+        }
+    }
+}

+ 34 - 0
ReportCMS/ReportCMS/SuperAdmin/Models/Http/CategoryRes.cs

@@ -0,0 +1,34 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System.Collections.Generic;
+using System;
+
+public class CategoryReq : Posting
+{
+    public int pageNumber { get; set; }
+    public int pageSize { get; set; }
+}
+
+public class GetCategory
+{
+    public int categoryId { get; set; }
+    public string categoryName { get; set; }
+    public string categoryNameLocal { get; set; }
+    public string status { get; set; }
+}
+
+public class GetCategoryData
+{
+    public List<GetCategory> category { get; set; }
+    public int totalPage { get; set; }
+}
+
+public class GetCategoryRes : WsResponse
+{
+    public GetCategoryData data { get; set; }
+
+    public static new GetCategoryRes Parse(String json)
+    {
+        return JsonConvert.DeserializeObject<GetCategoryRes>(json);
+    }
+}

+ 60 - 0
ReportCMS/ReportCMS/SuperAdmin/Models/Http/ChargeRegisterReq.cs

@@ -0,0 +1,60 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System.Collections.Generic;
+using System;
+
+public class ChargeRegisterReq : Posting
+{
+    public string msisdn { get; set; }
+    public string fromTime { get; set; }
+    public string toTime { get; set; }
+    public int pageNumber { get; set; }
+    public int pageSize { get; set; }
+}
+
+public class Register
+{
+    public string registerTime { get; set; }
+    public string packageCode { get; set; }
+    public string command { get; set; }
+    public string channel { get; set; }
+    public string expiredTime { get; set; }
+    public string msisdn { get; set; }
+}
+
+public class RegisterData
+{
+    public List<Register> data { get; set; }
+    public int totalPage { get; set; }
+}
+
+public class ChargeLog
+{
+    public List<ChargeLogdetail1> data { get; set; }
+    public int totalPage { get; set; }
+}
+
+public class ChargeLogdetail1
+{
+    public int id { get; set; }
+    public String chargeTime { get; set; }
+    public String description { get; set; }
+    public String fee { get; set; }
+    public String msisdn { get; set; }
+}
+
+public class Data
+{
+    public RegisterData register { get; set; }
+    public ChargeLog chargeLog { get; set; }
+}
+
+public class ChargeRegisterRes : WsResponse
+{
+    public Data data { get; set; }
+
+    public static new ChargeRegisterRes Parse(String json)
+    {
+        return JsonConvert.DeserializeObject<ChargeRegisterRes>(json);
+    }
+}

+ 67 - 0
ReportCMS/ReportCMS/SuperAdmin/Models/Http/ContentFaq.cs

@@ -0,0 +1,67 @@
+using Microsoft.AspNetCore.Http;
+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 FaqsGetReq : Posting
+    {
+        public string v_code { get; set; }
+        public string v_channel { get; set; }
+        public string v_langid { get; set; }
+    }
+
+
+
+    public class FaqsGetData
+    {
+        public string ID { get; set; }
+        public string QUESTION { get; set; }
+        public string ANSWER { get; set; }
+        public string CHANNEL { get; set; }
+        public string LANG_ID { get; set; }
+        public string STATUS { get; set; }
+        public string USER_ID { get; set; }
+        public string UPDATED_DATE { get; set; }
+        public string CODE { get; set; }
+        public string ORDER_BY { get; set; }
+    }
+
+    public class FaqsGetRes : WsResponse
+    {
+        public List<FaqsGetData> data { get; set; }
+
+        public static new FaqsGetRes Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<FaqsGetRes>(json);
+        }
+    }
+
+    //edit
+
+    public class FaqsEditReq : Posting
+    {
+        public FaqsEditData[] data { get; set; }
+        // public string[] testString { get; set; }
+        public string v_userid { get; set; }
+        public string v_type { get; set; }
+        public string v_code { get; set; }
+        public string v_order_by { get; set; }
+    }
+
+
+    public class FaqsEditData
+    {
+        public string v_id { get; set; }
+        public string v_question { get; set; }
+        public string v_answer { get; set; }
+        public string v_channel { get; set; }
+        public string v_lang_id { get; set; }
+    }
+
+}

+ 67 - 0
ReportCMS/ReportCMS/SuperAdmin/Models/Http/ContentParam.cs

@@ -0,0 +1,67 @@
+using Microsoft.AspNetCore.Http;
+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 ParamsGetReq : Posting
+    {
+        public string v_code { get; set; }
+        public string v_channel { get; set; }
+        public string v_langid { get; set; }
+    }
+
+
+
+    public class ParamsGetData
+    {
+        public int ID { get; set; }
+        public string CODE { get; set; }
+        public string GROUP_CODE { get; set; }
+        public string SVALUES { get; set; }
+        public string DISPLAY1 { get; set; }
+        public string DISPLAY2 { get; set; }
+        public string DISPLAY3 { get; set; }
+        public string STATUS { get; set; }
+        public string CHANNEL { get; set; }
+        public string USER_ID { get; set; }
+        public string UPDATE_DATE { get; set; }
+    }
+
+    public class ParamsGetRes : WsResponse
+    {
+        public List<ParamsGetData> data { get; set; }
+        public static new ParamsGetRes Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<ParamsGetRes>(json);
+        }
+    }
+
+    //edit 
+    public class ParamsEditData
+    {
+        public string v_id { get; set; }
+        public string v_status { get; set; }
+        public string v_channel { get; set; }
+        public string v_group_code { get; set; }
+        public string v_values { get; set; }
+        public string v_display1 { get; set; }
+        public string v_display2 { get; set; }
+        public string v_display3 { get; set; }
+    }
+
+
+    public class ParamsEditReq : Posting
+    {
+        public  ParamsEditData[] data { get; set; }
+        public string v_userid { get; set; }
+        public string v_type { get; set; }
+        public string v_code { get; set; }
+        public string v_order_by { get; set; }
+    }
+}

+ 94 - 0
ReportCMS/ReportCMS/SuperAdmin/Models/Http/DashboardModel.cs

@@ -0,0 +1,94 @@
+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 DashboardModel
+    {
+        public DailyData dailyData { get; set; }
+        public DailyData accuData { get; set; }
+        public DailyPartnerData dailyDatas { get; set; }
+
+        public DailyPartnerData accuDatas { get; set; }
+        public List<DailyData> currentMonthData { get; set; }
+        public List<DailyData> lastMonthData { get; set; }
+        public String fromDate { get; set; }
+        public String toDate { get; set; }
+        public String channel { get; set; }
+
+    }
+
+    public class DailyDataReq : Posting
+    {
+        public string data_date { get; set; }
+        public string start_date { get; set; }
+        public string end_date { get; set; }
+        public string channel { get; set; }
+        public string v_type { get; set; }
+        public string partner { get; set; }
+        public string v_partner { get; set; }
+        
+
+    }
+
+    public class DailyDataRes : WsResponse
+    {
+        public DailyData data { get; set; }
+        public static new DailyDataRes Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<DailyDataRes>(json);
+        }
+    }
+
+    public class DailyData
+    {
+        public int id { get; set; }
+        public int totalTicket { get; set; }
+        public int totalRevenue { get; set; }
+        public int totalBill { get; set; }
+        public int totalUser { get; set; }
+        public string createdDate { get; set; }
+        public string dataDate { get; set; }
+        public string channel { get; set; }
+
+        public DailyData() { }
+        public static DailyData Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<DailyData>(json);
+        }
+    }
+
+
+    public class DailyDataTotal
+    {
+        public String NGAY { get; set; }
+        public int DAY_REVENUE { get; set; }
+        public int DAY_TICKET { get; set; }
+        public int DAY_BILL { get; set; }
+        public int DAY_USER_BUY { get; set; }
+        public string DAY_USER_REG { get; set; }
+
+    }
+    public class MonthlyDataRes : WsResponse
+    {
+        public List<DailyData> data { get; set; }
+        public static new MonthlyDataRes Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<MonthlyDataRes>(json);
+        }
+    }
+
+
+    public class MonthlyDataTotalRes : WsResponse
+    {
+        public List<DailyDataTotal> data { get; set; }
+        public static new MonthlyDataTotalRes Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<MonthlyDataTotalRes>(json);
+        }
+    }
+}

+ 85 - 0
ReportCMS/ReportCMS/SuperAdmin/Models/Http/DashboardPartnerModel.cs

@@ -0,0 +1,85 @@
+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 DashboardPartnerModel
+    {
+        public DailyPartnerData dailyData { get; set; }
+        public DailyPartnerData accuData { get; set; }
+        public List<DailyPartnerData> currentMonthData { get; set; }
+        public List<DailyPartnerData> lastMonthData { get; set; }
+        public String fromDate { get; set; }
+        public String toDate { get; set; }
+        public String channel { get; set; }
+
+    }
+
+    public class DailyPartnerDataReq : Posting
+    {
+        public string data_date { get; set; }
+        public string start_date { get; set; }
+        public string end_date { get; set; }
+        public string channel { get; set; }
+    }
+
+    public class DailyPartnerDataRes : WsResponse
+    {
+        public List<DailyPartnerData> data { get; set; }
+        public static new DailyPartnerDataRes Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<DailyPartnerDataRes>(json);
+        }
+    }
+
+    public class DailyPartnerDataRess : WsResponse
+    {
+        public DailyPartnerData data { get; set; }
+        public static new DailyPartnerDataRess Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<DailyPartnerDataRess>(json);
+        }
+    }
+
+    public class DailyPartnerData
+    {
+        public int ID { get; set; }
+        public int TOTALREVENUE { get; set; }
+        public int TOTALTICKET { get; set; }
+
+        public int TOTALBILL { get; set; }
+        public int TOTALUSERBUY { get; set; }
+        public int TOTALUSERRG { get; set; }
+
+        public int DAYREVENUE { get; set; }
+        public int DAYTICKET { get; set; }
+
+        public int DAYBILL { get; set; }
+        public int DAYUSERBUY { get; set; }
+        public int DAYUSERRG { get; set; }
+
+        public string DATADATE { get; set; }
+        public int CHANNEL { get; set; }
+        public int TOTALUSER { get; set; }
+        public string CREATEDDATE { get; set; }
+
+        public DailyPartnerData() { }
+        public static DailyPartnerData Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<DailyPartnerData>(json);
+        }
+    }
+
+    public class MonthlyPartnerDataRes : WsResponse
+    {
+        public List<DailyPartnerData> data { get; set; }
+        public static new MonthlyPartnerDataRes Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<MonthlyPartnerDataRes>(json);
+        }
+    }
+}

+ 47 - 0
ReportCMS/ReportCMS/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; }
+
+    }
+}

+ 90 - 0
ReportCMS/ReportCMS/SuperAdmin/Models/Http/Evoucher.cs

@@ -0,0 +1,90 @@
+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 VoucherObj
+    {
+        public String stt{ get; set; }
+        public String serial{ get; set; }
+        public String evoucher{ get; set; }
+        public String money{ get; set; }
+        public String createDate{ get; set; }
+        public String expireDate{ get; set; }
+        public String msisdn{ get; set; }
+        public String status{ get; set; }
+        public String sendDate{ get; set; }
+    }
+
+    public class EvoucherUploadReq : Posting
+    {
+        public String code { get; set; }
+        public String name { get; set; }
+        public String users { get; set; }
+        public String totalRow { get; set; }
+        public String totalMoney { get; set; }
+        public List<VoucherObj> list { get; set; }
+
+
+    }
+
+
+    public class EvoucherStatusCheckReq : Posting
+    {
+        public String fromDate { get; set; }
+        public String toDate { get; set; }
+        public String evoucher { get; set; }
+        public String msisdn { get; set; }
+        public String status { get; set; }
+    }
+
+
+    public class EvoucherStatusCheckRes
+    {
+        public List<VoucherObj> list;
+        public String responseCode;
+        public String responseMessage;
+
+        public EvoucherStatusCheckRes() { }
+
+        public static EvoucherStatusCheckRes Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<EvoucherStatusCheckRes>(json);
+        }
+    }
+
+    public class EvoucherTotalSearchReq : Posting
+    {
+        public String fromDate { get; set; }
+        public String toDate { get; set; }
+        public String status { get; set; }
+    }
+
+
+    public class EvoucherTotalSearchRes
+    {
+        public List<VoucherTotal> list;
+        public String responseCode;
+        public String responseMessage;
+
+        public EvoucherTotalSearchRes() { }
+
+        public static EvoucherTotalSearchRes Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<EvoucherTotalSearchRes>(json);
+        }
+    }
+
+    public class VoucherTotal
+    {
+        public String stt { get; set; }
+        public String money { get; set; }
+        public String total { get; set; }
+    }
+
+}

+ 42 - 0
ReportCMS/ReportCMS/SuperAdmin/Models/Http/GetArticlesReq.cs

@@ -0,0 +1,42 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System;
+using System.Collections.Generic;
+
+public class GetArticlesReq : Posting
+{
+    public string status { get; set; }
+    public int pageNumber { get; set; }
+    public int pageSize { get; set; }
+}
+
+public class ArticlesData
+{
+    public int articleId { get; set; }
+    public int categoryId { get; set; }
+    public string? title { get; set; }
+    public string? titleLocal { get; set; }
+    public string? content { get; set; }
+    public string? contentLocal { get; set; }
+    public string? imageUrl { get; set; }
+    public string? videoUrl { get; set; }
+    public string? status { get; set; }
+    public string? publishDate { get; set; }
+    public string? expireDate { get; set; }
+}
+
+public class ArticleData
+{
+    public List<ArticlesData> articles { get; set; }
+    public int totalPage { get; set; }
+}
+
+public class GetArticlesRes : WsResponse
+{
+    public ArticleData data { get; set; }
+
+    public static new GetArticlesRes Parse(String json)
+    {
+        return JsonConvert.DeserializeObject<GetArticlesRes>(json);
+    }
+}

+ 62 - 0
ReportCMS/ReportCMS/SuperAdmin/Models/Http/GetCodePrizeRes.cs

@@ -0,0 +1,62 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System.Collections.Generic;
+using System;
+
+public class GetCodePrizeReq : Posting
+{
+    public string predictTermId { get; set; }
+    public int pageNumber { get; set; }
+    public int pageSize { get; set; }
+}
+
+public class CodePrizesData
+{
+    public int id { get; set; }
+    public int predictTermId { get; set; }
+    public int prizeId { get; set; }
+    public string name { get; set; }
+    public string description { get; set; }
+    public string value { get; set; }
+    public string type { get; set; }
+    public int money { get; set; }
+    public string status { get; set; }
+    public string createdTime { get; set; }
+    public string timeClaimed { get; set; }
+    public string userClaimed { get; set; }
+    public string predictHistoryId { get; set; }
+    public string updatedTime { get; set; }
+}
+public class PredictTerm
+{
+    public int id { get; set; }
+    public string name { get; set; }
+    public string description { get; set; }
+    public string type { get; set; }
+    public string fromDate { get; set; }
+    public string toDate { get; set; }
+    public string status { get; set; }
+    public string picture { get; set; }
+    public string timeDraw { get; set; }
+}
+public class CodePrizeInfos
+{
+    public List<CodePrizesData> codePrizes { get; set; }
+    public PredictTerm predictTerm { get; set; }
+}
+
+public class GetCodePrizeData
+{
+    public List<CodePrizeInfos> codePrizeInfos { get; set; }
+    public int totalPage { get; set; }
+}
+
+public class GetCodePrizeRes : WsResponse
+{
+    public GetCodePrizeData data { get; set; }
+
+    public static new GetCodePrizeRes Parse(String json)
+    {
+        return JsonConvert.DeserializeObject<GetCodePrizeRes>(json);
+    }
+}

+ 35 - 0
ReportCMS/ReportCMS/SuperAdmin/Models/Http/GetQuestionsGroupRes.cs

@@ -0,0 +1,35 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System.Collections.Generic;
+using System;
+
+public class GetQuestionsGroupReq : Posting
+{
+    public int pageNumber { get; set; }
+    public int pageSize { get; set; }
+}
+
+public class GetQuestionsGroup
+{
+    public int id { get; set; }
+    public string name { get; set; }
+    public string description { get; set; }
+    public string status { get; set; }
+    public string image { get; set; }
+}
+
+public class GetQuestionsGroupData
+{
+    public List<GetQuestionsGroup> questionGroups { get; set; }
+    public int totalPage { get; set; }
+}
+
+public class GetQuestionsGroupRes : WsResponse
+{
+    public GetQuestionsGroupData data { get; set; }
+
+    public static new GetQuestionsGroupRes Parse(String json)
+    {
+        return JsonConvert.DeserializeObject<GetQuestionsGroupRes>(json);
+    }
+}

+ 91 - 0
ReportCMS/ReportCMS/SuperAdmin/Models/Http/GetRandom.cs

@@ -0,0 +1,91 @@
+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 RandomModel
+    {
+        public TermDraw termDraw { get; set; }
+        public long remainTime { get; set; }
+        public List<PrizeObj> listPrize { get; set; }
+        public PrizeObj currentPrize { get; set; }
+        public int type { get; set; }
+        public int finished { get; set; }
+
+    }
+    public class GetRandomNotDrawReq : Posting
+    {
+        public string type { get; set; }
+    }
+
+    public class UpRandomNotDrawReq : Posting
+    {
+        public string randomId { get; set; }
+        public string seq { get; set; }
+    }
+
+    public class PrizeObj
+    {
+        public int index { get; set; }
+        public String result { get; set; }
+        public String name { get; set; }
+        public String prizeValue { get; set; }
+        public String randomStatus { get; set; }
+        public PrizeObj() { }
+        public PrizeObj(String result, String name, String prizeValue, String randomStatus)
+        {
+            this.result = result;
+            this.name = name;
+            this.prizeValue = prizeValue;
+            this.randomStatus = randomStatus;
+        }
+    }
+
+    public class TermDraw
+    {
+        public String createDate { get; set; }
+        public String startDate { get; set; }
+        public String endDate { get; set; }
+        public String randomDate { get; set; }
+        public String status { get; set; }
+        public String id { get; set; }
+        public String g1 { get; set; }
+        public String g2 { get; set; }
+        public String g3 { get; set; }
+        public String g4 { get; set; }
+        public String g5 { get; set; }
+        public String g6 { get; set; }
+        public String g7 { get; set; }
+        public String g1Draw { get; set; }
+        public String g2Draw { get; set; }
+        public String g3Draw { get; set; }
+        public String g4Draw { get; set; }
+        public String g5Draw { get; set; }
+        public String g6Draw { get; set; }
+        public String g7Draw { get; set; }
+
+        public TermDraw() { }
+        public static TermDraw Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<TermDraw>(json);
+        }
+    }
+
+    public class GetRandomNotDrawRes
+    {
+        public List<TermDraw> list;
+        public String responseCode;
+        public String responseMessage;
+        public GetRandomNotDrawRes() { }
+
+        public static GetRandomNotDrawRes Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<GetRandomNotDrawRes>(json);
+        }
+    }
+}

+ 55 - 0
ReportCMS/ReportCMS/SuperAdmin/Models/Http/GetRankingPrizesReq.cs

@@ -0,0 +1,55 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System.Collections.Generic;
+using System;
+using DocumentFormat.OpenXml.Bibliography;
+
+public class GetRankingPrizesReq : Posting
+{
+   
+    public int pageNumber { get; set; }
+    public int pageSize { get; set; }
+}
+
+
+
+
+public class RankingPrizesData
+{
+    public string id { get; set; }
+    public string accountId { get; set; }
+    public string rankingFrom { get; set; }
+    public string scores { get; set; }
+    public string insertTime { get; set; }
+    public string lastUpdate { get; set; }
+    public string rankingTo { get; set; }
+    public string period { get; set; }
+    public string status { get; set; }
+    public string UpdateBy { get; set; }
+}
+public class RankingPrizesDatas
+{
+    public RankingPrizesData ranking { get; set; }
+    public string accountUserId { get; set; }
+    public string msisdn { get; set; }
+    public string prizeName { get; set; }
+    public decimal? prizeId { get; set; }
+    
+}
+
+public class GetRankingPrizesData
+{
+    public List<RankingPrizesDatas> rankings { get; set; }
+    public int totalPage { get; set; }
+    public bool countFlagResult { get; set; }
+}
+
+public class GetRankingPrizesRes : WsResponse
+{
+    public GetRankingPrizesData data { get; set; }
+
+    public static new GetRankingPrizesRes Parse(String json)
+    {
+        return JsonConvert.DeserializeObject<GetRankingPrizesRes>(json);
+    }
+}

+ 37 - 0
ReportCMS/ReportCMS/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; }
+    }
+}

+ 42 - 0
ReportCMS/ReportCMS/SuperAdmin/Models/Http/GetSongRes.cs

@@ -0,0 +1,42 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System;
+using System.Collections.Generic;
+
+public class GetSongReq : Posting
+{
+    public string status { get; set; }
+    public int pageNumber { get; set; }
+    public int pageSize { get; set; }
+}
+
+public class SongData
+{
+    public int id { get; set; }
+    public string? name { get; set; }
+    public string? description { get; set; }
+    public string? contentType { get; set; }
+    public string? content { get; set; }
+    public int questionGroupId { get; set; }
+    public string? createdTime { get; set; }
+    public string? updatedTime { get; set; }
+    public string? fromDate { get; set; }
+    public string? toDate { get; set; }
+    public string? status { get; set; }
+}
+
+public class GetSongData
+{
+    public List<SongData> songs { get; set; }
+    public int totalPage { get; set; }
+}
+
+public class GetSongRes : WsResponse
+{
+    public GetSongData data { get; set; }
+
+    public static new GetSongRes Parse(String json)
+    {
+        return JsonConvert.DeserializeObject<GetSongRes>(json);
+    }
+}

+ 40 - 0
ReportCMS/ReportCMS/SuperAdmin/Models/Http/GetSourceReq.cs

@@ -0,0 +1,40 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System.Collections.Generic;
+using System;
+
+public class GetSourceReq : Posting
+{
+    public string predictTermId { get; set; }
+    public string termStoreId { get; set; }
+    public string status { get; set; }
+    public int pageNumber { get; set; }
+    public int pageSize { get; set; }
+}
+
+public class GetSource
+{
+    public int id { get; set; }
+    public string name { get; set; }
+    public string description { get; set; }
+    public int priority { get; set; }
+    public string picture { get; set; }
+    public string type { get; set; }
+    public string status { get; set; }
+}
+
+public class GetSourceData
+{
+    public List<GetSource> sources { get; set; }
+    public int totalPage { get; set; }
+}
+
+public class GetSourceRes : WsResponse
+{
+    public GetSourceData data { get; set; }
+
+    public static new GetSourceRes Parse(String json)
+    {
+        return JsonConvert.DeserializeObject<GetSourceRes>(json);
+    }
+}

+ 33 - 0
ReportCMS/ReportCMS/SuperAdmin/Models/Http/GetUserTurnReq.cs

@@ -0,0 +1,33 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System.Collections.Generic;
+using System;
+using DocumentFormat.OpenXml.Bibliography;
+
+public class GetUserTurnReq : Posting
+{
+    public string msisdn { get; set; }
+}
+
+
+public class GetUserTurnData
+{
+    public String msisdn { get; set; }
+    public int totalTurn { get; set; }
+    public int turnRegister { get; set; }
+    public int turnBuyMore { get; set; }
+    public int turnMission { get; set; }
+    public int turnBonus { get; set; }
+    public int turnPredict { get; set; }
+    public int turnLeft { get; set; }
+}
+
+public class GetUserTurnRes : WsResponse
+{
+    public GetUserTurnData data { get; set; }
+
+    public static new GetUserTurnRes Parse(String json)
+    {
+        return JsonConvert.DeserializeObject<GetUserTurnRes>(json);
+    }
+}

+ 39 - 0
ReportCMS/ReportCMS/SuperAdmin/Models/Http/HistoryPlayRes.cs

@@ -0,0 +1,39 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System.Collections.Generic;
+using System;
+
+public class HistoryPlayReq : Posting
+{
+    public string msisdn { get; set; }
+    public string fromTime { get; set; }
+    public string toTime { get; set; }
+    public int pageNumber { get; set; }
+    public int pageSize { get; set; }
+}
+
+public class historyPlay
+{
+    public string msisdn { get; set; }
+    public string timeStart { get; set; }
+    public string timeSubmit { get; set; }
+    public int status { get; set; }
+    public string totalPoint { get; set; }
+    public Boolean isFree { get; set; }
+}
+
+public class HistoryPlayData
+{
+    public List<historyPlay> historyPlays { get; set; }
+    public int totalPage { get; set; }
+}
+
+public class HistoryPlayRes : WsResponse
+{
+    public HistoryPlayData data { get; set; }
+
+    public static new HistoryPlayRes Parse(String json)
+    {
+        return JsonConvert.DeserializeObject<HistoryPlayRes>(json);
+    }
+}

+ 32 - 0
ReportCMS/ReportCMS/SuperAdmin/Models/Http/InsertArticles.cs

@@ -0,0 +1,32 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System.Collections.Generic;
+using System;
+using SuperAdmin.Models.Http;
+
+public class InsertArticlesReq : Posting
+{
+    public List<ArticleDataInsert> ArticleList { get; set; }
+    
+}
+
+public class ArticleDataInsert
+{
+    public string categoryName { get; set; }
+    public string categoryName_local { get; set; }
+    public string title { get; set; }
+    public string title_local { get; set; }
+    public string content { get; set; }
+    public string content_local { get; set; }
+    public string image { get; set; }
+    public string publish_date { get; set; }
+    public string expire_date { get; set; }
+
+
+}
+
+public class DeleteArticleReq : Posting
+{
+    public int id { get; set; }
+
+}

+ 37 - 0
ReportCMS/ReportCMS/SuperAdmin/Models/Http/InsertCodePrizeRes.cs

@@ -0,0 +1,37 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System.Collections.Generic;
+using System;
+using SuperAdmin.Models.Http;
+
+public class InsertCodePrizeReq : Posting
+{
+    public List<InsertCodePrize> codePrizes { get; set; }
+    
+}
+
+public class InsertCodePrize
+{
+    public string predictTermId { get; set; }
+    public string prizeId { get; set; }
+    public string type { get; set; }
+    public string value { get; set; }
+    public string status { get; set; }
+
+}
+
+
+
+//public class InsertCodePrizeData
+//{
+//}
+
+public class InsertCodePrizeRes : WsResponse
+{
+    //public InsertCodePrizeData data { get; set; }
+
+    public static new InsertCodePrizeRes Parse(String json)
+    {
+        return JsonConvert.DeserializeObject<InsertCodePrizeRes>(json);
+    }
+}

+ 42 - 0
ReportCMS/ReportCMS/SuperAdmin/Models/Http/InsertSong.cs

@@ -0,0 +1,42 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System.Collections.Generic;
+using System;
+using SuperAdmin.Models.Http;
+
+public class InsertSongReq : Posting
+{
+    public List<Songs> Songs { get; set; }
+    
+}
+
+public class Songs
+{
+    public string questionName { get; set; }
+    public string questionDescription { get; set; }
+    public string questionContent { get; set; }
+    public string questionLink { get; set; }
+    public string questionPriority { get; set; }
+    public string category { get; set; }
+    public string categoryImage { get; set; }
+    public string categoryPriority { get; set; }
+    public List<AnswerInsert> answerInsert { get; set; }
+
+
+}
+
+public class AnswerInsert
+{
+    public string? answerName { get; set; }
+    public string? answerDescription { get; set; }
+    public int answerPriority { get; set; }
+    public string? answerContent { get; set; }
+    public string? isRight { get; set; }
+
+}
+
+public class DeleteSongReq : Posting
+{
+    public int id { get; set; }
+
+}

+ 56 - 0
ReportCMS/ReportCMS/SuperAdmin/Models/Http/InsertToPicRes.cs

@@ -0,0 +1,56 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System.Collections.Generic;
+using System;
+using SuperAdmin.Models.Http;
+
+public class AddToPicReq : Posting
+{
+    public List<AddToPic> termStores { get; set; }
+    
+}
+
+public class AddToPic
+{
+    public string name { get; set; }
+    public string description { get; set; }
+    public string fromTime { get; set; }
+    public string toTime { get; set; }
+    public string type { get; set; }
+    public string status { get; set; }
+    public string timeDraw { get; set; }
+    public string picture { get; set; }
+
+    public string dayRun { get; set; }
+    
+
+}
+public class TermStoreAdd
+{
+    public int id { get; set; }
+    public string name { get; set; }
+    public string description { get; set; }
+    public string fromTime { get; set; }
+    public string toTime { get; set; }
+    public string dayRun { get; set; }
+    public string status { get; set; }
+    public string type { get; set; }
+    public string timeDraw { get; set; }
+    public string picture { get; set; }
+    public string createdTime { get; set; }
+    public string updatedTime { get; set; }
+}
+public class AddCodeData
+{
+    public List<TermStoreAdd> termStores { get; set; }
+}
+public class AddToPicRes : WsResponse
+{
+    public AddCodeData data { get; set; }
+    public static new AddToPicRes Parse(String json)
+    {
+        return JsonConvert.DeserializeObject<AddToPicRes>(json);
+    }
+}
+
+

+ 49 - 0
ReportCMS/ReportCMS/SuperAdmin/Models/Http/LoadRankingPrizesReq.cs

@@ -0,0 +1,49 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System.Collections.Generic;
+using System;
+using DocumentFormat.OpenXml.Bibliography;
+
+public class LoadRankingPrizesReq : Posting
+{
+   
+    public int pageNumber { get; set; }
+    public int pageSize { get; set; }
+}
+
+
+public class prizeData
+{
+    public string Id { get; set; }
+    public string Name { get; set; }
+    public string Description { get; set; }
+    public string Value { get; set; }
+    public string Money { get; set; }
+    public string Status { get; set; }
+
+}
+
+public class RankingPrizes
+{
+    public string SubService { get; set; }
+    public string Rank { get; set; }
+    public string Money { get; set; }
+    public string PrizeId { get; set; }
+    public string Period { get; set; }
+}
+
+public class LoadRankingPrizesData
+{
+    public List<RankingPrizes> rankingPrizes { get; set; }
+    public int totalPage { get; set; }
+}
+
+public class LoadRankingPrizesRes : WsResponse
+{
+    public LoadRankingPrizesData data { get; set; }
+
+    public static new LoadRankingPrizesRes Parse(String json)
+    {
+        return JsonConvert.DeserializeObject<LoadRankingPrizesRes>(json);
+    }
+}

+ 27 - 0
ReportCMS/ReportCMS/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; }
+    }
+}

+ 46 - 0
ReportCMS/ReportCMS/SuperAdmin/Models/Http/PrizesReq.cs

@@ -0,0 +1,46 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System.Collections.Generic;
+using System;
+
+public class PrizesReq : Posting
+{
+
+    public String termStoreId { get; set; }
+
+    public String status { get; set; }
+    public int pageNumber { get; set; }
+    public int pageSize { get; set; }
+
+}
+
+public class prizesData
+{
+    public int id { get; set; }
+    public string code { get; set; }
+    public string name { get; set; }
+    public string description { get; set; }
+    public int priority { get; set; }
+    public string picture { get; set; }
+    public string type { get; set; }
+    public string value { get; set; }
+    public string status { get; set; }
+    public string packgeCode { get; set; }
+    public string packgeType { get; set; }
+}
+
+public class PrizeIdData
+{
+    public List<prizesData> termStores { get; set; }
+    public int totalPage { get; set; }
+}
+
+public class PrizeRes : WsResponse
+{
+    public PrizeIdData data { get; set; }
+
+    public static new PrizeRes Parse(String json)
+    {
+        return JsonConvert.DeserializeObject<PrizeRes>(json);
+    }
+}

+ 45 - 0
ReportCMS/ReportCMS/SuperAdmin/Models/Http/RankingRes.cs

@@ -0,0 +1,45 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System.Collections.Generic;
+using System;
+
+public class RankingReq : Posting
+{
+    public string msisdn { get; set; }
+    public string rankType { get; set; }
+    public string fromTime { get; set; }
+    public string toTime { get; set; }
+    public int pageNumber { get; set; }
+    public int pageSize { get; set; }
+}
+
+public class rankingItem
+{
+    public decimal id { get; set; }
+    public string msisdn { get; set; }
+    public string rankType { get; set; }
+    public DateTime? rankDate { get; set; }
+    public decimal? rankPosition { get; set; }
+    public decimal? totalBetValue { get; set; }
+    public decimal? rewardValue { get; set; }
+    public string rewardUnit { get; set; }
+    public int? rewardStatus { get; set; }
+    public DateTime? rewardDate { get; set; }
+    public string note { get; set; }
+}
+
+public class RankingData
+{
+    public List<rankingItem> rankings { get; set; }
+    public int totalPage { get; set; }
+}
+
+public class RankingRes : WsResponse
+{
+    public RankingData data { get; set; }
+
+    public static new RankingRes Parse(String json)
+    {
+        return JsonConvert.DeserializeObject<RankingRes>(json);
+    }
+}

+ 48 - 0
ReportCMS/ReportCMS/SuperAdmin/Models/Http/ReportDailyRes.cs

@@ -0,0 +1,48 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System.Collections.Generic;
+using System;
+
+public class ReportDailyReq : Posting
+{
+    public string type { get; set; }
+    public string serviceName { get; set; }
+    public string fromTime { get; set; }
+    public string toTime { get; set; }
+    public int pageNumber { get; set; }
+    public int pageSize { get; set; }
+}
+
+public class Revenues
+{
+    public int id { get; set; }
+    public string timeReport { get; set; }
+    public int registerOnMps { get; set; }
+    public int registerOnWeb { get; set; }
+    public int registerTotal { get; set; }
+    public int renew { get; set; }
+    public int buyOnWeb { get; set; }
+    public int buyOnMps { get; set; }
+    public int userActive { get; set; }
+    public int userInactive { get; set; }
+    public int revenue { get; set; }
+    public int bonus { get; set; }
+    public string type { get; set; }
+    public int userActiveTotal { get; set; }
+}
+
+public class ReportDailyData
+{
+    public List<Revenues> revenue { get; set; }
+    public int totalPage { get; set; }
+}
+
+public class ReportDailyRes : WsResponse
+{
+    public ReportDailyData data { get; set; }
+
+    public static new ReportDailyRes Parse(String json)
+    {
+        return JsonConvert.DeserializeObject<ReportDailyRes>(json);
+    }
+}

+ 60 - 0
ReportCMS/ReportCMS/SuperAdmin/Models/Http/ReportMoneyHourlyRes.cs

@@ -0,0 +1,60 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System.Collections.Generic;
+using System;
+
+
+public class RevenuesData
+{
+    public string date { get; set; }
+    public string serviceName { get; set; }
+    public int registerOnWeb { get; set; }
+    public hours hours { get; set; }
+    
+}
+public class hours
+{
+    public int h00 { get; set; }
+    public int h01 { get; set; }
+    public int h02 { get; set; }
+    public int h03 { get; set; }
+    public int h04 { get; set; }
+    public int h05 { get; set; }
+    public int h06 { get; set; }
+    public int h07 { get; set; }
+    public int h08 { get; set; }
+    public int h09 { get; set; }
+    public int h10 { get; set; }
+    public int h11 { get; set; }
+    public int h12 { get; set; }
+    public int h13 { get; set; }
+    public int h14 { get; set; }
+    public int h15 { get; set; }
+    public int h16 { get; set; }
+    public int h17 { get; set; }
+    public int h18 { get; set; }
+    public int h19 { get; set; }
+    public int h20 { get; set; }
+    public int h21 { get; set; }
+    public int h22 { get; set; }
+    public int h23 { get; set; }
+   
+}
+
+public class ReportMoneyHourlyData
+{
+    public List<RevenuesData> revenue { get; set; }
+    public int totalPage { get; set; }
+}
+
+public class ReportMoneyHourlyRes : WsResponse
+{
+    public ReportMoneyHourlyData data { get; set; }
+    public string errorCode { get; set; }
+    public string message { get; set; }
+
+    public static new ReportMoneyHourlyRes Parse(String json)
+    {
+        return JsonConvert.DeserializeObject<ReportMoneyHourlyRes>(json);
+    }
+}

+ 22 - 0
ReportCMS/ReportCMS/SuperAdmin/Models/Http/SetCodePrizeForUserRes.cs

@@ -0,0 +1,22 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System.Collections.Generic;
+using System;
+
+public class SetCodePrizeForUserReq : Posting
+{
+    public string msisdn { get; set; }
+    public string code { get; set; }
+}
+public class SetCodePrizeData
+{
+}
+public class SetCodePrizeForUserRes : WsResponse
+{
+    public SetCodePrizeData data { get; set; }
+
+    public static new SetCodePrizeForUserRes Parse(String json)
+    {
+        return JsonConvert.DeserializeObject<SetCodePrizeForUserRes>(json);
+    }
+}

+ 21 - 0
ReportCMS/ReportCMS/SuperAdmin/Models/Http/SetPrizeReq.cs

@@ -0,0 +1,21 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System.Collections.Generic;
+using System;
+
+public class SetPrizeReq : Posting
+{
+    public int predictWinnerId { get; set; }
+}
+public class SetPrizeData
+{
+}
+public class SetPrizeRes : WsResponse
+{
+    public SetPrizeData data { get; set; }
+
+    public static new SetPrizeRes Parse(String json)
+    {
+        return JsonConvert.DeserializeObject<SetPrizeRes>(json);
+    }
+}

+ 46 - 0
ReportCMS/ReportCMS/SuperAdmin/Models/Http/SetToPicRes.cs

@@ -0,0 +1,46 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System.Collections.Generic;
+using System;
+
+public class SetToPicReq : Posting
+{
+    public string predictTermId { get; set; }
+    public string termStoreId { get; set; }
+    public string status { get; set; }
+    public int pageNumber { get; set; }
+    public int pageSize { get; set; }
+}
+
+public class termStoresData
+{
+    public int id { get; set; }
+    public string name { get; set; }
+    public string description { get; set; }
+    public string fromTime { get; set; }
+    public string toTime { get; set; }
+    public string dayRun { get; set; }
+    public string status { get; set; }
+    public string type { get; set; }
+    public string timeDraw { get; set; }
+    public object picture { get; set; }
+    public string createdTime { get; set; }
+    public string updatedTime { get; set; }
+}
+
+
+public class SetToPicData
+{
+    public List<termStoresData> termStores { get; set; }
+    public int totalPage { get; set; }
+}
+
+public class SetToPicRes : WsResponse
+{
+    public SetToPicData data { get; set; }
+
+    public static new SetToPicRes Parse(String json)
+    {
+        return JsonConvert.DeserializeObject<SetToPicRes>(json);
+    }
+}

+ 35 - 0
ReportCMS/ReportCMS/SuperAdmin/Models/Http/SubmitPayRewardsReq.cs

@@ -0,0 +1,35 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System.Collections.Generic;
+using System;
+using SuperAdmin.Models.Http;
+
+public class SubmitPayRewardsReq : Posting
+{
+    public string msisdn { get; set; }
+    public int rank { get; set; }
+    public decimal money { get; set; }
+    public int id { get; set; }
+    public string userid { get; set; }
+    public string point { get; set; }
+}
+
+public class SubmitPayRewardsRes : WsResponse
+{
+    public static new SubmitPayRewardsRes Parse(String json)
+    {
+        return JsonConvert.DeserializeObject<SubmitPayRewardsRes>(json);
+    }
+
+    public SubmitPayRewardsData data { get; set; }
+}
+
+public class SubmitPayRewardsData
+{
+    public string msisdn { get; set; }
+    public int rank { get; set; }
+    public decimal money { get; set; }
+    public int id { get; set; }
+    public string winnerId { get; set; }
+    public List<object> result { get; set; }
+}

+ 22 - 0
ReportCMS/ReportCMS/SuperAdmin/Models/Http/SubmitPrizeReq.cs

@@ -0,0 +1,22 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System.Collections.Generic;
+using System;
+using SuperAdmin.Models.Http;
+
+public class submitPrizeReq : Posting
+{
+    public int id { get; set; }
+    public string msisdn { get; set; }
+
+}
+
+public class GrandPrizesRes : WsResponse
+{
+    public static new GrandPrizesRes Parse(String json)
+    {
+        return JsonConvert.DeserializeObject<GrandPrizesRes>(json);
+    }
+}
+
+

+ 32 - 0
ReportCMS/ReportCMS/SuperAdmin/Models/Http/UpdateCodePrizeRes.cs

@@ -0,0 +1,32 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System.Collections.Generic;
+using System;
+using SuperAdmin.Models.Http;
+
+public class UpdateCodePrizeReq : Posting
+{
+    public List<UpdateCodePrize> codePrizes { get; set; }
+    
+}
+
+public class UpdateCodePrize
+{
+    public string id { get; set; }
+    public string predictTermId { get; set; }
+    public string prizeId { get; set; }
+    public string type { get; set; }
+    public string value { get; set; }
+    public string status { get; set; }
+
+}
+
+
+public class UpdateCodePrizeRes : WsResponse
+{
+
+    public static new UpdateCodePrizeRes Parse(String json)
+    {
+        return JsonConvert.DeserializeObject<UpdateCodePrizeRes>(json);
+    }
+}

+ 74 - 0
ReportCMS/ReportCMS/SuperAdmin/Models/Http/UpdatePrizesReq.cs

@@ -0,0 +1,74 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System.Collections.Generic;
+using System;
+using SuperAdmin.Models.Http;
+
+public class UserPrizeReq : Posting
+{
+    public string msisdn { get; set; }
+    public string type { get; set; }
+    public string fromTime { get; set; }
+    public string toTime { get; set; }
+    public int pageNumber { get; set; }
+    public int pageSize { get; set; }
+    public String predictTermId { get; set; }
+    
+}
+
+public class UserPrizes
+{
+    public string msisdn { get; set; }
+    public string period { get; set; }
+    public string prize { get; set; }
+    public string processTime { get; set; }
+    public string drawTime { get; set; }
+    public string status { get; set; }
+    public string result { get; set; }
+    public string type { get; set; }
+    public int predictTermId { get; set; }
+    public int prizeId { get; set; }
+    public List<TransactionLogs> transactionLogs { get; set; }
+    public List<CodePrizes> CodePrizes { get; set; }
+
+}
+public class TransactionLogs
+{
+    public string requestTime { get; set; }
+    public string errorCode { get; set; }
+    public string code { get; set; }
+}
+
+public class CodePrizes
+{
+    public int id { get; set; }
+    public int predictTermId { get; set; }
+    public int prizeId { get; set; }
+    public object name { get; set; }
+    public object description { get; set; }
+    public string value { get; set; }
+    public string type { get; set; }
+    public int money { get; set; }
+    public string status { get; set; }
+    public String createdTime { get; set; }
+    public String timeClaimed { get; set; }
+    public string userClaimed { get; set; }
+    public int predictHistoryId { get; set; }
+    public String updatedTime { get; set; }
+
+}
+public class UserPrizeData
+{
+    public List<UserPrizes> prizes { get; set; }
+    public int totalPage { get; set; }
+}
+
+public class UserPrizeRes : WsResponse
+{
+    public UserPrizeData data { get; set; }
+
+    public static new UserPrizeRes Parse(String json)
+    {
+        return JsonConvert.DeserializeObject<UserPrizeRes>(json);
+    }
+}

+ 36 - 0
ReportCMS/ReportCMS/SuperAdmin/Models/Http/UpdateSourceReq.cs

@@ -0,0 +1,36 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System.Collections.Generic;
+using System;
+using SuperAdmin.Models.Http;
+
+public class UpdateSourceReq : Posting
+{
+    public List<UpdateSource> sources { get; set; }
+    public int termStoreId { get; set; }
+
+
+}
+
+public class UpdateSource
+{
+    public int id { get; set; }
+    public string name { get; set; }
+    public string description { get; set; }
+    public int priority { get; set; }
+    public string picture { get; set; }
+    public string type { get; set; }
+    public string status { get; set; }
+   
+}
+
+public class UpdateSourceRes : WsResponse
+{
+    //public UpdateCodeData data { get; set; }
+    public static new UpdateSourceRes Parse(String json)
+    {
+        return JsonConvert.DeserializeObject<UpdateSourceRes>(json);
+    }
+}
+
+

+ 58 - 0
ReportCMS/ReportCMS/SuperAdmin/Models/Http/UpdateToPicRes.cs

@@ -0,0 +1,58 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System.Collections.Generic;
+using System;
+using SuperAdmin.Models.Http;
+
+public class UpdateToPicReq : Posting
+{
+    public List<UpdateToPic> termStores { get; set; }
+    
+}
+
+public class UpdateToPic
+{
+    public string id { get; set; }
+    public string name { get; set; }
+    public string description { get; set; }
+    public string fromTime { get; set; }
+    public string toTime { get; set; }
+    public string type { get; set; }
+    public string status { get; set; }
+    public string timeDraw { get; set; }
+    public string picture { get; set; }
+
+    public string dayRun { get; set; }
+    
+
+}
+public class TermStore
+{
+    public int id { get; set; }
+    public string name { get; set; }
+    public string description { get; set; }
+    public string fromTime { get; set; }
+    public string toTime { get; set; }
+    public string dayRun { get; set; }
+    public string status { get; set; }
+    public string type { get; set; }
+    public string timeDraw { get; set; }
+    public string picture { get; set; }
+    public string createdTime { get; set; }
+    public string updatedTime { get; set; }
+}
+public class UpdateCodeData
+{
+    public List<TermStore> TermStore { get; set; }
+    public int totalPage { get; set; }
+}
+public class UpdateToPicRes : WsResponse
+{
+    public UpdateCodeData data { get; set; }
+    public static new UpdateToPicRes Parse(String json)
+    {
+        return JsonConvert.DeserializeObject<UpdateToPicRes>(json);
+    }
+}
+
+

+ 29 - 0
ReportCMS/ReportCMS/SuperAdmin/Models/Http/UserPrizeReq.cs

@@ -0,0 +1,29 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System.Collections.Generic;
+using System;
+using SuperAdmin.Models.Http;
+
+public class UpdatePrizesReq : Posting
+{
+    public int termStoreId { get; set; }
+    public int[] prizes { get; set; }
+
+}
+
+
+public class UpdatePrizesData
+{
+    //public List<UserPrizes> prizes { get; set; }
+    public int totalPage { get; set; }
+}
+
+public class UpdatePrizesRes : WsResponse
+{
+    public UpdatePrizesData data { get; set; }
+
+    public static new UpdatePrizesRes Parse(String json)
+    {
+        return JsonConvert.DeserializeObject<UpdatePrizesRes>(json);
+    }
+}

+ 54 - 0
ReportCMS/ReportCMS/SuperAdmin/Models/Http/WinnerReq.cs

@@ -0,0 +1,54 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System.Collections.Generic;
+using System;
+using DocumentFormat.OpenXml.Bibliography;
+
+public class WinnerReq : Posting
+{
+    public string msisdn { get; set; }
+    public string type { get; set; }
+    public string fromTime { get; set; }
+    public string toTime { get; set; }
+    public int pageNumber { get; set; }
+    public int pageSize { get; set; }
+}
+
+public class SourcesList : Posting
+{
+    public int id { get; set; }
+    public string picture { get; set; }
+   
+}
+
+
+
+public class winners
+{
+    public string msisdn { get; set; }
+    public string period { get; set; }
+    public string prize { get; set; }
+    public string spinTime { get; set; }
+    public string processTime { get; set; }
+    public string status { get; set; }
+    public string transactionPaymentId { get; set; }
+    public string totalPoints { get; set; }
+    public string actionType { get; set; }
+    public string prizeWinnerId { get; set; }
+}
+
+public class WinnerData
+{
+    public List<winners> winners { get; set; }
+    public int totalPage { get; set; }
+}
+
+public class WinnerRes : WsResponse
+{
+    public WinnerData data { get; set; }
+
+    public static new WinnerRes Parse(String json)
+    {
+        return JsonConvert.DeserializeObject<WinnerRes>(json);
+    }
+}

+ 39 - 0
ReportCMS/ReportCMS/SuperAdmin/Models/Http/loadPredictTermIdRes.cs

@@ -0,0 +1,39 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System.Collections.Generic;
+using System;
+
+public class loadPredictTermIdReq : Posting
+{
+    public string type { get; set; }
+    
+}
+
+public class predictTerms
+{
+    public int id { get; set; }
+    public string name { get; set; }
+    public string description { get; set; }
+    public string type { get; set; }
+    public string fromDate { get; set; }
+    public string toDate { get; set; }
+    public string status { get; set; }
+    public string picture { get; set; }
+    public string timeDraw { get; set; }
+}
+
+public class loadPredictTermIdData
+{
+    public List<predictTerms> predictTerms { get; set; }
+    public int totalPage { get; set; }
+}
+
+public class loadPredictTermIdRes : WsResponse
+{
+    public loadPredictTermIdData data { get; set; }
+
+    public static new loadPredictTermIdRes Parse(String json)
+    {
+        return JsonConvert.DeserializeObject<loadPredictTermIdRes>(json);
+    }
+}

+ 43 - 0
ReportCMS/ReportCMS/SuperAdmin/Models/Http/loadPrizeIdReq.cs

@@ -0,0 +1,43 @@
+using Newtonsoft.Json;
+using SuperAdmin.Models.Object;
+using System.Collections.Generic;
+using System;
+
+public class loadPrizeIdReq : Posting
+{
+    public String status { get; set; }
+    public int pageNumber { get; set; }
+    public int pageSize { get; set; }
+
+}
+
+public class prizes
+{
+    public int id { get; set; }
+    public string code { get; set; }
+    public string name { get; set; }
+    public string description { get; set; }
+    public int priority { get; set; }
+    public string picture { get; set; }
+    public string type { get; set; }
+    public string value { get; set; }
+    public string status { get; set; }
+    public string packgeCode { get; set; }
+    public string packgeType { get; set; }
+}
+
+public class loadPrizeIdData
+{
+    public List<prizes> prizes { get; set; }
+    public int totalPage { get; set; }
+}
+
+public class loadPrizeIdRes : WsResponse
+{
+    public loadPrizeIdData data { get; set; }
+
+    public static new loadPrizeIdRes Parse(String json)
+    {
+        return JsonConvert.DeserializeObject<loadPrizeIdRes>(json);
+    }
+}

+ 18 - 0
ReportCMS/ReportCMS/SuperAdmin/Models/Object/Account.cs

@@ -0,0 +1,18 @@
+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
ReportCMS/ReportCMS/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"];
+
+            }
+        }
+    }
+}

+ 55 - 0
ReportCMS/ReportCMS/SuperAdmin/Models/Object/Posting.cs

@@ -0,0 +1,55 @@
+using Newtonsoft.Json;
+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 string language { get; set; }
+
+    }
+
+    public class WsResponseCommon
+    {
+        public int status { get; set; }
+        public string errorCode { get; set; }
+        public string message { get; set; }
+        public string timestamp { get; set; }
+        public object data { get; set; }
+
+        public static WsResponseCommon Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<WsResponseCommon>(json);
+        }
+    }
+
+    public class WsResponse
+    {
+        public int status { get; set; }
+        public string errorCode { get; set; }
+        public string message { get; set; }
+        public string timestamp { get; set; }
+        //public object data { get; set; }
+        public string requestId { get; set; }
+        public string responseTime { get; set; }
+        public string totalRow { get; set; }
+        public string totalPage { get; set; }
+        public string pageNumber { get; set; }
+
+        public static WsResponse Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<WsResponse>(json);
+        }
+    }
+
+}

+ 55 - 0
ReportCMS/ReportCMS/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));
+                    }
+                }
+            }
+        }
+    }
+}

+ 36 - 0
ReportCMS/ReportCMS/SuperAdmin/Models/Object/RolesObj.cs

@@ -0,0 +1,36 @@
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace SuperAdmin.Models.Object
+{
+    public class GetListRoleReq : Posting
+    {
+        public string code { get; set; }
+        public string name { get; set; }
+    }
+
+    public class RolesObj
+    {
+        public int id { get; set; }
+        public string roleName { get; set; }
+        public string roleCode { get; set; }
+        public string status { get; set; }
+        public string createdTime { get; set; }
+        public static RolesObj Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<RolesObj>(json);
+        }
+    }
+
+    public class GetListRoleRes : WsResponse
+    {
+        public List<RolesObj> data { get; set; }
+        public static new GetListRoleRes Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<GetListRoleRes>(json);
+        }
+    }
+}

+ 219 - 0
ReportCMS/ReportCMS/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
ReportCMS/ReportCMS/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
ReportCMS/ReportCMS/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"];
+            }
+        }
+    }
+
+}

+ 130 - 0
ReportCMS/ReportCMS/SuperAdmin/Models/Object/UserRoles.cs

@@ -0,0 +1,130 @@
+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 username { get; set; }
+        public String password { get; set; }
+        public String uuid { get; set; }
+        //public String channel { get; set; } 
+    }
+    public class ResetPasswordReq : Posting
+    {
+        public String username { get; set; }
+    }
+
+    public class ReloadTokenReq : Posting
+    {
+
+        public String username { get; set; }
+        public String uuid { get; set; }
+        public String refreshToken { get; set; }
+    }
+
+    public class ReqCheckRole : Posting
+    {
+        public String username { get; set; }
+        public String actionPath { get; set; }
+        public ReqCheckRole(String username, String actionPath)
+        {
+            this.username = username;
+            this.actionPath = actionPath;
+        }
+    }
+
+    public class ConfirmOtpReq : Posting
+    {
+        public String actionCode { get; set; }
+        public String password { get; set; }
+        public String otp { get; set; }
+    }
+
+    public class ResetPasswordData
+    {
+        public string actionCode { get; set; }
+        public object expiredTimeOtp { get; set; }
+        public object wrongTimesOtp { get; set; }
+    }
+
+    public class ResetPasswordResponse : WsResponse
+    {
+        public ResetPasswordData data { get; set; }
+        public static new ResetPasswordResponse Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<ResetPasswordResponse>(json);
+        }
+    }
+
+    public class LoginData
+    {
+        public string lockUntil { get; set; }
+        public string wrongTimes { get; set; }
+        public string lastLogin { get; set; }
+        public string sysdate { get; set; }
+        public List<string> permissions { get; set; }
+        public string token { get; set; }
+        public string refreshToken { get; set; }
+        public string role { get; set; }
+
+        public static LoginData Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<LoginData>(json);
+        }
+    }
+
+    public class LoginResponse : WsResponse
+    {
+        public LoginData data { get; set; }
+        public static new LoginResponse Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<LoginResponse>(json);
+        }
+    }
+
+    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);
+        }
+    }
+
+    public class GetListFunctionRes : WsResponse
+    {
+        public List<String> data { get; set; }
+        public static new GetListFunctionRes Parse(String json)
+        {
+            return JsonConvert.DeserializeObject<GetListFunctionRes>(json);
+        }
+    }
+
+    public class UserRoleUpdateReq : Posting
+    {
+        public string userId { get; set; }
+        public string[] roles { get; set; }
+    }
+}

+ 23 - 0
ReportCMS/ReportCMS/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
ReportCMS/ReportCMS/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
ReportCMS/ReportCMS/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
ReportCMS/ReportCMS/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
ReportCMS/ReportCMS/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
ReportCMS/ReportCMS/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
ReportCMS/ReportCMS/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
ReportCMS/ReportCMS/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>();
+                });
+    }
+}

+ 22 - 0
ReportCMS/ReportCMS/SuperAdmin/Properties/PublishProfiles/FolderProfile.pubxml

@@ -0,0 +1,22 @@
+<?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>E:\Ex_publish\Mzb\cms</PublishUrl>
+    <WebPublishMethod>FileSystem</WebPublishMethod>
+    <SiteUrlToLaunchAfterPublish />
+    <TargetFramework>net7.0</TargetFramework>
+    <ProjectGuid>000a9a28-ee22-4214-887d-108273a43763</ProjectGuid>
+    <SelfContained>true</SelfContained>
+    <RuntimeIdentifier>linux-x64</RuntimeIdentifier>
+    <PublishSingleFile>false</PublishSingleFile>
+  </PropertyGroup>
+</Project>

+ 22 - 0
ReportCMS/ReportCMS/SuperAdmin/Properties/PublishProfiles/FolderProfile1.pubxml

@@ -0,0 +1,22 @@
+<?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>E:\Code\SuperAdmin\EX_WIN</PublishUrl>
+    <WebPublishMethod>FileSystem</WebPublishMethod>
+    <SiteUrlToLaunchAfterPublish />
+    <TargetFramework>netcoreapp3.1</TargetFramework>
+    <RuntimeIdentifier>win-x64</RuntimeIdentifier>
+    <PublishSingleFile>false</PublishSingleFile>
+    <ProjectGuid>000a9a28-ee22-4214-887d-108273a43763</ProjectGuid>
+    <SelfContained>true</SelfContained>
+  </PropertyGroup>
+</Project>

+ 22 - 0
ReportCMS/ReportCMS/SuperAdmin/Properties/PublishProfiles/FolderProfile2.pubxml

@@ -0,0 +1,22 @@
+<?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>E:\Code\SupperAdminAbl\ex</PublishUrl>
+    <WebPublishMethod>FileSystem</WebPublishMethod>
+    <SiteUrlToLaunchAfterPublish />
+    <TargetFramework>netcoreapp3.1</TargetFramework>
+    <RuntimeIdentifier>linux-x64</RuntimeIdentifier>
+    <PublishSingleFile>false</PublishSingleFile>
+    <ProjectGuid>000a9a28-ee22-4214-887d-108273a43763</ProjectGuid>
+    <SelfContained>true</SelfContained>
+  </PropertyGroup>
+</Project>

+ 21 - 0
ReportCMS/ReportCMS/SuperAdmin/Properties/PublishProfiles/FolderProfile3.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>netcoreapp3.1</TargetFramework>
+    <RuntimeIdentifier>win-x64</RuntimeIdentifier>
+    <ProjectGuid>000a9a28-ee22-4214-887d-108273a43763</ProjectGuid>
+    <SelfContained>true</SelfContained>
+  </PropertyGroup>
+</Project>

+ 17 - 0
ReportCMS/ReportCMS/SuperAdmin/Properties/PublishProfiles/FolderProfile4.pubxml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+https://go.microsoft.com/fwlink/?LinkID=208121.
+-->
+<Project>
+  <PropertyGroup>
+    <DeleteExistingFiles>false</DeleteExistingFiles>
+    <ExcludeApp_Data>false</ExcludeApp_Data>
+    <LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
+    <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
+    <LastUsedPlatform>Any CPU</LastUsedPlatform>
+    <PublishProvider>FileSystem</PublishProvider>
+    <PublishUrl>E:\Code\KungCang\ReportKungkang\EX</PublishUrl>
+    <WebPublishMethod>FileSystem</WebPublishMethod>
+    <_TargetId>Folder</_TargetId>
+  </PropertyGroup>
+</Project>

+ 30 - 0
ReportCMS/ReportCMS/SuperAdmin/Properties/launchSettings.json

@@ -0,0 +1,30 @@
+{
+  "profiles": {
+    "IIS Express": {
+      "commandName": "IISExpress",
+      "workingDirectory": "C:\\Program Files\\IIS Express\\config",
+      "launchBrowser": true,
+      "environmentVariables": {
+        "ASPNETCORE_ENVIRONMENT": "Development"
+      },
+      "nativeDebugging": true,
+      "use64Bit": true
+    },
+    "SuperAdmin": {
+      "commandName": "Project",
+      "launchBrowser": true,
+      "environmentVariables": {
+        "ASPNETCORE_ENVIRONMENT": "Development"
+      },
+      "applicationUrl": "https://localhost:50012;http://localhost:50002"
+    }
+  },
+  "iisSettings": {
+    "windowsAuthentication": false,
+    "anonymousAuthentication": true,
+    "iisExpress": {
+      "applicationUrl": "http://localhost:57291",
+      "sslPort": 0
+    }
+  }
+}

+ 85 - 0
ReportCMS/ReportCMS/SuperAdmin/Report_cms.csproj

@@ -0,0 +1,85 @@
+<Project Sdk="Microsoft.NET.Sdk.Web">
+
+  <PropertyGroup>
+    <TargetFramework>net7.0</TargetFramework>
+    <UserSecretsId>c3fe1f60-1c9f-4eb7-b25a-1a3892f4a80f</UserSecretsId>
+    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
+    <ApplicationIcon />
+    <OutputType>Exe</OutputType>
+    <StartupObject />
+  </PropertyGroup>
+
+  <ItemGroup>
+    <Compile Remove="Views\Roles\**" />
+    <Compile Remove="wwwroot\bk\**" />
+    <Compile Remove="wwwroot\superadmin\bk\**" />
+    <Content Remove="Views\Roles\**" />
+    <Content Remove="wwwroot\bk\**" />
+    <Content Remove="wwwroot\superadmin\bk\**" />
+    <EmbeddedResource Remove="Views\Roles\**" />
+    <EmbeddedResource Remove="wwwroot\bk\**" />
+    <EmbeddedResource Remove="wwwroot\superadmin\bk\**" />
+    <None Remove="Views\Roles\**" />
+    <None Remove="wwwroot\bk\**" />
+    <None Remove="wwwroot\superadmin\bk\**" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <Compile Remove="Models\Vsa\Vsa.cs" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <Content Remove="Views\Admin\_Result.cshtml" />
+    <Content Remove="Views\Admin\_Result1.cshtml" />
+    <Content Remove="Views\Admin\_Result2.cshtml" />
+    <Content Remove="Views\Partial\_MonthChart.cshtml" />
+    <Content Remove="Views\Partial\_Result1.cshtml" />
+    <Content Remove="Views\Partial\_Result2.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\" />
+    <Folder Include="wwwroot\audios\" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <None Include="wwwroot\temp\file_up_songs_Guess_Song_Mytel.xlsx" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <Compile Update="Views\Admin\ReportListWinner.cs">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Compile>
+  </ItemGroup>
+
+</Project>

+ 16 - 0
ReportCMS/ReportCMS/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
ReportCMS/ReportCMS/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;
+        }
+
+    }
+}

+ 306 - 0
ReportCMS/ReportCMS/SuperAdmin/Source/LumilotoUtils.cs

@@ -0,0 +1,306 @@
+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 OtpType
+        {
+            public const string CREATE_ACCOUNT = "1";
+            public const string RESET_PASSWORD = "2";
+            public const string CREATE_AGENT = "3";
+            public const string LOGIN_FAILED = "4";
+        }
+        public class GameIds
+        {
+            public const string LUCKY_POWER = "1";
+            public const string LUCKY_DAY = "2";
+            public const string LUCKY_PLUS = "3";
+        }
+        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 waitTicket = "0";
+            public const string waitStart = "1";
+            public const string available = "2";
+            public const string waitResult = "3";
+            public const string finished = "4";
+            public const string locked = "5";
+        }
+        public class PrizeOfTermStatus
+        {
+            public const string notSubmit = "0";
+            public const string waitApprove = "1";
+            public const string approved = "2";
+            public const string rejected = "3";
+        }
+
+        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 class Customer
+            {
+                public const String wsLogin = "wsLogin";
+                public const String wsResetPassword = "wsResetPassword";
+                public const String wsGetCustomerInfo = "wsGetCustomerInfo";
+                public const String wsReloadToken = "wsReloadToken";
+            }
+
+            public class CMS
+            {
+                // report
+                public const String wsSearchUser = "wsSearchUser";
+                public const String wsCountUser = "wsCountUser";
+                public const String wsDisableUser = "wsDisableUser";
+                public const String wsEnableUser = "wsEnableUser";
+                public const String wsChangePassword = "wsChangePassword";
+               
+            }
+
+            public class Config
+            {
+                public const String Winner = "Winner";
+                public const String ChargeRegister = "ChargeRegister";
+                public const String ReportDaily = "ReportDaily";
+                public const String ReportMoneyHourly = "ReportMoneyHourly";
+                public const String ReportSubHourly = "ReportSubHourly";
+                public const String UserPrize = "UserPrize";
+                public const String HistoryPlay = "HistoryPlay";
+                public const String Ranking = "Ranking";
+                public const String SetCodePrizeForUser = "SetCodePrizeForUser";
+                public const String GetCodePrize = "GetCodePrize";
+                public const String GetSong = "GetSong";
+                public const String DeleteSong = "DeleteSong";
+                public const String InsertCodePrize = "InsertCodePrize";
+                public const String UpdateCodePrize = "UpdateCodePrize";
+                public const String GetPredictTerm = "GetPredictTerm";
+                public const String GetMonthlyPrizes = "GetMonthlyPrizes";
+                public const String SetToPic = "SetToPic";
+                public const String UpdateToPic = "UpdateToPic";
+                public const String InsertToPic = "InsertToPic";
+                public const String GetSource = "GetSource";
+                public const String InsertSource = "InsertSource";
+                public const String UpdateSource = "UpdateSource";
+                public const String GetUserTurn = "GetUserTurn";
+                public const String GetPrizes = "GetPrizes";
+                public const String UpdatePrizes = "UpdatePrizes";
+                public const String ReRunPrizeForUser = "ReRunPrizeForUser";
+                public const String InsertSong = "InsertSong";
+                public const String GetQuestionsGroup = "GetQuestionsGroup";
+
+                public const String InsertArticle = "InsertArticle";
+                public const String GetArticle = "GetArticle";
+                public const String Getcategory = "Getcategory";
+                public const String SubmitPrize = "SubmitPrize";
+
+                public const String GetRanking = "GetRanking";
+                public const String GetRankingPrize = "GetRankingPrize";
+                public const String SubmitPayRewards = "SubmitPayRewards";
+
+            }
+
+            public const String Executes = "wsExecutes";
+            public const String PATH_OUTSIDE = "pathOutside";
+            public const String BaseAudioLink = "BaseAudioLink";
+
+        }
+
+        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 "-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 GetStatusPrizeOfTerm(string status)
+        {
+            switch (status)
+            {
+                case PrizeOfTermStatus.notSubmit:
+                    return "Not submit";
+                case PrizeOfTermStatus.waitApprove:
+                    return "Wait Approve";
+                case PrizeOfTermStatus.approved:
+                    return "Approved";
+                case PrizeOfTermStatus.rejected:
+                    return "Rejected";
+            }
+            return "";
+        }
+
+        public static String GetMessageType(int type)
+        {
+            switch (type)
+            {
+                case MessageType.SMS_TEXT:
+                    return "SMS Text";
+                case MessageType.SMS_FLASH:
+                    return "SMS Flash";
+                case MessageType.NOTI:
+                    return "Notification";
+            }
+            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 "";
+        }
+
+
+        public class MessageType
+        {
+            public const int SMS_TEXT = 0;
+            public const int SMS_FLASH = 1;
+            public const int NOTI = 11;
+        }
+        public class CampaignStatus
+        {
+            public const string INIT = "INIT";
+            public const string WAITING = "WAITING";
+            public const string REJECTED = "REJECTED";
+            public const string APPROVED = "APPROVED";
+            public const string COMPLETED = "COMPLETED";
+        }
+    }
+}

+ 127 - 0
ReportCMS/ReportCMS/SuperAdmin/Startup.cs

@@ -0,0 +1,127 @@
+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.Http.Features;
+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.Configure<FormOptions>(options =>
+            {
+                options.ValueLengthLimit = int.MaxValue; // Tăng giới hạn độ dài dữ liệu form
+                options.MultipartBodyLengthLimit = 100L * 1024 * 1024 * 1024; // Tăng giới hạn kích thước các file tải lên
+            });
+            //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;
+                //options.Cookie.SecurePolicy = CookieSecurePolicy.Always;
+            });
+            //services.Configure<CookiePolicyOptions>(options =>
+            //{
+            //    options.CheckConsentNeeded = context => false;
+            //    options.MinimumSameSitePolicy = SameSiteMode.None;
+            //});
+            //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)
+        {
+            // UsePathBase MUST be first — it strips the sub-path prefix (e.g. /cms)
+            // so all subsequent middleware see clean paths
+            String domain = Configuration.GetSection(UtilsController.Constant.SUB_DOMAIN).Value;
+            if (!string.IsNullOrEmpty(domain))
+            {
+                app.UsePathBase(domain);
+            }
+
+            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.UseCookiePolicy(new CookiePolicyOptions
+            //{
+            //    Secure = CookieSecurePolicy.Always,
+            //    MinimumSameSitePolicy = SameSiteMode.None
+            //});
+            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();
+
+            app.UseEndpoints(endpoints =>
+            {
+                endpoints.MapControllerRoute(
+                    name: "default",
+                    pattern: "{controller=Home}/{action=Index}/{id?}");
+            });
+        }
+    }
+}

+ 24 - 0
ReportCMS/ReportCMS/SuperAdmin/SuperAdmin.sln

@@ -0,0 +1,24 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.5.2.0
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GuessSongCms", "GuessSongCms.csproj", "{6A421DD8-EE9A-5010-F768-3A4C67B4E896}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{6A421DD8-EE9A-5010-F768-3A4C67B4E896}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{6A421DD8-EE9A-5010-F768-3A4C67B4E896}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{6A421DD8-EE9A-5010-F768-3A4C67B4E896}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{6A421DD8-EE9A-5010-F768-3A4C67B4E896}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {60FCCFC6-B0DE-489D-BAE4-99216938D0B6}
+	EndGlobalSection
+EndGlobal

+ 638 - 0
ReportCMS/ReportCMS/SuperAdmin/Views/Admin/Dashboard.cshtml

@@ -0,0 +1,638 @@
+@{
+    ViewData["Title"] = "Home Page";
+}
+
+@using SuperAdmin.Models.Http;
+@using Microsoft.AspNetCore.Http;
+@using SuperAdmin.Controllers;
+@using SuperAdmin.Models.Object;
+@using SuperCms.Extensions;
+
+@inject IJsonHelper Json;
+@model DashboardModel
+@{
+}
+
+<div class="content-header row">
+    <div class="content-header-left col-md-6 col-12 mb-2">
+        <h3 class="content-header-title mb-0">Report Summary</h3>
+    </div>
+</div>
+
+<div class="content-body">
+    <div class="row">
+        <div class="col-12">
+            <div class="card">
+                <div class="card-content">
+                    <div class="card-body">
+                        <div class="row container">
+                            <div class="col-md-6">
+                                <div class="form-group row">
+                                    <label class=" label-control" style="padding-top: 10px; min-width: 100px" for="fromDateTotal">Select day:</label>
+                                    <div class="col-md-6">
+                                        <input type="text" id="fromDateTotal" class="form-control border-primary fromDate" placeholder="From Date" name="fromDateTotal">
+                                    </div>
+                                </div>
+                            </div>
+                            <div class="col-md-6">
+                                <div class="form-group row">
+                                    <div class="col-md-9">
+                                        <button type="button" id="btnSearchTotal" class="btn btn-success" onclick="dailyReportTotal();">Search</button>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+
+    <div id="partial-content_total">
+    </div>
+
+    <div class="row match-height">
+        <div class="col-xl-12 col-lg-12">
+            <div class="card">
+                <div class="card-header">
+                    <h4 class="card-title">Month Report</h4>
+                    <a class="heading-elements-toggle"><i class="fa fa-ellipsis-v font-medium-3"></i></a>
+                    <div class="heading-elements">
+                        <ul class="list-inline mb-0">
+                            <li><a data-action="reload"><i class="feather icon-rotate-cw"></i></a></li>
+                            <li><a data-action="expand"><i class="feather icon-maximize"></i></a></li>
+                        </ul>
+                    </div>
+                    <div class="row">
+                        <div class="col-md-3">
+                            <div class="form-group">
+                                <label for="reportMonth">Month:</label>
+                                <input type="text" id="reportMonth" class="form-control border-primary reportMonth" placeholder="Month" name="reportMonth">
+                            </div>
+                        </div>
+                        <div class="col-md-3">
+                            <div class="form-group">
+                                <label for="reportType">Type:</label>
+                                <select id="reportType" class="form-control border-primary reportType" placeholder="Month" name="reportType" onchange="changeChart();">
+                                    <option value="1">Revenue</option>
+                                    <option value="2">Sell Ticket</option>
+                                    <option value="3">Order</option>
+                                    <option value="4">Buying User</option>
+                                </select>
+                            </div>
+                        </div>
+                        <div class="col-md-3" style="margin-top:auto">
+                            <div class="form-group row">
+                                <div class="col-md-9">
+                                    <button type="button" id="btnMonthChart" class="btn btn-success" onclick="monthChart();">Search</button>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="card-content">
+                    <div class="card-body height-400" id="chart-containter">
+                        <canvas id="chart-weekly-report"></canvas>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+
+</div>
+
+<div class="content-header row">
+    <div class="content-header-left col-md-6 col-12 mb-2">
+        <h3 class="content-header-title mb-0">Report by EU</h3>
+    </div>
+</div>
+<div class="content-body">
+    <div class="row">
+        <div class="col-12">
+            <div class="card">
+                <div class="card-content">
+                    <div class="card-body">
+                        <div class="row container">
+                            <div class="col-md-6">
+                                <div class="form-group row">
+                                    <label class=" label-control" style="padding-top: 10px; min-width: 100px" for="fromDate">Select day:</label>
+                                    <div class="col-md-6">
+                                        <input type="text" id="fromDate" class="form-control border-primary fromDate" placeholder="From Date" name="fromDate">
+                                    </div>
+                                </div>
+                            </div>
+
+                            <div class="col-md-6">
+                                <div class="form-group row">
+                                    <label class=" label-control" style="padding-top: 10px; min-width: 100px" for="paymentChannel">Payment Channel</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">*@
+                                        <select id="paymentChannel" class="form-control">
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+
+                            <div class="col-md-6">
+                                <div class="form-group row">
+                                    <div class="col-md-9">
+                                        <button type="button" id="btnSearch" class="btn btn-success" onclick="dailyReport();">Search</button>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+
+    <div id="partial-content">
+    </div>
+
+</div>
+
+<div class="content-header row">
+    <div class="content-header-left col-md-6 col-12 mb-2">
+        <h3 class="content-header-title mb-0">Point of sale</h3>
+    </div>
+</div>
+<div class="content-body">
+    <div class="row">
+        <div class="col-12">
+            <div class="card">
+                <div class="card-content">
+                    <div class="card-body">
+                        <div class="row container">
+                            <div class="col-md-4">
+                                <div class="form-group row">
+                                    <label class=" label-control" style="padding-top: 10px; min-width: 100px" for="fromDate_partner">Select day:</label>
+                                    <div class="col-md-6">
+                                        <input type="text" id="fromDate_partner" class="form-control border-primary fromDate" placeholder="From Date" name="fromDate_partner">
+                                    </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="partner">Partner</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">*@
+                                        <select id="partner" class="form-control" onchange="reloadChannelPartner();">
+                                        </select>
+                                    </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="paymentChannel_partner">Sales Channel</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">*@
+                                        <select id="paymentChannel_partner" class="form-control">
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                            <div class="col-md-4">
+                                <div class="form-group row">
+                                    <div class="col-md-9">
+                                        <button type="button" id="btnSearchPartner" class="btn btn-success" onclick="dailyReport_partner();">Search</button>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+
+    <div id="partial-content_partner">
+    </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>
+        var monthData;
+
+
+        function loadPaymentChannel() {
+            $.ajax({
+                url: baseUrl("/Admin/LoadPaymentChannel"),
+                data: {
+                },
+                type: "POST",
+                success: function (data) {
+                    if (data.error != "0" && data.error != "1") {
+                        showModal('message-dialog');
+                        $('#message-content').html(data.content.split("\n").join("<br />"));
+                    } else {
+                        // add option
+                        $("#paymentChannel").html("");
+                        $('#paymentChannel').append($('<option>', {
+                            value: "",
+                            text: "-- All --"
+                        }));
+                        $.each(data.data, function (i, item) {
+                            $('#paymentChannel').append($('<option>', {
+                                value: item.code,
+                                text: item.name
+                            }));
+                        });
+                        $("#paymentChannel").val($("#paymentChannel option:first").val());
+                    }
+                },
+                error: function (data) {
+                }
+            })
+        }
+
+        function dailyReport() {
+            startSpinner('btnSearch');
+            $.ajax({
+                url: baseUrl("/Admin/LoadDashboard"),
+                data: {
+                    __RequestVerificationToken: $('input[name="__RequestVerificationToken"]').val(),
+                    start_date: $("#fromDate").val(),
+                    end_date: $("#fromDate").val(),
+                    channel: $("#paymentChannel").val()
+                },
+                type: "POST",
+                success: function (data) {
+                    stopSpinner('btnSearch');
+                    $("#partial-content").html(data);
+
+
+                },
+                error: function (data) {
+                    stopSpinner('btnSearch');
+                }
+            })
+        }
+
+        function dailyReportTotal() {
+            startSpinner('btnSearchTotal');
+            $.ajax({
+                url: baseUrl("/Admin/LoadDashboardTotal"),
+                data: {
+                    __RequestVerificationToken: $('input[name="__RequestVerificationToken"]').val(),
+                    start_date: $("#fromDateTotal").val(),
+                    end_date: $("#fromDateTotal").val(),
+                    v_type: "1"
+                },
+                type: "POST",
+                success: function (data) {
+                    stopSpinner('btnSearchTotal');
+                    $("#partial-content_total").html(data);
+                },
+                error: function (data) {
+                    stopSpinner('btnSearchTotal');
+                }
+            })
+        }
+
+        function dailyReport_partner() {
+            startSpinner('btnSearchPartner');
+            $.ajax({
+                url: baseUrl("/Admin/LoadDashboardPartner"),
+                data: {
+                    __RequestVerificationToken: $('input[name="__RequestVerificationToken"]').val(),
+                    start_date: $("#fromDate_partner").val(),
+                    end_date: $("#fromDate_partner").val(),
+                    channel: $("#paymentChannel_partner").val(),
+                    v_type: "0",
+                    partner: $("#partner").val()
+                },
+                type: "POST",
+                success: function (data) {
+                    stopSpinner('btnSearchPartner');
+                    $("#partial-content_partner").html(data);
+
+
+                },
+                error: function (data) {
+                    stopSpinner('btnSearchPartner');
+                }
+            })
+        }
+
+        function genChart_partner() {
+            var type = $("#reportType_partner").val();
+
+            var reportMonth = $("#reportMonth_partner").val();
+            var last_month = moment(reportMonth, 'MM/YYYY').add(-1, 'M').format("MMM YYYY");
+            var current_month = moment(reportMonth, 'MM/YYYY').format("MMM YYYY");
+
+            var xAxis = [];
+            for (let i = 0; i < 31; i++) {
+                xAxis.push((i + 1));
+            }
+            var value1 = [];
+            var value2 = [];
+            if (type == "1") {
+                for (let i = 0; i < xAxis.length; i++) {
+                    if (monthData.current_month.length > i) {
+                        value1.push(monthData.current_month[i].totalRevenue);
+                    }
+                    if (monthData.last_month.length > i) {
+                        value2.push(monthData.last_month[i].totalRevenue);
+                    }
+                }
+            } else if (type == "2") {
+                for (let i = 0; i < xAxis.length; i++) {
+                    if (monthData.current_month.length > i) {
+                        value1.push(monthData.current_month[i].totalTicket);
+                    }
+                    if (monthData.last_month.length > i) {
+                        value2.push(monthData.last_month[i].totalTicket);
+                    }
+                }
+            } else if (type == "3") {
+                for (let i = 0; i < xAxis.length; i++) {
+                    if (monthData.current_month.length > i) {
+                        value1.push(monthData.current_month[i].totalBill);
+                    }
+                    if (monthData.last_month.length > i) {
+                        value2.push(monthData.last_month[i].totalBill);
+                    }
+                }
+            } else if (type == "4") {
+                for (let i = 0; i < xAxis.length; i++) {
+                    if (monthData.current_month.length > i) {
+                        value1.push(monthData.current_month[i].totalUser);
+                    }
+                    if (monthData.last_month.length > i) {
+                        value2.push(monthData.last_month[i].totalUser);
+                    }
+                }
+            }
+
+
+            load_chart_revenue("chart-containter2", "chart-weekly-partner", current_month, last_month,
+                value1, value2, xAxis);
+        }
+
+        function genChart() {
+            var type = $("#reportType").val();
+
+            var reportMonth = $("#reportMonth").val();
+            var last_month = moment(reportMonth, 'MM/YYYY').add(-1, 'M').format("MMM YYYY");
+            var current_month = moment(reportMonth, 'MM/YYYY').format("MMM YYYY");
+
+            var xAxis = [];
+            for (let i = 0; i < 31; i++) {
+                xAxis.push((i + 1));
+            }
+            var value1 = [];
+            var value2 = [];
+            if (type == "1") {
+                for (let i = 0; i < xAxis.length; i++) {
+                    if (monthData.current_month.length > i) {
+                        value1.push(monthData.current_month[i].daY_REVENUE);
+                    }
+                    if (monthData.last_month.length > i) {
+                        value2.push(monthData.last_month[i].daY_REVENUE);
+                    }
+                }
+            } else if (type == "2") {
+                for (let i = 0; i < xAxis.length; i++) {
+                    if (monthData.current_month.length > i) {
+                        value1.push(monthData.current_month[i].daY_TICKET);
+                    }
+                    if (monthData.last_month.length > i) {
+                        value2.push(monthData.last_month[i].daY_TICKET);
+                    }
+                }
+            } else if (type == "3") {
+                for (let i = 0; i < xAxis.length; i++) {
+                    if (monthData.current_month.length > i) {
+                        value1.push(monthData.current_month[i].daY_BILL);
+                    }
+                    if (monthData.last_month.length > i) {
+                        value2.push(monthData.last_month[i].daY_BILL);
+                    }
+                }
+            } else if (type == "4") {
+                for (let i = 0; i < xAxis.length; i++) {
+                    if (monthData.current_month.length > i) {
+                        value1.push(monthData.current_month[i].daY_USER_REG);
+                    }
+                    if (monthData.last_month.length > i) {
+                        value2.push(monthData.last_month[i].daY_USER_REG);
+                    }
+                }
+            }
+
+
+            load_chart_revenue("chart-containter", "chart-weekly-report", current_month, last_month,
+                value1, value2, xAxis);
+        }
+
+        function changeChart() {
+            if (monthData == null) {
+                monthChart();
+            } else {
+                genChart();
+            }
+        }
+
+
+        function monthChart() {
+            var reportMonth = $("#reportMonth").val();
+
+            startSpinner('btnMonthChart');
+            $.ajax({
+                url: baseUrl("/Admin/LoadMonthChargeTotal"),
+                data: {
+                    __RequestVerificationToken: $('input[name="__RequestVerificationToken"]').val(),
+                    month: reportMonth
+                },
+                type: "POST",
+                success: function (data) {
+                    stopSpinner('btnMonthChart');
+                    if (data.error == "0") {
+                        monthData = data;
+
+                        genChart();
+
+
+                    }
+                },
+                error: function (data) {
+                    stopSpinner('btnSearch');
+                }
+            })
+        }
+
+        function monthChart_partner() {
+            var reportMonth = $("#reportMonth_partner").val();
+
+            startSpinner('btnMonthChart');
+            $.ajax({
+                url: baseUrl("/Admin/LoadMonthChargePartner"),
+                data: {
+                    __RequestVerificationToken: $('input[name="__RequestVerificationToken"]').val(),
+                    month: reportMonth
+                },
+                type: "POST",
+                success: function (data) {
+                    stopSpinner('btnMonthChart');
+                    if (data.error == "0") {
+                        monthData = data;
+
+                        genChart_partner();
+
+
+                    }
+                },
+                error: function (data) {
+                    stopSpinner('btnSearch');
+                }
+            })
+        }
+
+        function reloadChannelPartner() {
+            LoadChannelPartner();
+        }
+
+        function LoadChannelPartner(channel) {
+         
+            $.ajax({
+                url: baseUrl("/Admin/LoadChannelPartner"),
+                data: {
+                    v_type: "4",
+                    v_partnercode: $("#partner").val()
+                },
+                type: "POST",
+                success: function (data) {
+                    if (data.error != "0" && data.error != "1") {
+                        showModal('message-dialog');
+                        $('#message-content').html(data.content.split("\n").join("<br />"));
+                    } else {
+                        // add option
+                        $("#paymentChannel_partner").html("");
+                        if (channel != null && channel != "-1") {
+
+                            $.each(data.data, function (i, item) {
+                                if (item.id == channel) {
+                                    $('#paymentChannel_partner').append($('<option>', {
+                                        value: item.id,
+                                        text: item.name
+                                    }));
+                                }
+                            });
+                        } else {
+
+                            if ($("#partner").val() == '2'){
+                                $('#paymentChannel_partner').append($('<option>', {
+                                    value: "",
+                                    text: "-- All --"
+                                }));
+                            }
+                            
+                            $.each(data.data, function (i, item) {
+                                $('#paymentChannel_partner').append($('<option>', {
+                                    value: item.id,
+                                    text: item.name
+                                }));
+                            });
+                        }
+                        $("#paymentChannel_partner").val($("#paymentChannel_partner option:first").val());
+                    }
+                },
+                error: function (data) {
+                }
+            })
+        }
+
+
+        function LoadPartner(channel) {
+           
+            $.ajax({
+                url: baseUrl("/Admin/LoadChannelPartner"),
+                data: {
+
+                    v_type: "3",
+                    v_channel: channel
+
+                },
+                type: "POST",
+                success: function (data) {
+                    if (data.error != "0" && data.error != "1") {
+                        showModal('message-dialog');
+                        $('#message-content').html(data.content.split("\n").join("<br />"));
+                    } else {
+                        // add option
+                   
+                        $("#partner").html("");
+                        if (channel != null && channel != "-1") {
+
+                        
+                            $.each(data.data, function (i, item) {
+                                //if (item.id == channel) {
+                                $('#partner').append($('<option>', {
+                                    value: item.id,
+                                    text: item.name
+                                }));
+                                //}
+                            });
+                        } else {
+                            
+                            $('#partner').append($('<option>', {
+                                value: "",
+                                text: "-- All --"
+                            }));
+                            $.each(data.data, function (i, item) {
+                                $('#partner').append($('<option>', {
+                                    value: item.id,
+                                    text: item.name
+                                }));
+                            });
+                        }
+                        $("#partner").val($("#partner option:first").val());
+
+
+                        LoadChannelPartner();
+                        dailyReport_partner();
+                    }
+                },
+                error: function (data) {
+                   
+
+                }
+            })
+        }
+
+        $(document).ready(function () {
+            $(".fromDate").datetimepicker({
+                format: "DD/MM/YYYY",
+                defaultDate: moment().add(-1, 'days')
+            });
+
+            $(".toDate").datetimepicker({
+                format: "DD/MM/YYYY",
+                defaultDate: moment().endOf('day')
+            });
+            $(".reportMonth").datetimepicker({
+                format: "MM/YYYY",
+                defaultDate: moment().startOf('month')
+            });
+
+            loadPaymentChannel();
+            var channel = '';
+            LoadPartner(channel);
+            dailyReportTotal();
+            dailyReport();
+            monthChart();
+            
+            
+        });
+
+    </script>
+}

+ 420 - 0
ReportCMS/ReportCMS/SuperAdmin/Views/Admin/DashboardPartner.cshtml

@@ -0,0 +1,420 @@
+@{
+    ViewBag.Title = "Trade";
+    Layout = "~/Views/Shared/_Layout.cshtml";
+}
+
+@using Microsoft.AspNetCore.Http;
+@using SuperAdmin.Controllers;
+@using SuperAdmin.Models.Object;
+@using SuperAdmin.Models.Http;
+@using SuperCms.Extensions;
+
+@*@inject IJsonHelper Json;
+@model DashboardPartnerModel*@
+@{
+    String partner = Context.Session.GetString("partner");
+}
+
+<div class="content-header row">
+    <div class="content-header-left col-md-6 col-12 mb-2">
+        <h3 class="content-header-title mb-0">Point of sale</h3>
+    </div>
+</div>
+<div class="content-body">
+    <div class="row">
+        <div class="col-12">
+            <div class="card">
+                <div class="card-content">
+                    <div class="card-body">
+                        <div class="row container">
+                            <div class="col-md-4">
+                                <div class="form-group row">
+                                    <label class=" label-control" style="padding-top: 10px; min-width: 100px" for="fromDate_partner">Select day:</label>
+                                    <div class="col-md-6">
+                                        <input type="text" id="fromDate_partner" class="form-control border-primary fromDate" placeholder="From Date" name="fromDate_partner">
+                                    </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="partner">Partner</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">*@
+                                        <select id="partner" class="form-control" onchange="reloadChannelPartner();">
+                                        </select>
+                                    </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="paymentChannel_partner">Channel Buy</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">*@
+                                        <select id="paymentChannel_partner" class="form-control">
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                            <div class="col-md-4">
+                                <div class="form-group row">
+                                    <div class="col-md-9">
+                                        <button type="button" id="btnSearchPartner" class="btn btn-success" onclick="dailyReport_partner()">Search</button>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+
+    <div id="partial-content_partner">
+    </div>
+
+</div>
+
+    <div id="partial-content">
+    </div>
+
+
+<div class="row match-height">
+    <div class="col-xl-12 col-lg-12">
+        <div class="card">
+            <div class="card-header">
+                <h4 class="card-title">Month Report</h4>
+                <a class="heading-elements-toggle"><i class="fa fa-ellipsis-v font-medium-3"></i></a>
+                <div class="heading-elements">
+                    <ul class="list-inline mb-0">
+                        <li><a data-action="reload"><i class="feather icon-rotate-cw"></i></a></li>
+                        <li><a data-action="expand"><i class="feather icon-maximize"></i></a></li>
+                    </ul>
+                </div>
+                <div class="row">
+                    <div class="col-md-3">
+                        <div class="form-group">
+                            <label for="reportMonth">Month:</label>
+                            <input type="text" id="reportMonth" class="form-control border-primary reportMonth" placeholder="Month" name="reportMonth">
+                        </div>
+                    </div>
+                    <div class="col-md-3">
+                        <div class="form-group">
+                            <label for="reportType">Type:</label>
+                            <select id="reportType" class="form-control border-primary reportType" placeholder="Month" name="reportType" onchange="changeChart();">
+                                <option value="1">Revenue</option>
+                                <option value="2">Sell Ticket</option>
+                                <option value="3">Order</option>
+                                <option value="4">Buying User</option>
+                            </select>
+                        </div>
+                    </div>
+                    <div class="col-md-3" style="margin-top:auto">
+                        <div class="form-group row">
+                            <div class="col-md-9">
+                                <button type="button" id="btnMonthChart" class="btn btn-success" onclick="monthChart_partner()">Search</button>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+            <div class="card-content">
+                <div class="card-body height-400" id="chart-containter2">
+                </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>
+        var monthData;
+        
+
+        function dailyReport_partner() {
+            startSpinner('btnSearchPartner');
+            
+            $.ajax({
+                url: baseUrl("/Admin/LoadDashboardPartner"),
+                data: {
+                    __RequestVerificationToken: $('input[name="__RequestVerificationToken"]').val(),
+                    start_date: $("#fromDate_partner").val(),
+                    end_date: $("#fromDate_partner").val(),
+                    channel: $("#paymentChannel_partner").val(),
+                    v_type: "0",
+                    partner: $("#partner").val()
+                },
+                type: "POST",
+                success: function (data) {
+                    stopSpinner('btnSearchPartner');
+                    $("#partial-content_partner").html(data);
+
+
+                },
+                error: function (data) {
+                    stopSpinner('btnSearchPartner');
+                   
+                }
+            })
+        }
+
+        function reloadChannelPartner() {
+            LoadChannelPartner();
+        }
+
+        function genChart_partner() {
+            var type = $("#reportType").val();
+
+            var reportMonth = $("#reportMonth").val();
+            var last_month = moment(reportMonth, 'MM/YYYY').add(-1, 'M').format("MMM YYYY");
+            var current_month = moment(reportMonth, 'MM/YYYY').format("MMM YYYY");
+
+            var xAxis = [];
+            for (let i = 0; i < 31; i++) {
+                xAxis.push((i + 1));
+            }
+            var value1 = [];
+            var value2 = [];
+            
+            if (type == "1") {
+                for (let i = 0; i < xAxis.length; i++) {
+                    if (monthData.current_month.length > i) {
+                        value1.push(monthData.current_month[i].daY_REVENUE);
+                    }
+                    if (monthData.last_month.length > i) {
+                        value2.push(monthData.last_month[i].daY_REVENUE);
+                    }
+                }
+            } else if (type == "2") {
+                for (let i = 0; i < xAxis.length; i++) {
+                    if (monthData.current_month.length > i) {
+                        value1.push(monthData.current_month[i].daY_TICKET);
+                    }
+                    if (monthData.last_month.length > i) {
+                        value2.push(monthData.last_month[i].daY_TICKET);
+                    }
+                }
+            } else if (type == "3") {
+                for (let i = 0; i < xAxis.length; i++) {
+                    if (monthData.current_month.length > i) {
+                        value1.push(monthData.current_month[i].daY_BILL);
+                    }
+                    if (monthData.last_month.length > i) {
+                        value2.push(monthData.last_month[i].daY_BILL);
+                    }
+                }
+            } else if (type == "4") {
+                for (let i = 0; i < xAxis.length; i++) {
+                    if (monthData.current_month.length > i) {
+                        value1.push(monthData.current_month[i].daY_USER_REG);
+                    }
+                    if (monthData.last_month.length > i) {
+                        value2.push(monthData.last_month[i].daY_USER_REG);
+                    }
+                }
+            }
+
+            load_chart_revenue("chart-containter2", "chart-weekly-partner", current_month, last_month,
+                value1, value2, xAxis);
+        }
+
+
+        function monthChart_partner() {
+            var reportMonth = $("#reportMonth").val();
+            var partner = '@partner';
+            startSpinner('btnMonthChart');
+            $.ajax({
+                url: baseUrl("/Admin/LoadMonthChargePartner"),
+                data: {
+                    __RequestVerificationToken: $('input[name="__RequestVerificationToken"]').val(),
+                    month: reportMonth,
+                    v_partner: partner
+                },
+                type: "POST",
+                success: function (data) {
+                    stopSpinner('btnMonthChart');
+                   
+                    if (data.error == "0") {
+                        monthData = data;
+
+                        genChart_partner();
+
+
+                    }
+                },
+                error: function (data) {
+                    stopSpinner('btnMonthChart');
+                   
+                }
+            })
+        }
+        function changeChart() {
+            if (monthData == null) {
+                monthChart();
+            } else {
+                genChart_partner();
+            }
+        }
+        function monthChart() {
+            var reportMonth = $("#reportMonth").val();
+            var partner = '@partner';
+            startSpinner('btnMonthChart');
+            $.ajax({
+                url: baseUrl("/Admin/LoadMonthChargePartner"),
+                data: {
+                    __RequestVerificationToken: $('input[name="__RequestVerificationToken"]').val(),
+                    month: reportMonth,
+                    v_partner: partner
+                },
+                type: "POST",
+                success: function (data) {
+                    stopSpinner('btnMonthChart');
+                   
+                    if (data.error == "0") {
+                        monthData = data;
+                        genChart_partner();
+
+                    }
+                },
+                error: function (data) {
+                    stopSpinner('btnSearch');
+                   
+                }
+            })
+        }
+        function LoadChannelPartner(channel) {
+            
+            $.ajax({
+                url: baseUrl("/Admin/LoadChannelPartner"),
+                data: {
+                    v_type: "4",
+                    v_partnercode: $("#partner").val()
+                },
+                type: "POST",
+                success: function (data) {
+                    if (data.error != "0" && data.error != "1") {
+                        showModal('message-dialog');
+                        $('#message-content').html(data.content.split("\n").join("<br />"));
+                    } else {
+                        // add option
+                        $("#paymentChannel_partner").html("");
+                        if (channel != null && channel != "-1") {
+
+                            $.each(data.data, function (i, item) {
+                                if (item.id == channel) {
+                                    $('#paymentChannel_partner').append($('<option>', {
+                                        value: item.id,
+                                        text: item.name
+                                    }));
+                                }
+                            });
+                        } else {
+                            
+                            if ($("#partner").val() == '2') {
+                                $('#paymentChannel_partner').append($('<option>', {
+                                    value: "",
+                                    text: "-- All --"
+                                }));
+                            }
+                            $.each(data.data, function (i, item) {
+                                $('#paymentChannel_partner').append($('<option>', {
+                                    value: item.id,
+                                    text: item.name
+                                }));
+                            });
+                        }
+                        $("#paymentChannel_partner").val($("#paymentChannel_partner option:first").val());
+                    }
+                },
+                error: function (data) {
+                   
+                }
+            })
+        }
+
+
+        function LoadPartner(partner) {
+           
+            $.ajax({
+                url: baseUrl("/Admin/LoadChannelPartner"),
+                data: {
+
+                    v_type: "4",
+                    v_partnercode: partner
+
+                },
+                type: "POST",
+                success: function (data) {
+                    if (data.error != "0" && data.error != "1") {
+                        showModal('message-dialog');
+                        $('#message-content').html(data.content.split("\n").join("<br />"));
+                    } else {
+                        // add option
+                       
+                        $("#partner").html("");
+                        if (partner != null && partner != "-1") {
+
+                           
+                            $.each(data.data, function (i, item) {
+                                //if (item.id == channel) {
+                                $('#partner').append($('<option>', {
+                                    value: item.id,
+                                    text: item.name
+                                }));
+                                //}
+                            });
+                        } else {
+                           
+                            $('#partner').append($('<option>', {
+                                value: "",
+                                text: "-- All --"
+                            }));
+                            $.each(data.data, function (i, item) {
+                                $('#partner').append($('<option>', {
+                                    value: item.id,
+                                    text: item.name
+                                }));
+                            });
+                        }
+                        $("#partner").val($("#partner option:first").val());
+
+
+                        LoadChannelPartner();
+                        dailyReport_partner();
+                        monthChart_partner();
+                    }
+                },
+                error: function (data) {
+                   
+                }
+            })
+        }
+
+
+        $(document).ready(function () {
+           
+            $(".fromDate").datetimepicker({
+                format: "DD/MM/YYYY",
+                defaultDate: moment().add(-1, 'days')
+            });
+
+            $(".toDate").datetimepicker({
+                format: "DD/MM/YYYY",
+                defaultDate: moment().endOf('day')
+            });
+            $(".reportMonth").datetimepicker({
+                format: "MM/YYYY",
+                defaultDate: moment().startOf('month')
+            });
+
+            var partner = '@partner';
+            LoadPartner(partner);
+            
+        });
+
+    </script>
+}

+ 472 - 0
ReportCMS/ReportCMS/SuperAdmin/Views/Admin/GetArticles.cshtml

@@ -0,0 +1,472 @@
+@{
+    ViewBag.Title = "Statistics";
+    Layout = "~/Views/Shared/_Layout.cshtml";
+}
+
+@using Newtonsoft.Json;
+@using SuperAdmin.Models;
+@using SuperAdmin.Models.Http;
+@using SuperAdmin.Controllers;
+@using SuperAdmin.Source;
+@using SuperCms.Extensions;
+
+@model GetSongRes
+
+<style>
+    img {
+        max-width: 100%;
+    }
+</style>
+<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">Songs</h4>
+                        <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">
+                                    <div class="row">
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>Status</label>
+                                                <div class='input-group'>
+                                                    <select id="status" class="form-control">
+                                                        <option value="ACTIVE">ACTIVE</option>
+                                                        <option value="INACTIVE">INACTIVE</option>
+                                                    </select>
+                                                </div>
+                                            </div>
+                                        </div>
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                                <button type="button" class="btn btn-primary" onclick="search()" id="btnSearch">
+                                                    <i class="icon-search"></i> Search
+                                                </button>
+                                            <button type="button" class="btn  btn-add" onclick="add()" id="btnAdd">
+                                                    <i class="icon-plus"></i> Add
+                                                </button>
+
+                                            <button type="button" class="btn  btn-add-image" onclick="addImg()" id="btnAddImage">
+                                                    <i class="icon-image"></i> Add Image
+                                                </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" id="mtList">
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </section>
+    <!-- // Basic form layout section end -->
+</div>
+<!-- Modal Edit Form -->
+
+<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">Update Code Prize</h4>
+                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+                    <span aria-hidden="true">×</span>
+                </button>
+            </div>
+            <div class="modal-body">
+                <div class="row" id="modalContent">
+                    <div class="col-12 ">
+                        <div class="tab-content">
+                            <div class="row">
+                                    <div class="col-md-3 col-sm-4 col-6" id="idhi">
+                                        <div class="form-group">
+                                            <label>ID</label>
+                                            <div class='input-group'>
+                                                <input id="paramId" name="paramId" class="form-control" type="number" disabled />
+                                            </div>
+                                        </div>
+                                    </div>
+                                <div class="col-md-3 col-sm-4 col-6">
+                                    <div class="form-group">
+                                        <label>PredictTermId</label>
+                                        <div class='input-group'>
+                                            <select id="predictTermIdEdit" class="form-control">
+                                            </select>
+                                        </div>
+                                    </div>
+                                </div>
+                                <div class="col-md-3 col-sm-4 col-6">
+                                    <div class="form-group">
+                                        <label>PrizeId</label>
+                                        <div class='input-group'>
+                                            <select id="prizeId" class="form-control">
+                                            </select>
+                                        </div>
+                                    </div>
+                                </div>
+                                <div class="col-md-3 col-sm-4 col-6">
+                                    <div class="form-group">
+                                        <label>Type</label>
+                                        <div class='input-group'>
+                                            <select id="type" class="form-control">
+                                                <option value="POINT">POINT</option>
+                                                <option value="MONEY">MONEY</option>
+                                            </select>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                            <div class="row">
+                               
+                                <div class="col-md-3 col-sm-4 col-6">
+                                    <div class="form-group">
+                                        <label>Value</label>
+                                        <div class='input-group'>
+                                            <input id="value" name="value" class="form-control" />
+                                        </div>
+                                    </div>
+                                </div>
+                                <div class="col-md-3 col-sm-4 col-6">
+                                    <div class="form-group">
+                                        <label>Status</label>
+                                        <div class='input-group'>
+                                            <select id="status" class="form-control">
+                                                <option value="ACTIVE">ACTIVE</option>
+                                                <option value="INACTIVE">INACTIVE</option>
+                                            </select>
+                                            <div class="col-md-3 col-sm-4 col-6" style="margin-top:0rem;display:flex;margin-left:1rem">
+                                                <button type="button" class="btn btn-primary" onclick="update()" id="btnUpdate" >
+                                                    <i class="icon-search"></i> Update
+                                                </button>
+                                                <button type="button" class="btn grey btn-outline-secondary" data-dismiss="modal" style="margin-top:0rem;display:flex;margin-left:1rem">Close</button>
+                                            </div>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                            <div class="row">
+                                <div class="col-md-12">
+                                    
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="modal-footer">
+        </div>
+    </div>
+</div>
+<div class="modal fade text-xs-left" id="modal-add-service1" 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">Upload Excel File</h4>
+                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+                    <span aria-hidden="true">×</span>
+                </button>
+            </div>
+            <div class="modal-body">
+                <div class="row" id="modalContent">
+                    <div class="col-12">
+                        <div class="form-group">
+                            <label for="excelFileUpload">Upload Excel File</label>
+                            <input type="file" id="excelFileUpload" class="form-control" accept=".xlsx, .xls" />
+                        </div>
+                        <div class="form-group">
+                            <button type="button" class="btn btn-primary" onclick="uploadExcelFile()">
+                                <i class="icon-upload"></i> Upload
+                            </button>
+                            <a href="~/temp/Update_content_HobbyHub_MOZ.xlsx" class="btn btn-secondary" download>
+                                <i class="icon-download"></i> Download Sample File
+                            </a>
+                            <button type="button" class="btn grey btn-primary" data-dismiss="modal">
+                                Close
+                            </button>
+                        </div>
+                    </div>
+                </div>
+            </div>
+            <div class="modal-footer1"></div>
+        </div>
+    </div>
+</div>
+
+<div class="modal fade text-xs-left" id="modal-add-service3" 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">Upload File Image</h4>
+                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+                    <span aria-hidden="true">×</span>
+                </button>
+            </div>
+            <div class="modal-body">
+                <div class="row" id="modalContent">
+                    <div class="col-12">
+                        <div class="form-group">
+                            <label for="excelFileUpload">Upload File Image</label>
+                            <input type="file" id="fileInputImg" class="form-control" multiple />
+                        </div>
+                        <div class="form-group">
+                            <button type="button" class="btn btn-primary" onclick="uploadFilesImg()">
+                                <i class="icon-upload"></i> Upload
+                            </button>
+                            <button type="button" class="btn grey btn-primary" data-dismiss="modal">
+                                Close
+                            </button>
+                        </div>
+                    </div>
+                </div>
+            </div>
+            <div class="modal-footer1"></div>
+        </div>
+    </div>
+</div>
+
+@section Scripts {
+
+    <script>
+
+        var tableDetail;
+        var editorQ = {};
+        var editorA = {};
+        var GetCodePrizeData = null;
+        function resetTableDetail() {
+            tableDetail = $("#grid_detail").DataTable({
+                orderCellsTop: true,
+                fixedHeader: true
+            });
+        }
+
+        function clearTable(table) {
+            if (table != null && table != undefined) {
+                table
+                    .clear()
+                    .destroy();
+            }
+        }
+        resetTableDetail();
+
+        function search() {
+           
+            startSpinner('btnSearch');
+            clearTable(tableDetail);
+            var mstatus = $("#status").val().trim();
+            if (!status) {
+                status = "ACTIVE"; 
+            }
+            $.ajax({
+                url: urlConfig("/Admin/GetArticlesSearch1"),
+                data: {
+                    status: mstatus,
+                    pageNumber: 0,
+                    pageSize: 100000
+                },
+                type: "POST",
+                success: function (data) {
+                    stopSpinner('btnSearch');
+                    if (data.error != null) {
+                        Swal.fire('Warning!', data.message, 'warning');
+                        return;
+                    }
+
+                    $("#mtList").html(data);
+                    resetTableDetail();
+                },
+                error: function (data) {
+                    stopSpinner('btnSearch');
+                    
+                }
+            })
+        }
+
+        function edit(id, predictTermId, prizeId, type, value, status, predictTermType) {
+           
+            $("#btnAddUpdate").html("Update");
+            $("#paramId").val(id);
+            loadPredictTermId(predictTermType, predictTermId);
+            loadMonthlyPrize(prizeId);
+            $("#type").val(type);
+            $("#value").val(value);
+            $("#status").val(status);
+            showModal("modal-add-service");
+               
+            }
+        function add() {
+            
+            showModal("modal-add-service1");
+        }
+        function addMusic() {
+            
+            showModal("modal-add-service2");
+        }
+        function addImg() {
+            
+            showModal("modal-add-service3");
+        }
+
+
+        function uploadExcelFile() {
+            
+            startSpinner('btnAdd');
+
+            // Lấy file từ input
+            const fileInput = document.getElementById('excelFileUpload'); // Đảm bảo `excelFileUpload` là id của input file
+            const file = fileInput.files[0]; // Lấy file đầu tiên trong danh sách
+
+            if (!file) {
+                Swal.fire('Warning!', 'Please select a file to upload!', 'warning');
+                stopSpinner('btnAdd');
+                return;
+            }
+
+            // Tạo FormData để gửi file
+            const formData = new FormData();
+            formData.append('file', file); // Thêm file vào FormData
+            formData.append('__RequestVerificationToken', $('input[name=__RequestVerificationToken]').val()); // Token CSRF nếu cần
+
+            $.ajax({
+                type: "POST",
+                url: baseUrl("/Admin/AddArticles"), // URL API xử lý upload file
+                data: formData,
+                processData: false, // Không xử lý dữ liệu (do dùng FormData)
+                contentType: false, // Không thiết lập Content-Type mặc định (do FormData tự làm)
+                headers: {
+                    'Accept': 'application/json' // Định dạng mong muốn của response
+                },
+                success: function (data) {
+                    stopSpinner('btnAdd');
+                    if (data.error != null) {
+                        Swal.fire('Warning!', data.message, 'warning');
+                        return;
+                    }
+                    Swal.fire('Success!', 'File uploaded successfully!', 'success');
+                    search(); // Thực hiện reload hoặc cập nhật dữ liệu
+                },
+                error: function (data) {
+                    stopSpinner('btnAdd');
+                    
+                    Swal.fire('Error!', 'An error occurred during the upload process.', 'error');
+                }
+            });
+        }
+
+        function uploadFiles() {
+            var files = document.getElementById('fileInput').files;
+            if (files.length === 0) {
+                Swal.fire('Warning!', 'Please select files to upload.', 'warning');
+                return;
+            }
+
+            var formData = new FormData();
+            Array.from(files).forEach(file => formData.append('files', file));
+
+            $.ajax({
+                url: '/Admin/UploadFile', 
+                type: 'POST',
+                data: formData,
+                processData: false,  
+                contentType: false, 
+                success: function (response) {
+                    Swal.fire('Success!', 'Files uploaded successfully.', 'success');
+                },
+                error: function (error) {
+                    Swal.fire('Error!', 'An error occurred while uploading.', 'error');
+                }
+            });
+        }
+
+
+        function uploadFilesImg() {
+            var files = document.getElementById('fileInputImg').files;
+            if (files.length === 0) {
+                Swal.fire('Warning!', 'Please select files to upload.', 'warning');
+                return;
+            }
+
+            var formData = new FormData();
+            Array.from(files).forEach(file => formData.append('files', file));
+
+            $.ajax({
+                url: '/Admin/UploadFile',
+                type: 'POST',
+                data: formData,
+                processData: false,
+                contentType: false,
+                success: function (response) {
+                    Swal.fire('Success!', 'Files uploaded successfully.', 'success');
+                },
+                error: function (error) {
+                    Swal.fire('Error!', 'An error occurred while uploading.', 'error');
+                }
+            });
+        }
+
+        function deleteSong(songId) {
+            
+            startSpinner('btnDelete'); 
+            $.ajax({
+                url: urlConfig("/Admin/DeleteSong"), 
+                type: "POST",
+                data: { id: songId },
+                success: function (data) {
+                    stopSpinner('btnDelete');
+                    console.log("data: " + data);
+                    if (data.success) {
+                        Swal.fire('Deleted!', 'The song has been deleted successfully.', 'success');
+                        $(`#gridbody_detail tr[data-song-id="${songId}"]`).remove();
+                        search();
+                    } else {
+                        Swal.fire('Error!', data.message || 'Unable to delete the song.', 'error');
+                    }
+                },
+                error: function (xhr) {
+                    stopSpinner('btnDelete'); // Stop spinner on error
+                    Swal.fire('Error!', 'An error occurred while deleting the song.', 'error');
+                    console.error(xhr.responseText);
+                }
+            });
+        }
+        Getcategory();
+        function Getcategory() {
+            $.ajax({
+                url: baseUrl("/Admin/Getcategory"),
+                data: {
+                    pageNumber: 0,
+                    pageSize: 100000
+                },
+                type: "POST",
+                success: function (data) {
+                    
+                },
+                error: function (data) {
+                    
+                }
+            })
+        }
+
+    </script>
+}
+

+ 484 - 0
ReportCMS/ReportCMS/SuperAdmin/Views/Admin/GetPrizes.cshtml

@@ -0,0 +1,484 @@
+@{
+    ViewBag.Title = "Statistics";
+    Layout = "~/Views/Shared/_Layout.cshtml";
+}
+
+@using Newtonsoft.Json;
+@using SuperAdmin.Models;
+@using SuperAdmin.Models.Http;
+@using SuperAdmin.Controllers;
+@using SuperAdmin.Source;
+@using SuperCms.Extensions;
+
+@model AddSourceRes
+
+@{
+    List<prizesData> listPrize = Context.Session.GetComplexData<List<prizesData>>("PrizeData");
+    String urlImail = Context.Session.GetComplexData<String>("urlImail");
+}
+<style>
+    img {
+        max-width: 100%;
+    }
+
+    .input-group.border {
+        border: 1px solid #ced4da; /* Add your desired border styles here */
+        border-radius: 5px; /* Optional: Add border-radius for rounded corners */
+        padding: 5px; /* Optional: Add padding for spacing */
+    }
+
+    #picture {
+        max-width: 100%;
+        max-height: 200px;
+        height: auto;
+        display: block;
+        margin-top: 10px;
+        object-fit: cover;
+    }
+
+    #preview-container {
+        display: flex;
+        flex-wrap: wrap;
+        justify-content: flex-start;
+    }
+
+    .preview-image {
+        width: 100px; /* 100% / 6 - khoảng cách giữa các ảnh (ở đây là 8px) */
+        height: 70px; /* Đặt chiều cao tùy ý */
+        border: 1px solid #ccc;
+        padding: 2px;
+        margin: 2px;
+        object-fit: cover;
+        box-sizing: border-box; /* Đảm bảo rằng padding và border không làm tăng kích thước thực của phần tử */
+    }
+
+    .checkbox-inline {
+        margin-right: 10px;
+    }
+
+        .checkbox-inline input {
+            margin-right: 5px;
+        }
+
+        .checkbox-inline input {
+            /* Add your preferred checkbox styling here */
+        }
+
+        .checkbox-inline::after {
+            content: '\A';
+            white-space: pre;
+        }
+
+    #checkboxPrizes {
+        margin-top: 10px;
+    }
+
+</style>
+<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">Set Prizes</h4>
+                        <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">
+                                    <div class="row">
+                                       
+                                            <div class="col-md-3 col-sm-4 col-6">
+                                                <div class="form-group">
+                                                    <label>Term StoreId</label>
+                                                    <div class='input-group'>
+                                                    <select id="termStoreId" class="form-control">
+                                                    </select>
+                                                    </div>
+                                                </div>
+                                            </div>
+                                        <div class="col-md-3 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>Status</label>
+                                                <div class='input-group'>
+                                                    <select id="status" class="form-control">
+                                                        <option value="">--All--</option>
+                                                        <option value="ACTIVE">ACTIVE</option>
+                                                        <option value="INACTIVE">INACTIVE</option>
+                                                    </select>
+                                                </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-success" onclick="add()" id="btnAdd">
+                                                <i class="icon-plus"></i> Update
+                                            </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" id="mtList">
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </section>
+    <!-- // Basic form layout section end -->
+</div>
+<!-- Modal Edit Form -->
+
+<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">Update Prizes</h4>
+                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+                    <span aria-hidden="true">×</span>
+                </button>
+            </div>
+            <div class="modal-body">
+                <div class="row" id="modalContent">
+                    <div class="col-12 ">
+                        <div class="tab-content">
+                            <div class="row">
+                                <div class="col-md-4 col-sm-4 col-6">
+                                    <div class="form-group">
+                                        <label>TermStoId</label>
+                                        <div class='input-group'>
+                                            <select id="TermId" class="form-control" onchange="onLoadPrizes()">
+                                                <!-- Populate dropdown options dynamically if needed -->
+                                            </select>
+                                        </div>
+                                    </div>
+                                </div>
+                                <div class="col-md-6">
+                                    <div class="form-group">
+                                        <label for="date">Prizes</label>
+                                        <br />
+                                        @if (listPrize != null && listPrize.Any())
+                                        {
+                                            foreach (var prize in listPrize)
+                                            {
+                                                <input type="checkbox" name="prizes" id="prizes-@prize.id" prize-id="@prize.id" title="@prize.name" class="check-role" />
+                                                <label for="prizes-@prize.id">@prize.name</label>
+                                                <br />
+                                            }
+                                        }
+                                    </div>
+                                </div>
+
+                                <div class="col-md-3 col-sm-4 col-6" >
+                                    <button type="button" class="btn btn-primary" onclick="addUpdate()" id="btnUpdate">
+                                        <i class="icon-search"></i> Update
+                                    </button>
+                                    <button type="button" class="btn grey btn-outline-secondary" data-dismiss="modal">Close</button>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+
+@section Scripts {
+
+    <script>
+        $(document).ready(function () {
+            // Ẩn phần tử có id là "paramId"
+            $('#idhi').hide();
+            $('#file_image_source').on('change', function (e) {
+                var files = e.target.files;
+                var fileNames = [];
+
+                $('#preview-container-source').empty();
+                for (var i = 0; i < files.length; i++) {
+                    var fileName = files[i].name;
+                    fileNames.push(fileName);
+
+                    var img = $('<img>').attr({
+                        'src': URL.createObjectURL(files[i]),
+                        'class': 'preview-image'
+                    });
+                    $('#preview-container-source').append(img);
+                }
+
+                //$('#file_name_placeholder').text('Selected Files: ' + fileNames.join(', '));
+            });
+            var urlImail = '@urlImail';
+            loadTermStory();
+        });
+
+        
+        var tableDetail;
+        function resetTableDetail() {
+            tableDetail = $("#grid_detail").DataTable({
+                orderCellsTop: true,
+                fixedHeader: true
+            });
+        }
+
+        function clearTable(table) {
+            if (table != null && table != undefined) {
+                table
+                    .clear()
+                    .destroy();
+            }
+        }
+        resetTableDetail();
+
+        function search() {
+           
+            startSpinner('btnSearch');
+            clearTable(tableDetail);
+            var termStoreId = $("#termStoreId").val();
+            if (termStoreId == 0) {
+                termStoreId = null;
+            }
+            var status = $("#status").val();
+
+            $.ajax({
+                url: urlConfig("/Admin/GetPrizes1"),
+                data: {
+                    termStoreId: termStoreId,
+                    status: status,
+                    pageNumber: 0,
+                    pageSize: 100000
+                },
+                type: "POST",
+                success: function (data) {
+                    stopSpinner('btnSearch');
+                    if (data.error != null) {
+                        Swal.fire('Warning!', data.message, 'warning');
+                        return;
+                    }
+
+                    $("#mtList").html(data);
+                    resetTableDetail();
+                },
+                error: function (data) {
+                    stopSpinner('btnSearch');
+                    
+                }
+            });
+        }
+
+        function loadTermStory() {
+            $.ajax({
+                url: baseUrl("/Admin/loadTermStory"),
+                data: {
+                    predictTermId: null,
+                    termStoreId: null,
+                    status: null,
+                    pageNumber: 0,
+                    pageSize: 100000
+                },
+                type: "POST",
+                success: function (data) {
+                    if (data.error != "0" && data.error != "1") {
+                        showModal('message-dialog');
+                        $('#message-content').html(data.content.split("\n").join("<br />"));
+                    } else {
+                        // add option
+                        $("#termStoreId").html("");
+                        $('#termStoreId').append($('<option>', {
+                            value: "",
+                            text: "-- All --"
+                        }));
+                        $.each(data.data.termStores, function (i, item) {
+                                $('#termStoreId').append($('<option>', {
+                                    value: item.id,
+                                    text: item.name
+                                }));
+
+                        });
+
+                        $("#termStoreId").val($("#termStoreId option:first").val());
+                    }
+                },
+                error: function (data) {
+                    
+                }
+            })
+        }
+        function loadTermStoryAdd() {
+            $.ajax({
+                url: baseUrl("/Admin/loadTermStory"),
+                data: {
+                    predictTermId: null,
+                    termStoreId: null,
+                    status: null,
+                    pageNumber: 0,
+                    pageSize: 100000
+                },
+                type: "POST",
+                success: function (data) {
+                    console.log("data:" + data.data.termStores);
+                    if (data.error != "0" && data.error != "1") {
+                        showModal('message-dialog');
+                        $('#message-content').html(data.content.split("\n").join("<br />"));
+                    } else {
+                        // add option
+                        $("#TermId").html("");
+                        $('#TermId').append($('<option>', {
+                            value: "",
+                            text: "-- All --"
+                        }));
+                        $.each(data.data.termStores, function (i, item) {
+                            $('#TermId').append($('<option>', {
+                                value: item.id,
+                                text: item.name
+                            }));
+
+                        });
+
+                        $("#TermId").val($("#TermId option:first").val());
+                    }
+                },
+                error: function (data) {
+                    
+                }
+            })
+        }
+
+        function add() {
+            
+            loadTermStoryAdd();
+            
+            PrizeBox();
+            showModal("modal-add-service");
+
+        }
+        function PrizeBox() {
+            $.ajax({
+                url: urlConfig("/Admin/PrizeBox"),
+                        data: {
+                           
+                        },
+                        type: "POST",
+                        success: function (data) {
+                            
+                        },
+                        error: function (error) {
+                            console.error('Error fetching checkbox data:', error);
+                        }
+                    });
+                }
+
+        function onLoadPrizes() {
+            var termId = $('#TermId').val(); // Get the selected TermId
+
+            $.ajax({
+                url: urlConfig("/Admin/loadPrizeBox"),
+                data: {
+                    termStoreId: termId, // Pass the selected TermId to the API
+                    status: "ACTIVE",
+                    pageNumber: 0,
+                    pageSize: 100000
+                },
+                type: "POST",
+                success: function (data) {
+                   
+
+                    // Check if data and data.data.termStores exist and is an array
+                    if (data && data.data && Array.isArray(data.data.termStores) && data.data.termStores.length > 0) {
+                        // Uncheck all checkboxes before checking the selected ones
+                        $(".check-role").prop('checked', false);
+
+                        $.each(data.data.termStores, function (i, item) {
+                            let id = item.id;
+                            console.log("id:" + id);
+                            $("#prizes-" + id).prop("checked", true);
+                        });
+                    } else {
+                        console.log("No termStores data or the array is empty.");
+                        // Uncheck all checkboxes if there are no items
+                        $(".check-role").prop('checked', false);
+                    }
+                },
+                error: function (error) {
+                    console.error('Error fetching checkbox data:', error);
+                }
+            });
+        }
+
+
+
+        function addUpdate() {
+            startSpinner('btnUpload');
+            console.log("No termStores data or the array is empty.");
+            var token = $('input[name=__RequestVerificationToken]').val();
+            var formData = new FormData();
+            formData.append('__RequestVerificationToken', token);
+            formData.append('termStoreId', $("#TermId").val());
+            var listPrizes = [];
+            $(".check-role:checked").each(function () {
+                let prizesId = $(this).attr("prize-id");
+                console.log("No termStores data or the array is empty." + prizesId);
+                listPrizes.push(prizesId + "");
+
+            });
+            var index = 0;
+            for (var prizesId of listPrizes) {
+                formData.append("listPrizes[" + index + "]", prizesId);
+                index++;
+            }
+
+            $.ajax({
+                type: "POST",
+                url: urlConfig("/Admin/UpdatePrizes"),
+                headers: { 'RequestVerificationToken': token },
+                data: formData,
+                contentType: false,
+                processData: false,
+                success: function (result) {
+                    stopSpinner("btnUpload");
+                    console.log("result: ");
+                    console.log(result);
+                    if (result.error == '0') {
+                        Swal.fire("Success!", "Success!", "success").
+                            then((result) => {
+                                $(".check-role").prop('checked', false);
+                                hideModal("modal-add-service");
+                                search();
+                            });
+                    } else {
+                        Swal.fire("Failed!", result.content, "error");
+                        //alert('Import failed: ' + result.content);
+                    }
+                },
+                error: function (err) {
+                    stopSpinner("btnUpload");
+                    Swal.fire("Failed!", err.statusText, "error");
+                    //alert(err.statusText);
+                }
+            });
+        }
+
+
+    </script>
+}
+

+ 507 - 0
ReportCMS/ReportCMS/SuperAdmin/Views/Admin/GetSong.cshtml

@@ -0,0 +1,507 @@
+@{
+    ViewBag.Title = "Statistics";
+    Layout = "~/Views/Shared/_Layout.cshtml";
+}
+
+@using Newtonsoft.Json;
+@using SuperAdmin.Models;
+@using SuperAdmin.Models.Http;
+@using SuperAdmin.Controllers;
+@using SuperAdmin.Source;
+@using SuperCms.Extensions;
+
+@model GetSongRes
+
+<style>
+    img {
+        max-width: 100%;
+    }
+</style>
+<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">Songs</h4>
+                        <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">
+                                    <div class="row">
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>Status</label>
+                                                <div class='input-group'>
+                                                    <select id="status" class="form-control">
+                                                        <option value="ACTIVE">ACTIVE</option>
+                                                        <option value="INACTIVE">INACTIVE</option>
+                                                    </select>
+                                                </div>
+                                            </div>
+                                        </div>
+                                        <div class="col-md-4 col-sm-4 col-6">
+                                                <button type="button" class="btn btn-primary" onclick="search()" id="btnSearch">
+                                                    <i class="icon-search"></i> Search
+                                                </button>
+                                            <button type="button" class="btn  btn-add" onclick="add()" id="btnAdd">
+                                                    <i class="icon-plus"></i> Add
+                                                </button>
+                                            <button type="button" class="btn btn-add-music" onclick="addMusic()" id="btnAddMusic">
+                                                    <i class="icon-music"></i> Add Music
+                                                </button>
+
+                                            <button type="button" class="btn  btn-add-image" onclick="addImg()" id="btnAddImage">
+                                                    <i class="icon-image"></i> Add Image
+                                                </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" id="mtList">
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </section>
+    <!-- // Basic form layout section end -->
+</div>
+<!-- Modal Edit Form -->
+
+<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">Update Code Prize</h4>
+                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+                    <span aria-hidden="true">×</span>
+                </button>
+            </div>
+            <div class="modal-body">
+                <div class="row" id="modalContent">
+                    <div class="col-12 ">
+                        <div class="tab-content">
+                            <div class="row">
+                                    <div class="col-md-3 col-sm-4 col-6" id="idhi">
+                                        <div class="form-group">
+                                            <label>ID</label>
+                                            <div class='input-group'>
+                                                <input id="paramId" name="paramId" class="form-control" type="number" disabled />
+                                            </div>
+                                        </div>
+                                    </div>
+                                <div class="col-md-3 col-sm-4 col-6">
+                                    <div class="form-group">
+                                        <label>PredictTermId</label>
+                                        <div class='input-group'>
+                                            <select id="predictTermIdEdit" class="form-control">
+                                            </select>
+                                        </div>
+                                    </div>
+                                </div>
+                                <div class="col-md-3 col-sm-4 col-6">
+                                    <div class="form-group">
+                                        <label>PrizeId</label>
+                                        <div class='input-group'>
+                                            <select id="prizeId" class="form-control">
+                                            </select>
+                                        </div>
+                                    </div>
+                                </div>
+                                <div class="col-md-3 col-sm-4 col-6">
+                                    <div class="form-group">
+                                        <label>Type</label>
+                                        <div class='input-group'>
+                                            <select id="type" class="form-control">
+                                                <option value="POINT">POINT</option>
+                                                <option value="MONEY">MONEY</option>
+                                            </select>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                            <div class="row">
+                               
+                                <div class="col-md-3 col-sm-4 col-6">
+                                    <div class="form-group">
+                                        <label>Value</label>
+                                        <div class='input-group'>
+                                            <input id="value" name="value" class="form-control" />
+                                        </div>
+                                    </div>
+                                </div>
+                                <div class="col-md-3 col-sm-4 col-6">
+                                    <div class="form-group">
+                                        <label>Status</label>
+                                        <div class='input-group'>
+                                            <select id="status" class="form-control">
+                                                <option value="ACTIVE">ACTIVE</option>
+                                                <option value="INACTIVE">INACTIVE</option>
+                                            </select>
+                                            <div class="col-md-3 col-sm-4 col-6" style="margin-top:0rem;display:flex;margin-left:1rem">
+                                                <button type="button" class="btn btn-primary" onclick="update()" id="btnUpdate" >
+                                                    <i class="icon-search"></i> Update
+                                                </button>
+                                                <button type="button" class="btn grey btn-outline-secondary" data-dismiss="modal" style="margin-top:0rem;display:flex;margin-left:1rem">Close</button>
+                                            </div>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                            <div class="row">
+                                <div class="col-md-12">
+                                    
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="modal-footer">
+        </div>
+    </div>
+</div>
+<div class="modal fade text-xs-left" id="modal-add-service1" 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">Upload Excel File</h4>
+                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+                    <span aria-hidden="true">×</span>
+                </button>
+            </div>
+            <div class="modal-body">
+                <div class="row" id="modalContent">
+                    <div class="col-12">
+                        <div class="form-group">
+                            <label for="excelFileUpload">Upload Excel File Songs</label>
+                            <input type="file" id="excelFileUpload" class="form-control" accept=".xlsx, .xls" />
+                        </div>
+                        <div class="form-group">
+                            <button type="button" class="btn btn-primary" onclick="uploadExcelFile()">
+                                <i class="icon-upload"></i> Upload
+                            </button>
+                            <a href="~/wwwroot/temp/file_up_songs_Guess_Song_Natcom_chuan.xlsx" class="btn btn-secondary" download>
+                                <i class="icon-download"></i> Download Sample File
+                            </a>
+                            <button type="button" class="btn grey btn-primary" data-dismiss="modal">
+                                Close
+                            </button>
+                        </div>
+                    </div>
+                </div>
+            </div>
+            <div class="modal-footer1"></div>
+        </div>
+    </div>
+</div>
+
+<div class="modal fade text-xs-left" id="modal-add-service2" 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">Upload File Music</h4>
+                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+                    <span aria-hidden="true">×</span>
+                </button>
+            </div>
+            <div class="modal-body">
+                <div class="row" id="modalContent">
+                    <div class="col-12">
+                        <div class="form-group">
+                            <label for="excelFileUpload">Upload File Music</label>
+                            <input type="file" id="fileInput" class="form-control" multiple />
+                        </div>
+                        <div class="form-group">
+                            <button type="button" class="btn btn-primary" onclick="uploadFiles()">
+                                <i class="icon-upload"></i> Upload
+                            </button>
+                            <button type="button" class="btn grey btn-primary" data-dismiss="modal">
+                                Close
+                            </button>
+                        </div>
+                    </div>
+                </div>
+            </div>
+            <div class="modal-footer1"></div>
+        </div>
+    </div>
+</div>
+
+<div class="modal fade text-xs-left" id="modal-add-service3" 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">Upload File Image</h4>
+                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+                    <span aria-hidden="true">×</span>
+                </button>
+            </div>
+            <div class="modal-body">
+                <div class="row" id="modalContent">
+                    <div class="col-12">
+                        <div class="form-group">
+                            <label for="excelFileUpload">Upload File Image</label>
+                            <input type="file" id="fileInputImg" class="form-control" multiple />
+                        </div>
+                        <div class="form-group">
+                            <button type="button" class="btn btn-primary" onclick="uploadFilesImg()">
+                                <i class="icon-upload"></i> Upload
+                            </button>
+                            <button type="button" class="btn grey btn-primary" data-dismiss="modal">
+                                Close
+                            </button>
+                        </div>
+                    </div>
+                </div>
+            </div>
+            <div class="modal-footer1"></div>
+        </div>
+    </div>
+</div>
+
+@section Scripts {
+
+    <script>
+
+        var tableDetail;
+        var editorQ = {};
+        var editorA = {};
+        var GetCodePrizeData = null;
+        function resetTableDetail() {
+            tableDetail = $("#grid_detail").DataTable({
+                orderCellsTop: true,
+                fixedHeader: true
+            });
+        }
+
+        function clearTable(table) {
+            if (table != null && table != undefined) {
+                table
+                    .clear()
+                    .destroy();
+            }
+        }
+        resetTableDetail();
+
+        function search() {
+           
+            startSpinner('btnSearch');
+            clearTable(tableDetail);
+            var mstatus = $("#status").val().trim();
+            if (!status) {
+                status = "ACTIVE"; 
+            }
+            $.ajax({
+                url: urlConfig("/Admin/GetSongSearch1"),
+                data: {
+                    status: mstatus,
+                    pageNumber: 0,
+                    pageSize: 100000
+                },
+                type: "POST",
+                success: function (data) {
+                    stopSpinner('btnSearch');
+                    if (data.error != null) {
+                        Swal.fire('Warning!', data.message, 'warning');
+                        return;
+                    }
+
+                    $("#mtList").html(data);
+                    resetTableDetail();
+                },
+                error: function (data) {
+                    stopSpinner('btnSearch');
+                    
+                }
+            })
+        }
+
+        function edit(id, predictTermId, prizeId, type, value, status, predictTermType) {
+           
+            $("#btnAddUpdate").html("Update");
+            $("#paramId").val(id);
+            loadPredictTermId(predictTermType, predictTermId);
+            loadMonthlyPrize(prizeId);
+            $("#type").val(type);
+            $("#value").val(value);
+            $("#status").val(status);
+            showModal("modal-add-service");
+               
+            }
+        function add() {
+            
+            showModal("modal-add-service1");
+        }
+        function addMusic() {
+            
+            showModal("modal-add-service2");
+        }
+        function addImg() {
+            
+            showModal("modal-add-service3");
+        }
+
+
+        function uploadExcelFile() {
+            
+            startSpinner('btnAdd');
+
+            // Lấy file từ input
+            const fileInput = document.getElementById('excelFileUpload'); // Đảm bảo `excelFileUpload` là id của input file
+            const file = fileInput.files[0]; // Lấy file đầu tiên trong danh sách
+
+            if (!file) {
+                Swal.fire('Warning!', 'Please select a file to upload!', 'warning');
+                stopSpinner('btnAdd');
+                return;
+            }
+
+            // Tạo FormData để gửi file
+            const formData = new FormData();
+            formData.append('file', file); // Thêm file vào FormData
+            formData.append('__RequestVerificationToken', $('input[name=__RequestVerificationToken]').val()); // Token CSRF nếu cần
+
+            $.ajax({
+                type: "POST",
+                url: baseUrl("/Admin/AddSong"), // URL API xử lý upload file
+                data: formData,
+                processData: false, // Không xử lý dữ liệu (do dùng FormData)
+                contentType: false, // Không thiết lập Content-Type mặc định (do FormData tự làm)
+                headers: {
+                    'Accept': 'application/json' // Định dạng mong muốn của response
+                },
+                success: function (data) {
+                    stopSpinner('btnAdd');
+                    if (data.error != null) {
+                        Swal.fire('Warning!', data.message, 'warning');
+                        return;
+                    }
+                    Swal.fire('Success!', 'File uploaded successfully!', 'success');
+                    search(); // Thực hiện reload hoặc cập nhật dữ liệu
+                },
+                error: function (data) {
+                    stopSpinner('btnAdd');
+                    
+                    Swal.fire('Error!', 'An error occurred during the upload process.', 'error');
+                }
+            });
+        }
+
+        function uploadFiles() {
+            var files = document.getElementById('fileInput').files;
+            if (files.length === 0) {
+                Swal.fire('Warning!', 'Please select files to upload.', 'warning');
+                return;
+            }
+
+            var formData = new FormData();
+            Array.from(files).forEach(file => formData.append('files', file));
+
+            $.ajax({
+                url: '/Admin/UploadFile', 
+                type: 'POST',
+                data: formData,
+                processData: false,  
+                contentType: false, 
+                success: function (response) {
+                    Swal.fire('Success!', 'Files uploaded successfully.', 'success');
+                },
+                error: function (error) {
+                    Swal.fire('Error!', 'An error occurred while uploading.', 'error');
+                }
+            });
+        }
+
+
+        function uploadFilesImg() {
+            var files = document.getElementById('fileInputImg').files;
+            if (files.length === 0) {
+                Swal.fire('Warning!', 'Please select files to upload.', 'warning');
+                return;
+            }
+
+            var formData = new FormData();
+            Array.from(files).forEach(file => formData.append('files', file));
+
+            $.ajax({
+                url: '/Admin/UploadFile',
+                type: 'POST',
+                data: formData,
+                processData: false,
+                contentType: false,
+                success: function (response) {
+                    Swal.fire('Success!', 'Files uploaded successfully.', 'success');
+                },
+                error: function (error) {
+                    Swal.fire('Error!', 'An error occurred while uploading.', 'error');
+                }
+            });
+        }
+
+        function deleteSong(songId) {
+            console.log("Deleting song with ID: " + songId);
+            startSpinner('btnDelete'); 
+            $.ajax({
+                url: urlConfig("/Admin/DeleteSong"), 
+                type: "POST",
+                data: { id: songId },
+                success: function (data) {
+                    stopSpinner('btnDelete');
+                    console.log("data: " + data);
+                    if (data.success) {
+                        Swal.fire('Deleted!', 'The song has been deleted successfully.', 'success');
+                        $(`#gridbody_detail tr[data-song-id="${songId}"]`).remove();
+                        search();
+                    } else {
+                        Swal.fire('Error!', data.message || 'Unable to delete the song.', 'error');
+                    }
+                },
+                error: function (xhr) {
+                    stopSpinner('btnDelete'); // Stop spinner on error
+                    Swal.fire('Error!', 'An error occurred while deleting the song.', 'error');
+                    console.error(xhr.responseText);
+                }
+            });
+        }
+        getQuestionsGroup();
+        function getQuestionsGroup() {
+            $.ajax({
+                url: baseUrl("/Admin/GetQuestionsGroup"),
+                data: {
+                    pageNumber: 0,
+                    pageSize: 100000
+                },
+                type: "POST",
+                success: function (data) {
+                    
+                },
+                error: function (data) {
+                    
+                }
+            })
+        }
+
+    </script>
+}
+

+ 680 - 0
ReportCMS/ReportCMS/SuperAdmin/Views/Admin/GetSource.cshtml

@@ -0,0 +1,680 @@
+@{
+    ViewBag.Title = "Statistics";
+    Layout = "~/Views/Shared/_Layout.cshtml";
+}
+
+@using Newtonsoft.Json;
+@using SuperAdmin.Models;
+@using SuperAdmin.Models.Http;
+@using SuperAdmin.Controllers;
+@using SuperAdmin.Source;
+@using SuperCms.Extensions;
+
+@model AddSourceRes
+
+@{
+    String urlImail = Context.Session.GetComplexData<String>("urlImail");
+}
+<style>
+    img {
+        max-width: 100%;
+    }
+
+    .input-group.border {
+        border: 1px solid #ced4da; /* Add your desired border styles here */
+        border-radius: 5px; /* Optional: Add border-radius for rounded corners */
+        padding: 5px; /* Optional: Add padding for spacing */
+    }
+
+    #picture {
+        max-width: 100%;
+        max-height: 200px;
+        height: auto;
+        display: block;
+        margin-top: 10px;
+        object-fit: cover;
+    }
+
+    #preview-container {
+        display: flex;
+        flex-wrap: wrap;
+        justify-content: flex-start;
+    }
+
+    .preview-image {
+        width: 100px; /* 100% / 6 - khoảng cách giữa các ảnh (ở đây là 8px) */
+        height: 70px; /* Đặt chiều cao tùy ý */
+        border: 1px solid #ccc;
+        padding: 2px;
+        margin: 2px;
+        object-fit: cover;
+        box-sizing: border-box; /* Đảm bảo rằng padding và border không làm tăng kích thước thực của phần tử */
+    }
+
+
+</style>
+<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">Set Source</h4>
+                        <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">
+                                    <div class="row">
+                                            <div class="col-md-3 col-sm-4 col-6">
+                                                <div class="form-group">
+                                                    <label>Term StoreId</label>
+                                                    <div class='input-group'>
+                                                    <select id="termStoreId" class="form-control">
+                                                    </select>
+                                                    </div>
+                                                </div>
+                                            </div>
+                                        <div class="col-md-3 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>Status</label>
+                                                <div class='input-group'>
+                                                    <select id="status" class="form-control">
+                                                        <option value="">--All--</option>
+                                                        <option value="ACTIVE">ACTIVE</option>
+                                                        <option value="INACTIVE">INACTIVE</option>
+                                                    </select>
+                                                </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-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" id="mtList">
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </section>
+    <!-- // Basic form layout section end -->
+</div>
+<!-- Modal Edit Form -->
+
+<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">Update Source</h4>
+                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+                    <span aria-hidden="true">×</span>
+                </button>
+            </div>
+            <div class="modal-body">
+                <div class="row" id="modalContent">
+                    <div class="col-12 ">
+                        <div class="tab-content">
+                            <div class="row">
+                                <div class="col-md-3 col-sm-4 col-6" id="idhi">
+                                    <div class="form-group">
+                                        <label>ID</label>
+                                        <div class='input-group'>
+                                            <input id="paramId" name="paramId" class="form-control" type="number" disabled />
+                                        </div>
+                                    </div>
+                                </div>
+                                @*<div class="col-md-3 col-sm-4 col-6">
+                                    <div class="form-group">
+                                        <label>Name Souce</label>
+                                        <div class='input-group'>
+                                            <input id="nameSouceEdit" name="nameSouceEdit" class="form-control" />
+                                        </div>
+                                    </div>
+                                </div>*@
+                                <div class="col-md-3 col-sm-4 col-6">
+                                    <div class="form-group">
+                                        <label>Description Souce</label>
+                                        <div class='input-group'>
+                                            <input id="descriptionSouceEdit" name="descriptionSouceEdit" class="form-control" />
+                                        </div>
+                                    </div>
+                                </div>
+                                 <div class="col-md-3 col-sm-4 col-6">
+                                    <div class="form-group">
+                                        <label>Type Souce</label>
+                                        <div class='input-group'>
+                                            <input id="typeSouceEdit" name="typeSouceEdit" class="form-control" value="IMAGE" disabled />
+                                        </div>
+                                    </div>
+                                </div>
+                                <div class="col-md-3 col-sm-4 col-6">
+                                    <div class="form-group">
+                                        <label>Priority Souce</label>
+                                        <div class='input-group'>
+                                            <input id="prioritySouceEdit" name="prioritySouceEdit" class="form-control" type="number" />
+                                        </div>
+                                    </div>
+                                </div>
+                               
+                                <div class="col-md-3 col-sm-4 col-6">
+                                    <div class="form-group">
+                                        <label>Status Souce</label>
+                                        <div class='input-group'>
+                                            <select id="statusSouceEdit" class="form-control">
+                                                <option value="ACTIVE">ACTIVE</option>
+                                                <option value="INACTIVE">INACTIVE</option>
+                                            </select>
+                                        </div>
+                                    </div>
+                                </div>
+                                <div class="col-md-3 col-sm-4 col-6">
+                                    <div class="form-group">
+                                        <label>Picture</label>
+                                        <div class='input-group'>
+                                            <input class="form-control" type="file" id="file_image_add" name="file_image_add" accept="image/png, image/gif, image/jpeg, image/jpg" >
+                                            <div id="preview-container-source">
+                                                <img id="image_preview" src="" alt="Image Preview">
+                                            </div>
+                                        </div>
+                                        <span id="file_name_placeholder"></span>
+                                    </div>
+                                </div>
+                                <div class="col-md-3 col-sm-4 col-6" >
+                                    <button type="button" class="btn btn-primary" onclick="update()" id="btnUpdate">
+                                        <i class="icon-search"></i> Update
+                                    </button>
+                                    <button type="button" class="btn grey btn-outline-secondary" data-dismiss="modal">Close</button>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+<div class="modal fade text-xs-left" id="modal-add-service1" 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">ADD Source</h4>
+                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+                    <span aria-hidden="true">×</span>
+                </button>
+            </div>
+            <div class="modal-body">
+                <div class="row" id="modalContent">
+                    <div class="col-12 ">
+                        <div class="row" id="modalContent">
+                            <div class="col-12 ">
+                                <h4 class="modal-title">ADD Souce</h4>
+                                <div class="tab-content">
+                                    <div class="row">
+                                        @*<div class="col-md-3 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>Name Souce</label>
+                                                <div class='input-group'>
+                                                    <input id="nameSouceAdd" name="nameSouce" class="form-control" />
+                                                </div>
+                                            </div>
+                                        </div>
+                                        <div class="col-md-3 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>Description Souce</label>
+                                                <div class='input-group'>
+                                                    <input id="descriptionSouceAdd" name="descriptionSouceAdd" class="form-control" />
+                                                </div>
+                                            </div>
+                                        </div>*@
+                                        <div class="col-md-3 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>Type Souce</label>
+                                                <div class='input-group'>
+                                                    <input id="typeSouceAdd" name="typeSouceAdd" class="form-control" value="IMAGE" disabled />
+                                                </div>
+                                            </div>
+                                        </div>
+                                        <div class="col-md-3 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>Status Souce</label>
+                                                <div class='input-group'>
+                                                    <select id="statusSouceAdd" class="form-control">
+                                                        <option value="ACTIVE">ACTIVE</option>
+                                                        <option value="INACTIVE">INACTIVE</option>
+                                                    </select>
+                                                </div>
+                                            </div>
+                                        </div>
+                                    </div>
+                                    <div class="row">
+                                        <div class="col-md-3 col-sm-4 col-6">
+                                            <div class="form-group">
+                                                <label>Picture</label>
+                                                <div class='input-group'>
+                                                    <input class="form-control" type="file" id="file_image_source" name="file_image_source" accept="image/png, image/gif, image/jpeg, image/jpg" multiple>
+                                                    <div id="preview-container-source"></div>
+                                                </div>
+                                                <span id="file_name_placeholder"></span>
+                                            </div>
+                                        </div>
+                                        <div class="col-md-3 col-sm-4 col-6" >
+                                            <button type="button" class="btn btn-primary" onclick="btnAdd()" id="btnAdd">
+                                                <i class="icon-search"></i> ADD
+                                            </button>
+                                            <button type="button" class="btn grey btn-outline-secondary" data-dismiss="modal">Close</button>
+                                        </div>
+                                    </div>
+
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+
+    </div>
+</div>
+
+@section Scripts {
+
+    <script>
+        $(document).ready(function () {
+            // Ẩn phần tử có id là "paramId"
+            $('#idhi').hide();
+            $('#file_image_source').on('change', function (e) {
+                var files = e.target.files;
+                var fileNames = [];
+
+                $('#preview-container-source').empty();
+                for (var i = 0; i < files.length; i++) {
+                    var fileName = files[i].name;
+                    fileNames.push(fileName);
+
+                    var img = $('<img>').attr({
+                        'src': URL.createObjectURL(files[i]),
+                        'class': 'preview-image'
+                    });
+                    $('#preview-container-source').append(img);
+                }
+
+                //$('#file_name_placeholder').text('Selected Files: ' + fileNames.join(', '));
+            });
+            var urlImail = '@urlImail';
+             loadPredictTermIdForType();
+            loadTermStory();
+        });
+
+        
+        var tableDetail;
+        function resetTableDetail() {
+            tableDetail = $("#grid_detail").DataTable({
+                orderCellsTop: true,
+                fixedHeader: true
+            });
+        }
+
+        function clearTable(table) {
+            if (table != null && table != undefined) {
+                table
+                    .clear()
+                    .destroy();
+            }
+        }
+        resetTableDetail();
+
+        function search() {
+           
+            startSpinner('btnSearch');
+            clearTable(tableDetail);
+            $.ajax({
+                url: urlConfig("/Admin/GetSource1"),
+                data: {
+                    //predictTermId: $("#predictTermId").val().trim(),
+                    termStoreId: $("#termStoreId").val().trim(),
+                    status: $("#status").val().trim(),
+                    pageNumber: 0,
+                    pageSize: 100000
+                },
+                type: "POST",
+                success: function (data) {
+                    stopSpinner('btnSearch');
+                    if (data.error != null) {
+                        Swal.fire('Warning!', data.message, 'warning');
+                        return;
+                    }
+
+                    $("#mtList").html(data);
+                    resetTableDetail();
+                },
+                error: function (data) {
+                    stopSpinner('btnSearch');
+                    
+                }
+            })
+        }
+        function loadTermStory() {
+            $.ajax({
+                url: baseUrl("/Admin/loadTermStory"),
+                data: {
+                    predictTermId: null,
+                    termStoreId: null,
+                    status: null,
+                    pageNumber: 0,
+                    pageSize: 100000
+                },
+                type: "POST",
+                success: function (data) {
+                    console.log("data:" + data.data.termStores);
+                    if (data.error != "0" && data.error != "1") {
+                        showModal('message-dialog');
+                        $('#message-content').html(data.content.split("\n").join("<br />"));
+                    } else {
+                        // add option
+                        $("#termStoreId").html("");
+                        //$('#termStoreId').append($('<option>', {
+                        //    value: "",
+                        //    text: "-- All --"
+                        //}));
+                        $.each(data.data.termStores, function (i, item) {
+                                $('#termStoreId').append($('<option>', {
+                                    value: item.id,
+                                    text: item.name
+                                }));
+
+                        });
+
+                        $("#termStoreId").val($("#termStoreId option:first").val());
+                    }
+                },
+                error: function (data) {
+                    
+                }
+            })
+        }
+        function convertTo24HourFormat(time12h) {
+            //console.log("time12h:" + time12h);
+            var [time, modifier] = time12h.split(' ');
+            
+            var [hours, minutes] = time.split(':');
+
+            if (hours === '12') {
+                hours = '00';
+            }
+
+            if (modifier === 'PM') {
+                hours = String(parseInt(hours, 10) + 12);
+            }
+
+            return hours + ':' + minutes + ':00';
+        }
+
+        function edit(id, name, description, priority, picture,type, status) {
+            clearImage();
+            $("#btnUpdate").html("Update");
+            $("#paramId").val(id);
+            $("#nameSouceEdit").val(name);
+            $("#descriptionSouceEdit").val(description);
+            $("#prioritySouceEdit").val(priority);
+            $("#statusSouceEdit").val(status);
+            $("#typeSouceEdit").val(type);
+            $("#image_preview").attr("src", picture);
+
+            showModal("modal-add-service");
+               
+            }
+        function add() {
+            
+            clearImage();
+            showModal("modal-add-service1");
+
+        }
+        function loadPredictTermIdForType(){
+            var type = $("#type").val();
+            $.ajax({
+                url: baseUrl("/Admin/loadPredictTermId"),
+                data: {
+                    type: "MONTHLY"
+                },
+                type: "POST",
+                success: function (data) {
+                    if (data.error != "0" && data.error != "1") {
+                        showModal('message-dialog');
+                        $('#message-content').html(data.content.split("\n").join("<br />"));
+                    } else {
+                        // add option
+                        $("#predictTermId").html("");
+
+                            $.each(data.data.predictTerms, function (i, item) {
+                                if (item.status === "OPENING") {
+                                    $('#predictTermId').append($('<option>', {
+                                        value: item.id,
+                                        text: item.name
+                                    }));
+                                }
+
+                            });
+                       
+                        $("#predictTermId").val($("#predictTermId option:first").val());
+                    }
+                },
+                error: function (data) {
+                    
+                }
+            })
+        }
+        function clearImage() {
+            $("input[name='file_image_source']").val("");
+            $("img[name='display_image']").removeAttr("src");
+        }
+        function update() {
+            console.log("update data");
+            var urlImail = '@urlImail';
+            startSpinner('btnUpdate');
+            var fileName = $("#file_image_add").val().split('\\').pop().split('/').pop();
+            //var link = urlImail+"/assets/images/predict_sources/" + fileName;
+            var link = fileName;
+            if (fileName == null || fileName == "") {
+                link = $("#image_preview").attr("src");
+            }
+
+            var sourcessss = [];
+            //var name = $("#nameSouceEdit").val();
+            var description = $("#descriptionSouceEdit").val();
+            var priority = parseInt($("#prioritySouceEdit").val(), 10);
+            var status = $("#statusSouceEdit").val();
+            var type = $("#typeSouceEdit").val();
+            var idsss = parseInt($("#paramId").val(), 10);
+            var termStoreId = parseInt($("#termStoreId").val(), 10);
+
+            for (var i = 0; i < 1; i++) {
+                var source = {
+                    id: idsss,
+                    name: link,
+                    description: description,
+                    priority: priority,
+                    type: type,
+                    status: status,
+                    picture: link
+                };
+                sourcessss.push(source);
+            }
+
+            var AddSourceReq = {
+                sources: sourcessss,
+                termStoreId: termStoreId
+            };
+            console.log("fileName:" + JSON.stringify(AddSourceReq));
+            $.ajax({
+                type: "POST",
+                data: JSON.stringify(AddSourceReq),
+                url: baseUrl("/Admin/UpdateSource1"),
+                contentType: "application/json",
+                headers: {
+                    'RequestVerificationToken': $('input[name=__RequestVerificationToken]').val(),
+                    'Accept': 'application/json'
+                },
+                success: function (data) {
+                    stopSpinner('btnAdd');
+                    if (data.error != null) {
+                        Swal.fire('Warning!', data.message, 'warning');
+                        stopSpinner('btnUpdate');
+                        return;
+                    }
+                    Swal.fire('Success!', 'Operation completed successfully!', 'success');
+                    updateImg("update_img");
+                    search();
+                    $('#modal-add-service').modal('hide');
+                    stopSpinner('btnUpdate');
+                },
+                error: function (data) {
+                    stopSpinner('btnUpdate');
+                   
+                }
+            });
+           
+
+        }
+        function updateImg(type) {
+            // lưu ảnh
+            var fileInputSource = null;
+            var filesSource = [];
+
+            if (type === "update_img") {
+                fileInputSource = $('#file_image_add')[0];
+                filesSource = fileInputSource.files;
+            } else if (type === "add_img") {
+                fileInputSource = $("#file_image_source")[0];
+                filesSource = fileInputSource.files;
+            }
+
+
+            if ( filesSource.length > 0) {
+                var formData = new FormData();
+
+                // Append each file to the FormData object
+                for (var i = 0; i < filesSource.length; i++) {
+                    formData.append('filesSource', filesSource[i]);
+                }
+
+                $.ajax({
+                    url: '/Admin/UploadImages',  // Replace with your actual API endpoint
+                    type: 'POST',
+                    data: formData,
+                    processData: false,
+                    contentType: false,
+                    success: function (data) {
+                        //console.log('Files uploaded successfully:', data.filePaths);
+                        // Handle the file paths as needed (e.g., display them on the page or perform further actions)
+                    },
+                    error: function (error) {
+                        console.error('Error during file upload:', error.responseText);
+                        // Handle the error as needed
+                    }
+                });
+            } else {
+                console.error('No files selected.');
+            }
+        }
+
+        function btnAdd() {
+            
+            var urlImail = '@urlImail';
+            startSpinner('btnAdd');
+                    
+                    var sources = [];
+                    var name = $("#nameSouceAdd").val();
+                    var description = $("#descriptionSouceAdd").val();
+                    var type = "IMAGE";
+                    var status = $("#statusSouceAdd").val();
+                    var files = $("#file_image_source")[0].files;
+                    var pictureArray = [];
+                    var termStoreId = parseInt($("#termStoreId").val(), 10);
+                   
+
+                    for (var i = 0; i < files.length; i++) {
+                        //var fileName = urlImail+"/assets/images/predict_sources/" + files[i].name;
+                        var fileName = files[i].name;
+                        pictureArray.push(fileName);
+                    }
+
+                    for (var i = 0; i < pictureArray.length; i++) {
+                        var pictureName = pictureArray[i].trim();
+                        var nameFile = pictureName;
+                        //if (pictureName.startsWith(urlImail+"/assets/images/predict_sources/")) {
+                        //     nameFile = pictureName.slice((urlImail+"/assets/images/predict_sources/").length);
+                        //}
+                        var source = {
+                            name: nameFile,
+                            description: description,
+                            priority: 1,
+                            type: type,
+                            status: status,
+                            picture: pictureName
+                        };
+                        sources.push(source);
+                    }
+
+                    var addSourceReq = {
+                        termStoreId: termStoreId,
+                        sources: sources
+                    };
+                    console.log("fileName:" + JSON.stringify(addSourceReq));
+                    $.ajax({
+                        type: "POST",
+                        data: JSON.stringify(addSourceReq),
+                        url: baseUrl("/Admin/AddSource1"),
+                        contentType: 'application/json',
+                        headers: {
+                            'RequestVerificationToken': $('input[name=__RequestVerificationToken]').val(),
+                            'Accept': 'application/json'
+                        },
+                        success: function (data) {
+                            if (data.error != null) {
+                                Swal.fire('Warning!', data.message, 'warning');
+                                stopSpinner('btnAdd');
+                                return;
+                            }
+                            Swal.fire('Success!', 'Operation completed successfully!', 'success');
+                            updateImg("add_img");
+                            search();
+                            $('#modal-add-service1').modal('hide');
+                            stopSpinner('btnAdd');
+                        },
+                        error: function (data) {
+                            stopSpinner('btnAdd');
+                           
+                        }
+                    });
+        }
+
+
+    </script>
+}
+

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

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

+ 212 - 0
ReportCMS/ReportCMS/SuperAdmin/Views/Admin/SetCodePrizeForUser.cshtml

@@ -0,0 +1,212 @@
+@{
+    ViewBag.Title = "Statistics";
+    Layout = "~/Views/Shared/_Layout.cshtml";
+}
+
+@using SuperAdmin.Models;
+@using SuperAdmin.Models.Http;
+@using SuperAdmin.Controllers;
+@using SuperAdmin.Source;
+
+@model WinnerRes
+@{
+
+}
+
+<style>
+    img {
+        max-width: 100%;
+    }
+</style>
+<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">Set Code Prize For User</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">
+                                    <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>Code</label>
+                                                <div class='input-group'>
+                                                    <input type="text" class="form-control" id="code" name="code">
+                                                </div>
+                                            </div>
+                                        </div>
+                                        <div class="col-md-4 col-sm-4 col-6 " >
+                                            <button type="button" class="btn btn-primary" onclick="search()" id="btnSearch">
+                                                <i class="icon-search"></i> Set Code
+                                            </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="tradeList">
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+        </div>
+    </section>
+    <!-- // Basic form layout section end -->
+</div>
+
+@section Scripts {
+    <script>
+
+        var tableDetail;
+
+        var tableLog;
+
+        $(document).ready(function () {
+
+            $(".fromDate").datetimepicker({
+                format: "YYYY-MM-DD",
+                defaultDate: moment().add(-30, 'days')
+            });
+
+            $(".toDate").datetimepicker({
+                format: "YYYY-MM-DD",
+                defaultDate: moment().endOf('day')
+            });
+
+
+        });
+       
+        function search() {
+            console.log("Search data");
+            startSpinner('btnSearch');
+
+            var msisdn = $("#msisdn").val().trim();
+            var code = $("#code").val().trim();
+            var url = "/Admin/SetCodePrizeForUserSearch1";
+
+            $.ajax({
+                url: urlConfig(url),
+                data: {
+                    msisdn: $("#msisdn").val().trim(),
+                    code: $("#code").val().trim(),
+                },
+                type: "POST",
+                headers: {
+                    'RequestVerificationToken': $('input[name=__RequestVerificationToken]').val(),
+                    'Accept': 'application/json'
+                },
+                success: function (data) {
+                    stopSpinner('btnSearch');
+                    if (data.error != null) {
+                        Swal.fire('Warning!', data.message, 'warning');
+                        return;
+                    }
+                    Swal.fire('Success!', 'Operation completed successfully!', 'success');
+                },
+                error: function (data) {
+                    stopSpinner('btnSearch');
+                    console.log(data);
+                }
+            })
+        }
+
+
+        function ViewDetail(transactionId) {
+            searchLog(transactionId);
+            showModal("modal-detail");
+        }
+
+        function exportExcel() {
+            console.log("Export data");
+            startSpinner('btnExportExcel');
+            var msisdn = $("#msisdn").val().trim();
+            var url = "/Config/WinnerExport1";
+
+            $.ajax({
+                url: urlConfig(url),
+                data: {
+                    msisdn: $("#msisdn").val(),
+                    fromTime: $("#fromDate").val(),
+                    toTime: $("#toDate").val(),
+                    type: $("#type").val(),
+                    pageNumber: 0,
+                    pageSize: 100000
+                },
+                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');
+                    if (data.error != null) {
+                        Swal.fire('Warning!', data.message, 'warning');
+                        return;
+                    }
+
+                    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>
+}
+

Niektoré súbory nie sú zobrazené, pretože je v týchto rozdielových dátach zmenené mnoho súborov