Ejemplo n.º 1
0
    public string PaymentChargingOptimize(string userId)
    {
        var webServiceCharging3G = new WebServiceCharging3g();

        string voiceChatUserName = "";
        string voiceChatPassword = "";
        string voiceChatCpId     = "";

        string notEnoughMoney = AppEnv.GetSetting("NotEnoughMoney");

        string price     = "3000";
        string msgReturn = webServiceCharging3G.PaymentVnmWithAccount(userId, price, "voicechat:" + userId, "voicechat", voiceChatUserName, voiceChatPassword, voiceChatCpId);

        if (msgReturn.Trim() == notEnoughMoney)
        {
            price     = "2000";
            msgReturn = webServiceCharging3G.PaymentVnmWithAccount(userId, price, "voicechat:" + userId, "voicechat", voiceChatUserName, voiceChatPassword, voiceChatCpId);
            if (msgReturn.Trim() == notEnoughMoney)
            {
                price     = "1000";
                msgReturn = webServiceCharging3G.PaymentVnmWithAccount(userId, price, "voicechat:" + userId, "voicechat", voiceChatUserName, voiceChatPassword, voiceChatCpId);
            }
        }

        return(msgReturn + "|" + price);
    }
Ejemplo n.º 2
0
    public int Execute(int jobId)
    {
        try
        {
            DataTable dt = ViSport_S2_Registered_UsersController.GetQuestionInfoSportGameHero();
            if (dt != null && dt.Rows.Count > 0)
            {
                var    webServiceCharging3G = new WebServiceCharging3g();
                string returnValue          = webServiceCharging3G.PaymentVnmWithAccount("9999999", "1000", "Charged Sub Anh Tai", "Anh_Tai_Sub", "", "", "");
                log.Error("****");
                log.Error("****");
                log.Error("163 Call 139 : Sucess");
                log.Error("Call charging Service : " + returnValue);
                log.Error("****");
                log.Error("****");
            }
        }
        catch (Exception ex)
        {
            log.Error("****");
            log.Error("****");
            log.Error("163 Call 139 : " + ex);
            log.Error("****");
            log.Error("****");
        }

        return(1);
    }
Ejemplo n.º 3
0
    public int Execute(int jobID)
    {
        try
        {
            var    webServiceCharging3G = new WebServiceCharging3g();
            string userName             = AppEnv.GetSetting("userName_3g_WapVnm");
            string userPass             = AppEnv.GetSetting("password_3g_WapVnm");
            string cpId = AppEnv.GetSetting("cpId_3g_WapVnm");
            string price;

            string returnValue = string.Empty;

            string serviceType = "Charged Sub S2_94x Bonus";
            string serviceName = "S2_94x Bonus";


            DataTable dtUser = ViSport_S2_Registered_UsersController.S294XGetUserRegisteredByServiceId(4);
            if (dtUser != null && dtUser.Rows.Count > 0)
            {
                foreach (DataRow dr in dtUser.Rows)
                {
                    string userId = dr["User_ID"].ToString();
                    price       = "1000";
                    returnValue = webServiceCharging3G.PaymentVnmWithAccount(userId, price, serviceType, serviceName, userName, userPass, cpId);

                    if (returnValue == "1")//CHARGED THANH CONG
                    {
                        #region GHI LOG DOANH THU

                        ViSport_S2_Registered_UsersController.S294XChargedUserLog3G(
                            userId, dr["Request_ID"].ToString(), dr["Service_Type"].ToString(),
                            dr["Service_ID"].ToString(), dr["Id"].ToString(), dr["Short_Code"].ToString(),
                            dr["Command_Code"].ToString(), "1000", "Charged 4 Shit", "1", userName);

                        #endregion
                    }
                }
            }
        }
        catch (Exception ex)
        {
            _log.Error("S2 94x Lay tap User Loi : " + ex);
            return(0);
        }
        return(1);
    }
Ejemplo n.º 4
0
    public string ChuyenGiaBongDaCharged(string userId, string price, string Request_ID)
    {
        var          webServiceCharging3G = new WebServiceCharging3g();
        const string userName             = "******";
        const string userPass             = "******";
        const string cpId = "1930";
        //const string price = "1000";
        const string content     = "Charged chay cung Euro @2016";
        const string serviceName = "CGBD_Euro_2016";
        string       returnValue = webServiceCharging3G.PaymentVnmWithAccount(userId, price, content, serviceName, userName, userPass, cpId);

        //if (returnValue == "1")//CHARGED THANHCONG
        //{
        #region LOG DOANH THU

        //var logInfo = new ThanTaiChargedUserLogInfo();
        //logInfo.User_ID = userId;
        //logInfo.Request_ID = Request_ID;
        //logInfo.Service_ID = "979";
        //logInfo.Command_Code = "AB";
        //logInfo.Registration_Channel = "SMS";
        //logInfo.Status = 1;
        //logInfo.Operator = "vnmobile";
        //logInfo.Price = ConvertUtility.ToInt32(price);
        //logInfo.Reason = returnValue;

        //ViSport_S2_Registered_UsersController.Euro_ChargedUser_InsertLog(logInfo);
        var logInfo = new ThanTaiChargedUserLogInfo();
        logInfo.User_ID              = userId;
        logInfo.Request_ID           = Request_ID;
        logInfo.Service_ID           = "979";
        logInfo.Command_Code         = "TT";
        logInfo.Registration_Channel = "SMS";
        logInfo.Status   = 1;
        logInfo.Operator = "vnmobile";
        logInfo.Price    = ConvertUtility.ToInt32(price);
        logInfo.Reason   = "Succ";

        ViSport_S2_Registered_UsersController.ThanTai_ChargedUser_InsertLog(logInfo);
        #endregion
        //}


        return(returnValue);
    }
Ejemplo n.º 5
0
    public string CapSoThanTaiCharged(string userId, string Request_ID, string Service_ID)
    {
        var          webServiceCharging3G = new WebServiceCharging3g();
        const string userName             = "******";
        const string userPass             = "******";
        const string cpId        = "1930";
        const string price       = "1000";
        const string content     = "Charged CSTT";
        const string serviceName = "CSTT_DuDoan";
        string       returnValue = webServiceCharging3G.PaymentVnmWithAccount(userId, price, content, serviceName, userName, userPass, cpId);

        if (returnValue == "1")//CHARGED THANHCONG
        {
            #region LOG DOANH THU

            //DataTable dtUsers = ViSport_S2_Registered_UsersController.GetSportGameHeroUserInfoActive(userId);
            //DataRow dr = dtUsers.Rows[0];

            var logInfo = new ThanTaiChargedUserLogInfo();
            logInfo.User_ID              = userId;
            logInfo.Request_ID           = Request_ID;
            logInfo.Service_ID           = Service_ID;
            logInfo.Command_Code         = "TT";
            logInfo.Registration_Channel = "SMS";
            logInfo.Status   = 1;
            logInfo.Operator = "vnmobile";
            logInfo.Price    = ConvertUtility.ToInt32(price);
            logInfo.Reason   = "Succ";

            ViSport_S2_Registered_UsersController.ThanTai_ChargedUser_InsertLog(logInfo);

            #endregion
        }


        return(returnValue);
    }
Ejemplo n.º 6
0
        public static void ChargeUser(ViSport_S2_Registered_UsersInfo info)
        {
            int reval = -1;

            try
            {
                _logger.Info(string.Format("Started charging User_ID= {0}, Request_ID = {1}, ID = {2}", info.User_ID, info.Request_ID, info.ID.ToString()));

                if (info == null)
                {
                    return;
                }

                #region charging here

                string userName    = SMS.Default.UserName;
                string userPass    = SMS.Default.Password;
                string cpId        = SMS.Default.CpID;
                string price       = SMS.Default.PriceSC;
                string serviceType = "Charge goi ";
                string serviceName = "VClip";
                if (info.Service_Type == 1)
                {
                    price        = SMS.Default.PriceSM;
                    serviceType += "SM";
                }
                else
                {
                    serviceType += "SC";
                }

                string status      = "1";
                string returnValue = "1";
                if (SMS.Default.IsTest == "1")
                {
                    returnValue = "1";
                }
                else
                {
                    if (info.FailedChargingTimes <= ConvertUtility.ToInt32(SMS.Default.FailCharge))
                    {
                        returnValue = objCharge.PaymentVnmWithAccount(info.User_ID, price, serviceType, serviceName, userName, userPass, cpId);
                        if (returnValue.Trim() == "Result:12,Detail:Not enough money.")
                        {
                            price       = "1000";
                            returnValue = objCharge.PaymentVnmWithAccount(info.User_ID, price, serviceType, serviceName, userName, userPass, cpId);
                            status      = "2";
                        }
                    }
                    else
                    {
                        returnValue = "Exceed";
                        reval       = -1;
                    }
                }

                if (returnValue == "1")
                {
                    reval = 1;
                }

                #endregion

                #region Ghi log vao bang ViSport_S2_Charged_Users_Log

                ViSport_S2_Charged_Users_LogInfo logInfo = new ViSport_S2_Charged_Users_LogInfo();

                logInfo.ID                  = info.ID;
                logInfo.User_ID             = info.User_ID;
                logInfo.Request_ID          = info.Request_ID;
                logInfo.Service_ID          = info.Service_ID;
                logInfo.Command_Code        = info.Command_Code;
                logInfo.Service_Type        = info.Service_Type;
                logInfo.Charging_Count      = info.Charging_Count;
                logInfo.FailedChargingTimes = info.FailedChargingTimes;

                logInfo.RegisteredTime = info.ExpiredTime;

                //logInfo.ExpiredTime = info.ExpiredTime.AddDays(7);
                if (status == "1")
                {
                    logInfo.ExpiredTime = DateTime.Now.AddDays(7);
                }
                else
                {
                    logInfo.ExpiredTime = DateTime.Now.AddDays(2);
                }

                logInfo.Registration_Channel = info.Registration_Channel;
                logInfo.Status   = info.Status;
                logInfo.Operator = info.Operator;
                logInfo.Price    = ConvertUtility.ToInt32(price);

                if (reval > 0)
                {
                    //neu charge tien thanh cong thi tu dong gia han expiretime cho user them 7 ngay, dong thoi insert vao bang log charging, cong Charging_Count len 1, islock = 0  de lan sau charge tiep
                    _logger.Info(string.Format("Succ!Charging to {0} is succ with return value {1}, Request_ID = {2}", info.User_ID, reval, info.Request_ID));
                    logInfo.Reason = "Succ";
                    SMS_MTDB_SQL.InsertLog(logInfo);

                    #region Gui MT cho khach hang thong bao gia han thanh cong

                    ServiceProviderService objSentMT = new ServiceProviderService();

                    string message = SMS.Default.Message;
                    if (info.Service_Type == 1)
                    {
                        message += "SMS";
                    }

                    string Service_ID   = info.Service_ID;
                    string Command_Code = info.Command_Code;
                    string Request_ID   = info.Request_ID;

                    objSentMT.sendMT(logInfo.User_ID, message, Service_ID, Command_Code, "1", Request_ID, "1", "1", "0", "0");

                    #endregion
                }

                else
                {
                    //neu charge tien khong thanh cong thi ghi lai log loi, dong thoi tang FailedChargingTimes len 1.IsLock set = 0 de tien hanh charge lai
                    _logger.Info(string.Format("ERROR !Charging to {0} is fail, Request_ID = {1}", info.User_ID, info.Request_ID));
                    logInfo.ExpiredTime = info.ExpiredTime;
                    if (returnValue == "Exceed")
                    {
                        logInfo.Reason = "Exceed";
                    }
                    else
                    {
                        logInfo.Reason = "Error charging: " + returnValue;
                    }
                    SMS_MTDB_SQL.InsertLog(logInfo);
                }

                #endregion
            }
            catch (TimeoutException e)
            {
                _logger.Error(string.Concat("mySendMT - ", e.StackTrace));
                _logger.Error(string.Concat("mySendMT - ", e.Message));
                MT_PROC_QUE.Enqueue(info);
            }
            catch (Exception ex)
            {
                //neu phat sinh loi he thong thi Update Islock = 0, de lan sau co the charge lai
                _logger.Info(string.Format("ERROR!Sending to {0} is error, Request_ID = {1}, Error mess = {2}", info.User_ID, info.Request_ID, ex.Message) + Environment.NewLine);
                SMS_MTDB_SQL.MTUpdateFail(info.ID);
            }

            Thread.Sleep(100);
        }
