AdminController.cs 72 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775
  1. using ClosedXML.Excel;
  2. using DocumentFormat.OpenXml.Drawing.Spreadsheet;
  3. using DocumentFormat.OpenXml.Spreadsheet;
  4. using Microsoft.AspNetCore.Hosting;
  5. using Microsoft.AspNetCore.Http;
  6. using Microsoft.AspNetCore.Mvc;
  7. using Microsoft.Extensions.Configuration;
  8. using OfficeOpenXml;
  9. using SuperAdmin.Models.Http;
  10. using SuperAdmin.Models.Object;
  11. using SuperAdmin.Source;
  12. using SuperCms.Extensions;
  13. using System;
  14. using System.Collections.Generic;
  15. using System.IO;
  16. using System.Linq;
  17. using System.Threading.Tasks;
  18. namespace SuperAdmin.Controllers
  19. {
  20. public class AdminController : BaseController
  21. {
  22. private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(Program));
  23. public AdminController(IConfiguration _configuration, IWebHostEnvironment hostEnvironment) : base(_configuration, hostEnvironment)
  24. {
  25. // init
  26. }
  27. public IActionResult Index(String fromDate, String toDate)
  28. {
  29. try
  30. {
  31. if (!CheckAuthToken())
  32. {
  33. //return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
  34. UserRoles vsa = HttpContext.Session.GetComplexData<UserRoles>("userInfo");
  35. //var listMenu = new List<String>();
  36. if (vsa != null && vsa.function != null)
  37. {
  38. var listObj = vsa.function;
  39. foreach (Function obj in listObj)
  40. {
  41. return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + obj.link);
  42. }
  43. }
  44. return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
  45. }
  46. fromDate = fromDate ?? DateTime.Now.AddDays(-15).ToString("dd/MM/yyyy");
  47. toDate = toDate ?? DateTime.Now.ToString("dd/MM/yyyy");
  48. //DashboardModel model = LoadDashboard(fromDate, toDate);
  49. //model.fromDate = fromDate;
  50. //model.toDate = toDate;
  51. return View();
  52. }
  53. catch (Exception ex)
  54. {
  55. log.Error("Error admin index: " + ex.Message, ex);
  56. return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
  57. }
  58. }
  59. // RESULT LUCKY_POWER UPDATE
  60. public IActionResult Results()
  61. {
  62. if (!CheckAuthToken())
  63. {
  64. return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
  65. }
  66. return View();
  67. }
  68. [HttpPost]
  69. public JsonResult ResultsGetById(string id)
  70. {
  71. if (!CheckAuthToken())
  72. {
  73. return Json(new
  74. {
  75. error = "-1",
  76. content = "Login first"
  77. });
  78. }
  79. //ExportGetListRes res = HttpContext.Session.GetComplexData<ExportGetListRes>("ExportGetListRes");
  80. TermGetListReq req = new TermGetListReq();
  81. req.rowsOnPage = "1";
  82. req.seqPage = "1";
  83. req.id = id;
  84. req.gameId = "-2";
  85. string result = SendPost(req, GetParameter(LumilotoUtils.WsType.TermResult));
  86. TermGetListRes res = TermGetListRes.Parse(result);
  87. if (res != null && res.listTerm != null)
  88. {
  89. return Json(new
  90. {
  91. error = "0",
  92. data = res.listTerm[0]
  93. });
  94. }
  95. return Json(new
  96. {
  97. error = "1",
  98. content = "Not found"
  99. });
  100. }
  101. [HttpPost]
  102. public JsonResult ResultsGet(TermGetListReq req)
  103. {
  104. if (!CheckAuthToken())
  105. {
  106. return Json(new
  107. {
  108. error = "-1",
  109. content = "Login first"
  110. });
  111. }
  112. //string account = HttpContext.Session.GetString("account");
  113. //req.usersName = account;
  114. req.rowsOnPage = "1000000";
  115. req.seqPage = "1";
  116. req.order = "desc";
  117. //req.type = "1"; // already result
  118. String url = GetParameter(LumilotoUtils.WsType.TermResult);
  119. string result = SendPost(req, url);
  120. TermGetListRes res = TermGetListRes.Parse(result);
  121. //HttpContext.Session.SetComplexData("ExportGetListRes", res);
  122. return Json(new
  123. {
  124. error = res.responseCode,
  125. content = res.responseMessage,
  126. data = res
  127. });
  128. }
  129. [HttpPost]
  130. public IActionResult ResultsSearch(TermGetListReq req)
  131. {
  132. if (!CheckAuthToken())
  133. {
  134. return Json(new
  135. {
  136. error = "-1",
  137. content = "Login first"
  138. });
  139. }
  140. //string account = HttpContext.Session.GetString("account");
  141. //req.usersName = account;
  142. req.rowsOnPage = "1000000";
  143. req.seqPage = "1";
  144. req.order = "desc";
  145. //req.type = "1"; // already result
  146. String url = GetParameter(LumilotoUtils.WsType.TermResult);
  147. string result = SendPost(req, url);
  148. TermGetListRes res = TermGetListRes.Parse(result);
  149. //HttpContext.Session.SetComplexData("ExportGetListRes", res);
  150. return PartialView("./_Result", res);
  151. }
  152. [HttpPost]
  153. public JsonResult ResultsAddUpdate(ResultsUpdateReq req)
  154. {
  155. if (!CheckAuthToken())
  156. {
  157. return Json(new
  158. {
  159. error = "-1",
  160. content = "Login first"
  161. });
  162. }
  163. string account = HttpContext.Session.GetString("account");
  164. req.users = account;
  165. String formatedRs = "";
  166. // format number
  167. //if (!validPowerResult(req.result, out formatedRs))
  168. //{
  169. // return Json(new
  170. // {
  171. // error = "2",
  172. // content = "Wrong input"
  173. // });
  174. //}
  175. //req.result = formatedRs;
  176. string result = SendPost(req, GetParameter(LumilotoUtils.WsType.LkpwResultUpdate));
  177. CommonRes res = CommonRes.Parse(result);
  178. return Json(new
  179. {
  180. error = res.responseCode,
  181. content = res.responseMessage
  182. });
  183. }
  184. [HttpPost]
  185. public JsonResult ResultsUpdateStatus(ResultsUpdateReq req)
  186. {
  187. if (!CheckAuthToken())
  188. {
  189. return Json(new
  190. {
  191. error = "-1",
  192. content = "Login first"
  193. });
  194. }
  195. string account = HttpContext.Session.GetString("account");
  196. req.users = account;
  197. string result = SendPost(req, GetParameter(LumilotoUtils.WsType.LkpwResultUpdate));
  198. CommonRes res = CommonRes.Parse(result);
  199. return Json(new
  200. {
  201. error = res.responseCode,
  202. content = res.responseMessage
  203. });
  204. }
  205. [HttpPost]
  206. public IActionResult ResultsExport(TermGetListReq req)
  207. {
  208. if (!CheckAuthToken())
  209. {
  210. return null;
  211. }
  212. ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
  213. req.rowsOnPage = "1000000";
  214. req.seqPage = "1";
  215. req.order = "desc";
  216. req.type = "1"; // already result
  217. String url = GetParameter(LumilotoUtils.WsType.TermResult);
  218. string result = SendPost(req, url);
  219. TermGetListRes res = TermGetListRes.Parse(result);
  220. List<Term> list = res.listTerm;
  221. string contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
  222. string fileName = "results.xlsx";
  223. try
  224. {
  225. using (var workbook = new XLWorkbook())
  226. {
  227. int i = 1;
  228. IXLWorksheet worksheet = workbook.Worksheets.Add("Statistics");
  229. worksheet.Column(i).Width = 15;
  230. worksheet.Cell(1, i++).Value = "No.";
  231. worksheet.Column(i).Width = 15;
  232. worksheet.Cell(1, i++).Value = "Game";
  233. worksheet.Column(i).Width = 20;
  234. worksheet.Cell(1, i++).Value = "Date";
  235. worksheet.Column(i).Width = 15;
  236. worksheet.Cell(1, i++).Value = "Term";
  237. worksheet.Column(i).Width = 80;
  238. worksheet.Cell(1, i++).Value = "Result";
  239. // make color
  240. worksheet.Row(1).Style.Font.Bold = true;
  241. worksheet.Row(1).Style.Fill.BackgroundColor = XLColor.Yellow;
  242. //worksheet.Cell(1, i++).Value = "BetId";
  243. if (list != null && list.Count > 0)
  244. {
  245. for (int index = 1; index <= list.Count; index++)
  246. {
  247. i = 1;
  248. var obj = list[index - 1];
  249. worksheet.Cell(index + 1, i++).Value = index;
  250. worksheet.Cell(index + 1, i++).Value = LumilotoUtils.GetGameName(obj.gameId);
  251. worksheet.Cell(index + 1, i++).Value = obj.date_end;
  252. worksheet.Cell(index + 1, i++).Value = obj.id;
  253. worksheet.Cell(index + 1, i++).Value = ResultVisible(obj.result, req.gameId);
  254. }
  255. }
  256. using (var stream = new MemoryStream())
  257. {
  258. workbook.SaveAs(stream);
  259. var content = stream.ToArray();
  260. return File(content, contentType, fileName);
  261. }
  262. }
  263. }
  264. catch (Exception ex)
  265. {
  266. return null;
  267. }
  268. }
  269. public String ResultVisible(string result, string gameId)
  270. {
  271. try
  272. {
  273. if (gameId == LumilotoUtils.GameIds.LUCKY_POWER)
  274. {
  275. var rs = "";
  276. for (var i = 0; i < 7; i++)
  277. {
  278. var num = result.Substring(3 * i, 2);
  279. if (i < 6)
  280. {
  281. rs += num + " ";
  282. }
  283. else
  284. {
  285. rs += "| " + num;
  286. }
  287. }
  288. return rs;
  289. }
  290. else if (gameId == LumilotoUtils.GameIds.LUCKY_DAY)
  291. {
  292. var rs = "";
  293. var results = result.Split("$");
  294. for (var i = 0; i < results.Length; i++)
  295. {
  296. var num = results[i].Split("&");
  297. if (i == 0)
  298. {
  299. rs += "First prize: ";
  300. for (var j = 0; j < num.Length; j++)
  301. {
  302. rs += num[j] + " ";
  303. }
  304. }
  305. else if (i == 1)
  306. {
  307. rs += "\r\nSecond prize: ";
  308. for (var j = 0; j < num.Length; j++)
  309. {
  310. rs += num[j] + " ";
  311. }
  312. }
  313. else if (i == 2)
  314. {
  315. rs += "\r\nThird prize: ";
  316. for (var j = 0; j < num.Length; j++)
  317. {
  318. rs += num[j] + " ";
  319. }
  320. }
  321. else if (i == 3)
  322. {
  323. rs += "\r\nForth prize: ";
  324. for (var j = 0; j < num.Length; j++)
  325. {
  326. rs += num[j] + " ";
  327. }
  328. }
  329. }
  330. return rs;
  331. }
  332. else
  333. {
  334. // plus
  335. var rs = "";
  336. string[] numbers = result.Split('&')[0].Split('$');
  337. rs += "Numbers: ";
  338. for (var j = 0; j < numbers.Length; j++)
  339. {
  340. rs += numbers[j] + " ";
  341. }
  342. if (result.Split('&').Length > 1)
  343. {
  344. string[] sp = result.Split('&')[1].Split(',');
  345. Dictionary<String, String> specials = new Dictionary<String, String>();
  346. foreach (String txt in sp)
  347. {
  348. specials.Add(txt.Split('=')[0], txt.Split('=')[1]);
  349. }
  350. rs += "\r\nOdd/even: ";
  351. if (specials["ISEVEN"] == "1")
  352. {
  353. rs += "Even " + specials["E"] + " ";
  354. }
  355. else
  356. {
  357. rs += "Even " + specials["E"] + " ";
  358. }
  359. if (specials["ISEVEN"] == "2")
  360. {
  361. rs += "Odd " + specials["O"] + " ";
  362. }
  363. else
  364. {
  365. rs += "Odd " + specials["O"] + " ";
  366. }
  367. rs += "\r\nBig/Small: ";
  368. if (specials["ISBIG"] == "1")
  369. {
  370. rs += "Big " + specials["B"] + " ";
  371. }
  372. else
  373. {
  374. rs += "Big " + specials["B"] + " ";
  375. }
  376. if (specials["ISBIG"] == "2")
  377. {
  378. rs += "Small " + specials["S"] + " ";
  379. }
  380. else
  381. {
  382. rs += "Small " + specials["S"] + " ";
  383. }
  384. }
  385. return rs;
  386. }
  387. }
  388. catch (Exception ex)
  389. {
  390. log.Error("Error parse result: " + result + ": " + ex.Message, ex);
  391. return "";
  392. }
  393. }
  394. // ReportSummary
  395. public IActionResult ReportSummary()
  396. {
  397. if (!CheckAuthToken())
  398. {
  399. return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
  400. }
  401. return View();
  402. }
  403. [HttpPost]
  404. public JsonResult ReportSummarySearch(RpTotalByDayReq req)
  405. {
  406. if (!CheckAuthToken())
  407. {
  408. return Json(new
  409. {
  410. error = "-1",
  411. content = "Login first"
  412. });
  413. }
  414. string url = GetParameter(LumilotoUtils.WsType.TrafficDayGet);
  415. string result = SendPost(req, url);
  416. RpTotalByDayRes res = RpTotalByDayRes.Parse(result);
  417. return Json(new
  418. {
  419. error = res.responseCode,
  420. content = res.responseMessage,
  421. data = res.list
  422. });
  423. }
  424. [HttpPost]
  425. public IActionResult ReportSummaryExport(RpTotalByDayReq req)
  426. {
  427. if (!CheckAuthToken())
  428. {
  429. return null;
  430. }
  431. ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
  432. string url = GetParameter(LumilotoUtils.WsType.TrafficDayGet);
  433. string result = SendPost(req, url);
  434. RpTotalByDayRes res = RpTotalByDayRes.Parse(result);
  435. List<RpTotalByDay> list = res.list;
  436. string contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
  437. string fileName = "report_summary.xlsx";
  438. try
  439. {
  440. using (var workbook = new XLWorkbook())
  441. {
  442. int i = 1;
  443. IXLWorksheet worksheet = workbook.Worksheets.Add("Report Summary");
  444. worksheet.Column(i).Width = 15;
  445. worksheet.Cell(1, i++).Value = "No.";
  446. worksheet.Column(i).Width = 20;
  447. worksheet.Cell(1, i++).Value = "Date";
  448. worksheet.Column(i).Width = 15;
  449. worksheet.Cell(1, i++).Value = "Total Players";
  450. worksheet.Column(i).Width = 15;
  451. worksheet.Cell(1, i++).Value = "Total Tickets";
  452. worksheet.Column(i).Width = 20;
  453. worksheet.Cell(1, i++).Value = "Total Bet Money(HTG)";
  454. worksheet.Column(i).Width = 20;
  455. worksheet.Cell(1, i++).Value = "Total Win Player";
  456. worksheet.Column(i).Width = 20;
  457. worksheet.Cell(1, i++).Value = "Total Win Ticket";
  458. worksheet.Column(i).Width = 20;
  459. worksheet.Cell(1, i++).Value = "Total Win Money(HTG)";
  460. worksheet.Column(i).Width = 20;
  461. worksheet.Cell(1, i++).Value = "Total Benefit(HTG)";
  462. // make color
  463. worksheet.Row(1).Style.Font.Bold = true;
  464. worksheet.Row(1).Style.Fill.BackgroundColor = XLColor.Yellow;
  465. //worksheet.Cell(1, i++).Value = "BetId";
  466. if (list != null && list.Count > 0)
  467. {
  468. for (int index = 1; index <= list.Count; index++)
  469. {
  470. i = 1;
  471. var obj = list[index - 1];
  472. worksheet.Cell(index + 1, i++).Value = index;
  473. worksheet.Cell(index + 1, i++).Value = obj.date;
  474. worksheet.Cell(index + 1, i++).Value = obj.player;
  475. worksheet.Cell(index + 1, i++).Value = obj.ticket;
  476. worksheet.Cell(index + 1, i++).Value = obj.money;
  477. worksheet.Cell(index + 1, i++).Value = obj.palyerWin;
  478. worksheet.Cell(index + 1, i++).Value = obj.ticketWin;
  479. worksheet.Cell(index + 1, i++).Value = obj.moneyWin;
  480. worksheet.Cell(index + 1, i++).Value = obj.benefit;
  481. }
  482. }
  483. using (var stream = new MemoryStream())
  484. {
  485. workbook.SaveAs(stream);
  486. var content = stream.ToArray();
  487. return File(content, contentType, fileName);
  488. }
  489. }
  490. }
  491. catch (Exception ex)
  492. {
  493. return null;
  494. }
  495. }
  496. // Report Compact
  497. public IActionResult ReportCompact()
  498. {
  499. if (!CheckAuthToken())
  500. {
  501. return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
  502. }
  503. return View();
  504. }
  505. [HttpPost]
  506. public JsonResult ReportCompactSearch(RpTotalByDayReq req)
  507. {
  508. if (!CheckAuthToken())
  509. {
  510. return Json(new
  511. {
  512. error = "-1",
  513. content = "Login first"
  514. });
  515. }
  516. string url = GetParameter(LumilotoUtils.WsType.TrafficDayGet);
  517. string result = SendPost(req, url);
  518. RpTotalByDayRes res = RpTotalByDayRes.Parse(result);
  519. return Json(new
  520. {
  521. error = res.responseCode,
  522. content = res.responseMessage,
  523. data = res.list
  524. });
  525. }
  526. [HttpPost]
  527. public IActionResult ReportCompactExport(RpTotalByDayReq req)
  528. {
  529. if (!CheckAuthToken())
  530. {
  531. return null;
  532. }
  533. ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
  534. string url = GetParameter(LumilotoUtils.WsType.TrafficDayGet);
  535. string result = SendPost(req, url);
  536. RpTotalByDayRes res = RpTotalByDayRes.Parse(result);
  537. List<RpTotalByDay> list = res.list;
  538. string contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
  539. string fileName = "report_compact.xlsx";
  540. try
  541. {
  542. using (var workbook = new XLWorkbook())
  543. {
  544. int i = 1;
  545. IXLWorksheet worksheet = workbook.Worksheets.Add("Report Summary");
  546. worksheet.Column(i).Width = 15;
  547. worksheet.Cell(1, i++).Value = "No.";
  548. worksheet.Column(i).Width = 20;
  549. worksheet.Cell(1, i++).Value = "Date";
  550. worksheet.Column(i).Width = 15;
  551. worksheet.Cell(1, i++).Value = "Total Players";
  552. worksheet.Column(i).Width = 20;
  553. worksheet.Cell(1, i++).Value = "Total Bet Money(HTG)";
  554. worksheet.Column(i).Width = 20;
  555. worksheet.Cell(1, i++).Value = "Total Win Money(HTG)";
  556. worksheet.Column(i).Width = 20;
  557. worksheet.Cell(1, i++).Value = "Total Benefit(HTG)";
  558. worksheet.Column(i).Width = 20;
  559. worksheet.Cell(1, i++).Value = "Sharing(HTG)";
  560. // make color
  561. worksheet.Row(1).Style.Font.Bold = true;
  562. worksheet.Row(1).Style.Fill.BackgroundColor = XLColor.Yellow;
  563. //worksheet.Cell(1, i++).Value = "BetId";
  564. if (list != null && list.Count > 0)
  565. {
  566. for (int index = 1; index <= list.Count; index++)
  567. {
  568. i = 1;
  569. var obj = list[index - 1];
  570. worksheet.Cell(index + 1, i++).Value = index;
  571. worksheet.Cell(index + 1, i++).Value = obj.date;
  572. worksheet.Cell(index + 1, i++).Value = obj.player;
  573. worksheet.Cell(index + 1, i++).Value = obj.money;
  574. worksheet.Cell(index + 1, i++).Value = obj.moneyWin;
  575. worksheet.Cell(index + 1, i++).Value = obj.benefit;
  576. worksheet.Cell(index + 1, i++).Value = obj.sharing;
  577. }
  578. }
  579. using (var stream = new MemoryStream())
  580. {
  581. workbook.SaveAs(stream);
  582. var content = stream.ToArray();
  583. return File(content, contentType, fileName);
  584. }
  585. }
  586. }
  587. catch (Exception ex)
  588. {
  589. return null;
  590. }
  591. }
  592. // Report Summary Bolet
  593. public IActionResult ReportSummaryBolet()
  594. {
  595. if (!CheckAuthToken())
  596. {
  597. return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
  598. }
  599. return View();
  600. }
  601. [HttpPost]
  602. public JsonResult ReportSummaryBoletSearch(RpTotalByBoletReq req)
  603. {
  604. if (!CheckAuthToken())
  605. {
  606. return Json(new
  607. {
  608. error = "-1",
  609. content = "Login first"
  610. });
  611. }
  612. string url = GetParameter(LumilotoUtils.WsType.TrafficBoletGet);
  613. string result = SendPost(req, url);
  614. RpTotalByBoletRes res = RpTotalByBoletRes.Parse(result);
  615. return Json(new
  616. {
  617. error = res.responseCode,
  618. content = res.responseMessage,
  619. data = res.list
  620. });
  621. }
  622. [HttpPost]
  623. public IActionResult ReportSummaryBoletExport(RpTotalByBoletReq req)
  624. {
  625. if (!CheckAuthToken())
  626. {
  627. return null;
  628. }
  629. ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
  630. string url = GetParameter(LumilotoUtils.WsType.TrafficBoletGet);
  631. string result = SendPost(req, url);
  632. RpTotalByBoletRes res = RpTotalByBoletRes.Parse(result);
  633. List<RpTotalByBolet> list = res.list;
  634. string contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
  635. string fileName = "report_summary_bolet.xlsx";
  636. try
  637. {
  638. using (var workbook = new XLWorkbook())
  639. {
  640. int i = 1;
  641. IXLWorksheet worksheet = workbook.Worksheets.Add("Report Summary");
  642. worksheet.Column(i).Width = 15;
  643. worksheet.Cell(1, i++).Value = "No.";
  644. worksheet.Column(i).Width = 20;
  645. worksheet.Cell(1, i++).Value = "Date";
  646. worksheet.Column(i).Width = 15;
  647. worksheet.Cell(1, i++).Value = "Total Players";
  648. worksheet.Column(i).Width = 15;
  649. worksheet.Cell(1, i++).Value = "Total Tickets";
  650. worksheet.Column(i).Width = 20;
  651. worksheet.Cell(1, i++).Value = "Total Bet Money(HTG)";
  652. worksheet.Column(i).Width = 20;
  653. worksheet.Cell(1, i++).Value = "Total Win money";
  654. worksheet.Column(i).Width = 20;
  655. worksheet.Cell(1, i++).Value = "Total ticket LOT1";
  656. worksheet.Column(i).Width = 20;
  657. worksheet.Cell(1, i++).Value = "Total Win Lot1";
  658. worksheet.Column(i).Width = 20;
  659. worksheet.Cell(1, i++).Value = "Total ticket Lot2";
  660. worksheet.Column(i).Width = 20;
  661. worksheet.Cell(1, i++).Value = "Total Win Lot2";
  662. worksheet.Column(i).Width = 20;
  663. worksheet.Cell(1, i++).Value = "Total ticket Lot3";
  664. worksheet.Column(i).Width = 20;
  665. worksheet.Cell(1, i++).Value = "Total Win Lot 3";
  666. // make color
  667. worksheet.Row(1).Style.Font.Bold = true;
  668. worksheet.Row(1).Style.Fill.BackgroundColor = XLColor.Yellow;
  669. //worksheet.Cell(1, i++).Value = "BetId";
  670. if (list != null && list.Count > 0)
  671. {
  672. for (int index = 1; index <= list.Count; index++)
  673. {
  674. i = 1;
  675. var obj = list[index - 1];
  676. worksheet.Cell(index + 1, i++).Value = index;
  677. worksheet.Cell(index + 1, i++).Value = obj.date;
  678. worksheet.Cell(index + 1, i++).Value = obj.player;
  679. worksheet.Cell(index + 1, i++).Value = obj.ticket;
  680. worksheet.Cell(index + 1, i++).Value = obj.money;
  681. worksheet.Cell(index + 1, i++).Value = obj.moneyWin;
  682. worksheet.Cell(index + 1, i++).Value = obj.ticketWinLot1;
  683. worksheet.Cell(index + 1, i++).Value = obj.moneyWinLot1;
  684. worksheet.Cell(index + 1, i++).Value = obj.ticketWinLot2;
  685. worksheet.Cell(index + 1, i++).Value = obj.moneyWinLot2;
  686. worksheet.Cell(index + 1, i++).Value = obj.ticketWinLot3;
  687. worksheet.Cell(index + 1, i++).Value = obj.moneyWinLot3;
  688. }
  689. }
  690. using (var stream = new MemoryStream())
  691. {
  692. workbook.SaveAs(stream);
  693. var content = stream.ToArray();
  694. return File(content, contentType, fileName);
  695. }
  696. }
  697. }
  698. catch (Exception ex)
  699. {
  700. return null;
  701. }
  702. }
  703. // Report Summary Lucky
  704. public IActionResult ReportSummaryLucky()
  705. {
  706. if (!CheckAuthToken())
  707. {
  708. return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
  709. }
  710. return View();
  711. }
  712. [HttpPost]
  713. public JsonResult ReportSummaryLuckySearch(RpTotalByDayLkpsReq req)
  714. {
  715. if (!CheckAuthToken())
  716. {
  717. return Json(new
  718. {
  719. error = "-1",
  720. content = "Login first"
  721. });
  722. }
  723. string url = GetParameter(LumilotoUtils.WsType.TrafficLuckyGet);
  724. string result = SendPost(req, url);
  725. RpTotalByDayLkpsRes res = RpTotalByDayLkpsRes.Parse(result);
  726. return Json(new
  727. {
  728. error = res.responseCode,
  729. content = res.responseMessage,
  730. data = res.list
  731. });
  732. }
  733. [HttpPost]
  734. public IActionResult ReportSummaryLuckyExport(RpTotalByDayLkpsReq req)
  735. {
  736. if (!CheckAuthToken())
  737. {
  738. return null;
  739. }
  740. ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
  741. string url = GetParameter(LumilotoUtils.WsType.TrafficLuckyGet);
  742. string result = SendPost(req, url);
  743. RpTotalByDayLkpsRes res = RpTotalByDayLkpsRes.Parse(result);
  744. List<RpTotalByDayLkps> list = res.list;
  745. string contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
  746. string fileName = "report_summary_lucky.xlsx";
  747. try
  748. {
  749. using (var workbook = new XLWorkbook())
  750. {
  751. int i = 1;
  752. IXLWorksheet worksheet = workbook.Worksheets.Add("Report Summary");
  753. worksheet.Column(i).Width = 15;
  754. worksheet.Cell(1, i++).Value = "No.";
  755. worksheet.Column(i).Width = 20;
  756. worksheet.Cell(1, i++).Value = "Date";
  757. worksheet.Column(i).Width = 15;
  758. worksheet.Cell(1, i++).Value = "Total Players";
  759. worksheet.Column(i).Width = 15;
  760. worksheet.Cell(1, i++).Value = "Total Tickets";
  761. worksheet.Column(i).Width = 20;
  762. worksheet.Cell(1, i++).Value = "Total Bet Money(HTG)";
  763. worksheet.Column(i).Width = 20;
  764. worksheet.Cell(1, i++).Value = "Total Win Player";
  765. worksheet.Column(i).Width = 20;
  766. worksheet.Cell(1, i++).Value = "Total Win Ticket";
  767. worksheet.Column(i).Width = 20;
  768. worksheet.Cell(1, i++).Value = "Total Win Money(HTG)";
  769. worksheet.Column(i).Width = 20;
  770. worksheet.Cell(1, i++).Value = "Total Benefit(HTG)";
  771. // make color
  772. worksheet.Row(1).Style.Font.Bold = true;
  773. worksheet.Row(1).Style.Fill.BackgroundColor = XLColor.Yellow;
  774. //worksheet.Cell(1, i++).Value = "BetId";
  775. if (list != null && list.Count > 0)
  776. {
  777. for (int index = 1; index <= list.Count; index++)
  778. {
  779. i = 1;
  780. var obj = list[index - 1];
  781. worksheet.Cell(index + 1, i++).Value = index;
  782. worksheet.Cell(index + 1, i++).Value = obj.date;
  783. worksheet.Cell(index + 1, i++).Value = obj.player;
  784. worksheet.Cell(index + 1, i++).Value = obj.ticket;
  785. worksheet.Cell(index + 1, i++).Value = obj.money;
  786. worksheet.Cell(index + 1, i++).Value = obj.palyerWin;
  787. worksheet.Cell(index + 1, i++).Value = obj.ticketWin;
  788. worksheet.Cell(index + 1, i++).Value = obj.moneyWin;
  789. worksheet.Cell(index + 1, i++).Value = obj.benefit;
  790. }
  791. }
  792. using (var stream = new MemoryStream())
  793. {
  794. workbook.SaveAs(stream);
  795. var content = stream.ToArray();
  796. return File(content, contentType, fileName);
  797. }
  798. }
  799. }
  800. catch (Exception ex)
  801. {
  802. return null;
  803. }
  804. }
  805. // Player Lucky
  806. public IActionResult ReportLuckyDetail()
  807. {
  808. if (!CheckAuthToken())
  809. {
  810. return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
  811. }
  812. return View();
  813. }
  814. public IActionResult ReportLuckyDetailSearch(SearchMsisdnReq req)
  815. {
  816. if (!CheckAuthToken())
  817. {
  818. return Json(new
  819. {
  820. error = "-1",
  821. content = "Login first"
  822. });
  823. }
  824. req.msisdn = BaseController.ValidateMsisdn(req.msisdn);
  825. string url = GetParameter(LumilotoUtils.WsType.MsisdnSearchLucky);
  826. string result = SendPost(req, url);
  827. SearchMsisdnRes res = SearchMsisdnRes.Parse(result);
  828. return Json(new
  829. {
  830. error = res.responseCode,
  831. content = res.responseMessage,
  832. data = res.list
  833. });
  834. }
  835. [HttpPost]
  836. public IActionResult ReportLuckyDetailExport(SearchMsisdnReq req)
  837. {
  838. if (!CheckAuthToken())
  839. {
  840. return null;
  841. }
  842. ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
  843. string url = GetParameter(LumilotoUtils.WsType.MsisdnSearchLucky);
  844. string result = SendPost(req, url);
  845. SearchMsisdnRes res = SearchMsisdnRes.Parse(result);
  846. List<TicketMsisdn> list = res.list;
  847. string contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
  848. string fileName = "player_ticket.xlsx";
  849. try
  850. {
  851. using (var workbook = new XLWorkbook())
  852. {
  853. int i = 1;
  854. IXLWorksheet worksheet = workbook.Worksheets.Add("Player Tickets");
  855. worksheet.Column(i).Width = 15;
  856. worksheet.Cell(1, i++).Value = "No.";
  857. worksheet.Column(i).Width = 20;
  858. worksheet.Cell(1, i++).Value = "Phone number";
  859. worksheet.Column(i).Width = 20;
  860. worksheet.Cell(1, i++).Value = "Channel Play";
  861. worksheet.Column(i).Width = 15;
  862. worksheet.Cell(1, i++).Value = "Ticket ID";
  863. worksheet.Column(i).Width = 15;
  864. worksheet.Cell(1, i++).Value = "Bet number";
  865. worksheet.Column(i).Width = 20;
  866. worksheet.Cell(1, i++).Value = "Bet Money (HTG)";
  867. worksheet.Column(i).Width = 20;
  868. worksheet.Cell(1, i++).Value = "Buy time";
  869. worksheet.Column(i).Width = 20;
  870. worksheet.Cell(1, i++).Value = "Drawn time";
  871. worksheet.Column(i).Width = 20;
  872. worksheet.Cell(1, i++).Value = "Result";
  873. worksheet.Column(i).Width = 20;
  874. worksheet.Cell(1, i++).Value = "Win Money (HTG)";
  875. // make color
  876. worksheet.Row(1).Style.Font.Bold = true;
  877. worksheet.Row(1).Style.Fill.BackgroundColor = XLColor.Yellow;
  878. //worksheet.Cell(1, i++).Value = "BetId";
  879. if (list != null && list.Count > 0)
  880. {
  881. for (int index = 1; index <= list.Count; index++)
  882. {
  883. i = 1;
  884. var obj = list[index - 1];
  885. worksheet.Cell(index + 1, i++).Value = index;
  886. worksheet.Cell(index + 1, i++).Value = obj.msisdn;
  887. worksheet.Cell(index + 1, i++).Value = obj.channel;
  888. worksheet.Cell(index + 1, i++).Value = obj.ticketId;
  889. worksheet.Cell(index + 1, i++).Value = obj.ticketCode;
  890. worksheet.Cell(index + 1, i++).Value = obj.money;
  891. worksheet.Cell(index + 1, i++).Value = obj.buyTime;
  892. worksheet.Cell(index + 1, i++).Value = obj.drawTime;
  893. worksheet.Cell(index + 1, i++).Value = obj.result;
  894. worksheet.Cell(index + 1, i++).Value = obj.moneyWin;
  895. }
  896. }
  897. using (var stream = new MemoryStream())
  898. {
  899. workbook.SaveAs(stream);
  900. var content = stream.ToArray();
  901. return File(content, contentType, fileName);
  902. }
  903. }
  904. }
  905. catch (Exception ex)
  906. {
  907. return null;
  908. }
  909. }
  910. // Player
  911. public IActionResult PlayerTicket()
  912. {
  913. if (!CheckAuthToken())
  914. {
  915. return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
  916. }
  917. return View();
  918. }
  919. public IActionResult PlayerTicketSearch(SearchMsisdnReq req)
  920. {
  921. if (!CheckAuthToken())
  922. {
  923. return Json(new
  924. {
  925. error = "-1",
  926. content = "Login first"
  927. });
  928. }
  929. req.msisdn = BaseController.ValidateMsisdn(req.msisdn);
  930. string url = GetParameter(LumilotoUtils.WsType.MsisdnSearch);
  931. string result = SendPost(req, url);
  932. SearchMsisdnRes res = SearchMsisdnRes.Parse(result);
  933. //return Json(new
  934. //{
  935. // error = res.responseCode,
  936. // content = res.responseMessage,
  937. // data = res.list
  938. //});
  939. return PartialView("./_PlayerHistory", res);
  940. }
  941. [HttpPost]
  942. public IActionResult PlayerTicketExport(SearchMsisdnReq req)
  943. {
  944. if (!CheckAuthToken())
  945. {
  946. return null;
  947. }
  948. ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
  949. string url = GetParameter(LumilotoUtils.WsType.MsisdnSearch);
  950. string result = SendPost(req, url);
  951. SearchMsisdnRes res = SearchMsisdnRes.Parse(result);
  952. List<TicketMsisdn> list = res.list;
  953. string contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
  954. string fileName = "player_ticket.xlsx";
  955. try
  956. {
  957. using (var workbook = new XLWorkbook())
  958. {
  959. int i = 1;
  960. IXLWorksheet worksheet = workbook.Worksheets.Add("Player Tickets");
  961. worksheet.Column(i).Width = 15;
  962. worksheet.Cell(1, i++).Value = "No.";
  963. worksheet.Column(i).Width = 20;
  964. worksheet.Cell(1, i++).Value = "Phone number";
  965. worksheet.Column(i).Width = 15;
  966. worksheet.Cell(1, i++).Value = "Lottery";
  967. worksheet.Column(i).Width = 20;
  968. worksheet.Cell(1, i++).Value = "Game";
  969. worksheet.Column(i).Width = 20;
  970. worksheet.Cell(1, i++).Value = "Channel Play";
  971. worksheet.Column(i).Width = 15;
  972. worksheet.Cell(1, i++).Value = "Ticket ID";
  973. worksheet.Column(i).Width = 15;
  974. worksheet.Cell(1, i++).Value = "Bet number";
  975. worksheet.Column(i).Width = 20;
  976. worksheet.Cell(1, i++).Value = "Bet Money (HTG)";
  977. worksheet.Column(i).Width = 20;
  978. worksheet.Cell(1, i++).Value = "Buy time";
  979. worksheet.Column(i).Width = 20;
  980. worksheet.Cell(1, i++).Value = "Drawn time";
  981. worksheet.Column(i).Width = 20;
  982. worksheet.Cell(1, i++).Value = "Result";
  983. worksheet.Column(i).Width = 20;
  984. worksheet.Cell(1, i++).Value = "Win Money (HTG)";
  985. // make color
  986. worksheet.Row(1).Style.Font.Bold = true;
  987. worksheet.Row(1).Style.Fill.BackgroundColor = XLColor.Yellow;
  988. //worksheet.Cell(1, i++).Value = "BetId";
  989. if (list != null && list.Count > 0)
  990. {
  991. for (int index = 1; index <= list.Count; index++)
  992. {
  993. i = 1;
  994. var obj = list[index - 1];
  995. worksheet.Cell(index + 1, i++).Value = index;
  996. worksheet.Cell(index + 1, i++).Value = obj.msisdn;
  997. worksheet.Cell(index + 1, i++).Value = obj.lottery;
  998. worksheet.Cell(index + 1, i++).Value = obj.game;
  999. worksheet.Cell(index + 1, i++).Value = obj.channel;
  1000. worksheet.Cell(index + 1, i++).Value = obj.ticketId;
  1001. worksheet.Cell(index + 1, i++).Value = obj.ticketCode;
  1002. worksheet.Cell(index + 1, i++).Value = obj.money;
  1003. worksheet.Cell(index + 1, i++).Value = obj.buyTime;
  1004. worksheet.Cell(index + 1, i++).Value = obj.drawTime;
  1005. worksheet.Cell(index + 1, i++).Value = obj.result;
  1006. worksheet.Cell(index + 1, i++).Value = obj.moneyWin;
  1007. }
  1008. }
  1009. using (var stream = new MemoryStream())
  1010. {
  1011. workbook.SaveAs(stream);
  1012. var content = stream.ToArray();
  1013. return File(content, contentType, fileName);
  1014. }
  1015. }
  1016. }
  1017. catch (Exception ex)
  1018. {
  1019. return null;
  1020. }
  1021. }
  1022. public IActionResult PlayerTransfer()
  1023. {
  1024. if (!CheckAuthToken())
  1025. {
  1026. return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
  1027. }
  1028. return View();
  1029. }
  1030. public IActionResult PlayerTransferSearch(SearchTransferMsisdnReq req)
  1031. {
  1032. if (!CheckAuthToken())
  1033. {
  1034. return Json(new
  1035. {
  1036. error = "-1",
  1037. content = "Login first"
  1038. });
  1039. }
  1040. req.order = "desc";
  1041. req.seqPage = "1";
  1042. req.rowsOnPage = "1000000";
  1043. req.msisdn = BaseController.ValidateMsisdn(req.msisdn);
  1044. if (req.msisdn == null || req.msisdn == "")
  1045. {
  1046. return Json(new
  1047. {
  1048. error = "10",
  1049. content = "Msisdn required"
  1050. });
  1051. }
  1052. string url = GetParameter(LumilotoUtils.WsType.TransferSearch);
  1053. string result = SendPost(req, url);
  1054. TransferMsisdnRes res = TransferMsisdnRes.Parse(result);
  1055. return PartialView("./_PlayerTransfer", res);
  1056. //return Json(new
  1057. //{
  1058. // error = res.responseCode,
  1059. // content = res.responseMessage,
  1060. // data = res.list
  1061. //});
  1062. }
  1063. public IActionResult PlayerTransferDetailSearch(SearchTransferMsisdnReq req)
  1064. {
  1065. if (!CheckAuthToken())
  1066. {
  1067. return Json(new
  1068. {
  1069. error = "-1",
  1070. content = "Login first"
  1071. });
  1072. }
  1073. req.order = "desc";
  1074. req.seqPage = "1";
  1075. req.rowsOnPage = "1000000";
  1076. string url = GetParameter(LumilotoUtils.WsType.TransferSearch);
  1077. string result = SendPost(req, url);
  1078. TransferMsisdnRes res = TransferMsisdnRes.Parse(result);
  1079. return PartialView("./_PlayerTransferDetail", res);
  1080. }
  1081. [HttpPost]
  1082. public IActionResult PlayerTransferExport(SearchTransferMsisdnReq req)
  1083. {
  1084. if (!CheckAuthToken())
  1085. {
  1086. return null;
  1087. }
  1088. ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
  1089. string url = GetParameter(LumilotoUtils.WsType.TransferSearch);
  1090. string result = SendPost(req, url);
  1091. TransferMsisdnRes res = TransferMsisdnRes.Parse(result);
  1092. List<TransferMsisdn> list = res.list;
  1093. string contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
  1094. string fileName = "player_transfer.xlsx";
  1095. try
  1096. {
  1097. using (var workbook = new XLWorkbook())
  1098. {
  1099. int i = 1;
  1100. IXLWorksheet worksheet = workbook.Worksheets.Add("Player Transfer");
  1101. worksheet.Column(i).Width = 15;
  1102. worksheet.Cell(1, i++).Value = "No.";
  1103. worksheet.Column(i).Width = 15;
  1104. worksheet.Cell(1, i++).Value = "Phone Request";
  1105. worksheet.Column(i).Width = 15;
  1106. worksheet.Cell(1, i++).Value = "Phone Receive";
  1107. worksheet.Column(i).Width = 20;
  1108. worksheet.Cell(1, i++).Value = "Time Request";
  1109. worksheet.Column(i).Width = 20;
  1110. worksheet.Cell(1, i++).Value = "Time Top-up";
  1111. worksheet.Column(i).Width = 15;
  1112. worksheet.Cell(1, i++).Value = "Status of Toto";
  1113. worksheet.Column(i).Width = 20;
  1114. worksheet.Cell(1, i++).Value = "Status Message";
  1115. worksheet.Column(i).Width = 15;
  1116. worksheet.Cell(1, i++).Value = "Coin Transfer";
  1117. worksheet.Column(i).Width = 20;
  1118. worksheet.Cell(1, i++).Value = "Channel Request";
  1119. worksheet.Column(i).Width = 20;
  1120. worksheet.Cell(1, i++).Value = "Channel Payment";
  1121. worksheet.Column(i).Width = 40;
  1122. worksheet.Cell(1, i++).Value = "Request ID";
  1123. worksheet.Column(i).Width = 40;
  1124. worksheet.Cell(1, i++).Value = "Response ID";
  1125. worksheet.Column(i).Width = 15;
  1126. worksheet.Cell(1, i++).Value = "errCodeApprove";
  1127. worksheet.Column(i).Width = 20;
  1128. worksheet.Cell(1, i++).Value = "errMsgApprove";
  1129. worksheet.Column(i).Width = 15;
  1130. worksheet.Cell(1, i++).Value = "errCodeCallback";
  1131. worksheet.Column(i).Width = 40;
  1132. worksheet.Cell(1, i++).Value = "Transaction";
  1133. worksheet.Column(i).Width = 15;
  1134. worksheet.Cell(1, i++).Value = "StatusWallet";
  1135. worksheet.Column(i).Width = 20;
  1136. worksheet.Cell(1, i++).Value = "StatusWalletMsg";
  1137. worksheet.Column(i).Width = 20;
  1138. worksheet.Cell(1, i++).Value = "ReasonReject";
  1139. // make color
  1140. worksheet.Row(1).Style.Font.Bold = true;
  1141. worksheet.Row(1).Style.Fill.BackgroundColor = XLColor.Yellow;
  1142. //worksheet.Cell(1, i++).Value = "BetId";
  1143. if (list != null && list.Count > 0)
  1144. {
  1145. for (int index = 1; index <= list.Count; index++)
  1146. {
  1147. i = 1;
  1148. var obj = list[index - 1];
  1149. worksheet.Cell(index + 1, i++).Value = index;
  1150. worksheet.Cell(index + 1, i++).Value = obj.acountSend;
  1151. worksheet.Cell(index + 1, i++).Value = obj.acountRecieve;
  1152. worksheet.Cell(index + 1, i++).Value = obj.timeRequest;
  1153. worksheet.Cell(index + 1, i++).Value = obj.timeTopup;
  1154. worksheet.Cell(index + 1, i++).Value = obj.status;
  1155. worksheet.Cell(index + 1, i++).Value = obj.statusMsg;
  1156. worksheet.Cell(index + 1, i++).Value = obj.money;
  1157. worksheet.Cell(index + 1, i++).Value = obj.channelRequest;
  1158. worksheet.Cell(index + 1, i++).Value = obj.channelPayment == "1" ? "Main balance" : "Mosan";
  1159. worksheet.Cell(index + 1, i++).Value = obj.reqeustId;
  1160. worksheet.Cell(index + 1, i++).Value = obj.responseId;
  1161. worksheet.Cell(index + 1, i++).Value = obj.errCodeApprove;
  1162. worksheet.Cell(index + 1, i++).Value = obj.errMsgApprove;
  1163. worksheet.Cell(index + 1, i++).Value = obj.errCodeCallback;
  1164. worksheet.Cell(index + 1, i++).Value = obj.transection;
  1165. worksheet.Cell(index + 1, i++).Value = obj.statusWallet;
  1166. worksheet.Cell(index + 1, i++).Value = obj.statusWalletMsg;
  1167. worksheet.Cell(index + 1, i++).Value = obj.reasonReject;
  1168. }
  1169. }
  1170. using (var stream = new MemoryStream())
  1171. {
  1172. workbook.SaveAs(stream);
  1173. var content = stream.ToArray();
  1174. return File(content, contentType, fileName);
  1175. }
  1176. }
  1177. }
  1178. catch (Exception ex)
  1179. {
  1180. return null;
  1181. }
  1182. }
  1183. public IActionResult PlayerExport()
  1184. {
  1185. if (!CheckAuthToken())
  1186. {
  1187. return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
  1188. }
  1189. return View();
  1190. }
  1191. public IActionResult PlayerExportAction(SearchMsisdnReq req)
  1192. {
  1193. if (!CheckAuthToken())
  1194. {
  1195. return null;
  1196. }
  1197. ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
  1198. string url = GetParameter(LumilotoUtils.WsType.MsisdnExport);
  1199. string result = SendPost(req, url);
  1200. SearchMsisdnRes res = SearchMsisdnRes.Parse(result);
  1201. List<TicketMsisdn> list = res.list;
  1202. string contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
  1203. string fileName = "player_list.xlsx";
  1204. try
  1205. {
  1206. using (var workbook = new XLWorkbook())
  1207. {
  1208. int i = 1;
  1209. IXLWorksheet worksheet = workbook.Worksheets.Add("Player List");
  1210. worksheet.Column(i).Width = 15;
  1211. worksheet.Cell(1, i++).Value = "No.";
  1212. worksheet.Column(i).Width = 15;
  1213. worksheet.Cell(1, i++).Value = "Phone number";
  1214. // make color
  1215. worksheet.Row(1).Style.Font.Bold = true;
  1216. worksheet.Row(1).Style.Fill.BackgroundColor = XLColor.Yellow;
  1217. //worksheet.Cell(1, i++).Value = "BetId";
  1218. if (list != null && list.Count > 0)
  1219. {
  1220. for (int index = 1; index <= list.Count; index++)
  1221. {
  1222. i = 1;
  1223. var obj = list[index - 1];
  1224. worksheet.Cell(index + 1, i++).Value = index;
  1225. worksheet.Cell(index + 1, i++).Value = obj.msisdn;
  1226. }
  1227. }
  1228. using (var stream = new MemoryStream())
  1229. {
  1230. workbook.SaveAs(stream);
  1231. var content = stream.ToArray();
  1232. return File(content, contentType, fileName);
  1233. }
  1234. }
  1235. }
  1236. catch (Exception ex)
  1237. {
  1238. return null;
  1239. }
  1240. }
  1241. private String formatStatus(String status)
  1242. {
  1243. if (status == "0")
  1244. {
  1245. return "Processing";
  1246. }
  1247. else if (status == "1")
  1248. {
  1249. return "Success";
  1250. }
  1251. else if (status == "2")
  1252. {
  1253. return "Pending";
  1254. }
  1255. else if (status == "3")
  1256. {
  1257. return "Revert";
  1258. }
  1259. return status;
  1260. }
  1261. // MT SEARCH
  1262. public IActionResult PlayerMt()
  1263. {
  1264. if (!CheckAuthToken())
  1265. {
  1266. return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
  1267. }
  1268. return View();
  1269. }
  1270. public IActionResult PlayerMtSearch(SearchMtReq req)
  1271. {
  1272. if (!CheckAuthToken())
  1273. {
  1274. return Json(new
  1275. {
  1276. error = "-1",
  1277. content = "Login first"
  1278. });
  1279. }
  1280. req.msisdn = BaseController.ValidateMsisdn(req.msisdn);
  1281. string url = GetParameter(LumilotoUtils.WsType.MtSearch);
  1282. string result = SendPost(req, url);
  1283. SearchMtRes res = SearchMtRes.Parse(result);
  1284. return Json(new
  1285. {
  1286. error = res.responseCode,
  1287. content = res.responseMessage,
  1288. data = res.list
  1289. });
  1290. }
  1291. [HttpPost]
  1292. public IActionResult PlayerMtExport(SearchMtReq req)
  1293. {
  1294. if (!CheckAuthToken())
  1295. {
  1296. return null;
  1297. }
  1298. ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
  1299. string url = GetParameter(LumilotoUtils.WsType.MtSearch);
  1300. string result = SendPost(req, url);
  1301. SearchMtRes res = SearchMtRes.Parse(result);
  1302. List<MtRecord> list = res.list;
  1303. string contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
  1304. string fileName = "player_mt.xlsx";
  1305. try
  1306. {
  1307. using (var workbook = new XLWorkbook())
  1308. {
  1309. int i = 1;
  1310. IXLWorksheet worksheet = workbook.Worksheets.Add("Player MT");
  1311. worksheet.Column(i).Width = 15;
  1312. worksheet.Cell(1, i++).Value = "No.";
  1313. worksheet.Column(i).Width = 15;
  1314. worksheet.Cell(1, i++).Value = "Phone number";
  1315. worksheet.Column(i).Width = 100;
  1316. worksheet.Cell(1, i++).Value = "Message Content";
  1317. worksheet.Column(i).Width = 20;
  1318. worksheet.Cell(1, i++).Value = "Send Time";
  1319. // make color
  1320. worksheet.Row(1).Style.Font.Bold = true;
  1321. worksheet.Row(1).Style.Fill.BackgroundColor = XLColor.Yellow;
  1322. //worksheet.Cell(1, i++).Value = "BetId";
  1323. if (list != null && list.Count > 0)
  1324. {
  1325. for (int index = 1; index <= list.Count; index++)
  1326. {
  1327. i = 1;
  1328. var obj = list[index - 1];
  1329. worksheet.Cell(index + 1, i++).Value = index;
  1330. worksheet.Cell(index + 1, i++).Value = obj.msisdn;
  1331. worksheet.Cell(index + 1, i++).Value = obj.message;
  1332. worksheet.Cell(index + 1, i++).Value = obj.sendTime;
  1333. }
  1334. }
  1335. using (var stream = new MemoryStream())
  1336. {
  1337. workbook.SaveAs(stream);
  1338. var content = stream.ToArray();
  1339. return File(content, contentType, fileName);
  1340. }
  1341. }
  1342. }
  1343. catch (Exception ex)
  1344. {
  1345. return null;
  1346. }
  1347. }
  1348. // REPORT BILL ORDER SUMMARY
  1349. public IActionResult ReportBillOrderSummary()
  1350. {
  1351. if (!CheckAuthToken())
  1352. {
  1353. return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
  1354. }
  1355. return View();
  1356. }
  1357. public IActionResult ReportBillOrderSummarySearch(RpSearchTotallBuyOderReq req)
  1358. {
  1359. if (!CheckAuthToken())
  1360. {
  1361. return Json(new
  1362. {
  1363. error = "-1",
  1364. content = "Login first"
  1365. });
  1366. }
  1367. string url = GetParameter(LumilotoUtils.WsType.rpSearchTotallBuyOder);
  1368. string result = SendPost(req, url);
  1369. RpSearchTotallBuyOderRes res = RpSearchTotallBuyOderRes.Parse(result);
  1370. return PartialView("./_ReportBillOrderSummary", res);
  1371. }
  1372. [HttpPost]
  1373. public IActionResult ReportBillOrderSummaryExport(RpSearchTotallBuyOderReq req)
  1374. {
  1375. if (!CheckAuthToken())
  1376. {
  1377. return null;
  1378. }
  1379. ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
  1380. string url = GetParameter(LumilotoUtils.WsType.rpSearchTotallBuyOder);
  1381. string result = SendPost(req, url);
  1382. RpSearchTotallBuyOderRes res = RpSearchTotallBuyOderRes.Parse(result);
  1383. List<TotallBuyOder> list = res.list;
  1384. string contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
  1385. string fileName = "bill_order_summary.xlsx";
  1386. try
  1387. {
  1388. using (var workbook = new XLWorkbook())
  1389. {
  1390. int i = 1;
  1391. long totalOrder = 0;
  1392. long totalMoney = 0;
  1393. long totalFee = 0;
  1394. long totalTicket = 0;
  1395. long totalMoneyWin = 0;
  1396. IXLWorksheet worksheet = workbook.Worksheets.Add("Report Bill Order Summary");
  1397. worksheet.Column(i).Width = 15;
  1398. worksheet.Cell(1, i++).Value = "No.";
  1399. worksheet.Column(i).Width = 20;
  1400. worksheet.Cell(1, i++).Value = "Date Time";
  1401. worksheet.Column(i).Width = 20;
  1402. worksheet.Cell(1, i++).Value = "Total Bill Order";
  1403. worksheet.Column(i).Width = 20;
  1404. worksheet.Cell(1, i++).Value = "Total Money Bet";
  1405. worksheet.Column(i).Width = 20;
  1406. worksheet.Cell(1, i++).Value = "Total Cost Telemor";
  1407. worksheet.Column(i).Width = 20;
  1408. worksheet.Cell(1, i++).Value = "Total Ticket";
  1409. worksheet.Column(i).Width = 20;
  1410. worksheet.Cell(1, i++).Value = "Total Win Money";
  1411. // make color
  1412. worksheet.Row(1).Style.Font.Bold = true;
  1413. worksheet.Row(1).Style.Fill.BackgroundColor = XLColor.Yellow;
  1414. //worksheet.Cell(1, i++).Value = "BetId";
  1415. if (list != null && list.Count > 0)
  1416. {
  1417. for (int index = 1; index <= list.Count; index++)
  1418. {
  1419. i = 1;
  1420. var obj = list[index - 1];
  1421. totalOrder += long.Parse(obj.totalOder);
  1422. totalMoney += long.Parse(obj.totalMoney);
  1423. totalFee += long.Parse(obj.totalFee);
  1424. totalTicket += long.Parse(obj.totalTicket);
  1425. totalMoneyWin += long.Parse(obj.totalMoneyWin);
  1426. worksheet.Cell(index + 1, i++).Value = index;
  1427. worksheet.Cell(index + 1, i).Style.DateFormat.Format = "dd/MM/yyyy";
  1428. worksheet.Cell(index + 1, i++).Value = DateTime.ParseExact(obj.date, "dd/MM/yyyy",null);
  1429. worksheet.Cell(index + 1, i++).Value = obj.totalOder;
  1430. worksheet.Cell(index + 1, i++).Value = obj.totalMoney;
  1431. worksheet.Cell(index + 1, i++).Value = obj.totalFee;
  1432. worksheet.Cell(index + 1, i++).Value = obj.totalTicket;
  1433. worksheet.Cell(index + 1, i++).Value = obj.totalMoneyWin;
  1434. }
  1435. }
  1436. int rowIdx = list.Count + 2;
  1437. // total row
  1438. worksheet.Row(rowIdx).Style.Border.TopBorder = XLBorderStyleValues.Thin;
  1439. worksheet.Row(rowIdx).Style.Font.Bold = true;
  1440. worksheet.Row(rowIdx).Height = 20;
  1441. worksheet.Row(rowIdx).Style.Font.FontSize = 13;
  1442. worksheet.Row(rowIdx).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
  1443. worksheet.Cell(rowIdx, 2).Value = "Total";
  1444. worksheet.Cell(rowIdx, 3).Value = totalOrder;
  1445. worksheet.Cell(rowIdx, 4).Value = totalMoney;
  1446. worksheet.Cell(rowIdx, 5).Value = totalFee;
  1447. worksheet.Cell(rowIdx, 6).Value = totalTicket;
  1448. worksheet.Cell(rowIdx, 7).Value = totalMoneyWin;
  1449. using (var stream = new MemoryStream())
  1450. {
  1451. workbook.SaveAs(stream);
  1452. var content = stream.ToArray();
  1453. return File(content, contentType, fileName);
  1454. }
  1455. }
  1456. }
  1457. catch (Exception ex)
  1458. {
  1459. return null;
  1460. }
  1461. }
  1462. // REPORT BILL ORDER DETAIL
  1463. public IActionResult ReportBillOrderDetail()
  1464. {
  1465. if (!CheckAuthToken())
  1466. {
  1467. return Redirect(GetParameter(UtilsController.Constant.SUB_DOMAIN) + "/Home/Login");
  1468. }
  1469. return View();
  1470. }
  1471. public IActionResult ReportBillOrderDetailSearch(RpSearchDetailBuyOderReq req)
  1472. {
  1473. if (!CheckAuthToken())
  1474. {
  1475. return Json(new
  1476. {
  1477. error = "-1",
  1478. content = "Login first"
  1479. });
  1480. }
  1481. string url = GetParameter(LumilotoUtils.WsType.rpSearchDetailBuyOder);
  1482. string result = SendPost(req, url);
  1483. RpSearchDetailBuyOderRes res = RpSearchDetailBuyOderRes.Parse(result);
  1484. return PartialView("./_ReportBillOrderDetail", res);
  1485. }
  1486. [HttpPost]
  1487. public IActionResult ReportBillOrderDetailExport(RpSearchDetailBuyOderReq req)
  1488. {
  1489. if (!CheckAuthToken())
  1490. {
  1491. return null;
  1492. }
  1493. ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
  1494. string url = GetParameter(LumilotoUtils.WsType.rpSearchDetailBuyOder);
  1495. string result = SendPost(req, url);
  1496. RpSearchDetailBuyOderRes res = RpSearchDetailBuyOderRes.Parse(result);
  1497. List<DetailBuyOder> list = res.list;
  1498. string contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
  1499. string fileName = "bill_order_detail.xlsx";
  1500. try
  1501. {
  1502. using (var workbook = new XLWorkbook())
  1503. {
  1504. int i = 1;
  1505. IXLWorksheet worksheet = workbook.Worksheets.Add("Report Bill Order Detail");
  1506. // make color
  1507. worksheet.Row(1).Style.Font.Bold = true;
  1508. worksheet.Row(1).Style.Fill.BackgroundColor = XLColor.Yellow;
  1509. worksheet.Row(1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
  1510. worksheet.Row(2).Style.Font.Bold = true;
  1511. worksheet.Row(2).Style.Fill.BackgroundColor = XLColor.Yellow;
  1512. worksheet.Row(2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
  1513. worksheet.Range(1, i, 2, i).Merge();
  1514. worksheet.Column(i).Width = 15;
  1515. worksheet.Range(1, i, 2, i).Style.Border.RightBorder = XLBorderStyleValues.Thin;
  1516. worksheet.Cell(1, i++).Value = "No.";
  1517. worksheet.Range(1, i, 2, i).Merge();
  1518. worksheet.Column(i).Width = 15;
  1519. worksheet.Range(1, i, 2, i).Style.Border.RightBorder = XLBorderStyleValues.Thin;
  1520. worksheet.Cell(1, i++).Value = "Phone Number";
  1521. worksheet.Range(1, i, 2, i).Merge();
  1522. worksheet.Column(i).Width = 20;
  1523. worksheet.Range(1, i, 2, i).Style.Border.RightBorder = XLBorderStyleValues.Thin;
  1524. worksheet.Cell(1, i++).Value = "Bill Order";
  1525. worksheet.Range(1, i, 2, i).Merge();
  1526. worksheet.Column(i).Width = 20;
  1527. worksheet.Range(1, i, 2, i).Style.Border.RightBorder = XLBorderStyleValues.Thin;
  1528. worksheet.Cell(1, i++).Value = "Channel Buy";
  1529. worksheet.Range(1, i, 2, i).Merge();
  1530. worksheet.Column(i).Width = 20;
  1531. worksheet.Range(1, i, 2, i).Style.Border.RightBorder = XLBorderStyleValues.Thin;
  1532. worksheet.Cell(1, i++).Value = "Total Money";
  1533. worksheet.Range(1, i, 2, i).Merge();
  1534. worksheet.Column(i).Width = 20;
  1535. worksheet.Range(1, i, 2, i).Style.Border.RightBorder = XLBorderStyleValues.Thin;
  1536. worksheet.Cell(1, i++).Value = "Total Fee";
  1537. worksheet.Range(1, i, 2, i).Merge();
  1538. worksheet.Column(i).Width = 20;
  1539. worksheet.Range(1, i, 2, i).Style.Border.RightBorder = XLBorderStyleValues.Thin;
  1540. worksheet.Cell(1, i++).Value = "Buying Time";
  1541. worksheet.Range(1, i, 2, i).Merge();
  1542. worksheet.Column(i).Width = 20;
  1543. worksheet.Range(1, i, 2, i).Style.Border.RightBorder = XLBorderStyleValues.Thin;
  1544. worksheet.Cell(1, i++).Value = "Game Name";
  1545. // ticket info, merge 3 col
  1546. worksheet.Range(1, i, 1, i + 2).Merge();
  1547. worksheet.Range(1, i, 1, i + 2).Style.Border.BottomBorder = XLBorderStyleValues.Thin;
  1548. worksheet.Range(1, i + 2, 2, i + 2).Style.Border.RightBorder = XLBorderStyleValues.Thin;
  1549. worksheet.Cell(1, i).Value = "Ticket Information";
  1550. // row 2 of ticket info
  1551. worksheet.Column(i).Width = 20;
  1552. worksheet.Cell(2, i).Style.Border.RightBorder = XLBorderStyleValues.Thin;
  1553. worksheet.Cell(2, i++).Value = "Ticket";
  1554. worksheet.Column(i).Width = 20;
  1555. worksheet.Cell(2, i).Style.Border.RightBorder = XLBorderStyleValues.Thin;
  1556. worksheet.Cell(2, i++).Value = "Money (cents)";
  1557. worksheet.Column(i).Width = 20;
  1558. worksheet.Cell(21, i).Style.Border.RightBorder = XLBorderStyleValues.Thin;
  1559. worksheet.Cell(2, i++).Value = "Turn ID";
  1560. worksheet.Row(3).Style.Border.TopBorder = XLBorderStyleValues.Thin;
  1561. worksheet.Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
  1562. //worksheet.Cell(1, i++).Value = "BetId";
  1563. if (list != null && list.Count > 0)
  1564. {
  1565. int rowIdx = 3;
  1566. long totalMoney = 0;
  1567. long totalFee = 0;
  1568. long moneyTicket = 0;
  1569. for (int index = 1; index <= list.Count; index++)
  1570. {
  1571. i = 1;
  1572. var obj = list[index - 1];
  1573. totalMoney += long.Parse(obj.money);
  1574. totalFee += long.Parse(obj.fee);
  1575. var ticketNum = obj.listTicket.Count;
  1576. worksheet.Range(rowIdx, i, rowIdx + ticketNum - 1, i).Merge();
  1577. worksheet.Cell(rowIdx, i++).Value = index;
  1578. worksheet.Range(rowIdx, i, rowIdx + ticketNum - 1, i).Merge();
  1579. worksheet.Cell(rowIdx, i++).Value = obj.user;
  1580. worksheet.Range(rowIdx, i, rowIdx + ticketNum - 1, i).Merge();
  1581. worksheet.Cell(rowIdx, i++).Value = obj.billCode;
  1582. worksheet.Range(rowIdx, i, rowIdx + ticketNum - 1, i).Merge();
  1583. worksheet.Cell(rowIdx, i++).Value = obj.channel;
  1584. worksheet.Range(rowIdx, i, rowIdx + ticketNum - 1, i).Merge();
  1585. worksheet.Cell(rowIdx, i++).Value = obj.money;
  1586. worksheet.Range(rowIdx, i, rowIdx + ticketNum - 1, i).Merge();
  1587. worksheet.Cell(rowIdx, i++).Value = obj.fee;
  1588. worksheet.Range(rowIdx, i, rowIdx + ticketNum - 1, i).Merge();
  1589. worksheet.Cell(rowIdx, i).Style.DateFormat.Format = "dd/MM/yyyy HH:mm:ss";
  1590. worksheet.Cell(rowIdx, i++).Value = DateTime.ParseExact(obj.buyTime, "dd/MM/yyyy HH:mm:ss", null);
  1591. worksheet.Range(rowIdx, i, rowIdx + ticketNum - 1, i).Merge();
  1592. worksheet.Cell(rowIdx, i++).Value = obj.gameName;
  1593. //ticket list
  1594. for (int j = 0; j < ticketNum; j++)
  1595. {
  1596. var ticket = obj.listTicket[j];
  1597. moneyTicket += long.Parse(ticket.money);
  1598. worksheet.Cell(rowIdx, i).Value = ticket.ticket;
  1599. worksheet.Cell(rowIdx, i + 1).Value = ticket.money;
  1600. worksheet.Cell(rowIdx, i + 2).Value = ticket.turnId;
  1601. rowIdx++;
  1602. }
  1603. //rowIdx += ticketNum;
  1604. }
  1605. // total row
  1606. worksheet.Row(rowIdx).Style.Border.TopBorder = XLBorderStyleValues.Thin;
  1607. worksheet.Row(rowIdx).Style.Font.Bold = true;
  1608. worksheet.Row(rowIdx).Height = 20;
  1609. worksheet.Row(rowIdx).Style.Font.FontSize = 13;
  1610. worksheet.Row(rowIdx).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
  1611. worksheet.Cell(rowIdx, 2).Value = "Total";
  1612. worksheet.Cell(rowIdx, 5).Value = totalMoney;
  1613. worksheet.Cell(rowIdx, 6).Value = totalFee;
  1614. worksheet.Cell(rowIdx, 10).Value = moneyTicket;
  1615. }
  1616. using (var stream = new MemoryStream())
  1617. {
  1618. workbook.SaveAs(stream);
  1619. var content = stream.ToArray();
  1620. return File(content, contentType, fileName);
  1621. }
  1622. }
  1623. }
  1624. catch (Exception ex)
  1625. {
  1626. return null;
  1627. }
  1628. }
  1629. }
  1630. }