Browse Source

update luckycall

sungrouptech 10 months ago
parent
commit
f29ae212c5
47 changed files with 1001 additions and 444 deletions
  1. 2 2
      LuckyCallWebCore/LuckyCallWebCore/Controllers/BaseController.cs
  2. 70 49
      LuckyCallWebCore/LuckyCallWebCore/Controllers/HomeController.cs
  3. 5 5
      LuckyCallWebCore/LuckyCallWebCore/Resources/Lang.Designer.cs
  4. 1 1
      LuckyCallWebCore/LuckyCallWebCore/Resources/Lang.fr.resx
  5. 4 4
      LuckyCallWebCore/LuckyCallWebCore/Resources/Lang.resx
  6. 39 44
      LuckyCallWebCore/LuckyCallWebCore/Views/Home/Guide_1.cshtml
  7. 38 42
      LuckyCallWebCore/LuckyCallWebCore/Views/Home/Guide_2.cshtml
  8. 3 3
      LuckyCallWebCore/LuckyCallWebCore/Views/Partial/_TopCoin.cshtml
  9. 7 7
      LuckyCallWebCore/LuckyCallWebCore/Views/Shared/_Layout.cshtml
  10. 1 1
      LuckyCallWebCore/LuckyCallWebCore/Views/_ViewImports.cshtml
  11. BIN
      LuckyCallWebCore/LuckyCallWebCore/wwwroot/images/background.png
  12. BIN
      LuckyCallWebCore/LuckyCallWebCore/wwwroot/images/background_bk.png
  13. BIN
      LuckyCallWebCore/LuckyCallWebCore/wwwroot/images/setting/an.png
  14. 7 0
      ProcessLuckyCard/ProcessLuckyCard/src/com/vas/luckycall/process/ImportSignal.java
  15. 95 77
      ProcessLuckyCard/ProcessLuckyCard/src/com/vas/luckycall/process/SignalProcess.java
  16. 2 1
      ProcessLuckyCard/ProcessLuckyCard/src/com/vas/portal/process/ExecutePrize.java
  17. 84 8
      ProcessLuckyCard/ProcessLuckyCard/src/com/vas/portal/utils/database/DbProcessor.java
  18. 10 0
      ProcessLuckyCard/ProcessLuckyCard/src/com/vas/portal/utils/object/InvitationObj.java
  19. 10 0
      ProcessLuckyCard/ProcessLuckyCard/src/com/vas/portal/utils/object/SvAdv.java
  20. 10 0
      ProcessLuckyCard/ProcessLuckyCard/src/com/vas/portal/utils/object/SvAdvScheduler.java
  21. 18 0
      ProcessLuckyCard/ProcessLuckyCard/src/com/vas/portal/utils/service/WSProcessor.java
  22. 34 34
      ProcessLuckyCard/etc/agent.cfg
  23. 3 6
      ProcessLuckyCard/etc/database.xml
  24. 2 9
      ReportWebCore/Db_LibCore/SqlConnString.cs
  25. 47 9
      ReportWebCore/SuperAdmin/Controllers/AdminController.cs
  26. 25 0
      ReportWebCore/SuperAdmin/Controllers/LuckySpinController.cs
  27. 19 0
      ReportWebCore/SuperAdmin/Models/Http/ErrResponse.cs
  28. 14 0
      ReportWebCore/SuperAdmin/Models/Services.cs
  29. 14 0
      ReportWebCore/SuperAdmin/Models/SvAdv.cs
  30. 19 0
      ReportWebCore/SuperAdmin/Models/SvAdvSchedule.cs
  31. 48 0
      ReportWebCore/SuperAdmin/Models/UserCoin.cs
  32. 1 1
      ReportWebCore/SuperAdmin/Properties/PublishProfiles/FolderProfile1.pubxml
  33. 21 0
      ReportWebCore/SuperAdmin/Properties/PublishProfiles/FolderProfile2.pubxml
  34. 1 1
      ReportWebCore/SuperAdmin/ReportWebCore.csproj
  35. 115 39
      ReportWebCore/SuperAdmin/Source/DbConnector.cs
  36. 6 0
      ReportWebCore/SuperAdmin/Views/Admin/ServiceAdvCounter.cshtml
  37. 81 61
      ReportWebCore/SuperAdmin/Views/Admin/ServiceAdvManagement.cshtml
  38. 11 5
      ReportWebCore/SuperAdmin/Views/Admin/ServiceAdvScheduler.cshtml
  39. 29 11
      ReportWebCore/SuperAdmin/Views/Admin/_ScheduleDetail.cshtml
  40. 81 9
      ReportWebCore/SuperAdmin/Views/LuckySpin/Ranking.cshtml
  41. 1 1
      ReportWebCore/SuperAdmin/appsettings.json
  42. 4 0
      ReportWebCore/SuperAdmin/wwwroot/admin-assets/js/admin.js
  43. 1 0
      WebserviceLuckyCard/WsLuckyCard/src/com/vas/webservices/WsCommon.java
  44. 1 1
      WebserviceLuckyCard/WsLuckyCard/src/com/vas/webservices/WsLuckyCall.java
  45. 14 10
      WebserviceLuckyCard/WsLuckyCard/src/com/vas/webservices/WsMps.java
  46. 1 1
      WebserviceLuckyCard/WsLuckyCard/src/com/vas/wsfw/database/WsProcessUtils.java
  47. 2 2
      WebserviceLuckyCard/etc/database.xml

+ 2 - 2
LuckyCallWebCore/LuckyCallWebCore/Controllers/BaseController.cs

@@ -19,7 +19,7 @@ using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Mvc;
 using Microsoft.Extensions.Configuration;
 using Microsoft.Extensions.Primitives;
-using LuckyCallWebCore.Resources;
+using Mzb_LuckyCall.Resources;
 using Newtonsoft.Json;
 using Newtonsoft.Json.Linq;
 using Org.BouncyCastle.Crypto;
@@ -225,7 +225,7 @@ namespace LuckyCallWebCore.Controllers
             //{
             //    // Add a HTTP Header to an outgoing request
             //    HttpRequestMessageProperty requestMessage = new HttpRequestMessageProperty();
-            //    requestMessage.Headers["lang"] = getCurrentLang();
+            //    requestMessage.Headers["Lang"] = getCurrentLang();
             //    OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = requestMessage;
             //}
         }

+ 70 - 49
LuckyCallWebCore/LuckyCallWebCore/Controllers/HomeController.cs

@@ -9,7 +9,7 @@ using System;
 using LuckyCallWebCore.Extensions;
 using LuckyCallWebCore.Models;
 using System.Threading.Tasks;
-using LuckyCallWebCore.Resources;
+using Mzb_LuckyCall.Resources;
 using System.ServiceModel;
 using System.ServiceModel.Channels;
 
@@ -545,37 +545,44 @@ namespace LuckyCallWebCore.Controllers
             {
                 ServiceAPI.response subInfo = null;
                 SetWsClient(ref wsClient, msisdn);
-                ServiceAPI.response res = wsClient.wsLogin(wsUser, wsPassword, password, msisdn);
-
-                if (res.errorCode == "0")
-                {
-                    // login success --> store session
-                    CreateAuthToken(msisdn, null);
-                    ReloadUserInfo(msisdn);
-                    LoginSuccessAction();
-                }
-                else
+                using (new OperationContextScope(wsClient.InnerChannel))
                 {
-                    LoginFailAction();
-                }
+                    // Add a HTTP Header to an outgoing request
+                    HttpRequestMessageProperty requestMessage = new HttpRequestMessageProperty();
+                    requestMessage.Headers["lang"] = getCurrentLang();
+                    OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = requestMessage;
+                    ServiceAPI.response res = wsClient.wsLogin(wsUser, wsPassword, password, msisdn);
 
-                if (subInfo != null)
-                {
-                    return Json(new
+                    if (res.errorCode == "0")
                     {
-                        error = res.errorCode,
-                        content = res.content,
-                        msisdn = msisdn.Substring(3)
-                    });
-                }
-                else
-                {
-                    return Json(new
+                        // login success --> store session
+                        CreateAuthToken(msisdn, null);
+                        ReloadUserInfo(msisdn);
+                        LoginSuccessAction();
+                    }
+                    else
                     {
-                        error = res.errorCode,
-                        content = res.content,
-                        msisdn = msisdn.Substring(3)
-                    });
+                        LoginFailAction();
+                    }
+
+                    if (subInfo != null)
+                    {
+                        return Json(new
+                        {
+                            error = res.errorCode,
+                            content = res.content,
+                            msisdn = msisdn.Substring(3)
+                        });
+                    }
+                    else
+                    {
+                        return Json(new
+                        {
+                            error = res.errorCode,
+                            content = res.content,
+                            msisdn = msisdn.Substring(3)
+                        });
+                    }
                 }
             }
             else