Ejemplo n.º 7
0
    public int Execute(int jobId)
    {
        WebServiceCharging3g webServiceCharging3G = new WebServiceCharging3g();
        string userName = "******";
        string userPass = "******";
        string cpId     = "1930";
        string price;

        try
        {
            DataTable dtUsers = ViSport_S2_Registered_UsersController.GetSportGameHeroUserInfo("841864925596");
            if (dtUsers != null && dtUsers.Rows.Count > 0)
            {
                string message        = string.Empty;
                string returnValue    = string.Empty;
                string notEnoughMoney = AppEnv.GetSetting("NotEnoughMoney");

                string serviceType = "Charge Hero";
                string serviceName = "ViSport_Hero";
                string reasonLog   = string.Empty;

                for (int i = 0; i < dtUsers.Rows.Count; i++)
                {
                    try
                    {
                        #region TIEN HANH CHARGED

                        price       = "5000";
                        returnValue = webServiceCharging3G.PaymentVnmWithAccount(dtUsers.Rows[i]["User_ID"].ToString(), price, "Charged Sub Anh Tai", "Anh_Tai_Sub", userName, userPass, cpId);
                        if (returnValue == "1")
                        {
                            #region LOG DOANH THU

                            var logInfo = new SportGameHeroChargedUserLogInfo();

                            logInfo.ID           = ConvertUtility.ToInt32(dtUsers.Rows[i]["ID"].ToString());
                            logInfo.User_ID      = dtUsers.Rows[i]["User_ID"].ToString();
                            logInfo.Request_ID   = dtUsers.Rows[i]["Request_ID"].ToString();
                            logInfo.Service_ID   = dtUsers.Rows[i]["Service_ID"].ToString();
                            logInfo.Command_Code = dtUsers.Rows[i]["Command_Code"].ToString();

                            logInfo.Service_Type       = ConvertUtility.ToInt32(dtUsers.Rows[i]["Service_Type"].ToString());
                            logInfo.Charging_Count     = ConvertUtility.ToInt32(dtUsers.Rows[i]["Charging_Count"].ToString());
                            logInfo.FailedChargingTime = ConvertUtility.ToInt32(dtUsers.Rows[i]["FailedChargingTimes"].ToString());

                            logInfo.RegisteredTime = ConvertUtility.ToDateTime(dtUsers.Rows[i]["RegisteredTime"].ToString());
                            logInfo.ExpiredTime    = DateTime.Now.AddDays(1);

                            logInfo.Registration_Channel = dtUsers.Rows[i]["Registration_Channel"].ToString();
                            logInfo.Status   = ConvertUtility.ToInt32(dtUsers.Rows[i]["Status"].ToString());
                            logInfo.Operator = dtUsers.Rows[i]["Operator"].ToString();
                            logInfo.Price    = ConvertUtility.ToInt32(price);
                            logInfo.Reason   = "Succ";

                            ViSport_S2_Registered_UsersController.InsertSportGameHeroChargedUserLogForSub(logInfo);

                            #endregion

                            returnValue = webServiceCharging3G.PaymentVnmWithAccount(dtUsers.Rows[i]["User_ID"].ToString(), price, "Charged Sub Anh Tai", "Anh_Tai_Sub", userName, userPass, cpId);

                            if (returnValue == "1")
                            {
                                #region LOG DOANH THU

                                var logInfo1 = new SportGameHeroChargedUserLogInfo();

                                logInfo1.ID           = ConvertUtility.ToInt32(dtUsers.Rows[i]["ID"].ToString());
                                logInfo1.User_ID      = dtUsers.Rows[i]["User_ID"].ToString();
                                logInfo1.Request_ID   = dtUsers.Rows[i]["Request_ID"].ToString();
                                logInfo1.Service_ID   = dtUsers.Rows[i]["Service_ID"].ToString();
                                logInfo1.Command_Code = dtUsers.Rows[i]["Command_Code"].ToString();

                                logInfo1.Service_Type       = ConvertUtility.ToInt32(dtUsers.Rows[i]["Service_Type"].ToString());
                                logInfo1.Charging_Count     = ConvertUtility.ToInt32(dtUsers.Rows[i]["Charging_Count"].ToString());
                                logInfo1.FailedChargingTime = ConvertUtility.ToInt32(dtUsers.Rows[i]["FailedChargingTimes"].ToString());

                                logInfo1.RegisteredTime = ConvertUtility.ToDateTime(dtUsers.Rows[i]["RegisteredTime"].ToString());
                                logInfo1.ExpiredTime    = DateTime.Now.AddDays(1);

                                logInfo1.Registration_Channel = dtUsers.Rows[i]["Registration_Channel"].ToString();
                                logInfo1.Status   = ConvertUtility.ToInt32(dtUsers.Rows[i]["Status"].ToString());
                                logInfo1.Operator = dtUsers.Rows[i]["Operator"].ToString();
                                logInfo1.Price    = ConvertUtility.ToInt32(price);
                                logInfo1.Reason   = "Succ";

                                ViSport_S2_Registered_UsersController.InsertSportGameHeroChargedUserLogForSub(logInfo1);

                                #endregion

                                returnValue = webServiceCharging3G.PaymentVnmWithAccount(dtUsers.Rows[i]["User_ID"].ToString(), price, "Charged Sub Anh Tai", "Anh_Tai_Sub", userName, userPass, cpId);

                                if (returnValue == "1")
                                {
                                    #region LOG DOANH THU

                                    var logInfo2 = new SportGameHeroChargedUserLogInfo();

                                    logInfo2.ID           = ConvertUtility.ToInt32(dtUsers.Rows[i]["ID"].ToString());
                                    logInfo2.User_ID      = dtUsers.Rows[i]["User_ID"].ToString();
                                    logInfo2.Request_ID   = dtUsers.Rows[i]["Request_ID"].ToString();
                                    logInfo2.Service_ID   = dtUsers.Rows[i]["Service_ID"].ToString();
                                    logInfo2.Command_Code = dtUsers.Rows[i]["Command_Code"].ToString();

                                    logInfo2.Service_Type       = ConvertUtility.ToInt32(dtUsers.Rows[i]["Service_Type"].ToString());
                                    logInfo2.Charging_Count     = ConvertUtility.ToInt32(dtUsers.Rows[i]["Charging_Count"].ToString());
                                    logInfo2.FailedChargingTime = ConvertUtility.ToInt32(dtUsers.Rows[i]["FailedChargingTimes"].ToString());

                                    logInfo2.RegisteredTime = ConvertUtility.ToDateTime(dtUsers.Rows[i]["RegisteredTime"].ToString());
                                    logInfo2.ExpiredTime    = DateTime.Now.AddDays(1);

                                    logInfo2.Registration_Channel = dtUsers.Rows[i]["Registration_Channel"].ToString();
                                    logInfo2.Status   = ConvertUtility.ToInt32(dtUsers.Rows[i]["Status"].ToString());
                                    logInfo2.Operator = dtUsers.Rows[i]["Operator"].ToString();
                                    logInfo2.Price    = ConvertUtility.ToInt32(price);
                                    logInfo2.Reason   = "Succ";

                                    ViSport_S2_Registered_UsersController.InsertSportGameHeroChargedUserLogForSub(logInfo2);

                                    #endregion
                                }
                            }
                        }


                        if (returnValue != "1")
                        {
                            #region LOG DOANH THU

                            var logInfo = new SportGameHeroChargedUserLogInfo();

                            logInfo.ID           = ConvertUtility.ToInt32(dtUsers.Rows[i]["ID"].ToString());
                            logInfo.User_ID      = dtUsers.Rows[i]["User_ID"].ToString();
                            logInfo.Request_ID   = dtUsers.Rows[i]["Request_ID"].ToString();
                            logInfo.Service_ID   = dtUsers.Rows[i]["Service_ID"].ToString();
                            logInfo.Command_Code = dtUsers.Rows[i]["Command_Code"].ToString();

                            logInfo.Service_Type       = ConvertUtility.ToInt32(dtUsers.Rows[i]["Service_Type"].ToString());
                            logInfo.Charging_Count     = ConvertUtility.ToInt32(dtUsers.Rows[i]["Charging_Count"].ToString());
                            logInfo.FailedChargingTime = ConvertUtility.ToInt32(dtUsers.Rows[i]["FailedChargingTimes"].ToString());

                            logInfo.RegisteredTime = ConvertUtility.ToDateTime(dtUsers.Rows[i]["RegisteredTime"].ToString());
                            logInfo.ExpiredTime    = DateTime.Now.AddDays(1);

                            logInfo.Registration_Channel = dtUsers.Rows[i]["Registration_Channel"].ToString();
                            logInfo.Status   = ConvertUtility.ToInt32(dtUsers.Rows[i]["Status"].ToString());
                            logInfo.Operator = dtUsers.Rows[i]["Operator"].ToString();
                            logInfo.Price    = ConvertUtility.ToInt32(price);
                            logInfo.Reason   = returnValue;

                            ViSport_S2_Registered_UsersController.InsertSportGameHeroChargedUserLogForSub(logInfo);

                            #endregion
                        }

                        if (returnValue == "1")//CHARGED THANH CONG
                        {
                            //reasonLog = "Succ";

                            //SEND MT CHO KHACH HANG

                            //DataTable dtQuestion = ViSport_S2_Registered_UsersController.GetQuestionInfoSportGameHero();
                            //if (dtQuestion != null && dtQuestion.Rows.Count > 0)
                            //{
                            message = "Ban da duoc cong 960 diem cho game show Anh tai bong da.Soan DIEM gui 979 de xem so diem hien tai.";



                            string serviceId   = dtUsers.Rows[i]["Service_ID"].ToString();
                            string commandCode = dtUsers.Rows[i]["Command_Code"].ToString();
                            string requestId   = dtUsers.Rows[i]["Request_ID"].ToString();


                            SendMtSportGame(dtUsers.Rows[i]["User_ID"].ToString(), message, serviceId, commandCode, requestId);

                            //}

                            //END SEND MT CHO KHACH HANG
                        }
                        //else
                        //{
                        //    reasonLog = returnValue;
                        //}


                        #endregion
                    }
                    catch (Exception ex)
                    {
                        log.Error("Anh tai bong da Loi charged : " + ex);
                        continue;
                    }
                    //DataTable dt = new DataTable();
                    //dt = ViSport_S2_Registered_UsersController.SportGameHeroCheckUserChargedByDay(dtUsers.Rows[i]["User_ID"].ToString());
                    //if (dt.Rows[0]["RETURN_ID"].ToString().Trim() == "0")
                    //{

                    //}
                }
            }

            return(1);
        }
        catch (Exception ex)
        {
            log.Error("Anh tai bong da Loi lay tap User : " + ex);
            return(0);
        }
    }
Ejemplo n.º 8
0
        public static void ChargeUser(ViSport_S2_Registered_UsersInfo info)
        {
            int reval = -1;

            try
            {
                _logger.Info(string.Format("Started charging User_ID= {0}, Request_ID = {1}, ID = {2}", info.User_ID, info.Request_ID, info.ID.ToString()));

                if (info == null)
                {
                    return;
                }

                #region charging here

                string userName    = SMS.Default.UserName;
                string userPass    = SMS.Default.Password;
                string cpId        = SMS.Default.CpID;
                string price       = SMS.Default.PriceSC;
                string serviceType = "Charge goi Vote ";
                string serviceName = "Vote";
                //if (info.Service_Type == 1)
                //{
                price = SMS.Default.PriceSM;
                //    serviceType += "SM";
                //}
                //else
                //{
                //    serviceType += "SC";
                //}

                //string status = "1";
                string returnValue;
                if (SMS.Default.IsTest == "1")
                {
                    returnValue = "1";
                }
                else
                {
                    if (info.FailedChargingTimes < ConvertUtility.ToInt32(SMS.Default.FailCharge))
                    {
                        price       = "5000";
                        returnValue = objCharge.PaymentVnmWithAccount(info.User_ID, price, serviceType, serviceName, userName, userPass, cpId);

                        if (returnValue.Trim() == "Result:12,Detail:Not enough money.")
                        {
                            price       = "3000";
                            returnValue = objCharge.PaymentVnmWithAccount(info.User_ID, price, serviceType, serviceName, userName, userPass, cpId);

                            if (returnValue.Trim() == "Result:12,Detail:Not enough money.")
                            {
                                price       = "2000";
                                returnValue = objCharge.PaymentVnmWithAccount(info.User_ID, price, serviceType, serviceName, userName, userPass, cpId);

                                if (returnValue.Trim() == "Result:12,Detail:Not enough money.")
                                {
                                    price       = "1000";
                                    returnValue = objCharge.PaymentVnmWithAccount(info.User_ID, price, serviceType, serviceName, userName, userPass, cpId);
                                }
                            }
                        }
                    }
                    else
                    {
                        returnValue = "Exceed";
                        reval       = -1;
                    }
                }

                if (returnValue == "1")
                {
                    reval = 1;
                }

                #endregion

                #region Ghi log vao bang ViSport_S2_Charged_Users_Log

                ViSport_S2_Charged_Users_LogInfo logInfo = new ViSport_S2_Charged_Users_LogInfo();

                logInfo.ID                   = info.ID;
                logInfo.User_ID              = info.User_ID;
                logInfo.Request_ID           = info.Request_ID;
                logInfo.Service_ID           = info.Service_ID;
                logInfo.Command_Code         = info.Command_Code;
                logInfo.Service_Type         = 0;//Charged Sub Service_Type
                logInfo.Charging_Count       = info.Charging_Count;
                logInfo.FailedChargingTimes  = info.FailedChargingTimes;
                logInfo.RegisteredTime       = DateTime.Now;
                logInfo.ExpiredTime          = DateTime.Now.AddDays(1);
                logInfo.Registration_Channel = info.Registration_Channel;
                logInfo.Status               = info.Status;
                logInfo.Operator             = info.Operator;
                logInfo.Price                = ConvertUtility.ToInt32(price);
                logInfo.Vote_PersonId        = info.Vote_PersonId;

                int sentMt = 0;

                if (reval > 0)
                {
                    #region Charged THANH CONG

                    //neu charge tien thanh cong thi tu dong gia han expiretime cho user them 7 ngay, dong thoi insert vao bang log charging, cong Charging_Count len 1, islock = 0  de lan sau charge tiep
                    _logger.Info(string.Format("Succ!Charging to {0} is succ with return value {1}, Request_ID = {2}", info.User_ID, reval, info.Request_ID));
                    logInfo.Reason = "Succ";

                    string messageContent = "";

                    //DataTable dt = SMS_MTDB_SQL.GetVoteAccountInfo(info.User_ID, info.Command_Code.ToUpper());

                    if (info.isDislike == 0)
                    {
                        SMS_MTDB_SQL.InsertLogLike(logInfo);

                        DataTable dt = SMS_MTDB_SQL.GetVoteAccountInfo(info.User_ID, info.Command_Code.ToUpper());

                        messageContent =
                            "So luot vote cua ban: " + dt.Rows[0]["Count"] + ". Ban dang thuoc top: " + dt.Rows[0]["Top"] + " nhung nguoi Vote nhieu nhat cho " + dt.Rows[0]["Name"] + ". Vote cang nhieu ban cang co co hoi la 1 trong 4 nguoi hen ho than tuong. Soan: Vote1 gui 8279 de gap go Mai Tho. Soan:Vote2 gui 8279 de gap go Linh Miu .Chi tiet truy cap: http://wap.vietnamobile.com.vn. HT: 19001255";
                    }
                    else
                    {
                        if (info.Vote_PersonId == 1)
                        {
                            logInfo.Vote_PersonId = 2;
                        }
                        else if (info.Vote_PersonId == 2)
                        {
                            logInfo.Vote_PersonId = 1;
                        }
                        SMS_MTDB_SQL.InsertLogDisLike(logInfo);

                        DataTable dt = SMS_MTDB_SQL.GetVoteAccountInfo(info.User_ID, info.Command_Code.ToUpper());

                        messageContent = "So Gach ban nem " + dt.Rows[0]["Name"] + ": " + dt.Rows[0]["Count"] + ". Ban dang thuoc top: " + dt.Rows[0]["Top"] + " nhung nguoi Nem Gach nhieu nhat. Nem Gach cang nhieu ban cang co co hoi la 1 trong 4 nguoi hen ho than tuong. Soan: Gach1 gui 8279 de gap go Linh Miu. Soan:Gach2 gui 8279 de gap go Mai Tho .Chi tiet truy cap: http://wap.vietnamobile.com.vn. HT: 19001255";
                    }

                    if (SMS.Default.IsTest == "0")
                    {
                        #region Gui MT cho khach hang thong bao gia han thanh cong

                        var objSentMT = new ServiceProviderService();

                        string Service_ID   = info.Service_ID;
                        string Command_Code = info.Command_Code;
                        string Request_ID   = info.Request_ID;

                        sentMt = objSentMT.sendMT(logInfo.User_ID, messageContent, Service_ID, Command_Code, "1", Request_ID, "1", "1", "0", "0");

                        #endregion
                    }

                    _logger.Info("Gui Mt cho so : " + logInfo.User_ID + " | Ket qua Mt :" + sentMt + " | ServiceId : " + info.Service_ID + " | Noi dung Mt : " + messageContent);

                    #endregion
                }
                else
                {
                    #region Charged THAT BAI

                    //neu charge tien khong thanh cong thi ghi lai log loi, dong thoi tang FailedChargingTimes len 1.IsLock set = 0 de tien hanh charge lai
                    _logger.Info(string.Format("ERROR !Charging to {0} is fail, Request_ID = {1}", info.User_ID, info.Request_ID));
                    logInfo.ExpiredTime = info.ExpiredTime;
                    if (returnValue == "Exceed")
                    {
                        logInfo.Reason = "Exceed";
                    }
                    else
                    {
                        logInfo.Reason = returnValue;
                    }

                    string messageContent = "";

                    if (info.isDislike == 0)
                    {
                        SMS_MTDB_SQL.InsertLogLike(logInfo);

                        DataTable dt = SMS_MTDB_SQL.GetVoteAccountInfo(info.User_ID, info.Command_Code.ToUpper());

                        messageContent =
                            "So luot vote cua ban: " + dt.Rows[0]["Count"] + ". Ban dang thuoc top: " + dt.Rows[0]["Top"] + " nhung nguoi Vote nhieu nhat cho " + dt.Rows[0]["Name"] + ". Vote cang nhieu ban cang co co hoi la 1 trong 4 nguoi hen ho than tuong. Soan: Vote1 gui 8279 de gap go Mai Tho. Soan:Vote2 gui 8279 de gap go Linh Miu. Chi tiet truy cap: http://wap.vietnamobile.com.vn. HT: 19001255";
                    }
                    else
                    {
                        //SMS_MTDB_SQL.InsertLogDisLike(logInfo);

                        if (info.Vote_PersonId == 1)
                        {
                            logInfo.Vote_PersonId = 2;
                        }
                        else if (info.Vote_PersonId == 2)
                        {
                            logInfo.Vote_PersonId = 1;
                        }
                        SMS_MTDB_SQL.InsertLogDisLike(logInfo);

                        DataTable dt = SMS_MTDB_SQL.GetVoteAccountInfo(info.User_ID, info.Command_Code.ToUpper());

                        messageContent = "So Gach ban nem " + dt.Rows[0]["Name"] + ": " + dt.Rows[0]["Count"] + ". Ban dang thuoc top: " + dt.Rows[0]["Top"] + " nhung nguoi Nem Gach nhieu nhat. Nem Gach cang nhieu ban cang co co hoi la 1 trong 3 nguoi hen ho than tuong. Soan: Gach1 gui 8279 de gap go Linh Miu. Soan:Gach2 gui 8279 de gap go Mai Tho Chi tiet truy cap: http://wap.vietnamobile.com.vn. HT: 19001255";
                    }


                    if (SMS.Default.IsTest == "0")
                    {
                        #region Gui MT cho khach hang thong bao gia han thanh cong

                        var objSentMT = new ServiceProviderService();

                        string Service_ID   = info.Service_ID;
                        string Command_Code = info.Command_Code;
                        string Request_ID   = info.Request_ID;

                        sentMt = objSentMT.sendMT(logInfo.User_ID, messageContent, Service_ID, Command_Code, "1", Request_ID, "1", "1", "0", "0");

                        #endregion
                    }

                    _logger.Info("Gui Mt cho so : " + logInfo.User_ID + " | Ket qua Mt :" + sentMt + " | ServiceId : " + info.Service_ID + " | Noi dung Mt : " + messageContent);

                    #endregion
                }

                #endregion
            }
            catch (TimeoutException e)
            {
                _logger.Error(string.Concat("mySendMT - ", e.StackTrace));
                _logger.Error(string.Concat("mySendMT - ", e.Message));
                MT_PROC_QUE.Enqueue(info);
            }
            catch (Exception ex)
            {
                //neu phat sinh loi he thong thi Update Islock = 0, de lan sau co the charge lai
                _logger.Info(string.Format("ERROR!Sending to {0} is error, Request_ID = {1}, Error mess = {2}", info.User_ID, info.Request_ID, ex.Message) + Environment.NewLine);
                SMS_MTDB_SQL.MTUpdateFail(info.ID);
            }

            Thread.Sleep(100);
        }