@@ -614,22 +621,29 @@ namespace LuckyCallWebCore.Controllers
             if (msisdn != "")
             {
                 SetWsClient(ref wsClient, msisdn);
-                ServiceAPI.response res = wsClient.wsCreateAccount(wsUser, wsPassword, "", msisdn);
-
-                if (res.errorCode == "0")
+                using (new OperationContextScope(wsClient.InnerChannel))
                 {
-                    // signup success --> store session
-                    SetLastSignUp();
-                    CreateAuthToken(msisdn, null);
-                    ReloadUserInfo(msisdn);
-                }
+                    // Add a HTTP Header to an outgoing request
+                    HttpRequestMessageProperty requestMessage = new HttpRequestMessageProperty();
+                    requestMessage.Headers["lang"] = getCurrentLang();
+                    OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = requestMessage;
+                    ServiceAPI.response res = wsClient.wsCreateAccount(wsUser, wsPassword, "", msisdn);
 
-                return Json(new
-                {
-                    error = res.errorCode,
-                    content = res.content,
-                    msisdn = msisdn.Substring(3)
-                });
+                    if (res.errorCode == "0")
+                    {
+                        // signup success --> store session
+                        SetLastSignUp();
+                        CreateAuthToken(msisdn, null);
+                        ReloadUserInfo(msisdn);
+                    }
+
+                    return Json(new
+                    {
+                        error = res.errorCode,
+                        content = res.content,
+                        msisdn = msisdn.Substring(3)
+                    });
+                }
             }
             else
             {
@@ -660,14 +674,21 @@ namespace LuckyCallWebCore.Controllers
             if (msisdn != "")
             {
                 SetWsClient(ref wsClient, msisdn);
-                ServiceAPI.response res = wsClient.wsResetPassword(wsUser, wsPassword, msisdn);
-
-                SetLastResetPass();
-                return Json(new
+                using (new OperationContextScope(wsClient.InnerChannel))
                 {
-                    error = res.errorCode,
-                    content = res.content
-                });
+                    // Add a HTTP Header to an outgoing request
+                    HttpRequestMessageProperty requestMessage = new HttpRequestMessageProperty();
+                    requestMessage.Headers["lang"] = getCurrentLang();
+                    OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = requestMessage;
+                    ServiceAPI.response res = wsClient.wsResetPassword(wsUser, wsPassword, msisdn);
+
+                    SetLastResetPass();
+                    return Json(new
+                    {
+                        error = res.errorCode,
+                        content = res.content
+                    });
+                }
             }
             else
             {

+ 5 - 5
LuckyCallWebCore/LuckyCallWebCore/Resources/Lang.Designer.cs

@@ -8,7 +8,7 @@
 // </auto-generated>
 //------------------------------------------------------------------------------
 
-namespace LuckyCallWebCore.Resources {
+namespace Mzb_LuckyCall.Resources {
     using System;
     
     
@@ -385,7 +385,7 @@ namespace LuckyCallWebCore.Resources {
         }
         
         /// <summary>
-        ///   Looks up a localized string similar to MY GIFT.
+        ///   Looks up a localized string similar to My Gift.
         /// </summary>
         public static string MyGift {
             get {
@@ -601,7 +601,7 @@ namespace LuckyCallWebCore.Resources {
         }
         
         /// <summary>
-        ///   Looks up a localized string similar to 1. Ranking is based on the player&apos;s coins. The more coins a player has, the higher the rank. The player with the highest number of coins will receive 50.000HTG from the service.
+        ///   Looks up a localized string similar to 1. Ranking is based on the player&apos;s coins. The more coins a player has, the higher the rank. The player with the highest number of coins will receive Iphone 10.000 MT from the service.
         /// </summary>
         public static string RuleDetail1 {
             get {
@@ -628,7 +628,7 @@ namespace LuckyCallWebCore.Resources {
         }
         
         /// <summary>
-        ///   Looks up a localized string similar to The player who achieved the highest and fastest number of coins in the month will receive 50.000HTG.
+        ///   Looks up a localized string similar to The player who achieved the highest and fastest number of coins in the month will receive the IPhone 10.000 MT.
         /// </summary>
         public static string SpecialPrizeDetail {
             get {
@@ -736,7 +736,7 @@ namespace LuckyCallWebCore.Resources {
         }
         
         /// <summary>
-        ///   Looks up a localized string similar to winners list.
+        ///   Looks up a localized string similar to Winners List.
         /// </summary>
         public static string WinnerList {
             get {

+ 1 - 1
LuckyCallWebCore/LuckyCallWebCore/Resources/Lang.fr.resx

@@ -283,7 +283,7 @@
     <value>Prémio</value>
   </data>
   <data name="RankingCoin" xml:space="preserve">
-    <value>Moeda de Classificação </value>
+    <value>Classificação </value>
   </data>
   <data name="RankUpdate" xml:space="preserve">
     <value>Actualizado a cada meia hora</value>

+ 4 - 4
LuckyCallWebCore/LuckyCallWebCore/Resources/Lang.resx

@@ -226,7 +226,7 @@
     <value>My coin</value>
   </data>
   <data name="MyGift" xml:space="preserve">
-    <value>MY GIFT</value>
+    <value>My Gift</value>
   </data>
   <data name="MyPackage" xml:space="preserve">
     <value>My Package</value>
@@ -298,7 +298,7 @@
     <value>Rule</value>
   </data>
   <data name="RuleDetail1" xml:space="preserve">
-    <value>1. Ranking is based on the player's coins. The more coins a player has, the higher the rank. The player with the highest number of coins will receive 50.000HTG from the service</value>
+    <value>1. Ranking is based on the player's coins. The more coins a player has, the higher the rank. The player with the highest number of coins will receive Iphone 10.000 MT from the service</value>
   </data>
   <data name="RuleDetail2" xml:space="preserve">
     <value>2. Leaderboard is refreshed every half hour</value>
@@ -307,7 +307,7 @@
     <value>Special Prize</value>
   </data>
   <data name="SpecialPrizeDetail" xml:space="preserve">
-    <value>The player who achieved the highest and fastest number of coins in the month will receive 50.000HTG</value>
+    <value>The player who achieved the highest and fastest number of coins in the month will receive the IPhone 10.000 MT</value>
   </data>
   <data name="Spin" xml:space="preserve">
     <value>Spin</value>
@@ -343,7 +343,7 @@
     <value>List of winners of the week</value>
   </data>
   <data name="WinnerList" xml:space="preserve">
-    <value>winners list</value>
+    <value>Winners List</value>
   </data>
   <data name="YouWon" xml:space="preserve">
     <value>You won!</value>

+ 39 - 44
LuckyCallWebCore/LuckyCallWebCore/Views/Home/Guide_1.cshtml

@@ -15,61 +15,56 @@
         <p style="font-size: 18px;">@Lang.Introduction</p>
     </div>
     <div class="group-info_service">
-        <p style="margin-left:0in;"><strong>Kijan pouw jwe</strong></p>
-        <p style="margin-left:0in;">Lucky Call se yon sevis apel sou fom vire pouw ka gen chans genyen prim entenet,mesaj,telefon sou aplikasyon NatID a.</p>
-        <p style="margin-left:0in;">Kado espesyan lew anrejistre epi akimile pi gwo kantite pwen nan mwa e rive nan pi gwo nivo avan,wap resevwa prim espesyal nan nwa kise 50.000HTG. Gen opotinite pouw resevwa bel ak anpil prim ki valab.</p>
-        <p style="margin-left:0in;">Kijan pouw gen chans vire? Aprew fin pale nan jounen an, system nan ap baw chans pouw vire gratis apre chak apel e li gratis.</p>
-        <p style="margin-left:0in;">Aplike: Yo touche sou kont prensipal ou pou apel sa</p>
+        <p style="margin-left:0in;"><strong>COMO JOGAR O VOZ DA SORTE</strong></p>
+        <p style="margin-left:0in;">Voz da Sorte é um serviço de chamadas de sorte na forma de um giro de sorte para ter a oportunidade de ganhar dados de internet, crédito na conta bónus do cliente e dinheiro no e-Mola.</p>
+        <p style="margin-left:0in;">Presente especial ao se cadastrar e acumular o maior número de pontos no mês e atingir a classificação mais alta primeiro, você receberá um prêmio especial mensal de 10.000 MT no e-Mola . Oportunidade de receber muitos presentes atraentes e valiosos.</p>
+        <p style="margin-left:0in;">Como ganhar um giro da sorte? Após terminar a chamada do dia, o sistema enviará um giro da sorte grátis após o término de cada ligação e não há taxa para esse giro.</p>
         <br />
-        <p style="margin-left:0in;"><strong>Anrejistre:</strong></p>
-        <p style="margin-left:0in;">Plan pa jou : wap resevwa 3 vire/jou (3HTG/jou/3 tou).</p>
-        <p style="margin-left:0in;">Plan 7 jou: Wap resevwa 14 vire/semen (2 vire pa jou) (10HTG/jou/14 fwa)</p>
-        <p style="margin-left:0in;">Kantite vire wap jwenn apre chak tanw fin pale siw anrejistre nan sevis la. Pouw ka vire, itilizate yo dwe fe 1 minit ap pale pou pi piti, apel pi ba k esa pap ka vire. Swiv tab sa:</p>
-        <p style="margin-left:0in;">Calling package:&nbsp;<span style="">On-net/Off-net</span></p>
+        <p style="margin-left:0in;"><strong>Registro:</strong></p>
+        <p style="margin-left:0in;">Pacote diário: você receberá 3 giros/dia (2 MT/dia/3 giros).</p>
+        <p style="margin-left:0in;">Pacote semanal: você receberá 21 giros/semana (3 giros por dia) (10 MT/dia/21 giros)</p>
+        <p style="margin-left:0in;">Na tabela abaixo podemos verificar o número de giros da sorte que podes receber após o término de cada chamada se registrares o serviço.</p>
+
         <ul>
-            <li><span style="">1minute &lt;=A&lt; 2 minutes: 2 spins</span></li>
-            <li><span style="">2 minutes &lt;= A &lt; 5 minutes: 4 spins</span></li>
-            <li><span style="">&gt;= 5 minutes: 7 spins</span></li>
+            <li><span style="">&lt; 1 minuto: 2 giros</span></li>
+            <li><span style="">1 minuto &lt;= A &lt; 5 minutos: 4 giros</span></li>
+            <li><span style="">&gt;= 5 minutos: 7 giros</span></li>
         </ul>
         <p style="margin-left:0in;">&nbsp;</p>
-        <p style="margin-left:0in;">Le: Le a se 7 jou avan dat ou resevwa li a. Vire yo ap espire apre 7 jou (23:59:59).</p>
+        <p style="margin-left:0in;">Tempo de uso: O tempo é de 7 dias a partir da data em que recebeste. Os giros irão expirar após 7 dias (23:59:59).</p>
         <br />
-        <p style="margin-left:0in;"><strong>Prim:</strong></p>
-        <p style="margin-left:0in;">Lew vire wap gen chans genyen youn nan prim say o:</p>
-        <p style="margin-left:0in;"><span style=""><strong>Daily Prize</strong></span></p>
+        <p style="margin-left:0in;"><strong>Prêmio:</strong></p>
+        <p style="margin-left:0in;">Ao girar, terás a chance de receber um dos seguintes prêmios:</p>
+        <p style="margin-left:0in;"><span style=""><strong>Prêmio Diário</strong></span></p>
         <ul>
-            <li><span style="">10 SMS (24h)</span></li>
-            <li><span style="">20 SMS (24h)</span></li>
-            <li><span style="">30 SMS (24h)</span></li>
-            <li><span style="">50 SMS (24h)</span></li>
-            <li><span style="">20 MB data (24h)</span></li>
-            <li><span style="">50 MB data (24h)</span></li>
-            <li><span style="">100 MB data&nbsp;(24h)</span></li>
-            <li><span style="">5 coins</span></li>
-            <li><span style="">10 coins</span></li>
-            <li><span style="">20 coins</span></li>
-            <li><span style="">30 coins</span></li>
+            <li><span style="">5 MB de internet (24h)</span></li>
+            <li><span style="">10 MB de internet (24h)</span></li>
+            <li><span style="">15 MB de internet (24h)</span></li>
+            <li><span style="">20 MB de internet (24h)</span></li>
+            <li><span style="">3 MT de crédito na conta bónus (24h)</span></li>
+            <li><span style="">5 MT de crédito na conta bónus (24h)</span></li>
+            <li><span style="">10 MT de crédito na conta bónus (24h)</span></li>
+            <li><span style="">5 moedas</span></li>
+            <li><span style="">10 moedas</span></li>
+            <li><span style="">15 moedas</span></li>
+            <li><span style="">20 moedas</span></li>
         </ul>
-        <p style="margin-left:0in;"><span style=""><strong>Monthly Prize</strong></span></p>
+        <p style="margin-left:0in;"><span style=""><strong>Prêmio Mensal</strong></span></p>
         <ul>
-            <li><span style="">50.000 HTG</span></li>
+            <li><span style="">10.000 MT</span></li>
         </ul>
-        <p style="margin-left:0in;">&nbsp;</p>
-        <p style="margin-left:0in;">Kijan pouw anrejistre?</p>
-        <p style="margin-left:0in;">Ou ka anrejistre direkteman nan aplikasyon an, klike “anrejistre plan pa jou” oswa “anrejistre plan semen” nan paj akey la</p>
-        <p style="margin-left:0in;">Anrejistre sou telefon;</p>
+        <p style="margin-left:0in;">Prémio especial de 10.000 MT para o cliente com maior pontuação (Classificação).</p>
+
         <br />
-        <p style="margin-left:0in;"><strong>Plan jou</strong></p>
-        <p style="margin-left:0in;">Konpoze *7080#, peze 1 oswa *7080*1#</p>
-        <p style="margin-left:0in;">Pri: 3HTG/ semen/3 vire pa jou</p>
-        <p style="margin-left:0in;"><strong>Plan 7 jou</strong></p>
-        <p style="margin-left:0in;">Konpoze *7080#, peze 2 oswa *7080*2#</p>
-        <p style="margin-left:0in;">Pri: 10HTG/ semen/2 vire pa jou</p>
+
+        <p style="margin-left:0in;"><strong>Regista pelo celular</strong></p>
+        <p style="margin-left:0in;"><strong>Pacote diário:</strong></p>
+        <p style="margin-left:0in;">Digita *1540#, pressiona 1 para registar o pacote diário, pressiona 1 “Pagar via conta básica” ou pressione 2 “Pagar via e- Mola ”</p>
+        <p style="margin-left:0in;">Taxa: 2 MT/dia/3 rodadas</p>
         <br />
-        <p style="margin-left:0in;"><strong>Kijan pouw jwe</strong></p>
-        <p style="margin-left:0in;">Jwe sou aplikasyon an</p>
-        <p style="margin-left:0in;">Nan paj dakey la, klike sou bwat kado a pouw ouvril. Chak bwat kado koresponn ak kado ou ka jwenn.</p>
-        <p style="margin-left:0in;">Pouw we nan ki nivo ou ye, klike sou “Nivo”</p>
+        <p style="margin-left:0in;"><strong>Pacote semanal</strong></p>
+        <p style="margin-left:0in;">Digita *1540#, pressiona 2 para registar o pacote semanal, pressiona 1 “Pagar via conta básica” ou pressiona 2 “Pagar via e- Mola ”</p>
+        <p style="margin-left:0in;">Taxa: 10 MT/semana/3 rodadas por dia</p>
     </div>
 </main>
 <!-- End Content page  -->

+ 38 - 42
LuckyCallWebCore/LuckyCallWebCore/Views/Home/Guide_2.cshtml

@@ -15,59 +15,55 @@
         <p style="font-size: 18px;">@Lang.Introduction</p>
     </div>
     <div class="group-info_service">
-        <p style="margin-left:0in;"><strong>INTRODUCING HOW TO PLAY</strong></p>
-        <p style="margin-left:0in;">Lucky Call is a lucky calling service in the form of a lucky spin to have the opportunity to give Data, SMS, 50.000 HTG rewards on the NatID application to customers.</p>
-        <p style="margin-left:0in;"><br>Special gift when you register and accumulate the highest number of points in the month and reach the highest rank first, you will receive a special monthly prize of 50.000HTG. Opportunity to receive many attractive and valuable gifts.</p>
-        <p style="margin-left:0in;"><br>How to earn lucky spin? After ending the call for the day, the system will send a free lucky spin after each call ends and there is no fee for this spin.</p>
-        <p style="margin-left:0in;">Apply: Your call spend balance from your main account.</p>
-        <br />
-        <p style="margin-left:0in;"><br><strong>Register:&nbsp;</strong></p>
-        <p style="margin-left:0in;">Daily package: you will receive 3 spins/day (3 HTG/day/3 turns).</p>
-        <p style="margin-left:0in;">Weekly package: you will receive 14 spins/week (2 spins per day) (10 HTG/day/14 turns).</p>
-        <p style="margin-left:0in;">The number of lucky spins you can receive after each call ends if you register for the service. To get a spin, users must call for at least 1 minute, and calls under 1 minute will not be eligible. Follow this:</p>
+        <p style="margin:0in 0in 12.0pt;"><span><strong>INTRODUCING HOW TO PLAY</strong></span></p>
+        <p style="margin:0in 0in 12.0pt;"><span>Lucky Call is a lucky calling service in the form of a lucky spin to have the opportunity to give Data, basic account rewards to customers.</span></p>
+        <p style="margin:0in 0in 12.0pt;"><span>Special gift when you register and accumulate the highest number of points in the month and reach the highest rank first, you will receive a special monthly prize of an 10.000 MT add wallet eMoney. Opportunity to receive many attractive and valuable gifts.</span></p>
+        <p style="margin:0in 0in 12.0pt;"><span>How to earn lucky spin? After ending the call for the day, the system will send a free lucky spin after each call ends and there is no fee for this spin.</span></p>
+        <p style="margin:0in 0in 12.0pt;"><br><strong>Register: </strong></p>
+        <p style="margin:0in 0in 12.0pt;"><span>Daily package: you will receive 3 spins/day (2 MT/day/3 turns).</span></p>
+        <p style="margin:0in 0in 12.0pt;"><span>Weekly package: you will receive 21 spins/week (3 spins per day) (10 MT/day/21 turns).</span></p>
+        <p>&nbsp;</p>
+        <p style="margin:0in 0in 12.0pt;"><span>The number of lucky spins you can receive after each call ends if you register for the service. Follow this table:</span></p>
         <ul>
-            <li><span style="">1minute &lt;=A&lt; 2 minutes: 2 spins</span></li>
-            <li><span style="">2 minutes &lt;= A &lt; 5 minutes: 4 spins</span></li>
+            <li><span style="">&lt; 1 minute: 2 spins</span></li>
+            <li><span style="">1 minute &lt;= A &lt; 5 minutes: 4 spins</span></li>
             <li><span style="">&gt;= 5 minutes: 7 spins</span></li>
         </ul>
-        <p style="margin-left:0in;">Use time: The time is 7 days from the date you receive it. Spins will expire after 7 days (23:59:59).</p>
-        <br />
-        <p style="margin-left:0in;"><span style=""><strong>Prize:</strong></span></p>
-        <p style="margin-left:0in;"><br>When spinning, you will have a chance to receive one of the following prizes:</p>
-        <p style="margin-left:0in;"><br><span style=""><strong>Daily Prize</strong></span></p>
+
+        <p style="margin:0in 0in 12.0pt;"></p>
+        <p style="margin:0in 0in 12.0pt;">
+            <span>Use time: The time is 7 days from the date you receive it. Spins will expire after 7 days (23:59:59).</span>
+            <span><strong></strong></span>
+        </p>
+        <p style="margin:0in 0in 12.0pt;"><strong>Prize:</strong><br>When spinning, you will have a chance to receive one of the following prizes:<strong></strong></p>
+        <p style="margin-left:0in;"><span style=""><strong>Daily Prize</strong></span></p>
         <ul>
-            <li><span style="">10 SMS (24h)</span></li>
-            <li><span style="">20 SMS (24h)</span></li>
-            <li><span style="">30 SMS (24h)</span></li>
-            <li><span style="">50 SMS (24h)</span></li>
-            <li><span style="">20 MB data (24h)</span></li>
-            <li><span style="">50 MB data (24h)</span></li>
-            <li><span style="">100 MB data&nbsp;(24h)</span></li>
+            <li><span style="">5 MB for mobile (24h)</span></li>
+            <li><span style="">10 MB for mobile (24h)</span></li>
+            <li><span style="">15 MB for mobile (24h)</span></li>
+            <li><span style="">20 MB for mobile (24h)</span></li>
+            <li><span style="">3 MT airtime (24h)</span></li>
+            <li><span style="">5 MT airtime (24h)</span></li>
+            <li><span style="">10 MT airtime (24h)</span></li>
             <li><span style="">5 coins</span></li>
             <li><span style="">10 coins</span></li>
+            <li><span style="">15 coins</span></li>
             <li><span style="">20 coins</span></li>
-            <li><span style="">30 coins</span></li>
         </ul>
         <p style="margin-left:0in;"><span style=""><strong>Monthly Prize</strong></span></p>
         <ul>
-            <li><span style="">50.000 HTG</span></li>
+            <li><span style="">10.000 MT</span></li>
         </ul>
-        <p style="margin-left:0in;"><br>50.000 HTG special prize for the user with the highest score (Ranking).</p>
-        <p style="margin-left:0in;"><br>How to register ?</p>
-        <p style="margin-left:0in;">Register directly on the application, click "Register for daily package" or "Register for weekly package" on the home page</p>
-        <br />
-        <p style="margin-left:0in;"><br><strong>Register via mobile phone.</strong></p>
-        <p style="margin-left:0in;"><strong>Daily package:</strong></p>
-        <p style="margin-left:0in;">Dial *7080#, press 1 or dial *7080*1#</p>
-        <p style="margin-left:0in;">Fee: 3 HTG/day/3 spins</p>
-        <p style="margin-left:0in;"><strong>Weekly package:</strong></p>
-        <p style="margin-left:0in;">Dial *7080#, press 2 or *7080*2#</p>
-        <p style="margin-left:0in;">Fee: 10 HTG/week/2 spins per day</p>
-        <br />
-        <p style="margin-left:0in;"><br><span style=""><strong>How to play:</strong></span></p>
-        <p style="margin-left:0in;">Play on the app</p>
-        <p style="margin-left:0in;">On the home page, click on the gift box to open the gift. Each gift box corresponds to a gift you can receive.</p>
-        <p style="margin-left:0in;">To see your ranking, please click "Score Ranking".</p>
+        <p style="margin:0in 0in 12.0pt;"><br><span>10.000 MT special prize for the user with the highest score (Ranking).</span></p>
+        <p style="margin:0in 0in 12.0pt;"><br><span><strong>How to register ?</strong></span></p>
+        <p style="margin:0in 0in 12.0pt;"><span>Register directly on the application, click "Register for daily package" or "Register for weekly package" on the home page</span></p>
+        <p style="margin:0in 0in 12.0pt;"><br><span><strong>Register via mobile phone.</strong></span></p>
+        <p style="margin:0in 0in 12.0pt;"><span><strong>Daily package:</strong></span></p>
+        <p style="margin:0in 0in 12.0pt;"><span>Dial *1540#, press 1 or dial *1540*1#, choose press 1 “Pay via basic account” or press 2 “Pay via e-Mola”</span></p>
+        <p style="margin:0in 0in 12.0pt;"><span>Fee: 2 MT/day/3 spins</span></p>
+        <p style="margin:0in 0in 12.0pt;"><span><strong>Weekly package:</strong></span></p>
+        <p style="margin:0in 0in 12.0pt;"><span>Dial *1540#, press 2 or *1540*2#, choose press 1 “Pay via basic account” or press 2 “Pay via e-Mola”</span></p>
+        <p style="margin:0in 0in 12.0pt;"><span>Fee: 10 MT/week/3 spins per day</span></p>
     </div>
 </main>
 <!-- End Content page  -->

+ 3 - 3
LuckyCallWebCore/LuckyCallWebCore/Views/Partial/_TopCoin.cshtml

@@ -20,15 +20,15 @@
                 <div class="w-25">
                     @if (i == 0)
                     {
-                        <img class="num" src="images/leaderboard/vang.png" alt="gold">
+                        <img class="num" src="/images/leaderboard/vang.png" alt="gold">
                     }
                     else if (i == 1)
                     {
-                        <img class="num" src="images/leaderboard/bac.png" alt="gold">
+                        <img class="num" src="/images/leaderboard/bac.png" alt="gold">
                     }
                     else if (i == 2)
                     {
-                        <img class="num" src="images/leaderboard/dong.png" alt="gold">
+                        <img class="num" src="/images/leaderboard/dong.png" alt="gold">
                     }
                     else
                     {

+ 7 - 7
LuckyCallWebCore/LuckyCallWebCore/Views/Shared/_Layout.cshtml

@@ -20,19 +20,19 @@
     <meta name="viewport" content="width=device-width, initial-scale=1.0" />
 
     <link rel="shortcut icon" href="/favicon.ico?v=1.1" type="image/x-icon" />
-    <title>Movitel - LUCKY CALL</title>
-    <meta name="description" content="Movitel - LUCKY CALL" />
-    <meta name="keywords" content="Movitel, lucky, call" />
+    <title>Movitel - Voz da Sorte</title>
+    <meta name="description" content="Movitel - Voz da Sorte" />
+    <meta name="keywords" content="Movitel, Voz da Sorte" />
     <meta property="og:locale" content="la_LA" />
-    <meta property="og:site_name" content="Movitel - LUCKY CALL" />
-    <meta property="og:title" content="Movitel - LUCKY CALL" />
-    <meta property="og:description" content="Movitel - LUCKY CALL" />
+    <meta property="og:site_name" content="Movitel - Voz da Sorte" />
+    <meta property="og:title" content="Movitel - Voz da Sorte" />
+    <meta property="og:description" content="Movitel - Voz da Sorte" />
     <meta property="og:type" content="website" />
     <meta property="og:url" content="@BaseController.RootHref" />
     <meta property="og:image" content="@(BaseController.RootHref + "/wheel/prize/10.png")" />
     <meta property="fb:app_id" content="@BaseController.FacebookAppId" />
     @*<meta name="google-adsense-account" content="ca-pub-6203932774218464" />*@
-    <link href="/" title="Movitel - LUCKY CALL" rel="canonical" />
+    <link href="/" title="Movitel - Voz da Sorte" rel="canonical" />
 
     @*<link href="~/css/bootstrap.min.css" rel="stylesheet" />*@
     <link rel="stylesheet" type="text/css" href="~/css/spin.css" />

+ 1 - 1
LuckyCallWebCore/LuckyCallWebCore/Views/_ViewImports.cshtml

@@ -1,7 +1,7 @@
 @using LuckyCallWebCore
 @using LuckyCallWebCore.Models
 @using LuckyCallWebCore.Source
-@using LuckyCallWebCore.Resources
+@using Mzb_LuckyCall.Resources
 @using ServiceAPI
 @using LuckyCallWebCore.Controllers;
 @using LuckyCallWebCore.Extensions;

BIN
LuckyCallWebCore/LuckyCallWebCore/wwwroot/images/background.png


BIN
LuckyCallWebCore/LuckyCallWebCore/wwwroot/images/background_bk.png


BIN
LuckyCallWebCore/LuckyCallWebCore/wwwroot/images/setting/an.png


+ 7 - 0
ProcessLuckyCard/ProcessLuckyCard/src/com/vas/luckycall/process/ImportSignal.java

@@ -162,8 +162,12 @@ public class ImportSignal extends ProcessRecordAbstract {
             raf = new RandomAccessFile(_file, "r");
 //            raf.seek(0);
 
+            // count cdr in day
+//            int allow = db.checkCdr();
+//            logger.info("Check allow = " + allow);
             // check in active time
             if (betweenFrameHour(Common.SCAN_SIGNAL_TIME)) {
+//                if (allow == 1) {
                 while ((line = raf.readLine()) != null) {
                     if (!line.isEmpty() && line.split("\\|").length >= 4) {
                         String[] values = line.split("\\|");
@@ -200,6 +204,9 @@ public class ImportSignal extends ProcessRecordAbstract {
                     db.insertCallSignal(listSignal);
                     listSignal.clear();
                 }
+//                } else {
+//                    logger.info("Limited signal in day");
+//                }
             } else {
                 logger.info("Not in frame signal call");
             }

+ 95 - 77
ProcessLuckyCard/ProcessLuckyCard/src/com/vas/luckycall/process/SignalProcess.java

@@ -79,7 +79,7 @@ public class SignalProcess extends ProcessRecordAbstract {
 
     @Override
     public List<Record> processListRecord(List<Record> listRecord) throws Exception {
-        int codeType = LuckyCallUtils.CodeType.LUCKY_CALL;
+        int codeType = LuckyCallUtils.CodeType.LUCKY_CARD;
         List<MtExtend> listMtExtend = new ArrayList();
         List<PushResord> listPush = new ArrayList();
         List<LuckySpinObj> listLuckySpin = new ArrayList();
@@ -100,11 +100,13 @@ public class SignalProcess extends ProcessRecordAbstract {
             }
         }
         HashMap<Integer, Integer> mCount = new HashMap();
+        int allow = db.checkCdr();
+        logger.info("Check allow = " + allow);
 
         for (Record record : listRecord) {
             CallSignalObj signalObj = (CallSignalObj) record;
             String msisdn = signalObj.getCallingNumber();
-            boolean invited = false;
+            boolean existed = false;
             boolean markedInvite = false;
             try {
                 // check invite
@@ -115,12 +117,13 @@ public class SignalProcess extends ProcessRecordAbstract {
                 }
                 InvitationObj invitation = null;
                 if (!listInvitation.isEmpty()) {
+                    existed = true;
                     invitation = listInvitation.get(0);
-                    if (invitation.getLastInvite().getTime() > atStartOfDay()) {
+                    if (invitation.getLastInvite().getTime() > atStartOfDay(2)) {
                         // already invited
-                        logger.info("Already invited in 2 days: " + msisdn);
-                        //continue;
-                        invited = true;
+                        logger.info("Already invited in days: " + msisdn);
+                        continue;
+                        //invited = true;
                     }
                 }
 
@@ -131,84 +134,98 @@ public class SignalProcess extends ProcessRecordAbstract {
 //                if (signalObj.getMoneyPaid() > 0) {
                 int spinAdded = LuckyCallUtils.getSpinLevel(signalObj.getCallDuration());
 //                }
-//                if (spinAdded > 0) {
-//                    // insert/update invite
-//                    if (!invited) {
-//                        if (invitation != null) {
-//                            invitation.setMessageType(signalObj.getMessageType());
-//                            db.updateInvitation(invitation);
-//                        } else {
-//                            invitation = new InvitationObj();
-//                            invitation.setMsisdn(msisdn);
-//                            invitation.setMessageType(signalObj.getMessageType());
-//                            db.insertInvitation(invitation);
-//                        }
-//                    }
-//                }
-
-                LuckySpinObj lc = new LuckySpinObj();
-                lc.setMsisdn(msisdn);
-                lc.setExpireTime(getExpireSpin());
-                lc.setAdded(spinAdded);
-                lc.setUsed(0);
-                lc.setChannelAdd(LuckyCallUtils.Channel.CALL);
                 if (spinAdded > 0) {
+                    // insert/update invite
+                    //if (!invited) {
+                    if (invitation != null) {
+                        invitation.setMessageType(signalObj.getMessageType());
+                        db.updateInvitation(invitation);
+                    } else {
+                        invitation = new InvitationObj();
+                        invitation.setMsisdn(msisdn);
+                        invitation.setMessageType(signalObj.getMessageType());
+                        db.insertInvitation(invitation);
+                    }
+                    existed = true;
+
+                    // add lucky spin
+                    LuckySpinObj lc = new LuckySpinObj();
+                    lc.setMsisdn(msisdn);
+                    lc.setExpireTime(getExpireSpin());
+                    lc.setAdded(spinAdded);
+                    lc.setUsed(0);
+                    lc.setChannelAdd(LuckyCallUtils.Channel.CALL);
                     listLuckySpin.add(lc);
+                    //}
                 }
-                
-                if (!invited) {
-                    if (spinAdded > 0 && (svAdv == null || db.checkBlackListCall(msisdn))) {
-                        boolean isSub = false;
-                        // check sub/unsub
-                        Boolean checkReg = db.checkRegisterInfo(msisdn);
-                        if (checkReg != null && checkReg) {
-                            // already registered
-                            logger.info("Already registered: " + msisdn);
-                            isSub = true;
-                        } else {
-                            logger.info("Not registered: " + msisdn);
+
+                if (allow == 1) {
+                    // check last message
+                    if (invitation != null) {
+                        if (invitation.getLastMessage() != null && invitation.getLastMessage().getTime() > atStartOfDay(2)) {
+                            // already sent message
+                            logger.info("Already message in 2 days: " + msisdn);
+                            continue;
                         }
+                    }
 
-                        String message;
-                        if (isSub) {
-                            // addd spin to customer
-                            message = MessageResponse.getMessage(Common.Message.MSG_GOT_LUCKY_SPIN_CALL, logger);
-                            message = message.replaceAll("%spin%", spinAdded + "");
-                            message = message.replaceAll("%expire%", sdf.format(lc.getExpireTime()));
+                    if (svAdv == null || db.checkBlackListCall(msisdn)) {
+                        if (spinAdded > 0) {
+                            long duration = signalObj.getCallDuration();
+                            if (duration >= 30) {
+                                boolean isSub = false;
+                                // check sub/unsub
+                                Boolean checkReg = db.checkRegisterInfo(msisdn);
+                                if (checkReg != null && checkReg) {
+                                    // already registered
+                                    logger.info("Already registered: " + msisdn);
+                                    isSub = true;
+                                } else {
+                                    logger.info("Not registered: " + msisdn);
+                                }
+                                String message;
+                                if (isSub) {
+                                    // addd spin to customer
+                                    message = MessageResponse.getMessage(Common.Message.MSG_GOT_LUCKY_SPIN_CALL, logger);
+                                    message = message.replaceAll("%spin%", spinAdded + "");
+                                    message = message.replaceAll("%expire%", sdf.format(getExpireSpin()));
 //                            PushResord pushRecord = new PushResord();
 //                            pushRecord.setMsisdn(msisdn);
 //                            pushRecord.setContent(message);
 //                            pushRecord.setRequestType(201);
 //                            pushRecord.setService("LUCKYCALL");
 //                            listPush.add(pushRecord);
-                            MtExtend mt = new MtExtend();
-                            mt.setMsisdn(msisdn);
-                            mt.setChannel(Common.CHANNEL);
-                            mt.setMessage(message);
-                            mt.setSendTime(signalObj.getEndTime());
-                            mt.setMessageType(Common.MESSAGE_TYPE);
-                            listMtExtend.add(mt);
-                        } else {
-                            // not sub -> invite
-                            message = MessageResponse.getMessage(Common.Message.INVITE_REGISTER_CALL, logger);
-                            message = message.replaceAll("%spin%", spinAdded + "");
-                            message = message.replaceAll("%expire%", sdf.format(lc.getExpireTime()));
-                            MtExtend mt = new MtExtend();
-                            mt.setMsisdn(msisdn);
-                            mt.setChannel(Common.CHANNEL);
-                            mt.setMessage(message);
-                            mt.setSendTime(signalObj.getEndTime());
-                            mt.setMessageType(Common.MESSAGE_TYPE);
-                            listMtExtend.add(mt);
+                                    MtExtend mt = new MtExtend();
+                                    mt.setMsisdn(msisdn);
+                                    mt.setChannel(Common.CHANNEL);
+                                    mt.setMessage(message);
+                                    mt.setSendTime(signalObj.getEndTime());
+                                    mt.setMessageType(Common.MESSAGE_TYPE);
+                                    listMtExtend.add(mt);
+                                } else {
+                                    // not sub -> invite
+                                    message = MessageResponse.getMessage(Common.Message.INVITE_REGISTER_CALL, logger);
+                                    message = message.replaceAll("%spin%", spinAdded + "");
+                                    message = message.replaceAll("%expire%", sdf.format(getExpireSpin()));
+                                    MtExtend mt = new MtExtend();
+                                    mt.setMsisdn(msisdn);
+                                    mt.setChannel(Common.CHANNEL);
+                                    mt.setMessage(message);
+                                    mt.setSendTime(signalObj.getEndTime());
+                                    mt.setMessageType(Common.MESSAGE_TYPE);
+                                    listMtExtend.add(mt);
+                                }
+
+                                // increate counter
+                                markedInvite = true;
+                                if (mCount.containsKey(0)) {
+                                    mCount.put(0, mCount.get(0) + 1);
+                                } else {
+                                    mCount.put(0, 1);
+                                }
+                            }
                         }
 
-                        // increate counter
-                        markedInvite = true;
-                        if (mCount.containsKey(0)) {
-                            mCount.put(0, mCount.get(0) + 1);
-                        } else {
-                            mCount.put(0, 1);
-                        }
                     } else {
                         // other services
                         long duration = signalObj.getCallDuration();
@@ -244,13 +261,13 @@ public class SignalProcess extends ProcessRecordAbstract {
                     }
 
                     if (markedInvite) {
-                        if (invitation != null) {
-                            invitation.setMessageType(signalObj.getMessageType());
-                            db.updateInvitation(invitation);
+                        if (existed) {
+                            db.updateInviteMessage(invitation);
                         } else {
                             invitation = new InvitationObj();
                             invitation.setMsisdn(msisdn);
                             invitation.setMessageType(signalObj.getMessageType());
+                            invitation.setLastMessage(new Timestamp(System.currentTimeMillis()));
                             db.insertInvitation(invitation);
                         }
                     }
@@ -317,7 +334,8 @@ public class SignalProcess extends ProcessRecordAbstract {
     }
 
     @Override
-    public List<Record> processException(List<Record> listRecord) {
+    public List<Record> processException(List<Record> listRecord
+    ) {
         logger.error("Exception when processing....");
         return listRecord;
     }
@@ -346,13 +364,13 @@ public class SignalProcess extends ProcessRecordAbstract {
 //        }
 //        return Common.listProduct.get(0);
 //    }
-    private long atStartOfDay() {
+    private long atStartOfDay(int day) {
         Calendar cal = Calendar.getInstance();
         cal.set(Calendar.HOUR_OF_DAY, 0);
         cal.set(Calendar.MINUTE, 0);
         cal.set(Calendar.SECOND, 0);
         cal.set(Calendar.MILLISECOND, 0);
-        cal.add(Calendar.DAY_OF_MONTH, -1);
+        cal.add(Calendar.DAY_OF_MONTH, -day);
         return cal.getTimeInMillis();
     }
 

+ 2 - 1
ProcessLuckyCard/ProcessLuckyCard/src/com/vas/portal/process/ExecutePrize.java

@@ -15,7 +15,6 @@ import com.vas.portal.utils.object.PrizeWinner;
 import com.vas.portal.utils.service.WSProcessor;
 import com.viettel.smsfw.manager.AppManager;
 import com.viettel.smsfw.process.ProcessRecordAbstract;
-import com.viettel.smsfw.utils.TransactionLog;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -102,6 +101,8 @@ public class ExecutePrize extends ProcessRecordAbstract {
                         if (db.addCoin(executeObj.getMsisdn()) == null) {
                             rsWs = Common.ErrCode.DB_ERROR;
                         }
+                    } else if (prizeObj.getActionType().equals("WALLET")) {
+                        rsWs = ws.addWallet(executeObj.getMsisdn());
                     } else {
                         logger.error("Not config prize execution: " + executeObj.getMsisdn() + ", " + prizeObj.getActionCode());
                         rsWs = "1";

+ 84 - 8
ProcessLuckyCard/ProcessLuckyCard/src/com/vas/portal/utils/database/DbProcessor.java

@@ -35,7 +35,6 @@ import com.vas.portal.utils.object.VotingCodeObj;
 import com.vas.portal.utils.object.VotingObj;
 import com.viettel.smsfw.database.DbProcessorFW;
 import com.viettel.smsfw.manager.AppManager;
-import com.viettel.smsfw.utils.TransactionLog;
 import java.sql.CallableStatement;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
@@ -2392,13 +2391,27 @@ public class DbProcessor extends DbProcessorFW {
         long startTime = System.currentTimeMillis();
         String sql;
         if (type == LuckyCallUtils.CodeType.LUCKY_CALL) {
-            sql = " select d.* from sv_adv_schedule_call s \n"
+            sql = " select d.*, nvl(sc.counter,0) counter from sv_adv_schedule_call s \n"
                     + "join sv_adv_schedule_detail_call d on s.id = d.schedule_id and d.status = 1 \n"
-                    + "where s.from_date <= sysdate and s.to_date >= sysdate and s.status = 1";
+                    + "left join (\n"
+                    + "select sum(counter) counter, sv_adv_id from schedule_counter_call sc\n"
+                    + "join sv_adv_schedule_detail_call d on d.id = sc.schedule_detail_id\n"
+                    + "where sc.report_date = trunc(sysdate)\n"
+                    + "group by sv_adv_id) sc on sc.sv_adv_id = d.sv_adv_id \n"
+                    + "where s.from_date <= sysdate and s.to_date >= sysdate and s.status = 1 "
+                    + "and (d.active_hour is null or ',' || d.active_hour || ',' like '%,' || to_number(to_char(sysdate,'hh24')) || ',%' ) "
+                    + "and (nvl(d.max_number_msg,0) = 0 or nvl(sc.counter,0) < d.max_number_msg)";
         } else {
-            sql = " select d.* from sv_adv_schedule s \n"
+            sql = " select d.* , nvl(sc.counter,0) counter from sv_adv_schedule s  \n"
                     + "join sv_adv_schedule_detail d on s.id = d.schedule_id and d.status = 1 \n"
-                    + "where s.from_date <= sysdate and s.to_date >= sysdate and s.status = 1";
+                    + "left join (\n"
+                    + "select sum(counter) counter, sv_adv_id from schedule_counter sc\n"
+                    + "join sv_adv_schedule_detail d on d.id = sc.schedule_detail_id\n"
+                    + "where sc.report_date = trunc(sysdate)\n"
+                    + "group by sv_adv_id) sc on sc.sv_adv_id = d.sv_adv_id \n"
+                    + "where s.from_date <= sysdate and s.to_date >= sysdate and s.status = 1  \n"
+                    + "and (d.active_hour is null or ',' || d.active_hour || ',' like '%,' || to_number(to_char(sysdate,'hh24')) || ',%' )  \n"
+                    + "and (nvl(d.max_number_msg,0) = 0 or nvl(sc.counter,0) < d.max_number_msg)";
         }
         try {
             connection = getConnection(dbName);
@@ -2413,6 +2426,7 @@ public class DbProcessor extends DbProcessorFW {
                 sv.setScheduleId(rs.getInt(SvAdvScheduler.SCHEDULE_ID));
                 sv.setSvAdvId(rs.getInt(SvAdvScheduler.SV_ADV_ID));
                 sv.setPercent(rs.getInt(SvAdvScheduler.PERCENT));
+                sv.setCounter(rs.getInt(SvAdvScheduler.COUNTER));
 //                sv.setSvAdv(getServiceAdv(sv.getSvAdvId()));
                 SvAdv svAdv = new SvAdv();
                 svAdv.setSvCode(rs.getString(SvAdv.SV_CODE));
@@ -2420,6 +2434,7 @@ public class DbProcessor extends DbProcessorFW {
                 svAdv.setChannelAdv(rs.getString(SvAdv.CHANNEL_ADV));
                 svAdv.setMessageType(rs.getInt(SvAdv.MESSAGE_TYPE));
                 svAdv.setFromMoney(rs.getLong(SvAdv.FROM_MONEY));
+                svAdv.setMaxNumberMsg(rs.getInt(SvAdv.MAX_NUMBER_MSG));
                 svAdv.setScheduleDetailId(sv.getId());
                 sv.setSvAdv(svAdv);
                 result.add(sv);
@@ -2447,7 +2462,8 @@ public class DbProcessor extends DbProcessorFW {
 //        String sql = "INSERT INTO call_signal (ID,CALLING_NUMBER,CALLED_NUMBER,START_TIME,END_TIME,CALL_DURATION,BALANCE_ID,MONEY_PAID,INSERT_TIME,MESSAGE_TYPE) \n"
 //                + "VALUES(CDR_RECHARGE_SEQ.nextval, ?, ?, ?, ?, ?, ?, ?, sysdate, ?)";
         String sql = "INSERT INTO call_signal (ID,CALLING_NUMBER,CALLED_NUMBER,START_TIME,END_TIME,CALL_DURATION,BALANCE_ID,MONEY_PAID,INSERT_TIME,MESSAGE_TYPE) \n"
-                + " values(call_signal_seq.nextval, ?, ?, ?, ?, ?, ?, ?, sysdate, ?)";
+                + " select call_signal_seq.nextval, ?, ?, ?, ?, ?, ?, ?, sysdate, ? from dual "
+                + " where not exists (select msisdn from invitation where msisdn = ? and last_invite > trunc(sysdate))";
         try {
             connection = getConnection(dbName);
             ps = connection.prepareStatement(sql);
@@ -2464,6 +2480,7 @@ public class DbProcessor extends DbProcessorFW {
                 ps.setString(i++, callSignal.getBalanceId());
                 ps.setDouble(i++, callSignal.getMoneyPaid());
                 ps.setInt(i++, callSignal.getMessageType());
+                ps.setString(i++, callSignal.getCallingNumber());
                 ps.addBatch();
             }
             ps.executeBatch();
@@ -2578,8 +2595,8 @@ public class DbProcessor extends DbProcessorFW {
         long timeStart = System.currentTimeMillis();
         PreparedStatement ps = null;
         Connection connection = null;
-        String sql = "INSERT INTO INVITATION (ID,MSISDN,LAST_INVITE,MESSAGE_TYPE,BALANCE_ID)"
-                + " VALUES(INVITATION_seq.nextval,?, sysdate, ?, ?)";
+        String sql = "INSERT INTO INVITATION (ID,MSISDN,LAST_INVITE,MESSAGE_TYPE,BALANCE_ID, LAST_MESSAGE)"
+                + " VALUES(INVITATION_seq.nextval,?, sysdate, ?, ?, ?)";
         try {
             connection = getConnection(dbName);
             ps = connection.prepareStatement(sql);
@@ -2590,6 +2607,7 @@ public class DbProcessor extends DbProcessorFW {
             ps.setString(1, invitation.getMsisdn());
             ps.setInt(2, invitation.getMessageType());
             ps.setString(3, invitation.getBalanceId());
+            ps.setTimestamp(4, invitation.getLastMessage());
             ps.executeUpdate();
             rs = true;
         } catch (Exception ex) {
@@ -2626,6 +2644,7 @@ public class DbProcessor extends DbProcessorFW {
                 obj.setLastInvite(rs.getTimestamp(InvitationObj.LAST_INVITE));
                 obj.setMessageType(rs.getInt(InvitationObj.MESSAGE_TYPE));
                 obj.setBalanceId(rs.getString(InvitationObj.BALANCE_ID));
+                obj.setLastMessage(rs.getTimestamp(InvitationObj.LAST_MESSAGE));
                 result.add(obj);
             }
         } catch (Exception ex) {
@@ -2668,6 +2687,33 @@ public class DbProcessor extends DbProcessorFW {
         return rs;
     }
 
+    public boolean updateInviteMessage(InvitationObj invitation) {
+        boolean rs = false;
+        long timeStart = System.currentTimeMillis();
+        PreparedStatement ps = null;
+        Connection connection = null;
+        String sql = "UPDATE INVITATION SET  LAST_MESSAGE = sysdate  "
+                + " WHERE msisdn = ?";
+        try {
+            connection = getConnection(dbName);
+            ps = connection.prepareStatement(sql);
+            if (AppManager.enableQueryDbTimeout) {
+                ps.setQueryTimeout(AppManager.queryDbTimeout);
+            }
+
+            ps.setString(1, invitation.getMsisdn());
+            ps.executeUpdate();
+            rs = true;
+        } catch (Exception ex) {
+            logger.error("Error updateInviteMessage", ex);
+        } finally {
+            closeResource(ps);
+            closeResource(connection);
+            logTime("Time to updateInviteMessage", timeStart);
+        }
+        return rs;
+    }
+
     // LUCKY SPIN
     public int[] insertLuckySpin(List<LuckySpinObj> listLc) {
         long timeSt = System.currentTimeMillis();
@@ -3138,4 +3184,34 @@ public class DbProcessor extends DbProcessorFW {
         }
         return result;
     }
+
+    public int checkCdr() {
+        long timeStart = System.currentTimeMillis();
+        CallableStatement cs = null;
+        ResultSet rs = null;
+        Connection connection = null;
+        String sql = "{call check_cdr ( ? )}";
+        try {
+            connection = getConnection(dbName);
+            cs = connection.prepareCall(sql);
+            if (AppManager.enableQueryDbTimeout) {
+                cs.setQueryTimeout(AppManager.queryDbTimeout);
+            }
+
+            cs.registerOutParameter(1, OracleTypes.CURSOR);
+            cs.executeUpdate();
+            rs = (ResultSet) cs.getObject(1);
+            while (rs.next()) {
+                return rs.getInt("allow");
+            }
+        } catch (Exception ex) {
+            logger.error("Error call check_cdr", ex);
+        } finally {
+            closeResource(rs);
+            closeResource(cs);
+            closeResource(connection);
+            logTime("Time to call check_cdr", timeStart);
+        }
+        return 0;
+    }
 }

+ 10 - 0
ProcessLuckyCard/ProcessLuckyCard/src/com/vas/portal/utils/object/InvitationObj.java

@@ -16,6 +16,7 @@ public class InvitationObj {
     public static final String ID = "ID";
     public static final String MSISDN = "MSISDN";
     public static final String LAST_INVITE = "LAST_INVITE";
+    public static final String LAST_MESSAGE = "LAST_MESSAGE";
     public static final String MESSAGE_TYPE = "MESSAGE_TYPE";
     public static final String BALANCE_ID = "BALANCE_ID";
     private long id;
@@ -23,6 +24,15 @@ public class InvitationObj {
     private Timestamp lastInvite;
     private int messageType;
     private String balanceId;
+    private Timestamp lastMessage;
+
+    public Timestamp getLastMessage() {
+        return lastMessage;
+    }
+
+    public void setLastMessage(Timestamp lastMessage) {
+        this.lastMessage = lastMessage;
+    }
 
     public String getBalanceId() {
         return balanceId;

+ 10 - 0
ProcessLuckyCard/ProcessLuckyCard/src/com/vas/portal/utils/object/SvAdv.java

@@ -17,6 +17,7 @@ public class SvAdv {
     public static final String CHANNEL_ADV = "CHANNEL_ADV";
     public static final String MESSAGE_TYPE = "MESSAGE_TYPE";
     public static final String FROM_MONEY = "FROM_MONEY";
+    public static final String MAX_NUMBER_MSG = "MAX_NUMBER_MSG";
     public static final String STATUS = "STATUS";
     private String svCode;
     private String msgAdv;
@@ -25,8 +26,17 @@ public class SvAdv {
     private int messageType;
     private long fromMoney;
     private int status;
+    private int maxNumberMsg;
     private int scheduleDetailId;
 
+    public int getMaxNumberMsg() {
+        return maxNumberMsg;
+    }
+
+    public void setMaxNumberMsg(int maxNumberMsg) {
+        this.maxNumberMsg = maxNumberMsg;
+    }
+
     public int getScheduleDetailId() {
         return scheduleDetailId;
     }

+ 10 - 0
ProcessLuckyCard/ProcessLuckyCard/src/com/vas/portal/utils/object/SvAdvScheduler.java

@@ -17,14 +17,24 @@ public class SvAdvScheduler {
 //    public static final String FROM_DATE = "FROM_DATE";
 //    public static final String TO_DATE = "TO_DATE";
 //    public static final String SCHEDULE_NAME = "SCHEDULE_NAME";
+    public static final String COUNTER = "COUNTER";
     public static final String PERCENT = "PERCENT";
 
     private int id;
     private int scheduleId;
     private int svAdvId;
     private int percent;
+    private int counter;
     private SvAdv svAdv;
 
+    public int getCounter() {
+        return counter;
+    }
+
+    public void setCounter(int counter) {
+        this.counter = counter;
+    }
+
     public SvAdv getSvAdv() {
         return svAdv;
     }

+ 18 - 0
ProcessLuckyCard/ProcessLuckyCard/src/com/vas/portal/utils/service/WSProcessor.java

@@ -204,6 +204,24 @@ public class WSProcessor extends WebserviceFW {
         return value;
     }
 
+    public String addWallet(String msisdn) {
+        WebserviceObject obj = this.getWebservice("add_wallet");
+        WebserviceMsg request = new WebserviceMsg();
+        request.setMsisdn(msisdn);
+        String msgTemplate = obj.getMsgTemplate().replace("#MSISDN#", msisdn);
+        msgTemplate = msgTemplate.replace("#ISDN#", msisdn.substring(Common.COUNTRY_CODE.length()));
+        request.setRequest(msgTemplate);
+
+        WebserviceMsg response = this.send(request, obj);
+        try {
+            String error = StringUtils.substringBetween(response.getResponse(), "<" + obj.getErrorTag() + ">", "</" + obj.getErrorTag() + ">");
+            return error;
+        } catch (Exception ex) {
+            logger.error("Error get response addWallet", ex);
+            return null;
+        }
+    }
+
     public String executeCmd(String msisdn, String cmdCode) {
         WebserviceObject wsObj = this.getWebservice("add_money");
         String actionCode = cmdCode;

+ 34 - 34
ProcessLuckyCard/etc/agent.cfg

@@ -167,23 +167,23 @@ changedClusterCannotConnectDbWarn2=Cluster changes, cluster has many nodes. This
 #db_name=dbapp
 #
 #
-#[sms2]
-##mandatory
-#clusterName=SignalProcess
-#nodeName=node1_SignalProcess
-#sql=select * from (Select * from call_signal order by id) where mod(calling_number, %nbMembers%) = %order% and rownum <= 100
-#initialHosts=127.0.0.1[8206]
-#ip=127.0.0.1
-#port=1326
-#timeout=1200000
-#checkInterval=500
-##allow or disallow to log timeout and loaded records
-#extraLog=true
-#protocolStack=../etc/tcp.xml
-#process_class=com.vas.luckycall.process.SignalProcess
-#dbprocess_class=com.vas.portal.utils.database.DbSignal
-#instances=1
-#db_name=dbapp
+[sms2]
+#mandatory
+clusterName=SignalProcess
+nodeName=node1_SignalProcess
+sql=select * from (Select * from call_signal order by id) where mod(calling_number, %nbMembers%) = %order% and rownum <= 100
+initialHosts=127.0.0.1[8206]
+ip=127.0.0.1
+port=1326
+timeout=1200000
+checkInterval=500
+#allow or disallow to log timeout and loaded records
+extraLog=true
+protocolStack=../etc/tcp.xml
+process_class=com.vas.luckycall.process.SignalProcess
+dbprocess_class=com.vas.portal.utils.database.DbSignal
+instances=1
+db_name=dbapp
 
 #[sms3]
 ##mandatory
@@ -222,20 +222,20 @@ changedClusterCannotConnectDbWarn2=Cluster changes, cluster has many nodes. This
 #instances=1
 #db_name=dbapp
 
-[sms3]
-#mandatory
-clusterName=ExecutePrize
-nodeName=node1_ExecutePrize
-sql=select * from (Select * from execute_prize order by id) where mod(id, %nbMembers%) = %order% and rownum <= 100
-initialHosts=127.0.0.1[8208]
-ip=127.0.0.1
-port=1328
-timeout=1200000
-checkInterval=6000
-#allow or disallow to log timeout and loaded records
-extraLog=true
-protocolStack=../etc/tcp.xml
-process_class=com.vas.portal.process.ExecutePrize
-dbprocess_class=com.vas.portal.utils.database.DbExecute
-instances=1
-db_name=dbapp
+#[sms3]
+##mandatory
+#clusterName=ExecutePrize
+#nodeName=node1_ExecutePrize
+#sql=select * from (Select * from execute_prize order by id) where mod(id, %nbMembers%) = %order% and rownum <= 100
+#initialHosts=127.0.0.1[8208]
+#ip=127.0.0.1
+#port=1328
+#timeout=1200000
+#checkInterval=6000
+##allow or disallow to log timeout and loaded records
+#extraLog=true
+#protocolStack=../etc/tcp.xml
+#process_class=com.vas.portal.process.ExecutePrize
+#dbprocess_class=com.vas.portal.utils.database.DbExecute
+#instances=1
+#db_name=dbapp

+ 3 - 6
ProcessLuckyCard/etc/database.xml

@@ -9,12 +9,9 @@
   </timeout-config>
   <named-config name="dbapp">
 	<property name="driver">oracle.jdbc.driver.OracleDriver</property>
-	<property name="connection">jdbc:oracle:thin:@(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = 171.244.50.177)(PORT = 1530))(CONNECT_DATA =(SERVER = DEDICATED)(SID=orcl)))</property>
-	<!-- <property name="username">lucky_card</property> -->
-	<!-- <property name="password">lucky_card@123</property> -->
-	<!-- <property name="connection">jdbc:oracle:thin:@(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))(CONNECT_DATA =(SERVER = DEDICATED)(SID=orcl)))</property> -->
-	<property name="username">myt_luckycall</property>
-	<property name="password">myt_luckycall</property>
+	<property name="connection">jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1539))(CONNECT_DATA=(SERVICE_NAME=ORA12C)))</property>
+	<property name="username">mzb_luckycall</property>
+	<property name="password">mzb_luckycall</property>
     <property name="initialPoolSize">5</property>
 	<property name="maxPoolSize">30</property>
 	<property name="minPoolSize">10</property>

+ 2 - 9
ReportWebCore/Db_LibCore/SqlConnString.cs

@@ -23,16 +23,9 @@ namespace Db_Core
         public static string[] ConnectionStrings = new string[]
         {
             //ConfigurationManager.AppSettings["connectionString"]
-            @"Data Source=(DESCRIPTION =
-                (ADDRESS = (PROTOCOL = TCP)(HOST = 10.228.101.115)(PORT = 1521))
-                (CONNECT_DATA =
-                  (SERVER = DEDICATED)
-                  (SERVICE_NAME = pdbvas1)
-                )
-              ); User ID=lucky_call_app;Password=Lh@aCl#12)pP;Max Pool Size=5;persist security info=false;Connection Timeout=300;Validate connection=true;",
+            @"Data Source=(DESCRIPTION_LIST=(LOAD_BALANCE=off)(FAILOVER=on)(DESCRIPTION=(LOAD_BALANCE=on)(TRANSPORT_CONNECT_TIMEOUT=3)(RETRY_COUNT=3)(ADDRESS=(PROTOCOL=tcp)(HOST=10.229.42.248)(PORT=1521))(ADDRESS=(PROTOCOL=tcp)(HOST=10.229.42.249)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME= vascp)))); User ID=eggshoot;Password=CitiBoy#)$11;Max Pool Size=10;persist security info=false;Connection Timeout=300;Validate connection=true;",
 
-            //@"Data Source=(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1561))(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1561))(LOAD_BALANCE = yes)(CONNECT_DATA =(SERVER = SHARED)(SERVICE_NAME = pdbvas1)))
-            //;User ID=lucky_call_app;Password=Lh@aCl#12)pP;Max Pool Size=10;persist security info=false;Connection Timeout=120;Validate connection=true;"
+            //@"Data Source=(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = 171.244.50.237)(PORT = 1539))(LOAD_BALANCE = yes)(CONNECT_DATA =(SERVER = SHARED)(SID=ORA12C)));User ID=mzb_luckycall;Password=mzb_luckycall;Max Pool Size=10;persist security info=false;Connection Timeout=120;Validate connection=true;"
 
             //@"Data Source=(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = 10.228.101.115)(PORT = 1521))(CONNECT_DATA =(SERVER = SHARED)(SERVICE_NAME = pdbvas1)))
             //;User ID=lucky_call_app;Password=Lh@aCl#12)pP;Max Pool Size=5;persist security info=false;Connection Timeout=120;Validate connection=true;"

+ 47 - 9
ReportWebCore/SuperAdmin/Controllers/AdminController.cs

@@ -936,17 +936,27 @@ namespace SuperAdmin.Controllers
                 String msgAdv = Request.Form["msgAdv"];
                 String channelAdv = Request.Form["channelAdv"];
                 String messageType = Request.Form["messageType"];
+                String activeHour = Request.Form["activeHour"];
+                String maxNumberMsg = Request.Form["maxNumberMsg"];
+                if (activeHour != null)
+                {
+                    activeHour = activeHour.Replace(" ", "");
+                }
                 String fromMoney = Request.Form["fromMoney"];
 
                 // call ws
-                db.InsertSvAdv(svCode, msgAdv, advName, channelAdv, messageType, fromMoney);
+                bool isSuccess = db.InsertSvAdv(svCode, msgAdv, advName, channelAdv, messageType, activeHour, maxNumberMsg, fromMoney);
                 //db.InsertSvAdvHistory(svCode, messageType);
 
                 // Returns message that successfully uploaded  
-                return Json(new
+                if (isSuccess)
                 {
-                    error_code = "0"
-                });
+                    return Json(new { error_code = "0", content = "Add service adv success" });
+                }
+                else
+                {
+                    return Json(new { error_code = "2", content = "Add service adv failed! DB error." });
+                }
             }
             catch (Exception ex)
             {
@@ -1149,15 +1159,24 @@ namespace SuperAdmin.Controllers
                 String msgAdv = Request.Form["msgAdv"];
                 String channelAdv = Request.Form["channelAdv"];
                 String messageType = Request.Form["messageType"];
+                String activeHour = Request.Form["activeHour"];
+                String maxNumberMsg = Request.Form["maxNumberMsg"];
+                if (activeHour != null)
+                {
+                    activeHour = activeHour.Replace(" ", "");
+                }
                 String fromMoney = Request.Form["fromMoney"];
 
-                db.UpdateServiceAdvInfo(svCode, msgAdv, advName, channelAdv, messageType, fromMoney, advId);
+                bool isSuccess = db.UpdateServiceAdvInfo(svCode, msgAdv, advName, channelAdv, messageType, activeHour, maxNumberMsg, fromMoney, advId);
 
-                return Json(new
+                if (isSuccess)
                 {
-                    error_code = "0"
-                });
-
+                    return Json(new { error_code = "0", content = "Update service adv success" });
+                }
+                else
+                {
+                    return Json(new { error_code = "2", content = "Update service adv failed! DB error." });
+                }
             }
             catch (Exception ex)
             {
@@ -1632,6 +1651,7 @@ namespace SuperAdmin.Controllers
             {
 
                 String scheduleName = Request.Form["scheduleName"];
+                String maxTotalMsg = Request.Form["maxTotalMsg"];
                 String fromDate = Request.Form["fromDate"];
                 String toDate = Request.Form["toDate"];
                 String listAdv = Request.Form["listAdv"];
@@ -1643,6 +1663,15 @@ namespace SuperAdmin.Controllers
                 advSchedule.from_date = DateTime.ParseExact(fromDate, "dd/MM/yyyy HH:mm:ss", null);
                 advSchedule.to_date = DateTime.ParseExact(toDate, "dd/MM/yyyy HH:mm:ss", null);
                 advSchedule.schedule_name = scheduleName;
+                if (maxTotalMsg != null)
+                {
+                    advSchedule.max_total_msg = int.Parse(maxTotalMsg);
+                }
+                else
+                {
+                    advSchedule.max_total_msg = 0;
+                }
+
                 advSchedule.list_adv = new List<SvAdv>();
                 foreach (ListAdv adv in myDeserializedClass.listAdv)
                 {
@@ -1705,6 +1734,7 @@ namespace SuperAdmin.Controllers
             {
                 String scheduleId = Request.Form["scheduleId"];
                 String scheduleName = Request.Form["scheduleName"];
+                String maxTotalMsg = Request.Form["maxTotalMsg"];
                 String fromDate = Request.Form["fromDate"];
                 String toDate = Request.Form["toDate"];
                 String listAdv = Request.Form["listAdv"];
@@ -1719,6 +1749,14 @@ namespace SuperAdmin.Controllers
                 advSchedule.from_date = DateTime.ParseExact(fromDate, "dd/MM/yyyy HH:mm:ss", null);
                 advSchedule.to_date = DateTime.ParseExact(toDate, "dd/MM/yyyy HH:mm:ss", null);
                 advSchedule.schedule_name = scheduleName;
+                if (maxTotalMsg != null)
+                {
+                    advSchedule.max_total_msg = int.Parse(maxTotalMsg);
+                }
+                else
+                {
+                    advSchedule.max_total_msg = 0;
+                }
                 advSchedule.id = int.Parse(scheduleId);
                 advSchedule.list_adv = new List<SvAdv>();
                 foreach (ListAdv adv in myDeserializedClass.listAdv)

+ 25 - 0
ReportWebCore/SuperAdmin/Controllers/LuckySpinController.cs

@@ -14,6 +14,7 @@ using Newtonsoft.Json;
 using ReportWeb.Source;
 using OfficeOpenXml;
 using ClosedXML.Excel;
+using ReportWebCore.Models.Http;
 
 namespace SuperAdmin.Controllers
 {
@@ -275,5 +276,29 @@ namespace SuperAdmin.Controllers
                 return null;
             }
         }
+
+
+        [HttpPost]
+        public JsonResult AddMoneyRanking(String id)
+        {
+            Users user = HttpContext.Session.GetComplexData<Users>("user");
+
+            if (user == null || user.role <= 0)
+            {
+                ViewBag.username = "Welcome!";
+                return Json(new
+                {
+                    error = "10",
+                    content = "Timeout"
+                });
+            }
+
+            ErrResponse dbRes  = db.ProcessPrizeTop(long.Parse(id)); 
+            return Json(new
+            {
+                error = dbRes.error,
+                content = dbRes.message
+            });
+        }
     }
 }

+ 19 - 0
ReportWebCore/SuperAdmin/Models/Http/ErrResponse.cs

@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace ReportWebCore.Models.Http
+{
+    public class ErrResponse
+    {
+        public string error { get; set; }
+        public string message { get; set; }
+        public ErrResponse() { }
+        public ErrResponse(string error, string message)
+        {
+            this.error = error;
+            this.message = message;
+        }
+    }
+}

+ 14 - 0
ReportWebCore/SuperAdmin/Models/Services.cs

@@ -35,6 +35,8 @@ namespace ReportWeb.Models
         public string channel_adv { get; set; }
         public string message_type { get; set; }
         public string from_money { get; set; }
+        public string active_hour { get; set; }
+        public int max_number_msg { get; set; }
         // status
         public int status { get; set; }
 
@@ -144,6 +146,18 @@ namespace ReportWeb.Models
                                 sv.from_money = reader.GetValue(i).ToString();
                             }
                             catch { }
+                        else if (reader.GetName(i).ToUpper() == "ACTIVE_HOUR")
+                            try
+                            {
+                                sv.active_hour = reader.GetValue(i).ToString();
+                            }
+                            catch { }
+                        else if (reader.GetName(i).ToUpper() == "MAX_NUMBER_MSG")
+                            try
+                            {
+                                sv.max_number_msg = int.Parse(reader.GetValue(i).ToString());
+                            }
+                            catch { }
                         else if (reader.GetName(i).ToUpper() == "STATUS")
                             try
                             {

+ 14 - 0
ReportWebCore/SuperAdmin/Models/SvAdv.cs

@@ -32,6 +32,8 @@ namespace ReportWeb.Models
         public int status { get; set; }
         public int percent { get; set; }
         public int counter { get; set; }
+        public int max_number_msg { get; set; }
+        public string active_hour { get; set; }
         public DateTime report_date { get; set; }
         public DateTime start_time { get; set; }
         public DateTime end_time { get; set; }
@@ -72,6 +74,18 @@ namespace ReportWeb.Models
                                 sv.adv_name = reader.GetValue(i).ToString();
                             }
                             catch { }
+                        else if (reader.GetName(i).ToUpper() == "ACTIVE_HOUR")
+                            try
+                            {
+                                sv.active_hour = reader.GetValue(i).ToString();
+                            }
+                            catch { }
+                        else if (reader.GetName(i).ToUpper() == "MAX_NUMBER_MSG")
+                            try
+                            {
+                                sv.max_number_msg = int.Parse(reader.GetValue(i).ToString());
+                            }
+                            catch { }
                         else if (reader.GetName(i).ToUpper() == "MESSAGE_TYPE")
                             try
                             {

+ 19 - 0
ReportWebCore/SuperAdmin/Models/SvAdvSchedule.cs

@@ -14,6 +14,7 @@ namespace ReportWeb.Models
         public DateTime? to_date { get; set; }
         public string schedule_name { get; set; }
         public int status { get; set; }
+        public int max_total_msg { get; set; }
         public List<SvAdv> list_adv { get; set; }
 
         public static List<SvAdvSchedule> Parse(OracleDataReader reader)
@@ -58,6 +59,12 @@ namespace ReportWeb.Models
                                 sv.status = int.Parse(reader.GetValue(i).ToString());
                             }
                             catch { }
+                        else if (reader.GetName(i).ToUpper() == "MAX_TOTAL_MSG")
+                            try
+                            {
+                                sv.max_total_msg = int.Parse(reader.GetValue(i).ToString());
+                            }
+                            catch { }
 
                         // adv info
                         else if (reader.GetName(i).ToUpper() == "SV_ADV_ID")
@@ -100,6 +107,18 @@ namespace ReportWeb.Models
                                 adv.channel_adv = reader.GetValue(i).ToString();
                             }
                             catch { }
+                        else if (reader.GetName(i).ToUpper() == "ACTIVE_HOUR")
+                            try
+                            {
+                                adv.active_hour = reader.GetValue(i).ToString();
+                            }
+                            catch { }
+                        else if (reader.GetName(i).ToUpper() == "MAX_NUMBER_MSG")
+                            try
+                            {
+                                adv.max_number_msg = int.Parse(reader.GetValue(i).ToString());
+                            }
+                            catch { }
                         else if (reader.GetName(i).ToUpper() == "FROM_MONEY")
                             try
                             {

+ 48 - 0
ReportWebCore/SuperAdmin/Models/UserCoin.cs

@@ -11,12 +11,17 @@ namespace ReportWeb.Models
     {
         public UserCoin()
         { }
+
+        public long id { get; set; }
         public string msisdn { get; set; }
         public int rank { get; set; }
         public DateTime? start_time { get; set; }
         public DateTime? end_time { get; set; }
         public DateTime? last_update { get; set; }
+        public DateTime? process_time { get; set; }
+        public int status { get; set; }
         public int total_coin { get; set; }
+        public int prize_id { get; set; }
         public string product_name { get; set; }
 
         public static List<UserCoin> Parse(OracleDataReader reader)
@@ -79,6 +84,49 @@ namespace ReportWeb.Models
                             }
                             catch { }
                         }
+                        else if (reader.GetName(i).ToUpper() == "ID")
+                        {
+                            try
+                            {
+                                UserCoin.id = long.Parse(reader.GetValue(i).ToString());
+                            }
+                            catch { }
+                        }
+                        else if (reader.GetName(i).ToUpper() == "PROCESS_TIME")
+                        {
+                            try
+                            {
+                                UserCoin.process_time = reader.GetDateTime(i);
+                            }
+                            catch { }
+                        }
+                        else if (reader.GetName(i).ToUpper() == "PRIZE_ID")
+                        {
+                            try
+                            {
+                                UserCoin.prize_id = int.Parse(reader.GetValue(i).ToString());
+                            }
+                            catch { }
+                        }
+                    }
+
+                    // set status
+                    if (UserCoin.end_time.Value > new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1))
+                    {
+                        // not in time
+                        UserCoin.status = 3;
+                    }
+                    else if (UserCoin.process_time != null)
+                    {
+                        UserCoin.status = 2; // processed
+                    }
+                    else if (UserCoin.prize_id > 0)
+                    {
+                        UserCoin.status = 1; // processing
+                    }
+                    else
+                    {
+                        UserCoin.status = 0; // not processed
                     }
                     result.Add(UserCoin);
                 }

+ 1 - 1
ReportWebCore/SuperAdmin/Properties/PublishProfiles/FolderProfile1.pubxml

@@ -14,7 +14,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
     <WebPublishMethod>FileSystem</WebPublishMethod>
     <SiteUrlToLaunchAfterPublish />
     <TargetFramework>net5.0</TargetFramework>
-    <RuntimeIdentifier>linux-x64</RuntimeIdentifier>
+    <RuntimeIdentifier>win-x64</RuntimeIdentifier>
     <ProjectGuid>000a9a28-ee22-4214-887d-108273a43763</ProjectGuid>
     <SelfContained>true</SelfContained>
   </PropertyGroup>

+ 21 - 0
ReportWebCore/SuperAdmin/Properties/PublishProfiles/FolderProfile2.pubxml

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

+ 1 - 1
ReportWebCore/SuperAdmin/ReportWebCore.csproj

@@ -54,7 +54,7 @@
     </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="Newtonsoft.Json" Version="13.0.3" />
     <PackageReference Include="NSwag.ApiDescription.Client" Version="13.0.5">
       <PrivateAssets>all</PrivateAssets>
       <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

+ 115 - 39
ReportWebCore/SuperAdmin/Source/DbConnector.cs

@@ -8,6 +8,7 @@ using Oracle.ManagedDataAccess.Client;
 using System.Data;
 using ReportWeb.Models;
 using ReportWeb.Source;
+using ReportWebCore.Models.Http;
 
 namespace SuperAdmin.Source
 {
@@ -57,8 +58,11 @@ namespace SuperAdmin.Source
         {
             try
             {
-                String sql = @"select sv.id, sv.sv_code, sv.sv_name, a.msg_adv, a.adv_name, a.channel_adv, a.message_type, a.from_money, a.status, a.id adv_id 
-                        from sv join sv_adv a on sv.sv_code = a.sv_code where sv.status = 1 
+                String sql = @"select sv.id, sv.sv_code, sv.sv_name,
+                        a.msg_adv, a.adv_name, a.channel_adv, a.message_type, a.from_money, a.status, a.id adv_id , a.active_hour, a.max_number_msg
+                        from sv
+                        join sv_adv a 
+                        on sv.sv_code = a.sv_code where sv.status = 1 
                         [ and a.status = ? ]";
                 SqlStatement stmt = SqlStatement.FromString(sql, SqlConnString.GAMEPORTAL);
                 if (status >= 0)
@@ -692,9 +696,10 @@ namespace SuperAdmin.Source
                     @"SELECT a.*  FROM 
                         (SELECT *
                         FROM ( SELECT  rownum rank, a.*
-                               FROM (SELECT  c.*, r.product_name
+                               FROM (SELECT  c.*, r.product_name, p.prize_id, p.process_time, p.execute_id
                                     FROM user_coin c 
                                     left join (select * from reg_info where status = 1) r  on c.msisdn = r.msisdn
+                                    left join (select * from prize_winner where period = 3 and code_time >= to_date(?, 'mm/yyyy') and code_time <= ADD_MONTHS(to_date(?, 'mm/yyyy'), 1) ) p on c.msisdn =  p.msisdn 
                                     where c.start_time <= to_date(?, 'mm/yyyy') and c.end_time  >= to_date(?, 'mm/yyyy')
                                          
                                     ORDER BY c.total_coin DESC, c.last_update) a )
@@ -710,15 +715,17 @@ namespace SuperAdmin.Source
                 SqlStatement stmt = new SqlStatement(sqlCommand, SqlConnString.GAMEPORTAL);
                 stmt.SetParameter(0, month);
                 stmt.SetParameter(1, month);
+                stmt.SetParameter(2, month);
+                stmt.SetParameter(3, month);
                 if (msisdn != null & msisdn.Length > 0)
                 {
-                    stmt.SetParameter(2, msisdn);
+                    stmt.SetParameter(4, msisdn);
                 }
                 else
                 {
                     if (maxRow > 0)
                     {
-                        stmt.SetParameter(3, maxRow);
+                        stmt.SetParameter(5, maxRow);
                     }
                 }
                 return UserCoin.Parse(stmt.ExecuteReader());
@@ -1545,14 +1552,14 @@ namespace SuperAdmin.Source
         }
 
         // SV ADV
-        public bool InsertSvAdv(string svCode, string msgAdv, string advName, string channelAdv, string messageType, string fromMoney)
+        public bool InsertSvAdv(string svCode, string msgAdv, string advName, string channelAdv, string messageType, string activeHour, string maxNumberMsg, string fromMoney)
         {
             try
             {
-                String sql = @"INSERT INTO sv_adv (ID, SV_CODE,ADV_NAME,MSG_ADV,MSG_ADV_PUSH,CHANNEL_ADV,MESSAGE_TYPE,FROM_MONEY,STATUS ) 
-                    VALUES(sv_adv_seq.nextval, ?, ?, ?, ?, ?, ?, ?, 1)";
+                String sql = @"INSERT INTO sv_adv (ID, SV_CODE,ADV_NAME,MSG_ADV,MSG_ADV_PUSH,CHANNEL_ADV,MESSAGE_TYPE,ACTIVE_HOUR,max_number_msg,FROM_MONEY,STATUS ) 
+                    VALUES(sv_adv_seq.nextval, ?, ?, ?, ?, ?, ?, ?, ?, ?, 1)";
                 SqlStatement stmt = SqlStatement.FromString(sql, SqlConnString.GAMEPORTAL);
-                stmt.SetParameters(svCode, advName, msgAdv, msgAdv, channelAdv, messageType, fromMoney);
+                stmt.SetParameters(svCode, advName, msgAdv, msgAdv, channelAdv, messageType, activeHour, maxNumberMsg, fromMoney);
                 stmt.ExecuteNonQuery(connType);
                 stmt.CloseConnection();
                 return true;
@@ -1584,14 +1591,14 @@ namespace SuperAdmin.Source
         //}
 
 
-        public bool UpdateServiceAdvInfo(string svCode, string msgAdv, string advName, string channelAdv, string messageType, string fromMoney, string advId)
+        public bool UpdateServiceAdvInfo(string svCode, string msgAdv, string advName, string channelAdv, string messageType, string activeHour, string maxNumberMsg, string fromMoney, string advId)
         {
             try
             {
-                String sql = @"Update sv_adv set sv_code = ?, msg_adv = ?,adv_name = ?,channel_adv = ?,message_type = ?,from_money = ? 
+                String sql = @"Update sv_adv set sv_code = ?, msg_adv = ?,adv_name = ?,channel_adv = ?,message_type = ?,active_hour = ? ,max_number_msg=?,from_money = ? 
                     where id = ?";
                 SqlStatement stmt = SqlStatement.FromString(sql, SqlConnString.GAMEPORTAL);
-                stmt.SetParameters(svCode, msgAdv, advName, channelAdv, messageType, fromMoney, advId);
+                stmt.SetParameters(svCode, msgAdv, advName, channelAdv, messageType, activeHour, maxNumberMsg, fromMoney, advId);
                 stmt.ExecuteNonQuery(connType);
                 stmt.CloseConnection();
                 return true;
@@ -1650,8 +1657,8 @@ namespace SuperAdmin.Source
                 String sql;
                 if (codeType == LuckyCardUtils.CodeType.LUCKY_CARD)
                 {
-                    sql = @"select s.*, a.adv_name, a.id sv_adv_id, a.sv_code, a.msg_adv, a.msg_adv_push, a.channel_adv, a.message_type, a.from_money,
-                             d.id schedule_detail_id, nvl(d.percent,0) percent 
+                    sql = @"select s.*, a.adv_name, d.sv_adv_id, d.sv_code, d.msg_adv, a.msg_adv_push, d.channel_adv, d.message_type, d.from_money,
+                             d.active_hour, d.max_number_msg, d.id schedule_detail_id, nvl(d.percent,0) percent 
                         from sv_adv_schedule s  
                         left join sv_adv a on a.status = 1
                         left join sv_adv_schedule_detail d on s.id = d.schedule_id and d.sv_adv_id = a.id and d.status = 1
@@ -1659,8 +1666,8 @@ namespace SuperAdmin.Source
                 }
                 else
                 {
-                    sql = @"select s.*, a.adv_name, a.id sv_adv_id, a.sv_code, a.msg_adv, a.msg_adv_push, a.channel_adv, a.message_type, a.from_money,
-                             d.id schedule_detail_id, nvl(d.percent,0) percent 
+                    sql = @"select s.*, a.adv_name, d.sv_adv_id, d.sv_code, d.msg_adv, d.msg_adv_push, d.channel_adv, d.message_type, d.from_money,
+                             d.active_hour, d.max_number_msg, d.id schedule_detail_id, nvl(d.percent,0) percent 
                         from sv_adv_schedule_call s  
                         left join sv_adv a on a.status = 1
                         left join sv_adv_schedule_detail_call d on s.id = d.schedule_id and d.sv_adv_id = a.id and d.status = 1
@@ -1689,18 +1696,20 @@ namespace SuperAdmin.Source
             DbConnection myConnection = null;
             SqlStatement stmt = new SqlStatement(SqlConnString.GAMEPORTAL);
             String sqlUpdateSchedule = codeType == LuckyCardUtils.CodeType.LUCKY_CARD
-                ? "UPDATE sv_adv_schedule SET from_date = :from_date, to_date = :to_date, schedule_name = :schedule_name WHERE id = :id"
-                : "UPDATE sv_adv_schedule_call SET from_date = :from_date, to_date = :to_date, schedule_name = :schedule_name WHERE id = :id";
+                ? "UPDATE sv_adv_schedule SET from_date = :from_date, to_date = :to_date, schedule_name = :schedule_name, max_total_msg = :max_total_msg WHERE id = :id"
+                : "UPDATE sv_adv_schedule_call SET from_date = :from_date, to_date = :to_date, schedule_name = :schedule_name, max_total_msg = :max_total_msg WHERE id = :id";
             String sqlDeleteAdv = codeType == LuckyCardUtils.CodeType.LUCKY_CARD
                 ? "UPDATE  sv_adv_schedule_detail SET status = 0 WHERE schedule_id = :schedule_id"
                 : "UPDATE  sv_adv_schedule_detail_call SET status = 0 WHERE schedule_id = :schedule_id";
             String sqlInsertAdv = codeType == LuckyCardUtils.CodeType.LUCKY_CARD
-                ? @"INSERT INTO sv_adv_schedule_detail (ID,SCHEDULE_ID,SV_ADV_ID,PERCENT,SV_CODE,MSG_ADV,CHANNEL_ADV,MESSAGE_TYPE,FROM_MONEY) 
-                                     SELECT sv_adv_schedule_detail_seq.nextval, 
-                                        :schedule_id, id, :percent, sv_code,  msg_adv, channel_adv, message_type, from_money FROM sv_adv WHERE id = :sv_adv_id"
-                : @"INSERT INTO sv_adv_schedule_detail_call (ID,SCHEDULE_ID,SV_ADV_ID,PERCENT,SV_CODE,MSG_ADV,CHANNEL_ADV,MESSAGE_TYPE,FROM_MONEY) 
-                                     SELECT sv_adv_schedule_detail_seq.nextval, 
-                                        :schedule_id, id, :percent, sv_code,  msg_adv, channel_adv, message_type, from_money FROM sv_adv WHERE id = :sv_adv_id";
+                ? @"INSERT INTO sv_adv_schedule_detail
+                    (ID,SCHEDULE_ID,SV_ADV_ID,PERCENT,SV_CODE,MSG_ADV,CHANNEL_ADV,MESSAGE_TYPE,FROM_MONEY,ACTIVE_HOUR,MAX_NUMBER_MSG)
+                    SELECT sv_adv_schedule_detail_seq.nextval, 
+                    :schedule_id, id, :percent, sv_code,  msg_adv, channel_adv, message_type, from_money, active_hour,MAX_NUMBER_MSG FROM sv_adv WHERE id = :sv_adv_id"
+                : @"INSERT INTO sv_adv_schedule_detail_call
+                    (ID,SCHEDULE_ID,SV_ADV_ID,PERCENT,SV_CODE,MSG_ADV,CHANNEL_ADV,MESSAGE_TYPE,FROM_MONEY,ACTIVE_HOUR,MAX_NUMBER_MSG)
+                    SELECT sv_adv_schedule_detail_seq.nextval, 
+                    :schedule_id, id, :percent, sv_code,  msg_adv, channel_adv, message_type, from_money, active_hour,MAX_NUMBER_MSG FROM sv_adv WHERE id = :sv_adv_id";
 
             try
             {
@@ -1716,6 +1725,7 @@ namespace SuperAdmin.Source
                     AddCmdParam(ref myCommand, "from_date", svAdvSchedule.from_date);
                     AddCmdParam(ref myCommand, "to_date", svAdvSchedule.to_date);
                     AddCmdParam(ref myCommand, "schedule_name", svAdvSchedule.schedule_name);
+                    AddCmdParam(ref myCommand, "max_total_msg", svAdvSchedule.max_total_msg);
                     AddCmdParam(ref myCommand, "id", svAdvSchedule.id);
                     myCommand.ExecuteNonQuery();
 
@@ -1788,7 +1798,8 @@ namespace SuperAdmin.Source
         {
             try
             {
-                String sql = @"select   sv.sv_code, sv.sv_name, a.msg_adv, a.adv_name, a.channel_adv, a.message_type, a.from_money, a.status, a.id   
+                String sql = @"select   sv.sv_code, sv.sv_name, a.msg_adv, a.adv_name, a.channel_adv, a.message_type, 
+                        a.from_money, a.active_hour, a.max_number_msg, a.status, a.id   
                         from sv join sv_adv a on sv.sv_code = a.sv_code 
                             where sv.status = 1 
                             and a.status = 1 ORDER BY sv.sv_code ";
@@ -1812,17 +1823,19 @@ namespace SuperAdmin.Source
             {
                 String sql = codeType == LuckyCardUtils.CodeType.LUCKY_CARD
                     ? @"select s.*, d.sv_adv_id, d.sv_code, d.msg_adv, d.channel_adv, d.message_type, d.from_money,
-                             d.id schedule_detail_id, nvl(d.percent,0) percent 
+                             d.id schedule_detail_id, nvl(d.percent,0) percent , sa.adv_name
                         from sv_adv_schedule s  
                         left join sv_adv_schedule_detail d on s.id = d.schedule_id and d.status = 1
+                        left join sv_adv sa on sa.id = d.sv_adv_id 
                         where 1=1
                          and s.from_date < ? +1
                          and s.to_date >= ? 
                         ORDER BY s.from_date desc"
                     : @"select s.*, d.sv_adv_id, d.sv_code, d.msg_adv, d.channel_adv, d.message_type, d.from_money,
-                             d.id schedule_detail_id, nvl(d.percent,0) percent 
+                             d.id schedule_detail_id, nvl(d.percent,0) percent , sa.adv_name
                         from sv_adv_schedule_call s  
                         left join sv_adv_schedule_detail_call d on s.id = d.schedule_id and d.status = 1
+                        left join sv_adv_call sa on sa.id = d.sv_adv_id 
                         where 1=1
                          and s.from_date < ? +1
                          and s.to_date >= ? 
@@ -1850,8 +1863,9 @@ namespace SuperAdmin.Source
                 String sql = codeType == LuckyCardUtils.CodeType.LUCKY_CARD
                     ? @"select nvl(c.schedule_detail_id,-1) schedule_detail_id,
                           nvl(c.counter,0) counter, nvl(c.create_time, s.from_date) start_time, nvl(c.report_date, trunc(s.from_date)) report_date,
-                          nvl(s.to_date, trunc(c.report_date) + 1 - 1/86400) end_time, d.*
+                          nvl(s.to_date, trunc(c.report_date) + 1 - 1/86400) end_time, d.*, a.adv_name
                     from  sv_adv_schedule_detail d
+                    join sv_adv a on a.id = d.sv_adv_id
                     full outer join schedule_counter c on d.id = c.schedule_detail_id 
                     left join sv_adv_schedule s  on s.id = d.schedule_id 
                     where 1=1 
@@ -1860,8 +1874,9 @@ namespace SuperAdmin.Source
                     ORDER BY nvl(c.report_date, trunc(s.from_date)) desc, d.sv_code"
                     : @"select nvl(c.schedule_detail_id,-1) schedule_detail_id,
                           nvl(c.counter,0) counter, nvl(c.create_time, s.from_date) start_time, nvl(c.report_date, trunc(s.from_date)) report_date,
-                          nvl(s.to_date, trunc(c.report_date) + 1 - 1/86400) end_time, d.*
+                          nvl(s.to_date, trunc(c.report_date) + 1 - 1/86400) end_time, d.*, a.adv_name
                     from  sv_adv_schedule_detail_call d
+                    join sv_adv a on a.id = d.sv_adv_id
                     full outer join schedule_counter_call c on d.id = c.schedule_detail_id 
                     left join sv_adv_schedule_call s  on s.id = d.schedule_id 
                     where 1=1 
@@ -1892,17 +1907,19 @@ namespace SuperAdmin.Source
                 ? "SELECT sv_adv_schedule_seq.nextval seq FROM DUAL"
                 : "SELECT sv_adv_schedule_call_seq.nextval seq FROM DUAL";
             String sqlUpdateSchedule = codeType == LuckyCardUtils.CodeType.LUCKY_CARD
-                ? @"INSERT INTO sv_adv_schedule (ID,FROM_DATE,TO_DATE,SCHEDULE_NAME,STATUS) 
-                    VALUES(:schedule_id, :from_date, :to_date, :schedule_name, 1)"
-                : @"INSERT INTO sv_adv_schedule_call (ID,FROM_DATE,TO_DATE,SCHEDULE_NAME,STATUS) 
-                    VALUES(:schedule_id, :from_date, :to_date, :schedule_name, 1)";
+                ? @"INSERT INTO sv_adv_schedule (ID,FROM_DATE,TO_DATE,SCHEDULE_NAME,max_total_msg,STATUS) 
+                    VALUES(:schedule_id, :from_date, :to_date, :schedule_name, :max_total_msg, 1)"
+                : @"INSERT INTO sv_adv_schedule_call (ID,FROM_DATE,TO_DATE,SCHEDULE_NAME,max_total_msg,STATUS) 
+                    VALUES(:schedule_id, :from_date, :to_date, :schedule_name, :max_total_msg, 1)";
             String sqlInsertAdv = codeType == LuckyCardUtils.CodeType.LUCKY_CARD
-                ? @"INSERT INTO sv_adv_schedule_detail (ID,SCHEDULE_ID,SV_ADV_ID,PERCENT,SV_CODE,MSG_ADV,CHANNEL_ADV,MESSAGE_TYPE,FROM_MONEY) 
-                                     SELECT sv_adv_schedule_detail_seq.nextval, 
-                                        :schedule_id, id, :percent, sv_code,  msg_adv, channel_adv, message_type, from_money FROM sv_adv WHERE id = :sv_adv_id"
-                : @"INSERT INTO sv_adv_schedule_detail_call (ID,SCHEDULE_ID,SV_ADV_ID,PERCENT,SV_CODE,MSG_ADV,CHANNEL_ADV,MESSAGE_TYPE,FROM_MONEY) 
-                                     SELECT sv_adv_schedule_detail_seq.nextval, 
-                                        :schedule_id, id, :percent, sv_code,  msg_adv, channel_adv, message_type, from_money FROM sv_adv WHERE id = :sv_adv_id";
+               ? @"INSERT INTO sv_adv_schedule_detail
+                    (ID,SCHEDULE_ID,SV_ADV_ID,PERCENT,SV_CODE,MSG_ADV,CHANNEL_ADV,MESSAGE_TYPE,FROM_MONEY,ACTIVE_HOUR,MAX_NUMBER_MSG)
+                    SELECT sv_adv_schedule_detail_seq.nextval, 
+                    :schedule_id, id, :percent, sv_code,  msg_adv, channel_adv, message_type, from_money, active_hour,MAX_NUMBER_MSG FROM sv_adv WHERE id = :sv_adv_id"
+               : @"INSERT INTO sv_adv_schedule_detail_call
+                    (ID,SCHEDULE_ID,SV_ADV_ID,PERCENT,SV_CODE,MSG_ADV,CHANNEL_ADV,MESSAGE_TYPE,FROM_MONEY,ACTIVE_HOUR,MAX_NUMBER_MSG)
+                    SELECT sv_adv_schedule_detail_seq.nextval, 
+                    :schedule_id, id, :percent, sv_code,  msg_adv, channel_adv, message_type, from_money, active_hour,MAX_NUMBER_MSG FROM sv_adv WHERE id = :sv_adv_id";
             // VALUES(sv_adv_schedule_detail_seq.nextval, :schedule_id, :sv_adv_id, :percent, :sv_code, :msg_adv, :channel_adv, :message_type, :from_money)";
 
             try
@@ -1929,6 +1946,7 @@ namespace SuperAdmin.Source
                     AddCmdParam(ref myCommand, "from_date", svAdvSchedule.from_date);
                     AddCmdParam(ref myCommand, "to_date", svAdvSchedule.to_date);
                     AddCmdParam(ref myCommand, "schedule_name", svAdvSchedule.schedule_name);
+                    AddCmdParam(ref myCommand, "max_total_msg", svAdvSchedule.max_total_msg);
                     myCommand.ExecuteNonQuery();
 
                     // insert new adv
@@ -1970,5 +1988,63 @@ namespace SuperAdmin.Source
         }
 
 
+        public ErrResponse ProcessPrizeTop(long id)
+        {
+            try
+            {
+                using (OracleConnection objConn = new OracleConnection(SqlCommon.GetConnectionString(SqlConnString.GAMEPORTAL)))
+                {
+                    OracleCommand objCmd = new OracleCommand();
+                    objCmd.Connection = objConn;
+                    objCmd.CommandText = "process_prize_top";
+                    objCmd.CommandType = CommandType.StoredProcedure;
+                    objCmd.Parameters.Add("id_", OracleDbType.Int32).Value = id;
+                    objCmd.Parameters.Add("cur_employees", OracleDbType.RefCursor).Direction = ParameterDirection.Output;
+                    try
+                    {
+                        objConn.Open();
+                        OracleDataReader objReader = objCmd.ExecuteReader();
+                        ErrResponse res = new ErrResponse();
+                        while (objReader.Read())
+                        {
+                            for (int i = 0; i < objReader.FieldCount; i++)
+                            {
+                                if (objReader.GetName(i).ToUpper() == "ERROR")
+                                {
+                                    res.error = objReader[i].ToString();
+                                }
+                                else if (objReader.GetName(i).ToUpper() == "MESSAGE")
+                                {
+                                    res.message = objReader[i].ToString();
+                                }
+                            }
+                            return res;
+                        }
+                        res.error = "-1";
+                        res.message = "Not found";
+                        return res;
+                    }
+                    catch (Exception ex)
+                    {
+                        log.Error("Exception ProcessPrizeTop: ", ex);
+                        return new ErrResponse("-1", "Error database");
+                    }
+                    finally
+                    {
+                        try
+                        {
+                            objConn.Close();
+                        }
+                        catch { }
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                log.Error("Error ProcessPrizeTop", ex);
+                return new ErrResponse("-1", "Error database");
+            }
+        }
+
     }
 }

+ 6 - 0
ReportWebCore/SuperAdmin/Views/Admin/ServiceAdvCounter.cshtml

@@ -152,7 +152,9 @@
                                                 <th scope="col">#</th>
                                                 <th scope="col" class="text-center">Report Date</th>
                                                 <th scope="col" class="text-center">Service</th>
+                                                <th scope="col" class="text-center">Adv Name</th>
                                                 <th scope="col" class="text-center">Target Percent</th>
+                                                <th scope="col" class="text-center">Limited</th>
                                                 <th scope="col" class="text-center">Count CDR</th>
                                                 <th scope="col" class="text-center">Start Time</th>
                                                 <th scope="col" class="text-center">End Time</th>
@@ -169,7 +171,9 @@
 
                                                         <td class="text-center">@adv.report_date.ToString("dd/MM/yyyy")</td>
                                                         <td class="text-center">@(adv.schedule_detail_id == 0 ? "LUCKY_CARD" : adv.sv_code == null || adv.sv_code == "" ? "UNKNOWN" : adv.sv_code)</td>
+                                                        <td class="text-left">@(adv.adv_name)</td>
                                                         <td class="text-right">@(adv.sv_code == null || adv.sv_code == "" ? "Remain" : adv.percent+"%")</td>
+                                                        <td class="text-right">@(adv.max_number_msg == 0 ? "-" : adv.max_number_msg +"")</td>
                                                         <td class="text-right">@(adv.counter)</td>
                                                         <td class="text-center">@adv.start_time.ToString("dd/MM/yyyy HH:mm:ss")</td>
                                                         <td class="text-center">@adv.end_time.ToString("dd/MM/yyyy HH:mm:ss")</td>
@@ -263,7 +267,9 @@
 
                     html += "<td class='text-center'>" + moment(service.report_date).format("DD/MM/YYYY") + "</td>";
                     html += "<td class='text-center'>" + (service.schedule_detail_id == 0 ? "LUCKY_CARD" : (service.sv_code == null || service.sv_code == "") ? "UNKNOWN" : service.sv_code) + "</td>";
+                    html += '<td class="text-left">' + service.adv_name + '</td>';
                     html += "<td class='text-right'>" + (service.sv_code == null || service.sv_code == "" ? "Remain" : service.percent + "%") + "</td>";
+                    html += '<td class="text-right">' + (service.max_number_msg == 0 ? "-" : service.max_number_msg) + '</td>';
                     html += "<td class='text-right'>" + service.counter + "</td>";
                     html += "<td class='text-center'>" + moment(service.start_time).format("DD/MM/YYYY HH:mm:ss") + "</td>";
                     html += "<td class='text-center'>" + moment(service.end_time).format("DD/MM/YYYY HH:mm:ss") + "</td>";

+ 81 - 61
ReportWebCore/SuperAdmin/Views/Admin/ServiceAdvManagement.cshtml

@@ -129,6 +129,8 @@
                                                 <th scope="col" class="text-center">Message</th>
                                                 <th scope="col" class="text-center">Channel</th>
                                                 <th scope="col" class="text-center">Message Type</th>
+                                                <th scope="col" class="text-center">Active Hour</th>
+                                                <th scope="col" class="text-center">Max no. msg</th>
                                                 <th scope="col" class="text-center">From Money</th>
                                                 <th scope="col" class="text-center">Status</th>
                                             </tr>
@@ -157,6 +159,8 @@
                                                         <td class="text-left">@service.msg_adv</td>
                                                         <td class="text-center">@service.channel_adv</td>
                                                         <td class="text-center">@{MsgTypeToText(service.message_type);}</td>
+                                                        <td class="text-right">@service.active_hour</td>
+                                                        <td class="text-right">@service.max_number_msg</td>
                                                         <td class="text-right">@service.from_money</td>
                                                         <td class="text-center">@{StatusToText(service.status);}</td>
                                                     </tr>
@@ -175,80 +179,91 @@
             <!-- // Basic form layout section end -->
         </div>
 
-        <div class="modal fade text-xs-left" id="modal-add-service" tabindex="-1" role="dialog" aria-labelledby="myModalLabel17" style="display: none;" aria-hidden="true">
-            <div class="modal-dialog modal-lg" role="document">
-                <div class="modal-content">
-                    <div class="modal-header">
-                        <h4 class="modal-title" id="modalLabelService">New Service Adv</h4>
-                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
-                            <span aria-hidden="true">×</span>
-                        </button>
-                    </div>
-                    <hidden id="advId"></hidden>
-                    <div class="modal-body">
-                        <div class="row">
+    </div>
+</div>
 
-                            <div class="col-md-6">
-                                <div class="form-group">
-                                    <label for="serviceCode">Service</label>
-                                    <select id="serviceCode" name="serviceCode" class="form-control">
-                                    </select>
-                                </div>
-                            </div>
+<div class="modal fade text-xs-left" id="modal-add-service" tabindex="-1" role="dialog" style="display: none;">
+    <div class="modal-dialog modal-lg" role="document">
+        <div class="modal-content">
+            <div class="modal-header">
+                <h4 class="modal-title" id="modalLabelService">New Service Adv</h4>
+                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+                    <span aria-hidden="true">×</span>
+                </button>
+            </div>
+            <hidden id="advId"></hidden>
+            <div class="modal-body">
+                <div class="row">
 
-                            <div class="col-md-6">
-                                <div class="form-group">
-                                    <label for="team1">Adv Name</label>
-                                    <input class="form-control" type="text" id="advName" name="advName" autocomplete="on">
-                                </div>
-                            </div>
-                            <div class="col-md-6">
-                                <div class="form-group">
-                                    <label for="team2">Message type</label>
-                                    <select class="form-control" id="messageType" name="messageType">
-                                        <option value="0" selected>SMS Text</option>
-                                        @*<option value="1">SMS Flash</option>*@
-                                        <option value="200">USSD Push</option>
-                                        <option value="201">USSD Flash</option>
-                                    </select>
-                                </div>
-                            </div>
+                    <div class="col-md-6">
+                        <div class="form-group">
+                            <label for="serviceCode">Service</label>
+                            <select id="serviceCode" name="serviceCode" class="form-control">
+                            </select>
+                        </div>
+                    </div>
 
-                            <div class="col-md-6">
-                                <div class="form-group">
-                                    <label for="team1">Channel</label>
-                                    <input class="form-control" type="text" id="channelAdv" name="channelAdv" autocomplete="on">
-                                </div>
-                            </div>
-                            <div class="col-md-12">
-                                <div class="form-group">
-                                    <label for="fromDate">Message adv</label>
-                                    <textarea class="form-control" id="msgAdv" name="msgAdv" autocomplete="off" rows="3"></textarea>
-                                </div>
-                            </div>
+                    <div class="col-md-6">
+                        <div class="form-group">
+                            <label for="team1">Adv Name</label>
+                            <input class="form-control" type="text" id="advName" name="advName" autocomplete="on">
+                        </div>
+                    </div>
+                    <div class="col-md-6">
+                        <div class="form-group">
+                            <label for="team2">Message type</label>
+                            <select class="form-control" id="messageType" name="messageType">
+                                <option value="0" selected>SMS Text</option>
+                                @*<option value="1">SMS Flash</option>*@
+                                <option value="200">USSD Push</option>
+                                <option value="201">USSD Flash</option>
+                            </select>
+                        </div>
+                    </div>
 
-                            <div class="col-md-6">
-                                <div class="form-group">
-                                    <label for="team2">From money</label>
-                                    <input class="form-control" type="number" id="fromMoney" name="fromMoney">
-                                </div>
-                            </div>
+                    <div class="col-md-6">
+                        <div class="form-group">
+                            <label for="team1">Channel</label>
+                            <input class="form-control" type="text" id="channelAdv" name="channelAdv" autocomplete="on">
+                        </div>
+                    </div>
+                    <div class="col-md-12">
+                        <div class="form-group">
+                            <label for="fromDate">Message adv</label>
+                            <textarea class="form-control" id="msgAdv" name="msgAdv" autocomplete="off" rows="3"></textarea>
+                        </div>
+                    </div>
+
+                    <div class="col-md-6">
+                        <div class="form-group">
+                            <label for="team2">Active Hour (comma splited)</label>
+                            <input class="form-control" type="text" id="activeHour" name="activeHour">
+                        </div>
+                    </div>
 
+                    <div class="col-md-6">
+                        <div class="form-group">
+                            <label for="team2">Max no. of message</label>
+                            <input class="form-control" type="number" id="maxNumberMsg" name="maxNumberMsg">
                         </div>
                     </div>
-                    <div class="modal-footer">
-                        <button type="button" class="btn grey btn-outline-secondary" data-dismiss="modal">Close</button>
-                        <button type="button" id="btnAddService" class="btn btn-outline-primary" onclick="addNewServiceAdv()">Add</button>
-                        <button type="button" id="btnUpdateInfo" class="btn btn-outline-primary" onclick="saveChangeServiceAdv()">Save Info</button>
+                    <div class="col-md-6">
+                        <div class="form-group">
+                            <label for="team2">From money</label>
+                            <input class="form-control" type="number" id="fromMoney" name="fromMoney">
+                        </div>
                     </div>
+
                 </div>
             </div>
+            <div class="modal-footer">
+                <button type="button" class="btn grey btn-outline-secondary" data-dismiss="modal">Close</button>
+                <button type="button" id="btnAddService" class="btn btn-outline-primary" onclick="addNewServiceAdv()">Add</button>
+                <button type="button" id="btnUpdateInfo" class="btn btn-outline-primary" onclick="saveChangeServiceAdv()">Save Info</button>
+            </div>
         </div>
     </div>
 </div>
-@*<link href="~/editor/summernote.css" rel="stylesheet">*@
-@*<script type="text/javascript" src="~/editor/summernote.js"></script>*@
-@*<script type="text/javascript" src="~/editor/script-custom-editor.js"></script>*@
 
 
 @section Scripts {
@@ -279,6 +294,7 @@
             $("#messageType").val("0");
             $("#msgAdv").val("");
             $("#fromMoney").val("0");
+            $("#activeHour").val("7,8,9,10,11,12,13,14,15,16,17,18,19,20");
 
             $("#btnAddService").show();
             $("#btnUpdateInfo").hide();
@@ -312,6 +328,8 @@
                         $("#channelAdv").val(service.channel_adv);
                         $("#messageType").val(service.message_type);
                         $("#msgAdv").val(service.msg_adv);
+                        $("#activeHour").val(service.active_hour);
+                        $("#maxNumberMsg").val(service.max_number_msg);
                         $("#fromMoney").val(service.from_money);
 
                         $("#btnAddService").hide();
@@ -398,6 +416,8 @@
                     html += "<td class='text-left'>" + service.msg_adv + "</td>";
                     html += "<td class='text-center'>" + service.channel_adv + "</td>";
                     html += "<td class='text-center'>" + MsgTypeToText(service.message_type) + "</td>";
+                    html += "<td class='text-right'>" + service.active_hour + "</td>";
+                    html += "<td class='text-right'>" + service.max_number_msg + "</td>";
                     html += "<td class='text-right'>" + service.from_money + "</td>";
                     html += "<td class='text-center'>" + StatusToText(service.status) + "</td>";
                     html += "</tr>";

+ 11 - 5
ReportWebCore/SuperAdmin/Views/Admin/ServiceAdvScheduler.cshtml

@@ -8,7 +8,7 @@
 @using ReportWeb.Source;
 
 @model List<SvAdvSchedule>
- 
+
 @{
     int? codeType = ViewBag.codeType;
 }
@@ -59,7 +59,7 @@
                                             <div class="row">
                                                 <div class="col-md-4">
                                                     <div class="form-group">
-                                                        <label for="teamName">Month</label>
+                                                        <label for="searchMonth">Month</label>
                                                         <select class="form-control" id="searchMonth" name="searchMonth">
                                                             @for (int i = 1; i <= 12; i++)
                                                             {
@@ -122,6 +122,7 @@
                                                 <th scope="col" class="text-center">Schedule tiltle</th>
                                                 <th scope="col" class="text-center">Start Time</th>
                                                 <th scope="col" class="text-center">End Time</th>
+                                                <th scope="col" class="text-center">Max Total Message</th>
                                                 <th scope="col" class="text-center">List Adv</th>
                                             </tr>
                                         </thead>
@@ -147,10 +148,11 @@
                                                         <td class="text-left">@advSchedule.schedule_name</td>
                                                         <td class="text-center">@advSchedule.from_date.Value.ToString("dd/MM/yyyy HH:mm:ss")</td>
                                                         <td class="text-center">@advSchedule.to_date.Value.ToString("dd/MM/yyyy HH:mm:ss")</td>
+                                                        <td class="text-right">@advSchedule.max_total_msg</td>
                                                         <td class="text-left">
                                                             @foreach (SvAdv adv in advSchedule.list_adv)
                                                             {
-                                                                <span style="display:block">@(adv.sv_code + ": " + adv.percent + "%")</span>
+                                                                <span style="display:block">@(adv.adv_name + ": " + adv.percent + "%")</span>
                                                             }
                                                         </td>
                                                     </tr>
@@ -258,6 +260,7 @@
         function addSvAdvSchedule() {
             // clear data
             $("#scheduleName").val("");
+            $("#maxTotalMsg").val(0);
 
             $("#btnAddService").show();
             $("#btnUpdateInfo").hide();
@@ -287,6 +290,7 @@
 
                 // Adding one more key to FormData object
                 formData.append('scheduleName', $("#scheduleName").val());
+                formData.append('maxTotalMsg', $("#maxTotalMsg").val());
                 formData.append('fromDate', $("#fromDate").val());
                 formData.append('toDate', $("#toDate").val());
                 formData.append('listAdv', JSON.stringify(svAdv));
@@ -307,7 +311,7 @@
                                 });
                             //alert('Import success: ' + result.content);
                         } else {
-                            swal("Add service adv schedule failed!", result.content, "error");
+                            swal("Add service adv schedule failed!", result.error_content, "error");
                             //alert('Import failed: ' + result.content);
                         }
                     },
@@ -340,6 +344,7 @@
 
                 formData.append('scheduleId', $("#scheduleId").val());
                 formData.append('scheduleName', $("#scheduleName").val());
+                formData.append('maxTotalMsg', $("#maxTotalMsg").val());
                 formData.append('fromDate', $("#fromDate").val());
                 formData.append('toDate', $("#toDate").val());
                 formData.append('listAdv', JSON.stringify(svAdv));
@@ -531,10 +536,11 @@
                     html += "<td class='text-left'>" + service.schedule_name + "</td>";
                     html += "<td class='text-center'>" + moment(service.from_date).format("DD/MM/YYYY HH:mm:ss") + "</td>";
                     html += "<td class='text-center'>" + moment(service.to_date).format("DD/MM/YYYY HH:mm:ss") + "</td>";
+                    html += "<td class='text-right'>" + service.max_total_msg + "</td>";
                     html += "<td class='text-left'>";
                     for (var j = 0; j < service.list_adv.length; j++) {
                         let adv = service.list_adv[j];
-                        html += "<span style='display:block'>" + adv.sv_code + ": " + adv.percent + "%</span>";
+                        html += "<span style='display:block'>" + adv.adv_name + ": " + adv.percent + "%</span>";
                     }
                     html += "</td>";
                     html += "</tr>";

+ 29 - 11
ReportWebCore/SuperAdmin/Views/Admin/_ScheduleDetail.cshtml

@@ -45,13 +45,19 @@
     }
 </style>
 <div class="row">
-    <div class="col-md-12">
+    <div class="col-md-6">
         <div class="form-group">
             <label for="team1">Schedule Title</label>
             <input class="form-control" type="text" id="scheduleName" name="scheduleName" autocomplete="on" value="@Model.schedule_name">
         </div>
     </div>
 
+    <div class="col-md-6">
+        <div class="form-group">
+            <label for="team1">Max Total Message</label>
+            <input class="form-control" type="number" id="maxTotalMsg" name="maxTotalMsg" autocomplete="on" value="@Model.max_total_msg">
+        </div>
+    </div>
 </div>
 <div class="row">
     <div class="col-md-6">
@@ -93,7 +99,12 @@
             <label><b>Percent</b></label>
         </div>
     </div>
-    <div class="col-md-8">
+    <div class="col-md-4">
+        <div class="">
+            <label><b>Message</b></label>
+        </div>
+    </div>
+    <div class="col-md-4">
         <div class="">
             <label><b>Adv Info</b></label>
         </div>
@@ -117,25 +128,32 @@
                 <input id="percent-@i" name="percent" class="form-control" type="number" min="0" max="100" value="@adv.percent" />
             </div>
         </div>
-        <div class="col-md-8">
+
+        <div class="col-md-4">
+            @adv.msg_adv
+        </div>
+        <div class="col-md-4">
             <div class="">
                 @*<label for="adv-info">Info</label>*@
-                <div name="adv-info" id="adv-info-@adv.id">
-                    <div>
+                <div name="adv-info" id="adv-info-@adv.id" class="row">
+                    <div class="col-6">
                         <b>Service</b>: @adv.sv_code
                     </div>
-                    <div>
+                    <div class="col-6">
                         <b>Message type</b>: @{MsgTypeToText(adv.message_type);}
                     </div>
-                    <div>
-                        <b>Message content</b>: @adv.msg_adv
-                    </div>
-                    <div>
+                    <div class="col-6">
                         <b>Channel</b>: @adv.channel_adv
                     </div>
-                    <div>
+                    <div class="col-6">
                         <b>From money</b>: @adv.from_money
                     </div>
+                    <div class="col-6">
+                        <b>Active hour</b>: @adv.active_hour
+                    </div>
+                    <div class="col-6">
+                        <b>Max no. message</b>: @adv.max_number_msg
+                    </div>
                 </div>
             </div>
         </div>

+ 81 - 9
ReportWebCore/SuperAdmin/Views/LuckySpin/Ranking.cshtml

@@ -84,6 +84,7 @@
                                     <th>Month</th>
                                     <th>Package</th>
                                     <th>Last Update</th>
+                                    <th>Action</th>
                                 </tr>
                             </thead>
                             <tbody id="gridbody1">
@@ -92,14 +93,35 @@
                                     for (int i = 0; i < Model.rankingCoin.Count; i++)
                                     {
                                         var his = Model.rankingCoin[i];
-                                <tr>
-                                    <td class="text-right">@(his.rank)</td>
-                                    <td class="text-center">@his.msisdn</td>
-                                    <td class="text-center">@his.total_coin</td>
-                                    <td class="text-right">@his.start_time.Value.ToString("MM/yyyy")</td>
-                                    <td class="text-right">@his.product_name</td>
-                                    <td class="text-right">@his.last_update.Value.ToString("dd/MM/yyyy HH:mm:ss")</td>
-                                </tr>
+                                        <tr>
+                                            <td class="text-right">@(his.rank)</td>
+                                            <td class="text-center">@his.msisdn</td>
+                                            <td class="text-center">@his.total_coin</td>
+                                            <td class="text-right">@his.start_time.Value.ToString("MM/yyyy")</td>
+                                            <td class="text-right">@his.product_name</td>
+                                            <td class="text-right">@his.last_update.Value.ToString("dd/MM/yyyy HH:mm:ss")</td>
+                                            <td class="text-center">
+                                                @if (i == 0)
+                                                {
+                                                    if (his.status == 0)
+                                                    {
+                                                        <button id="btn-add-money" class="btn btn-danger" onclick="addMoney(@his.id);">
+                                                            <i class="fa fa-money"></i> Add Money
+                                                        </button>
+                                                    }
+                                                    else if (his.status == 1)
+                                                    {
+                                                        <span>Processing</span>
+                                                    }
+                                                    else if (his.status == 2)
+                                                    {
+                                                        <span>Processed</span>
+                                                    } else {
+                                                        <span>Not ready</span>
+                                                    }
+                                                }
+                                            </td>
+                                        </tr>
                                     }
                                 }
                             </tbody>
@@ -254,6 +276,9 @@
                     html += "<td class='text-center'> " + moment(news.start_time).format("MM/YYYY") + "</td> ";
                     html += "<td class='text-right'> " + news.product_name + "</td> ";
                     html += "<td class='text-center'> " + moment(news.last_update).format("DD/MM/YYYY HH:mm:ss") + "</td> ";
+                    html += "<td class='text-center'>"
+                        + (i == 0 ? (news.status == 0 ? "<button id='btn-add-money' class='btn btn-danger btn-sm' onclick='addMoney(" + news.id + ");'><i class='fa fa-money'></i> Add Money</span>" : news.status == 1 ? "Processing" : news.status == 2 ? "Processed" : "Not ready") : "")
+                        + "</td>";
                     html += "</tr>";
                 }
             }
@@ -316,12 +341,59 @@
             })
         }
 
-
         $(document).ready(function () {
             $("#fromDate").datetimepicker({
                 format: "MM/YYYY",
                 defaultDate: moment().startOf('month')
             });
         });
+
+
+        function addMoney(id) {
+            startSpinner("btn-add-money");
+            swal({
+                title: "Are you sure?",
+                text: "System will add money automatically!",
+                icon: "warning",
+                buttons: [
+                    'No!',
+                    'Yes!'
+                ],
+                dangerMode: true,
+            }).then(function (isConfirm) {
+                console.log(isConfirm);
+                if (isConfirm) {
+                    $.ajax({
+                        url: subDomain + "/LuckySpin/AddMoneyRanking",
+                        data: {
+                            __RequestVerificationToken: $('input[name="__RequestVerificationToken"]').val(),
+                            id: id
+                        },
+                        type: "POST",
+                        success: function (data) {
+                            stopSpinner('btnSearch');
+                            console.log(data);
+                            if (data.error != "0") {
+                                console.log(data.content);
+                                swal("Warning", data.content, "warning");
+                            } else {
+                                swal("Success!", data.content, "success");
+                                SearchHistory();
+                            }
+                        },
+                        error: function (data) {
+                            stopSpinner('btnSearch');
+                            console.log(data);
+                            resetTableDetail();
+                        }
+                    })
+
+                } else {
+                    stopSpinner("btn-add-money");
+                }
+            })
+
+        }
+
     </script>
 }

+ 1 - 1
ReportWebCore/SuperAdmin/appsettings.json

@@ -11,7 +11,7 @@
   "channel": "APP",
   "numberSeparated": ".",
   "PARENT_ID": "100207",
-  "countryCode": "509",
+  "countryCode": "258",
 
 
   // real server

+ 4 - 0
ReportWebCore/SuperAdmin/wwwroot/admin-assets/js/admin.js

@@ -364,6 +364,8 @@ function addNewServiceAdv() {
         formData.append('msgAdv', $("#msgAdv").val());
         formData.append('channelAdv', $("#channelAdv").val());
         formData.append('messageType', $("#messageType").val());
+        formData.append('activeHour', $("#activeHour").val());
+        formData.append('maxNumberMsg', $("#maxNumberMsg").val());
         formData.append('fromMoney', $("#fromMoney").val());
 
         $.ajax({
@@ -409,6 +411,8 @@ function saveChangeServiceAdv() {
         formData.append('msgAdv', $("#msgAdv").val());
         formData.append('channelAdv', $("#channelAdv").val());
         formData.append('messageType', $("#messageType").val());
+        formData.append('activeHour', $("#activeHour").val());
+        formData.append('maxNumberMsg', $("#maxNumberMsg").val());
         formData.append('fromMoney', $("#fromMoney").val());
 
         $.ajax({

+ 1 - 0
WebserviceLuckyCard/WsLuckyCard/src/com/vas/webservices/WsCommon.java

@@ -101,6 +101,7 @@ public class WsCommon extends WebserviceAbstract {
             if (listReg == null || listReg.isEmpty()) {
                 logger.warn("Renew but not registered: " + msisdn + " -> register for customer");
                 registerByMps(msisdn, packName, 0, LuckyCallUtils.Channel.MPS);
+                listReg = db.getRegisterInfo(msisdn, packName);
 //                response.setErrorCode(Common.ErrorCode.NOT_REGISTERED);
 //                response.setContent(MessageResponse.get(Common.Message.NOT_REGISTERED, logger, getLang()));
 //                return response;

+ 1 - 1
WebserviceLuckyCard/WsLuckyCard/src/com/vas/webservices/WsLuckyCall.java

@@ -146,7 +146,7 @@ public class WsLuckyCall extends WsCommon {
                 } else {
                     String lang = (String) ctx.getMessageContext().get("lang");
                     response.setErrorCode(Common.ResultCode.SUCCESS);
-                    response.setListProduct(Common.listProduct);
+                    response.setListProduct(Common.listProductWeb);
                 }
             }
 

+ 14 - 10
WebserviceLuckyCard/WsLuckyCard/src/com/vas/webservices/WsMps.java

@@ -14,7 +14,7 @@ import com.vas.wsfw.obj.Request;
 import com.vas.wsfw.obj.Response;
 import com.vas.wsfw.obj.SmsMtObj;
 import com.vas.wsfw.obj.UserInfo;
-import com.viettel.ussdfw.log.ProcessTransLog;
+//import com.viettel.ussdfw.log.ProcessTransLog;
 import com.viettel.ussdfw.object.TransactionLog;
 import java.io.UnsupportedEncodingException;
 import java.security.NoSuchAlgorithmException;
@@ -57,7 +57,7 @@ public class WsMps extends WsCommon {
         response.setErrorCode(SUCCESS);
         // translog
         Timestamp reqTime = new Timestamp(System.currentTimeMillis());
-        TransactionLog transLog = new TransactionLog(); 
+        TransactionLog transLog = new TransactionLog();
 //        transLog.setTransactionId(transactionId);
         transLog.setCommand(params);
         transLog.setMsisdn(msisdn);
@@ -107,7 +107,7 @@ public class WsMps extends WsCommon {
                 } else {
                     msisdn = formatMsisdn(msisdn);
                     String channel = LuckyCallUtils.Channel.SMS;
-                    if ("1".equals(command)) {
+                    if ("1".equals(command) || "2".equals(command)) {
                         channel = LuckyCallUtils.Channel.USSD;
                     }
                     if (params.equals("0")) {
@@ -134,7 +134,7 @@ public class WsMps extends WsCommon {
                 transLog.setErrorCode(response.getErrorCode());
                 transLog.setResponse(response.toString());
                 transLog.setResponseTime(new Timestamp(System.currentTimeMillis()));
-                ProcessTransLog.enqueue(transLog);
+//                ProcessTransLog.enqueue(transLog);
             } catch (Exception ex) {
                 logger.error("Error insert log", ex);
             } finally {
@@ -153,6 +153,7 @@ public class WsMps extends WsCommon {
             @WebParam(name = "msisdn", targetNamespace = "http://contentws/xsd") String msisdn,
             @WebParam(name = "chargetime", targetNamespace = "http://contentws/xsd") String chargetime,
             @WebParam(name = "params", targetNamespace = "http://contentws/xsd") String params,
+            @WebParam(name = "mode", targetNamespace = "http://contentws/xsd") String mode,
             @WebParam(name = "amount", targetNamespace = "http://contentws/xsd") String fee,
             @WebParam(name = "transactionId", targetNamespace = "http://contentws/xsd") String transactionId) {
 
@@ -176,6 +177,7 @@ public class WsMps extends WsCommon {
                     append("\nparams:").append(params).
                     append("\nchargetime:").append(chargetime).
                     append("\nserviceid:").append(serviceid).
+                    append("\nmode:").append(mode).
                     append("\namount:").append(fee).
                     append("\ntransactionId:").append(transactionId);
             logger.info(br);
@@ -210,9 +212,10 @@ public class WsMps extends WsCommon {
 //                } else {
                 msisdn = formatMsisdn(msisdn);
                 if (params.equals("0")) {
-                    renewMps(msisdn, serviceid, Integer.parseInt(fee));
+                    if ("REAL".equals(mode)) {
+                        renewMps(msisdn, serviceid, Integer.parseInt(fee));
 
-                    // send message
+                        // send message
 //                    Timestamp expireFree = db.iGetExpireFree(msisdn);
 //                    String message2 = MessageResponse.get(autoRenew ? Common.Message.REGISTER_SUCCESS_USSD_RENEW : Common.Message.REGISTER_SUCCESS_USSD, logger);
 //                    message2 = message2.replaceAll("%expire%", df.format(expireTime));
@@ -224,8 +227,9 @@ public class WsMps extends WsCommon {
 //                    mt.setChannel(Common.CHANNEL);
 //                    mt.setMessage(message2);
 //                    db.insertMt(mt);
-                    // return
-                    logger.info("Renew account success: " + msisdn);
+                        // return
+                        logger.info("Renew account success: " + msisdn);
+                    }
                     response.setErrorCode(Common.ErrorCode.SUCCESS);
                     response.setContent(Common.ResultCode.SUCCESS);
                     return response.getErrorCode();
@@ -246,9 +250,9 @@ public class WsMps extends WsCommon {
                 transLog.setResponse(response.toString());
                 transLog.setResponseTime(new Timestamp(System.currentTimeMillis()));
                 if (transactionId != null) {
-                    
+
                 }
-                ProcessTransLog.enqueue(transLog);
+//                ProcessTransLog.enqueue(transLog);
             } catch (Exception ex) {
                 logger.error("Error insert log", ex);
             } finally {

+ 1 - 1
WebserviceLuckyCard/WsLuckyCard/src/com/vas/wsfw/database/WsProcessUtils.java

@@ -356,7 +356,7 @@ public class WsProcessUtils extends DbProcessorAbstract {
         Connection connection = null;
         List listConfig = null;
         String sql = "SELECT * FROM PACKG "
-                + (bizId == 1 ? " and biz_id > 0 " : "")
+                + (bizId == 1 ? " where biz_id > 0 " : "")
                 + " order by product_id ";
         try {
             connection = getConnection(dbName);

+ 2 - 2
WebserviceLuckyCard/etc/database.xml

@@ -10,8 +10,8 @@
   <named-config name="dbProcess">
 	<property name="driver">oracle.jdbc.driver.OracleDriver</property>
 	<property name="connection">jdbc:oracle:thin:@(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1539))(CONNECT_DATA =(SERVER = DEDICATED)(SID=ORA12C)))</property>
-	<property name="username">myt_luckycall</property>
-	<property name="password">myt_luckycall</property>
+	<property name="username">mzb_luckycall</property>
+	<property name="password">mzb_luckycall</property>
 	<property name="initialPoolSize">5</property>
 	<property name="maxPoolSize">30</property>
 	<property name="minPoolSize">10</property>