Ejemplo n.º 9
0
    public int Execute(int jobID)
    {
        WebServiceCharging3g webServiceCharging3G = new WebServiceCharging3g();
        string userName = "******";
        string userPass = "******";
        string cpId     = "1928";
        string price    = "5000";

        try
        {
            DataTable dtUsers = VoteRegisterController.SecretGetUserByType(false);
            if (dtUsers != null && dtUsers.Rows.Count > 0)
            {
                string message        = string.Empty;
                string returnValue    = string.Empty;
                string notEnoughMoney = "Result:12,Detail:Not enough money.";

                string serviceType = "BiMat_HotGirl";
                string serviceName = "BiMat_HotGirl";
                string reasonLog   = string.Empty;
                foreach (DataRow dr in dtUsers.Rows)
                {
                    string userId = dr["User_ID"].ToString();

                    returnValue = webServiceCharging3G.PaymentVnmWithAccount(userId, price, serviceType, serviceName, userName, userPass, cpId);
                    if (returnValue.Trim() == notEnoughMoney)
                    {
                        price       = "3000";
                        returnValue = webServiceCharging3G.PaymentVnmWithAccount(userId, price, serviceType, serviceName, userName, userPass, cpId);
                        if (returnValue.Trim() == notEnoughMoney)
                        {
                            price       = "2000";
                            returnValue = webServiceCharging3G.PaymentVnmWithAccount(userId, price, serviceType, serviceName, userName, userPass, cpId);
                            if (returnValue.Trim() == notEnoughMoney)
                            {
                                price       = "1000";
                                returnValue = webServiceCharging3G.PaymentVnmWithAccount(userId, price, serviceType, serviceName, userName, userPass, cpId);
                            }
                        }
                    }

                    if (returnValue.Trim() == "1")//CHARGED THANH CONG
                    {
                        reasonLog = "Succ";
                    }
                    else
                    {
                        reasonLog = returnValue;
                    }

                    #region LOG DOANH THU

                    VoteChargedUserLogInfo logInfo = new VoteChargedUserLogInfo();

                    logInfo.ID                   = ConvertUtility.ToInt32(dr["ID"].ToString());
                    logInfo.User_ID              = userId;
                    logInfo.Request_ID           = dr["Request_ID"].ToString();
                    logInfo.Service_ID           = dr["Service_ID"].ToString();
                    logInfo.Command_Code         = dr["Command_Code"].ToString();
                    logInfo.Service_Type         = 0;//Charged Sub Service_Type
                    logInfo.Charging_Count       = ConvertUtility.ToInt32(dr["Charging_Count"].ToString());
                    logInfo.FailedChargingTime   = ConvertUtility.ToInt32(dr["FailedChargingTimes"].ToString());
                    logInfo.RegisteredTime       = DateTime.Now;
                    logInfo.ExpiredTime          = DateTime.Now.AddDays(1);
                    logInfo.Registration_Channel = dr["Registration_Channel"].ToString();
                    logInfo.Status               = ConvertUtility.ToInt32(dr["Status"].ToString());
                    logInfo.Operator             = dr["Operator"].ToString();
                    logInfo.Price                = ConvertUtility.ToInt32(price);
                    logInfo.Vote_PersonId        = 1;
                    logInfo.Reason               = reasonLog;

                    VoteRegisterController.SecretChargedUserLogInsertForSub(logInfo);

                    #endregion

                    #region GUI SMS CHO KHACH_HANG

                    if (returnValue.Trim() == "1")
                    {
                        string serviceId   = dr["Service_ID"].ToString();
                        string commandCode = dr["Command_Code"].ToString();
                        string requestId   = dr["Request_ID"].ToString();

                        DataTable dt = VoteRegisterController.SecretGetCountByPersonId(userId, 1);
                        message = "So luot Dat gach cua ban: " + dt.Rows[0]["Count"] + ". Ban dang thuoc top " + dt.Rows[0]["Top"] + " nhung nguoi dat gach nhieu nhat. Dat gach cang nhieu ban cang co nhieu co hoi gap mat de biet BI MAT DONG TROI cua hot girl Mai Tho. De tiep tuc dat gach, Soan Gach gui 8379 hoac su dung 3G truy cap http://wap.vietnamobile.com.vn. HT: 19001255";

                        SendMtSecret(userId, serviceId, commandCode, message, requestId);

                        //GUI THEM TIN TUC BI_MAT_MAI_THO
                        DataTable dtSecretContent = VoteRegisterController.SecretGetRandomContent();
                        if (dtSecretContent != null && dtSecretContent.Rows.Count > 0)
                        {
                            message = dtSecretContent.Rows[0]["MT1"].ToString();
                            SendMtSecret(userId, serviceId, commandCode, message, requestId);
                        }
                    }

                    #endregion
                }
            }
            return(1);
        }
        catch (Exception ex)
        {
            log.Error(ex.ToString());
            return(0);
        }
    }
Ejemplo n.º 10
0
    public int Execute(int jobID)
    {
        //log.Error(" ");
        //log.Error("****Game Thanh Nu Sub Error******");
        //log.Error("LOG Start");
        //log.Error("**********");
        //log.Error(" ");
        //return 1;

        WebServiceCharging3g webServiceCharging3G = new WebServiceCharging3g();

        vn.thanhnu.Service partnerService = new vn.thanhnu.Service();

        string userName = "******";
        string passWord = "******";
        string cpId     = "1937";

        try
        {
            DataTable dtUser = ViSport_S2_Registered_UsersController.ThanhNuGameGetUserByType();
            if (dtUser != null && dtUser.Rows.Count > 0)
            {
                string message       = string.Empty;
                string partnerResult = string.Empty;

                int price = 1000;

                foreach (DataRow dr in dtUser.Rows)
                {
                    string vnmChargedResult = webServiceCharging3G.PaymentVnmWithAccount(dr["User_ID"].ToString(), "1000", "Charged Sub Thanh Nu", "Thanh_Nu_Sub", userName, passWord, cpId);

                    if (vnmChargedResult == "1")//CHARGED THANH CONG
                    {
                        partnerResult = partnerService.smsGiaHan(dr["User_ID"].ToString(), "1");
                        if (partnerResult.Trim() == "1")
                        {
                            message = "Goi dich vu Game Thanh Nu  cua Quy Khach da duoc gia han thanh cong. Quy khach duoc cong 110 G_Coin vao tk. Cam on Quy Khach da su dung goi dich vu .";
                            SendMtThanhNu(dr["User_ID"].ToString(), message, dr["Service_ID"].ToString(), dr["Command_Code"].ToString(), dr["Request_ID"].ToString());
                        }
                    }
                    else
                    {
                        partnerResult = partnerService.smsGiaHan(dr["User_ID"].ToString(), "0");
                        if (partnerResult == "1")// CHARGED G_Coint thanh cong
                        {
                            message          = "Quy Khach da gia han thanh cong Game Thanh Nu";
                            price            = 0;
                            vnmChargedResult = "1";
                        }
                        else if (partnerResult == "0")
                        {
                            message = "Tk cua Quy Khach khong du de gia han Game Thanh Nu ";
                        }

                        SendMtThanhNu(dr["User_ID"].ToString(), message, dr["Service_ID"].ToString(), dr["Command_Code"].ToString(), dr["Request_ID"].ToString());
                    }

                    //LOG DOANH THU
                    var e = new ThanhNuChargedUserLogInfo();

                    e.ID                   = ConvertUtility.ToInt32(dr["ID"].ToString());
                    e.User_ID              = dr["User_ID"].ToString();
                    e.Request_ID           = dr["Request_ID"].ToString();
                    e.Service_ID           = dr["Service_ID"].ToString();
                    e.Command_Code         = dr["Command_Code"].ToString();
                    e.Service_Type         = 0;
                    e.Charging_Count       = 0;
                    e.FailedChargingTime   = 0;
                    e.RegisteredTime       = DateTime.Now;
                    e.ExpiredTime          = DateTime.Now.AddDays(1);
                    e.Registration_Channel = "SMS";
                    e.Status               = 1;
                    e.Operator             = "vnmobile";

                    if (vnmChargedResult == "1")
                    {
                        e.Reason = "Succ";
                    }
                    else
                    {
                        e.Reason = vnmChargedResult;
                    }

                    e.Price         = price;
                    e.PartnerResult = partnerResult;

                    ViSport_S2_Registered_UsersController.ThanhNuChargedUserLog(e);
                }
            }

            return(1);
        }
        catch (Exception ex)
        {
            log.Error(" ");
            log.Error("****Game Thanh Nu Sub Error******");
            log.Error(ex.ToString());
            log.Error("**********");
            log.Error(" ");

            return(0);
        }
    }
Ejemplo n.º 11
0
    public int Execute(int jobID)
    {
        try
        {
            var webServiceCharging3G = new WebServiceCharging3g();

            //string userName = AppEnv.GetSetting("userName_3g_WapVnm");
            //string userPass = AppEnv.GetSetting("password_3g_WapVnm");
            //string cpId = AppEnv.GetSetting("cpId_3g_WapVnm");

            string userName = AppEnv.GetSetting("userName_3g_visport");
            string userPass = AppEnv.GetSetting("password_3g_visport");
            string cpId     = AppEnv.GetSetting("cpId_3g_visport");

            string price;

            string notEnoughMoney = AppEnv.GetSetting("NotEnoughMoney");

            const string serviceType = "Charged Sub World Cup VTV";
            const string serviceName = "World_Cup_VTV";

            DataTable dtUsers = ViSport_S2_Registered_UsersController.WorldCupGetRegisterUserForChargedVtv();
            if (dtUsers != null && dtUsers.Rows.Count > 0)
            {
                foreach (DataRow dr in dtUsers.Rows)
                {
                    string userId = dr["User_ID"].ToString();

                    //price = "3000";
                    //string returnValue = webServiceCharging3G.PaymentVnmWithAccount(userId, price, serviceType, serviceName, userName, userPass, cpId);

                    price = "3000";
                    string returnValue = webServiceCharging3G.PaymentVnmWithAccount(userId, price, serviceType, serviceName, userName, userPass, cpId);
                    if (returnValue.Trim() == notEnoughMoney)
                    {
                        price       = "2000";
                        returnValue = webServiceCharging3G.PaymentVnmWithAccount(userId, price, serviceType, serviceName, userName, userPass, cpId);
                        if (returnValue.Trim() == notEnoughMoney)
                        {
                            price       = "1000";
                            returnValue = webServiceCharging3G.PaymentVnmWithAccount(userId, price, serviceType, serviceName, userName, userPass, cpId);
                        }
                    }

                    _log.Debug(" ");
                    _log.Debug(" ");
                    _log.Debug("UserId : " + userId);
                    _log.Debug("Price : " + price);
                    _log.Debug("ReturnValue : " + returnValue);
                    _log.Debug("UserName : "******" | UserPass : "******" | CpId : " + cpId);
                    _log.Debug(" ");
                    _log.Debug(" ");

                    if (returnValue == "1")//CHARGED THANH_CONG
                    {
                        #region GOI API sang VTV

                        string url = "http://worldcup.visport.vn/TelcoApi/service.php?action=VMGgiahan&msisdn=" + userId + "&price=" + price;

                        var post = new PostSubmitter();
                        post.Url  = url;
                        post.Type = PostSubmitter.PostTypeEnum.Get;
                        string message = post.Post();

                        _log.Debug(" ");
                        _log.Debug(" ");
                        _log.Debug("API Call : " + url);
                        _log.Debug("UserId : " + userId);
                        _log.Debug("Content From VTV : " + message);
                        _log.Debug(" ");
                        _log.Debug(" ");

                        //SendMtWorldCup(userId, message, dr["Service_ID"].ToString(), dr["Command_Code"].ToString(),dr["User_ID"].ToString());

                        #endregion

                        #region LOG DOANH THU

                        const string reasonLog = "Succ";

                        var logInfo = new SportGameHeroChargedUserLogInfo();

                        logInfo.ID           = ConvertUtility.ToInt32(dr["ID"].ToString());
                        logInfo.User_ID      = dr["User_ID"].ToString();
                        logInfo.Request_ID   = dr["Request_ID"].ToString();
                        logInfo.Service_ID   = dr["Service_ID"].ToString();
                        logInfo.Command_Code = dr["Command_Code"].ToString();

                        logInfo.Service_Type       = ConvertUtility.ToInt32(dr["Service_Type"].ToString());
                        logInfo.Charging_Count     = ConvertUtility.ToInt32(dr["Charging_Count"].ToString());
                        logInfo.FailedChargingTime = ConvertUtility.ToInt32(dr["FailedChargingTimes"].ToString());

                        logInfo.RegisteredTime = ConvertUtility.ToDateTime(dr["RegisteredTime"].ToString());
                        logInfo.ExpiredTime    = DateTime.Now.AddDays(1);

                        logInfo.Registration_Channel = dr["Registration_Channel"].ToString();
                        logInfo.Status   = ConvertUtility.ToInt32(dr["Status"].ToString());
                        logInfo.Operator = dr["Operator"].ToString();
                        logInfo.Price    = ConvertUtility.ToInt32(price);
                        logInfo.Reason   = reasonLog;

                        ViSport_S2_Registered_UsersController.WorldCupChargedUserLogForSubVtv6(logInfo);

                        #endregion
                    }
                }
            }
        }
        catch (Exception ex)
        {
            _log.Error("WC Loi lay Tap User VTV : " + ex);
            return(0);
        }
        return(1);
    }
Ejemplo n.º 12
0
    public int Execute(int jobID)
    {
        var    webServiceCharging3G = new WebServiceCharging3g();
        string userName             = "******";
        string userPass             = "******";
        string cpId = "1930";
        string price;

        try
        {
            DataTable dtUsers = ViSport_S2_Registered_UsersController.GetSportGameUserByTypeBonus();
            if (dtUsers != null && dtUsers.Rows.Count > 0)
            {
                for (int i = 0; i < dtUsers.Rows.Count; i++)
                {
                    try
                    {
                        #region TIEN HANH CHARGED

                        price = "1000";
                        string returnValue = webServiceCharging3G.PaymentVnmWithAccount(dtUsers.Rows[i]["User_ID"].ToString(), price, "Charged Sub Anh Tai", "Anh_Tai_Sub", userName, userPass, cpId);

                        if (returnValue == "1")
                        {
                            #region LOG DOANH THU

                            var logInfo = new SportGameHeroChargedUserLogInfo();

                            logInfo.ID           = ConvertUtility.ToInt32(dtUsers.Rows[i]["ID"].ToString());
                            logInfo.User_ID      = dtUsers.Rows[i]["User_ID"].ToString();
                            logInfo.Request_ID   = dtUsers.Rows[i]["Request_ID"].ToString();
                            logInfo.Service_ID   = dtUsers.Rows[i]["Service_ID"].ToString();
                            logInfo.Command_Code = dtUsers.Rows[i]["Command_Code"].ToString();

                            logInfo.Service_Type       = ConvertUtility.ToInt32(dtUsers.Rows[i]["Service_Type"].ToString());
                            logInfo.Charging_Count     = ConvertUtility.ToInt32(dtUsers.Rows[i]["Charging_Count"].ToString());
                            logInfo.FailedChargingTime = ConvertUtility.ToInt32(dtUsers.Rows[i]["FailedChargingTimes"].ToString());

                            logInfo.RegisteredTime = ConvertUtility.ToDateTime(dtUsers.Rows[i]["RegisteredTime"].ToString());
                            logInfo.ExpiredTime    = DateTime.Now.AddDays(1);

                            logInfo.Registration_Channel = dtUsers.Rows[i]["Registration_Channel"].ToString();
                            logInfo.Status   = ConvertUtility.ToInt32(dtUsers.Rows[i]["Status"].ToString());
                            logInfo.Operator = dtUsers.Rows[i]["Operator"].ToString();
                            logInfo.Price    = ConvertUtility.ToInt32(price);
                            logInfo.Reason   = "Succ";

                            ViSport_S2_Registered_UsersController.InsertSportGameHeroChargedUserLogForSubBonus(logInfo);

                            #endregion
                        }
                        else
                        {
                            #region LOG DOANH THU

                            var logInfo = new SportGameHeroChargedUserLogInfo();

                            logInfo.ID           = ConvertUtility.ToInt32(dtUsers.Rows[i]["ID"].ToString());
                            logInfo.User_ID      = dtUsers.Rows[i]["User_ID"].ToString();
                            logInfo.Request_ID   = dtUsers.Rows[i]["Request_ID"].ToString();
                            logInfo.Service_ID   = dtUsers.Rows[i]["Service_ID"].ToString();
                            logInfo.Command_Code = dtUsers.Rows[i]["Command_Code"].ToString();

                            logInfo.Service_Type       = ConvertUtility.ToInt32(dtUsers.Rows[i]["Service_Type"].ToString());
                            logInfo.Charging_Count     = ConvertUtility.ToInt32(dtUsers.Rows[i]["Charging_Count"].ToString());
                            logInfo.FailedChargingTime = ConvertUtility.ToInt32(dtUsers.Rows[i]["FailedChargingTimes"].ToString());

                            logInfo.RegisteredTime = ConvertUtility.ToDateTime(dtUsers.Rows[i]["RegisteredTime"].ToString());
                            logInfo.ExpiredTime    = DateTime.Now.AddDays(1);

                            logInfo.Registration_Channel = dtUsers.Rows[i]["Registration_Channel"].ToString();
                            logInfo.Status   = ConvertUtility.ToInt32(dtUsers.Rows[i]["Status"].ToString());
                            logInfo.Operator = dtUsers.Rows[i]["Operator"].ToString();
                            logInfo.Price    = ConvertUtility.ToInt32(price);
                            logInfo.Reason   = returnValue;

                            ViSport_S2_Registered_UsersController.InsertSportGameHeroChargedUserLogForSubBonus(logInfo);

                            #endregion
                        }

                        #endregion
                    }
                    catch (Exception ex)
                    {
                        log.Error("Anh tai bong da Loi charged : " + ex);
                    }
                }
            }

            return(1);
        }
        catch (Exception ex)
        {
            log.Error("Anh tai bong da Loi lay tap User : " + ex);
            return(0);
        }
    }
    public int Execute(int jobID)
    {
        WebServiceCharging3g webServiceCharging3G = new WebServiceCharging3g();
        string userName = "******";
        string userPass = "******";
        string cpId     = "1930";
        string price;

        try
        {
            DataTable dtUsers = ViSport_S2_Registered_UsersController.GetSportGameUserByTypeTp(false);
            if (dtUsers != null && dtUsers.Rows.Count > 0)
            {
                string message        = string.Empty;
                string returnValue    = string.Empty;
                string notEnoughMoney = AppEnv.GetSetting("NotEnoughMoney");

                string serviceType = "Charge Hero";
                string serviceName = "ViSport_Hero";
                string reasonLog   = string.Empty;

                int count = 0;

                for (int i = 0; i < dtUsers.Rows.Count; i++)
                {
                    if (count >= 3)
                    {
                        Thread.Sleep(1000);
                        count = 0;
                    }

                    try
                    {
                        string msisdn = dtUsers.Rows[i]["User_ID"].ToString();

                        #region TIEN HANH CHARGED

                        price       = "5000";
                        returnValue = webServiceCharging3G.PaymentVnmWithAccount(dtUsers.Rows[i]["User_ID"].ToString(), price, "Charged Sub Trieu phu bong da ", "Trieuphu_Sub", userName, userPass, cpId);
                        if (returnValue.Trim() == notEnoughMoney)
                        {
                            price       = "3000";
                            returnValue = webServiceCharging3G.PaymentVnmWithAccount(dtUsers.Rows[i]["User_ID"].ToString(), price, "Charged Sub Trieu phu bong da", "Trieuphu_Sub", userName, userPass, cpId);
                            if (returnValue.Trim() == notEnoughMoney)
                            {
                                price       = "2000";
                                returnValue = webServiceCharging3G.PaymentVnmWithAccount(dtUsers.Rows[i]["User_ID"].ToString(), price, "Charged Sub Trieu phu bong da", "Trieuphu_Sub", userName, userPass, cpId);
                                if (returnValue.Trim() == notEnoughMoney)
                                {
                                    price       = "1000";
                                    returnValue = webServiceCharging3G.PaymentVnmWithAccount(dtUsers.Rows[i]["User_ID"].ToString(), price, "Charged Sub Trieu phu bong da", "Trieuphu_Sub", userName, userPass, cpId);
                                }
                            }
                        }

                        if (returnValue == "1")
                        {
                            #region Sinh MDT

                            string code1 = RandomActiveCode.Generate(8);
                            string code2 = RandomActiveCode.Generate(8);
                            ViSport_S2_Registered_UsersController.SportGameHeroLotteryCodeInsert(msisdn, code1);
                            ViSport_S2_Registered_UsersController.SportGameHeroLotteryCodeInsert(msisdn, code2);

                            #endregion

                            #region LOG DOANH THU

                            var logInfo = new SportGameHeroChargedUserLogInfo();

                            logInfo.ID           = ConvertUtility.ToInt32(dtUsers.Rows[i]["ID"].ToString());
                            logInfo.User_ID      = dtUsers.Rows[i]["User_ID"].ToString();
                            logInfo.Request_ID   = dtUsers.Rows[i]["Request_ID"].ToString();
                            logInfo.Service_ID   = dtUsers.Rows[i]["Service_ID"].ToString();
                            logInfo.Command_Code = dtUsers.Rows[i]["Command_Code"].ToString();

                            logInfo.Service_Type       = ConvertUtility.ToInt32(dtUsers.Rows[i]["Service_Type"].ToString());
                            logInfo.Charging_Count     = ConvertUtility.ToInt32(dtUsers.Rows[i]["Charging_Count"].ToString());
                            logInfo.FailedChargingTime = ConvertUtility.ToInt32(dtUsers.Rows[i]["FailedChargingTimes"].ToString());

                            logInfo.RegisteredTime = ConvertUtility.ToDateTime(dtUsers.Rows[i]["RegisteredTime"].ToString());
                            logInfo.ExpiredTime    = DateTime.Now.AddDays(1);

                            logInfo.Registration_Channel = dtUsers.Rows[i]["Registration_Channel"].ToString();
                            logInfo.Status   = ConvertUtility.ToInt32(dtUsers.Rows[i]["Status"].ToString());
                            logInfo.Operator = dtUsers.Rows[i]["Operator"].ToString();
                            logInfo.Price    = ConvertUtility.ToInt32(price);
                            logInfo.Reason   = "Succ";

                            ViSport_S2_Registered_UsersController.InsertSportGameHeroChargedUserLogForSub(logInfo);

                            #endregion
                        }
                        else
                        {
                            #region LOG DOANH THU

                            var logInfo = new SportGameHeroChargedUserLogInfo();

                            logInfo.ID           = ConvertUtility.ToInt32(dtUsers.Rows[i]["ID"].ToString());
                            logInfo.User_ID      = dtUsers.Rows[i]["User_ID"].ToString();
                            logInfo.Request_ID   = dtUsers.Rows[i]["Request_ID"].ToString();
                            logInfo.Service_ID   = dtUsers.Rows[i]["Service_ID"].ToString();
                            logInfo.Command_Code = dtUsers.Rows[i]["Command_Code"].ToString();

                            logInfo.Service_Type       = ConvertUtility.ToInt32(dtUsers.Rows[i]["Service_Type"].ToString());
                            logInfo.Charging_Count     = ConvertUtility.ToInt32(dtUsers.Rows[i]["Charging_Count"].ToString());
                            logInfo.FailedChargingTime = ConvertUtility.ToInt32(dtUsers.Rows[i]["FailedChargingTimes"].ToString());

                            logInfo.RegisteredTime = ConvertUtility.ToDateTime(dtUsers.Rows[i]["RegisteredTime"].ToString());
                            logInfo.ExpiredTime    = DateTime.Now.AddDays(1);

                            logInfo.Registration_Channel = dtUsers.Rows[i]["Registration_Channel"].ToString();
                            logInfo.Status   = ConvertUtility.ToInt32(dtUsers.Rows[i]["Status"].ToString());
                            logInfo.Operator = dtUsers.Rows[i]["Operator"].ToString();
                            logInfo.Price    = ConvertUtility.ToInt32(price);
                            logInfo.Reason   = returnValue;

                            ViSport_S2_Registered_UsersController.InsertSportGameHeroChargedUserLogForSub(logInfo);

                            #endregion
                        }

                        if (returnValue == "1")//CHARGED THANH CONG
                        {
                            string today = DateTime.Now.DayOfWeek.ToString();

                            string serviceId   = dtUsers.Rows[i]["Service_ID"].ToString();
                            string commandCode = dtUsers.Rows[i]["Command_Code"].ToString();
                            string requestId   = dtUsers.Rows[i]["Request_ID"].ToString();

                            if (CheckDayOfWeek(today)) //Tra MT vao cac ngay 3,5,7
                            {
                                #region SEND MT THONG_TIN_TRAN_DAU

                                DataTable dtMtFootball = ViSport_S2_Registered_UsersController.SportGameHeroMatchGetByDay();
                                if (dtMtFootball != null && dtMtFootball.Rows.Count > 0)
                                {
                                    string teamA = UnicodeUtility.UnicodeToKoDau(dtMtFootball.Rows[0]["Team_A_Name"].ToString());
                                    string teamB = UnicodeUtility.UnicodeToKoDau(dtMtFootball.Rows[0]["Team_B_Name"].ToString());

                                    string message1 = "Tran dau du doan ngay hom nay la: " + teamA + " va " + teamB + ". De du doan " + teamA + " thang soan KQ 1, du doan " + teamB + " thang soan KQ 3, du doan 2 doi hoa soan KQ 2 gui 979";
                                    SendMtSportGame(dtUsers.Rows[i]["User_ID"].ToString(), message1, serviceId, commandCode, requestId); //MT1

                                    string message2 = "De du doan tong so ban thang soan BT G gui 979 (voi G la tong so ban thang 2 doi ghi trong thoi gian thi dau chinh thuc)";
                                    SendMtSportGame(dtUsers.Rows[i]["User_ID"].ToString(), message2, serviceId, commandCode, requestId); //MT2

                                    string message3 = "De du doan ti so trong thoi gian chinh thuc soan TS A B gui 979 trong do A la so ban thang doi " + teamA + " ghi duoc, B la so ban thang doi " + teamB + " ghi duoc.";
                                    SendMtSportGame(dtUsers.Rows[i]["User_ID"].ToString(), message3, serviceId, commandCode, requestId); //MT3

                                    string message4 = "De du doan " + teamA + " co ti le giu bong nhieu hon soan GB 1, du doan " + teamB + " co ti le giu bong nhieu hon soan GB 3, hai doi co ti le giu bong ngang nhau soan GB 2 gui 979";
                                    SendMtSportGame(dtUsers.Rows[i]["User_ID"].ToString(), message4, serviceId, commandCode, requestId); //MT4

                                    string message5 = "De du doan tong so the vang soan TV C gui 979 trong do C la tong so the vang trong tai rut ra cho 2 doi trong thoi gian thi dau chinh thuc ";
                                    SendMtSportGame(dtUsers.Rows[i]["User_ID"].ToString(), message5, serviceId, commandCode, requestId); //MT5
                                }


                                #endregion
                            }
                            else //Tra Cau hoi vao cac ngay 2,4,6,CN
                            {
                                #region SEND MT CAU_HOI_BONG_DA

                                //SEND MT CHO KHACH HANG

                                DataTable dtQuestion = ViSport_S2_Registered_UsersController.GetQuestionInfoSportGameHero();
                                if (dtQuestion != null && dtQuestion.Rows.Count > 0)
                                {
                                    message = dtQuestion.Rows[0]["Question"].ToString();
                                    message = message.Replace("P1", "1").Replace("P2", "2");

                                    int    questionIdnew = ConvertUtility.ToInt32(dtQuestion.Rows[0]["Id"].ToString());
                                    string answer        = dtQuestion.Rows[0]["Answer"].ToString();
                                    answer = answer.Replace("P1", "1").Replace("P2", "2");

                                    ViSport_S2_Registered_UsersController.InsertSportGameHeroAnswerLog(dtUsers.Rows[i]["User_ID"].ToString(), questionIdnew, message, answer, DateTime.Now, 0); // LUU LOG Question
                                    SendMtSportGame(dtUsers.Rows[i]["User_ID"].ToString(), message, serviceId, commandCode, requestId);
                                }

                                //END SEND MT CHO KHACH HANG

                                #endregion
                            }
                        }

                        #endregion

                        count = count + 1;
                    }
                    catch (Exception ex)
                    {
                        log.Error("Trieu phu bong da Loi charged : " + ex);
                    }
                }
            }

            return(1);
        }
        catch (Exception ex)
        {
            log.Error("Trieu phu bong da Loi lay tap User : " + ex);
            return(0);
        }
    }
Ejemplo n.º 14
0
    public int Execute(int jobID)
    {
        WebServiceCharging3g webServiceCharging3G = new WebServiceCharging3g();
        string userName = "******";
        string userPass = "******";
        string cpId     = "1930";
        string price    = "4000";

        try
        {
            DataTable dtUsers = ViSport_S2_Registered_UsersController.GetSportGameUserByType(false);
            if (dtUsers != null && dtUsers.Rows.Count > 0)
            {
                string message        = string.Empty;
                string returnValue    = string.Empty;
                string notEnoughMoney = AppEnv.GetSetting("NotEnoughMoney");

                string serviceType = "Charge Hero";
                string serviceName = "ViSport_Hero";
                string reasonLog   = string.Empty;

                for (int i = 0; i < dtUsers.Rows.Count; i++)
                {
                    try
                    {
                        #region TIEN HANH CHARGED

                        price       = "5000";
                        returnValue = webServiceCharging3G.PaymentVnmWithAccount(dtUsers.Rows[i]["User_ID"].ToString(), price, "Charged Sub Anh Tai", "Anh_Tai_Sub", userName, userPass, cpId);
                        if (returnValue.Trim() == notEnoughMoney)
                        {
                            price       = "3000";
                            returnValue = webServiceCharging3G.PaymentVnmWithAccount(dtUsers.Rows[i]["User_ID"].ToString(), price, "Charged Sub Anh Tai", "Anh_Tai_Sub", userName, userPass, cpId);
                            if (returnValue.Trim() == notEnoughMoney)
                            {
                                price       = "2000";
                                returnValue = webServiceCharging3G.PaymentVnmWithAccount(dtUsers.Rows[i]["User_ID"].ToString(), price, "Charged Sub Anh Tai", "Anh_Tai_Sub", userName, userPass, cpId);
                                if (returnValue.Trim() == notEnoughMoney)
                                {
                                    price       = "1000";
                                    returnValue = webServiceCharging3G.PaymentVnmWithAccount(dtUsers.Rows[i]["User_ID"].ToString(), price, "Charged Sub Anh Tai", "Anh_Tai_Sub", userName, userPass, cpId);
                                }
                            }
                        }

                        if (returnValue == "1")
                        {
                            #region LOG DOANH THU

                            var logInfo = new SportGameHeroChargedUserLogInfo();

                            logInfo.ID           = ConvertUtility.ToInt32(dtUsers.Rows[i]["ID"].ToString());
                            logInfo.User_ID      = dtUsers.Rows[i]["User_ID"].ToString();
                            logInfo.Request_ID   = dtUsers.Rows[i]["Request_ID"].ToString();
                            logInfo.Service_ID   = dtUsers.Rows[i]["Service_ID"].ToString();
                            logInfo.Command_Code = dtUsers.Rows[i]["Command_Code"].ToString();

                            logInfo.Service_Type       = ConvertUtility.ToInt32(dtUsers.Rows[i]["Service_Type"].ToString());
                            logInfo.Charging_Count     = ConvertUtility.ToInt32(dtUsers.Rows[i]["Charging_Count"].ToString());
                            logInfo.FailedChargingTime = ConvertUtility.ToInt32(dtUsers.Rows[i]["FailedChargingTimes"].ToString());

                            logInfo.RegisteredTime = ConvertUtility.ToDateTime(dtUsers.Rows[i]["RegisteredTime"].ToString());
                            logInfo.ExpiredTime    = DateTime.Now.AddDays(1);

                            logInfo.Registration_Channel = dtUsers.Rows[i]["Registration_Channel"].ToString();
                            logInfo.Status   = ConvertUtility.ToInt32(dtUsers.Rows[i]["Status"].ToString());
                            logInfo.Operator = dtUsers.Rows[i]["Operator"].ToString();
                            logInfo.Price    = ConvertUtility.ToInt32(price);
                            logInfo.Reason   = "Succ";

                            ViSport_S2_Registered_UsersController.InsertSportGameHeroChargedUserLogForSub(logInfo);

                            #endregion
                        }
                        else
                        {
                            #region LOG DOANH THU

                            var logInfo = new SportGameHeroChargedUserLogInfo();

                            logInfo.ID           = ConvertUtility.ToInt32(dtUsers.Rows[i]["ID"].ToString());
                            logInfo.User_ID      = dtUsers.Rows[i]["User_ID"].ToString();
                            logInfo.Request_ID   = dtUsers.Rows[i]["Request_ID"].ToString();
                            logInfo.Service_ID   = dtUsers.Rows[i]["Service_ID"].ToString();
                            logInfo.Command_Code = dtUsers.Rows[i]["Command_Code"].ToString();

                            logInfo.Service_Type       = ConvertUtility.ToInt32(dtUsers.Rows[i]["Service_Type"].ToString());
                            logInfo.Charging_Count     = ConvertUtility.ToInt32(dtUsers.Rows[i]["Charging_Count"].ToString());
                            logInfo.FailedChargingTime = ConvertUtility.ToInt32(dtUsers.Rows[i]["FailedChargingTimes"].ToString());

                            logInfo.RegisteredTime = ConvertUtility.ToDateTime(dtUsers.Rows[i]["RegisteredTime"].ToString());
                            logInfo.ExpiredTime    = DateTime.Now.AddDays(1);

                            logInfo.Registration_Channel = dtUsers.Rows[i]["Registration_Channel"].ToString();
                            logInfo.Status   = ConvertUtility.ToInt32(dtUsers.Rows[i]["Status"].ToString());
                            logInfo.Operator = dtUsers.Rows[i]["Operator"].ToString();
                            logInfo.Price    = ConvertUtility.ToInt32(price);
                            logInfo.Reason   = returnValue;

                            ViSport_S2_Registered_UsersController.InsertSportGameHeroChargedUserLogForSub(logInfo);

                            #endregion
                        }

                        if (returnValue == "1")//CHARGED THANH CONG
                        {
                            #region SEND MT CHO USER

                            //SEND MT CHO KHACH HANG

                            DataTable dtQuestion = ViSport_S2_Registered_UsersController.GetQuestionInfoSportGameHero();
                            if (dtQuestion != null && dtQuestion.Rows.Count > 0)
                            {
                                message = dtQuestion.Rows[0]["Question"].ToString();

                                int    questionIdnew = ConvertUtility.ToInt32(dtQuestion.Rows[0]["Id"].ToString());
                                string answer        = dtQuestion.Rows[0]["Answer"].ToString();

                                string serviceId   = dtUsers.Rows[i]["Service_ID"].ToString();
                                string commandCode = dtUsers.Rows[i]["Command_Code"].ToString();
                                string requestId   = dtUsers.Rows[i]["Request_ID"].ToString();


                                ViSport_S2_Registered_UsersController.InsertSportGameHeroAnswerLog(dtUsers.Rows[i]["User_ID"].ToString(), questionIdnew, message, answer, DateTime.Now, 0); // LUU LOG Question
                                SendMtSportGame(dtUsers.Rows[i]["User_ID"].ToString(), message, serviceId, commandCode, requestId);
                            }

                            //END SEND MT CHO KHACH HANG

                            #endregion
                        }

                        #endregion
                    }
                    catch (Exception ex)
                    {
                        log.Error("Anh tai bong da Loi charged : " + ex);
                        continue;
                    }
                }
            }

            return(1);
        }
        catch (Exception ex)
        {
            log.Error("Anh tai bong da Loi lay tap User : " + ex);
            return(0);
        }
    }
    public int Execute(int jobId)
    {
        WebServiceCharging3g webServiceCharging3G = new WebServiceCharging3g();
        string userName = "******";
        string userPass = "******";
        string cpId     = "1928";
        string price    = "5000";

        try
        {
            DataTable dtUsers = VoteRegisterController.NewVoteGetUserByType(false);
            if (dtUsers != null && dtUsers.Rows.Count > 0)
            {
                string message        = string.Empty;
                string returnValue    = string.Empty;
                string notEnoughMoney = "Result:12,Detail:Not enough money.";

                string serviceType = "HotGirl_QuanTu";
                string serviceName = "HotGirl_QuanTu";
                string reasonLog   = string.Empty;
                foreach (DataRow dr in dtUsers.Rows)
                {
                    string userId = dr["User_ID"].ToString();
                    returnValue = webServiceCharging3G.PaymentVnmWithAccount(userId, price, serviceType, serviceName, userName, userPass, cpId);
                    if (returnValue.Trim() == notEnoughMoney)
                    {
                        price       = "3000";
                        returnValue = webServiceCharging3G.PaymentVnmWithAccount(userId, price, serviceType, serviceName, userName, userPass, cpId);
                        if (returnValue.Trim() == notEnoughMoney)
                        {
                            price       = "2000";
                            returnValue = webServiceCharging3G.PaymentVnmWithAccount(userId, price, serviceType, serviceName, userName, userPass, cpId);
                            if (returnValue.Trim() == notEnoughMoney)
                            {
                                price       = "1000";
                                returnValue = webServiceCharging3G.PaymentVnmWithAccount(userId, price, serviceType, serviceName, userName, userPass, cpId);
                            }
                        }
                    }

                    if (returnValue.Trim() == "1")//CHARGED THANH CONG
                    {
                        reasonLog = "Succ";
                    }
                    else
                    {
                        reasonLog = returnValue;
                    }

                    #region LOG DOANH THU

                    var logInfo = new VoteChargedUserLogInfo();

                    logInfo.ID                   = ConvertUtility.ToInt32(dr["ID"].ToString());
                    logInfo.User_ID              = userId;
                    logInfo.Request_ID           = dr["Request_ID"].ToString();
                    logInfo.Service_ID           = dr["Service_ID"].ToString();
                    logInfo.Command_Code         = dr["Command_Code"].ToString();
                    logInfo.Service_Type         = 0;//Charged Sub Service_Type
                    logInfo.Charging_Count       = ConvertUtility.ToInt32(dr["Charging_Count"].ToString());
                    logInfo.FailedChargingTime   = ConvertUtility.ToInt32(dr["FailedChargingTimes"].ToString());
                    logInfo.RegisteredTime       = DateTime.Now;
                    logInfo.ExpiredTime          = DateTime.Now.AddDays(1);
                    logInfo.Registration_Channel = dr["Registration_Channel"].ToString();
                    logInfo.Status               = ConvertUtility.ToInt32(dr["Status"].ToString());
                    logInfo.Operator             = dr["Operator"].ToString();
                    logInfo.Price                = ConvertUtility.ToInt32(price);
                    logInfo.Vote_PersonId        = 1;
                    logInfo.Reason               = reasonLog;

                    VoteRegisterController.NewVoteChargedUserLogInsertForSub(logInfo);

                    #endregion

                    #region GUI SMS CHO KHACH_HANG

                    if (returnValue.Trim() == "1")
                    {
                        string serviceId   = dr["Service_ID"].ToString();
                        string commandCode = dr["Command_Code"].ToString();
                        string requestId   = dr["Request_ID"].ToString();

                        DataTable dt        = VoteRegisterController.NewVoteRegisterUserGetInfo(userId);
                        int       voteCount = ConvertUtility.ToInt32(dt.Rows[0]["Vote_Count"]);
                        string    voteTop   = GetTopVote(voteCount);

                        message = "So luot vote cua ban: " + voteCount + ".Ban dang thuoc top: " + voteTop + " nhung nguoi Vote nhieu nhat.Soan: Vote1 gui 8579 de Hen Ho voi 1 trong 5 Hot Girl Xinh Dep.Chi tiet truy cap: http://wap.vietnamobile.com.vn. HT: 19001255";

                        SendMtNewVote(userId, serviceId, commandCode, message, requestId);
                    }

                    #endregion
                }
            }

            return(1);
        }
        catch (Exception ex)
        {
            log.Error(ex.ToString());
            return(0);
        }
    }
Ejemplo n.º 16
0
        public static void ChargeUser(ViSport_S2_Registered_SpamSms_UserInfo info)
        {
            int reval = -1;

            try
            {
                _logger.Info(string.Format("Started charging User_ID= {0}, Request_ID = {1}, ID = {2}, IsTest = {3}", info.User_Id, info.Request_Id, info.Id, SMS.Default.IsTest));

                //if (info == null)
                //{
                //    return;
                //}

                #region charging here

                string userName    = SMS.Default.UserName;
                string userPass    = SMS.Default.Password;
                string cpId        = SMS.Default.CpID;
                string price       = "1000";
                string serviceType = "Charge Sub News ";
                string serviceName = "ViSport";
                //if (info.Service_Type == 1)
                //{
                //    price = SMS.Default.PriceSM;
                //    serviceType += "SM";
                //}
                //else
                //{
                //    serviceType += "SC";
                //}

                string status = "1";
                string returnValue;
                if (SMS.Default.IsTest == "1")
                {
                    returnValue = "1";
                }
                else
                {
                    if (info.FailedChargingTimes <= ConvertUtility.ToInt32(SMS.Default.FailCharge))
                    {
                        returnValue = objCharge.PaymentVnmWithAccount(info.User_Id, price, serviceType, serviceName, userName, userPass, cpId);
                    }
                    else
                    {
                        returnValue = "Exceed";
                        reval       = -1;
                    }
                }

                if (returnValue == "1")
                {
                    reval = 1;
                }

                #endregion

                #region Ghi log vao bang ViSport_S2_Charged_Users_Log

                ViSport_S2_Registered_SpamSms_UserInfo logInfo = new ViSport_S2_Registered_SpamSms_UserInfo();

                logInfo.Id           = info.Id;
                logInfo.User_Id      = info.User_Id;
                logInfo.Request_Id   = info.Request_Id;
                logInfo.Service_Id   = info.Service_Id;
                logInfo.Command_Code = info.Command_Code;

                logInfo.Service_Type        = info.Service_Type;
                logInfo.Charging_Count      = info.Charging_Count;
                logInfo.FailedChargingTimes = info.FailedChargingTimes;

                logInfo.RegisteredTime = info.RegisteredTime;
                logInfo.ExpiredTime    = DateTime.Now.AddDays(1);

                //if(status == "1")
                //{
                //    logInfo.ExpiredTime = info.ExpiredTime.AddDays(7);
                //}
                //else
                //{
                //    logInfo.ExpiredTime = info.ExpiredTime.AddDays(3);
                //}


                logInfo.Registration_Channel = info.Registration_Channel;
                logInfo.Status   = info.Status;
                logInfo.Operator = info.Operator;
                logInfo.Price    = ConvertUtility.ToInt32(price);

                if (reval > 0)
                {
                    _logger.Info(string.Format("Succ!Charging to {0} is succ with return value {1}, Request_ID = {2}", info.User_Id, reval, info.Request_Id));
                    logInfo.Reason = "Succ";

                    //SMS_MTDB_SQL.ViSportSpamSmsUserUpdateExpiredTime(logInfo.Id); //Update ViSport_SpamSms_User Expiredtime

                    SMS_MTDB_SQL.InsertLog(logInfo);

                    //if (SMS.Default.IsTest == "0")
                    //{
                    //#region Gui MT cho khach hang thong bao gia han thanh cong

                    //ServiceProviderService objSentMT = new ServiceProviderService();

                    //string msgType = "";

                    //if (info.Sub_Code.ToUpper() == "TT")
                    //{
                    //    msgType = "Tin the thao 24h";
                    //}
                    //else if (info.Sub_Code.ToUpper() == "MU")
                    //{
                    //    msgType = "Tin MU 24h";
                    //}

                    //string message = "QK da gia han thanh cong DV " + msgType + " tren cong the thao Visport cua VietNamobile (1000d/ngay). De huy DK soan tin HUY " + info.Sub_Code + " gui 979";

                    //string Service_ID = info.Service_Id;
                    //string Command_Code = info.Command_Code;
                    //string Request_ID = info.Request_Id;

                    //int sentMt = objSentMT.sendMT(logInfo.User_Id, message, Service_ID, Command_Code, "1", Request_ID, "1", "1", "0", "0");
                    //_logger.Info("SentMt return: " + sentMt);

                    //#endregion
                    //}
                }
                else
                {
                    //neu charge tien khong thanh cong thi ghi lai log loi, dong thoi tang FailedChargingTimes len 1.IsLock set = 0 de tien hanh charge lai
                    _logger.Info(string.Format("ERROR !Charging to {0} is fail, Request_ID = {1}", info.User_Id, info.Request_Id));
                    logInfo.ExpiredTime = info.ExpiredTime;
                    if (returnValue == "Exceed")
                    {
                        logInfo.Reason = "Exceed";
                    }
                    else
                    {
                        logInfo.Reason = "Error charging: " + returnValue;
                    }

                    if (SMS.Default.IsTest == "0")
                    {
                        SMS_MTDB_SQL.InsertLog(logInfo);
                    }
                }

                #endregion
            }
            catch (TimeoutException e)
            {
                _logger.Error(string.Concat("mySendMT - ", e.StackTrace));
                _logger.Error(string.Concat("mySendMT - ", e.Message));
                MT_PROC_QUE.Enqueue(info);
            }
            catch (Exception ex)
            {
                //neu phat sinh loi he thong thi Update Islock = 0, de lan sau co the charge lai
                _logger.Info(string.Format("ERROR!Sending to {0} is error, Request_ID = {1}, Error mess = {2}", info.User_Id, info.Request_Id, ex.Message) + Environment.NewLine);
                SMS_MTDB_SQL.MTUpdateFail(info.Id);
            }

            Thread.Sleep(100);
        }
Ejemplo n.º 17
0
    public int Execute(int jobID)
    {
        WebServiceCharging3g webServiceCharging3G = new WebServiceCharging3g();
        string userName = "******";
        string userPass = "******";
        string cpId     = "1928";
        string price;

        try
        {
            DataTable dt = ViSport_S2_Registered_UsersController.VClipGetMTByStatus(false);
            if (dt != null && dt.Rows.Count > 0)
            {
                string message        = string.Empty;
                string returnValue    = string.Empty;
                string notEnoughMoney = "Result:12,Detail:Not enough money.";

                string serviceType = "Charged Sub VClip";
                string serviceName = "VClip";
                string reasonLog   = string.Empty;
                string status      = "1";

                foreach (DataRow dr in dt.Rows)
                {
                    string userId = dr["User_ID"].ToString();
                    price       = "2000";
                    returnValue = webServiceCharging3G.PaymentVnmWithAccount(userId, price, serviceType, serviceName, userName, userPass, cpId);
                    if (returnValue.Trim() == notEnoughMoney)
                    {
                        price       = "1000";
                        returnValue = webServiceCharging3G.PaymentVnmWithAccount(userId, price, serviceType, serviceName, userName, userPass, cpId);
                    }

                    if (returnValue == "1")//CHARGED THANH CONG
                    {
                        #region Log Doanh Thu

                        var logInfo = new ViSport_S2_Charged_Users_LogInfo();

                        logInfo.ID                   = ConvertUtility.ToInt32(dr["Id"].ToString());
                        logInfo.User_ID              = userId;
                        logInfo.Request_ID           = dr["Request_ID"].ToString();
                        logInfo.Service_ID           = dr["Service_ID"].ToString();
                        logInfo.Command_Code         = dr["Command_Code"].ToString();
                        logInfo.Service_Type         = ConvertUtility.ToInt32(dr["Service_Type"].ToString());
                        logInfo.Charging_Count       = ConvertUtility.ToInt32(dr["Charging_Count"].ToString());
                        logInfo.FailedChargingTimes  = ConvertUtility.ToInt32(dr["FailedChargingTimes"].ToString());
                        logInfo.RegisteredTime       = ConvertUtility.ToDateTime(dr["RegisteredTime"].ToString());
                        logInfo.ExpiredTime          = DateTime.Now;
                        logInfo.Registration_Channel = dr["Registration_Channel"].ToString();
                        logInfo.Status               = ConvertUtility.ToInt32(dr["Status"].ToString());
                        logInfo.Operator             = dr["Operator"].ToString();
                        logInfo.Price                = ConvertUtility.ToInt32(price);
                        logInfo.Reason               = "Succ";

                        ViSport_S2_Registered_UsersController.VClipInsertLog(logInfo);

                        #endregion
                    }
                    else
                    {
                        #region Log Doanh Thu

                        var logInfo = new ViSport_S2_Charged_Users_LogInfo();

                        logInfo.ID                   = ConvertUtility.ToInt32(dr["Id"].ToString());
                        logInfo.User_ID              = userId;
                        logInfo.Request_ID           = dr["Request_ID"].ToString();
                        logInfo.Service_ID           = dr["Service_ID"].ToString();
                        logInfo.Command_Code         = dr["Command_Code"].ToString();
                        logInfo.Service_Type         = ConvertUtility.ToInt32(dr["Service_Type"].ToString());
                        logInfo.Charging_Count       = ConvertUtility.ToInt32(dr["Charging_Count"].ToString());
                        logInfo.FailedChargingTimes  = ConvertUtility.ToInt32(dr["FailedChargingTimes"].ToString());
                        logInfo.RegisteredTime       = ConvertUtility.ToDateTime(dr["RegisteredTime"].ToString());
                        logInfo.ExpiredTime          = DateTime.Now;
                        logInfo.Registration_Channel = dr["Registration_Channel"].ToString();
                        logInfo.Status               = ConvertUtility.ToInt32(dr["Status"].ToString());
                        logInfo.Operator             = dr["Operator"].ToString();
                        logInfo.Price                = ConvertUtility.ToInt32(price);
                        logInfo.Reason               = returnValue;

                        ViSport_S2_Registered_UsersController.VClipInsertLog(logInfo);

                        #endregion
                    }

                    if (returnValue == "1")//CHARGED THANH CONG
                    {
                        #region Gui MT cho khach hang thong bao gia han thanh cong

                        var       objSentMt = new ServiceProviderService();
                        const int msgType   = (int)Constant.MessageType.NoCharge;

                        message = "(092)Quy khach da gia han thanh cong DV VMclip cua Vietnamobile. Moi ban truy cap: http://kho-clip.com/" + userId + ".aspx de xem cac video HOT cap nhat 24/24 MIEN PHI. De huy DK, soan CLIP OFF gui 949. HT 19001255";

                        string serviceId   = dr["Service_ID"].ToString();
                        string commandCode = dr["Command_Code"].ToString();
                        string requestId   = dr["Request_ID"].ToString();

                        int value = objSentMt.sendMT(userId, message, serviceId, commandCode, msgType.ToString(), requestId, "1", "1", "0", "0");

                        var objMt = new ViSport_S2_SMS_MTInfo();
                        objMt.User_ID       = userId;
                        objMt.Message       = message;
                        objMt.Service_ID    = serviceId;
                        objMt.Command_Code  = commandCode;
                        objMt.Message_Type  = 1;
                        objMt.Request_ID    = requestId;
                        objMt.Total_Message = 1;
                        objMt.Message_Index = 0;
                        objMt.IsMore        = 0;
                        objMt.Content_Type  = 0;
                        objMt.ServiceType   = 0;
                        objMt.ResponseTime  = DateTime.Now;
                        objMt.isLock        = false;
                        objMt.PartnerID     = "Xzone";
                        objMt.Operator      = "vnmobile";
                        ViSport_S2_SMS_MTController.InsertVClip(objMt);

                        log.Info(" ");
                        log.Info("***** LOG SEND MT VCLIP *****");

                        log.Info("User_ID : " + userId);
                        log.Info("Message : " + message);
                        log.Info("Service_ID : " + serviceId);
                        log.Info("Command_Code : " + commandCode);
                        log.Info("Send_MT : " + value);

                        log.Info("****************************************");
                        log.Info(" ");


                        #endregion
                    }
                }
            }
        }
        catch (Exception ex)
        {
            log.Info(" ");
            log.Info("***** VClip Charged Error *****");
            log.Info("Error : " + ex);
            log.Info(" ");
            return(0);
        }

        return(1);
    }
Ejemplo n.º 18
0
        public static void ChargeUser(ViSport_S2_Registered_SpamSms_UserInfo info)
        {
            int reval = -1;

            try
            {
                _logger.Info(string.Format("Started charging User_ID= {0}, Request_ID = {1}, ID = {2}, IsTest = {3}", info.User_Id, info.Request_Id, info.Id, SMS.Default.IsTest));

                //if (info == null)
                //{
                //    return;
                //}

                #region charging here

                string userName    = SMS.Default.UserName;
                string userPass    = SMS.Default.Password;
                string cpId        = SMS.Default.CpID;
                string price       = string.Empty;
                string serviceType = "Charge Sub Sport Game ";
                string serviceName = "ViSport_Hero";

                string notEnoughMoney = "Result:12,Detail:Not enough money.";

                string status = "1";
                string returnValue;
                if (SMS.Default.IsTest == "1")
                {
                    returnValue = "1";
                }
                else
                {
                    if (info.FailedChargingTimes <= ConvertUtility.ToInt32(SMS.Default.FailCharge))
                    {
                        price       = "4000";
                        returnValue = objCharge.PaymentVnmWithAccount(info.User_Id, price, serviceType, serviceName, userName, userPass, cpId);

                        if (returnValue.Trim() == notEnoughMoney)
                        {
                            price       = "3000";
                            returnValue = objCharge.PaymentVnmWithAccount(info.User_Id, price, serviceType, serviceName, userName, userPass, cpId);

                            if (returnValue.Trim() == notEnoughMoney)
                            {
                                price       = "2000";
                                returnValue = objCharge.PaymentVnmWithAccount(info.User_Id, price, serviceType, serviceName, userName, userPass, cpId);

                                if (returnValue.Trim() == notEnoughMoney)
                                {
                                    price       = "1000";
                                    returnValue = objCharge.PaymentVnmWithAccount(info.User_Id, price, serviceType, serviceName, userName, userPass, cpId);
                                }
                            }
                        }
                    }
                    else
                    {
                        returnValue = "Exceed";
                        reval       = -1;
                    }
                }

                if (returnValue == "1")
                {
                    reval = 1;
                }

                #endregion

                #region Ghi log vao bang ViSport_S2_Charged_Users_Log

                var logInfo = new ViSport_S2_Registered_SpamSms_UserInfo();

                logInfo.Id           = info.Id;
                logInfo.User_Id      = info.User_Id;
                logInfo.Request_Id   = info.Request_Id;
                logInfo.Service_Id   = info.Service_Id;
                logInfo.Command_Code = info.Command_Code;

                logInfo.Service_Type        = info.Service_Type;
                logInfo.Charging_Count      = info.Charging_Count;
                logInfo.FailedChargingTimes = info.FailedChargingTimes;

                logInfo.RegisteredTime = info.RegisteredTime;
                logInfo.ExpiredTime    = DateTime.Now.AddDays(1);

                logInfo.Registration_Channel = info.Registration_Channel;
                logInfo.Status   = info.Status;
                logInfo.Operator = info.Operator;
                logInfo.Price    = ConvertUtility.ToInt32(price);

                if (reval > 0)
                {
                    _logger.Info(string.Format("Succ!Charging to {0} is succ with return value {1}, Request_ID = {2}", info.User_Id, reval, info.Request_Id));
                    logInfo.Reason = "Succ";


                    if (SMS.Default.IsTest == "0")
                    {
                        #region Gui MT cho khach hang thong bao gia han thanh cong

                        ServiceProviderService objSentMT = new ServiceProviderService();

                        string message = string.Empty;

                        DataTable dtQuestion = SMS_MTDB_SQL.GetQuestionInfoSportGameHero();
                        if (dtQuestion != null && dtQuestion.Rows.Count > 0)
                        {
                            message = dtQuestion.Rows[0]["Question"].ToString();

                            int    questionIdnew = ConvertUtility.ToInt32(dtQuestion.Rows[0]["Id"].ToString());
                            string answer        = dtQuestion.Rows[0]["Answer"].ToString();

                            SMS_MTDB_SQL.InsertSportGameHeroAnswerLog(info.User_Id, questionIdnew, message, answer, DateTime.Now, 0); // LUU LOG Question

                            string serviceId   = info.Service_Id;
                            string commandCode = info.Command_Code;
                            string requestId   = info.Request_Id;

                            DataTable dtMt = SMS_MTDB_SQL.CheckExistSendMt(info.User_Id);

                            if (dtMt != null && dtMt.Rows.Count > 0)
                            {
                                _logger.Info("Da gui MT cho so : " + info.User_Id);
                            }
                            else
                            {
                                if (!string.IsNullOrEmpty(message))
                                {
                                    int sentMt = objSentMT.sendMT(logInfo.User_Id, message, serviceId, commandCode, "1", requestId, "1", "1", "0", "0");
                                    _logger.Info("SentMt return: " + sentMt + "| UserId:" + logInfo.User_Id);
                                }

                                #region LOG SEND MT

                                var objMt = new ViSport_S2_SMS_MTInfo();
                                objMt.User_ID       = info.User_Id;
                                objMt.Message       = message;
                                objMt.Service_ID    = serviceId;
                                objMt.Command_Code  = commandCode;
                                objMt.Message_Type  = 1;
                                objMt.Request_ID    = requestId;
                                objMt.Total_Message = 1;
                                objMt.Message_Index = 0;
                                objMt.IsMore        = 0;
                                objMt.Content_Type  = 0;
                                objMt.ServiceType   = 0;
                                objMt.ResponseTime  = DateTime.Now;
                                objMt.isLock        = false;
                                objMt.PartnerID     = "VNM";
                                objMt.Operator      = "vnmobile";
                                objMt.IsQuestion    = 1;

                                SMS_MTDB_SQL.InsertSportGameHeroMt(objMt);

                                #endregion
                            }
                        }

                        #endregion
                    }

                    SMS_MTDB_SQL.InsertLog(logInfo); //LOG DOANH THU
                }
                else
                {
                    //neu charge tien khong thanh cong thi ghi lai log loi, dong thoi tang FailedChargingTimes len 1.IsLock set = 0 de tien hanh charge lai
                    _logger.Info(string.Format("ERROR !Charging to {0} is fail, Request_ID = {1}", info.User_Id, info.Request_Id));
                    logInfo.ExpiredTime = info.ExpiredTime;
                    if (returnValue == "Exceed")
                    {
                        logInfo.Reason = "Exceed";
                    }
                    else
                    {
                        logInfo.Reason = returnValue;
                    }

                    if (SMS.Default.IsTest == "0")
                    {
                        SMS_MTDB_SQL.InsertLog(logInfo); //LOG DOANH THU
                    }
                }

                #endregion
            }
            catch (TimeoutException e)
            {
                _logger.Error(string.Concat("mySendMT - ", e.StackTrace));
                _logger.Error(string.Concat("mySendMT - ", e.Message));
                MT_PROC_QUE.Enqueue(info);
            }
            catch (Exception ex)
            {
                //neu phat sinh loi he thong thi Update Islock = 0, de lan sau co the charge lai
                _logger.Info(string.Format("ERROR!Sending to {0} is error, Request_ID = {1}, Error mess = {2}", info.User_Id, info.Request_Id, ex.Message) + Environment.NewLine);
                SMS_MTDB_SQL.MTUpdateFail(info.Id);
            }

            Thread.Sleep(100);
        }