Ejemplo n.º 1
0
    public void SendMtThanhNu(string userId, string mtMessage, string serviceId, string commandCode, string requestId)
    {
        var objSentMt = new ServiceProviderService();

        if (AppEnv.GetSetting("TestFlag") == "0")
        {
            int result = objSentMt.sendMT(userId, mtMessage, serviceId, commandCode, "1", requestId, "1", "1", "0", "0");
            log.Debug("Send MT result : " + result);
            log.Debug("userId : " + userId);
            log.Debug("Noi dung MT : " + mtMessage);
            log.Debug("ServiceId : " + serviceId);
            log.Debug("commandCode : " + commandCode);
            log.Debug("requestId : " + requestId);
        }

        var objMt = new ViSport_S2_SMS_MTInfo();

        objMt.User_ID       = userId;
        objMt.Message       = mtMessage;
        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";

        ViSport_S2_SMS_MTController.InsertThanhNuMt(objMt);
    }
Ejemplo n.º 2
0
    private static void SendMtSecret(string User_ID, string Service_ID, string Command_Code, string Message, string Request_ID)
    {
        var objSentMt = new ServiceProviderService();

        string message = Message;

        if (AppEnv.GetSetting("TestFlag") == "0")
        {
            objSentMt.sendMT(User_ID, message, Service_ID, Command_Code, "1", Request_ID, "1", "1", "0", "0");
        }

        var objMt = new VoteSmsMtInfo();

        objMt.User_ID       = User_ID;
        objMt.Message       = message;
        objMt.Service_ID    = Service_ID;
        objMt.Command_Code  = Command_Code;
        objMt.Message_Type  = 1;
        objMt.Request_ID    = Request_ID;
        objMt.Total_Message = 1;
        objMt.Message_Index = 0;
        objMt.IsMore        = 0;
        objMt.Content_Type  = 0;
        objMt.ServiceType   = 0;
        objMt.ResponseTime  = DateTime.Now;
        objMt.IsLock        = 0;
        objMt.PartnerId     = "Xzone";
        objMt.Operator      = GetTelco(User_ID);

        VoteRegisterController.SecretSmsMtInsert(objMt);
    }
Ejemplo n.º 3
0
    public void SendMtCauHoiMayMan(string userId, string mtMessage, string serviceId, string commandCode, string requestId)
    {
        var objSentMt = new ServiceProviderService();

        const int msgType = (int)Constant.MessageType.NoCharge;

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

        log.Debug("Send MT result : " + result);
        log.Debug("userId : " + userId);
        log.Debug("Noi dung MT : " + mtMessage);
        log.Debug("ServiceId : " + serviceId);
        log.Debug("commandCode : " + commandCode);
        log.Debug("requestId : " + requestId);

        var objMt = new ThanTai_MT_Info();

        objMt.User_ID       = userId;
        objMt.Message       = mtMessage;
        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.PartnerID = "VMG";
        objMt.Operator  = "vnmobile";
        objMt.Type      = 2;
        ThanTai_MT_Controller.Insert_CauHoiMayMan_MT(objMt);
    }
Ejemplo n.º 4
0
    public void SendMtDomMedia(string userId, string mtMessage, string serviceId, string commandCode, string requestId)
    {
        var objSentMt = new ServiceProviderService();

        const int msgType = (int)Constant.MessageType.NoCharge;

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

        _log.Debug("***** DOM_Media Send MT *****");
        _log.Debug("Send MT result : " + result);
        _log.Debug("userId : " + userId);
        _log.Debug("Noi dung MT : " + mtMessage);
        _log.Debug("ServiceId : " + serviceId);
        _log.Debug("commandCode : " + commandCode);
        _log.Debug("requestId : " + requestId);
        _log.Debug("*****");
    }
Ejemplo n.º 5
0
    public void SendMtLuckyFone(string userId, string mtMessage, string serviceId, string commandCode, string requestId)
    {
        var objSentMt = new ServiceProviderService();

        const int msgType = (int)Constant.MessageType.NoCharge;

        if (AppEnv.GetSetting("TestFlag") == "0")
        {
            int result = objSentMt.sendMT(userId, mtMessage, serviceId, commandCode, msgType.ToString(), requestId, "1", "1", "0", "0");
            _log.Debug("Send MT result : " + result);
            _log.Debug("userId : " + userId);
            _log.Debug("Noi dung MT : " + mtMessage);
            _log.Debug("ServiceId : " + serviceId);
            _log.Debug("commandCode : " + commandCode);
            _log.Debug("requestId : " + requestId);
        }
    }
Ejemplo n.º 6
0
    public void SendMtVnptMedia(string userId, string mtMessage, string serviceId, string commandCode, string requestId)
    {
        var objSentMt = new ServiceProviderService();

        const int msgType = (int)Constant.MessageType.NoCharge;

        //if (AppEnv.GetSetting("TestFlag") == "0")
        //{
        int result = objSentMt.sendMT(userId, mtMessage, serviceId, commandCode, msgType.ToString(), requestId, "1", "1", "0", "0");

        _log.Debug("***** VNPT_Media Send MT *****");
        _log.Debug("Send MT result : " + result);
        _log.Debug("userId : " + userId);
        _log.Debug("Noi dung MT : " + mtMessage);
        _log.Debug("ServiceId : " + serviceId);
        _log.Debug("commandCode : " + commandCode);
        _log.Debug("requestId : " + requestId);
        _log.Debug("*****");
        //}

        const int isQuestion = 0; // = 1 : CAU HOI GUI TU WinService

        var objMt = new ViSport_S2_SMS_MTInfo();

        objMt.User_ID       = userId;
        objMt.Message       = mtMessage;
        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      = "VNM";
        objMt.IsQuestion    = isQuestion;

        ViSport_S2_SMS_MTController.VnptInsertMt(objMt);
    }
Ejemplo n.º 7
0
    public void SendMtWorldCupLiveNews(string userId, string mtMessage, string serviceId, string commandCode, string requestId)
    {
        var objSentMt = new ServiceProviderService();

        const int msgType = (int)Constant.MessageType.NoCharge;

        //if (AppEnv.GetSetting("TestFlag") == "0")
        //{
        serviceId = "949";
        int result = objSentMt.sendMT(userId, mtMessage, serviceId, commandCode, msgType.ToString(), requestId, "1", "1", "0", "0");

        _log.Debug("Send MT result : " + result);
        _log.Debug("userId : " + userId);
        _log.Debug("Noi dung MT : " + mtMessage);
        _log.Debug("ServiceId : " + serviceId);
        _log.Debug("commandCode : " + commandCode);
        _log.Debug("requestId : " + requestId);
        //}

        var objMt = new ViSport_S2_SMS_MTInfo();

        objMt.User_ID       = userId;
        objMt.Message       = mtMessage;
        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;

        ViSport_S2_Registered_UsersController.WorldCupInsertMtLog(objMt);
    }
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 static void SentMtInfo(ViSport_S2_Registered_UsersInfo info)
        {
            DataTable dt = ViSport_S2_SMS_MTController.GetMtContent(info.Sub_Code.ToUpper());

            if (dt != null && dt.Rows.Count > 0)
            {
                //if(!string.IsNullOrEmpty(dt.Rows[0]["MT"].ToString()))
                //{
                try
                {
                    int    hour = ConvertUtility.ToInt32(dt.Rows[0]["Hour"].ToString());
                    string day  = dt.Rows[0]["Day"].ToString();

                    //DataTable dtMt = ViSport_S2_SMS_MTController.CheckAlreadySendMt(info.User_ID,hour,day,info.Sub_Code);
                    //_logger.Info("Tham So Check CheckAlreadySendMt : " + info.User_ID + "| hour : " + hour + "| day : " + day);

                    //if (dtMt != null && dtMt.Rows[0]["RETURN_ID"].ToString() == "1")
                    //{
                    //    _logger.Info("Da gui MT cho so : " + info.User_ID + "| hour : " + hour + "| day : " + day);
                    //}
                    //else
                    //{
                    //string message = dt.Rows[0]["MT"].ToString(); //Message lay tu DB;

                    //string messageKd = UnicodeUtility.UnicodeToKoDau(message); //Loai bo dau;


                    #region Gui MT cho khach hang

                    var objSentMt = new ServiceProviderService();

                    string serviceId   = info.Service_ID;
                    string commandCode = info.Command_Code;
                    string requestId   = info.Request_ID;

                    //for (int i = 0; i < 3;i++ )
                    //{
                    const int mtOrder   = 1;
                    string    mtContent = string.Empty;

                    if (!string.IsNullOrEmpty(dt.Rows[0]["MT1"].ToString()))
                    {
                        mtContent = dt.Rows[0]["MT1"].ToString();
                    }
                    else if (!string.IsNullOrEmpty(dt.Rows[0]["MT2"].ToString()))
                    {
                        mtContent = dt.Rows[0]["MT2"].ToString();
                    }
                    else if (!string.IsNullOrEmpty(dt.Rows[0]["MT3"].ToString()))
                    {
                        mtContent = dt.Rows[0]["MT3"].ToString();
                    }

                    //if(i==0)
                    //{
                    //    mtOrder = 1;
                    //    mtContent = dt.Rows[0]["MT1"].ToString();
                    //}
                    //else if(i == 1)
                    //{
                    //    mtOrder = 2;
                    //    mtContent = dt.Rows[0]["MT2"].ToString();
                    //}
                    //else
                    //{
                    //    mtOrder = 3;
                    //    mtContent = dt.Rows[0]["MT3"].ToString();
                    //}

                    DataTable dtMt = ViSport_S2_SMS_MTController.CheckAlreadySendMt(info.User_ID, hour, day, info.Sub_Code, mtOrder);
                    _logger.Info("Tham So Check CheckAlreadySendMt : " + info.User_ID + " | hour : " + hour + " | day : " + day + " | sub_code :" + info.Sub_Code + " | mt_order :" + mtOrder);

                    if (dtMt != null && dtMt.Rows.Count > 0)
                    {
                        _logger.Info("Da gui MT cho so : " + info.User_ID + " | hour : " + hour + " | day : " + day + " | sub_code :" + info.Sub_Code + " | mt_order :" + mtOrder);
                    }
                    else
                    {
                        _logger.Info(string.Format("Started Send MT User_ID= {0}, Request_ID = {1}, ID = {2}, Message = {3}", info.User_ID, info.Request_ID, info.ID, mtContent));

                        if (!string.IsNullOrEmpty(mtContent))
                        {
                            int sentMt = objSentMt.sendMT(info.User_ID, mtContent, serviceId, commandCode, "1", requestId, "1", "1", "0", "0");
                            _logger.Info("SentMt return: " + sentMt);
                        }

                        #region Log Sms MT

                        var objMt = new ViSport_S2_SMS_MTInfo();
                        objMt.User_ID       = info.User_ID;
                        objMt.Message       = mtContent;
                        objMt.Service_ID    = serviceId;
                        objMt.Command_Code  = commandCode;
                        objMt.Sub_Code      = info.Sub_Code;
                        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      = "ViSport_MT";

                        objMt.MtOrder = mtOrder;

                        ViSport_S2_SMS_MTController.InsertMtSpamSmsUser(objMt);

                        #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.º 10
0
    public string NotifyChargingInfo(string registeredId, string userId, string requestId, string serviceId, string serviceType, string chargingValue, string chargingAccount, string chargingTime, string chargingResponse)
    {
        log.Info(" ");
        log.Info("***** LOG VClip CHARGED NOTIFICATION From ANDY *****");

        log.Info("User_ID : " + userId);
        log.Info("chargingValue : " + chargingValue);
        log.Info("chargingAccount : " + chargingAccount);
        log.Info("chargingTime : " + chargingTime);
        log.Info("chargingResponse : " + chargingResponse);

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

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

            var logInfo = new ViSport_S2_Charged_Users_LogInfo();

            logInfo.ID                   = ConvertUtility.ToInt32(registeredId);
            logInfo.User_ID              = userId;
            logInfo.Request_ID           = requestId;
            logInfo.Service_ID           = serviceId;
            logInfo.Command_Code         = "CLIP";
            logInfo.Service_Type         = ConvertUtility.ToInt32(serviceType);
            logInfo.Charging_Count       = 0;
            logInfo.FailedChargingTimes  = 0;
            logInfo.RegisteredTime       = DateTime.Now;
            logInfo.ExpiredTime          = DateTime.Now.AddDays(1);
            logInfo.Registration_Channel = "SMS";
            logInfo.Status               = 1;
            logInfo.Operator             = "vnmobile";
            logInfo.Price                = ConvertUtility.ToInt32(chargingValue);
            logInfo.Reason               = "Succ";

            ViSport_S2_Registered_UsersController.VClipInsertLog(logInfo);

            #endregion
        }
        else //CHARGED THAT BAI
        {
            #region Log Doanh Thu

            var logInfo = new ViSport_S2_Charged_Users_LogInfo();

            logInfo.ID                   = ConvertUtility.ToInt32(registeredId);
            logInfo.User_ID              = userId;
            logInfo.Request_ID           = requestId;
            logInfo.Service_ID           = serviceId;
            logInfo.Command_Code         = "CLIP";
            logInfo.Service_Type         = ConvertUtility.ToInt32(serviceType);
            logInfo.Charging_Count       = 0;
            logInfo.FailedChargingTimes  = 0;
            logInfo.RegisteredTime       = DateTime.Now;
            logInfo.ExpiredTime          = DateTime.Now.AddDays(1);
            logInfo.Registration_Channel = "SMS";
            logInfo.Status               = 1;
            logInfo.Operator             = "vnmobile";
            logInfo.Price                = ConvertUtility.ToInt32(chargingValue);
            logInfo.Reason               = chargingResponse;

            ViSport_S2_Registered_UsersController.VClipInsertLog(logInfo);

            #endregion
        }

        if (chargingResponse.Trim() == "1")
        {
            #region Gui MT cho khach hang thong bao gia han thanh cong

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

            string 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";

            const string commandCode = "CLIP";
            int          value       = objSentMt.sendMT(userId, message, "949", 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
        }

        return("1");
    }
Ejemplo n.º 11
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.º 12
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);
        }
Ejemplo n.º 13
0
    public string NotifyChargingInfo(string registeredId, string userId, string requestId, string serviceId, string serviceType, string chargingValue, string chargingAccount, string chargingTime, string chargingResponse)
    {
        log.Info(" ");
        log.Info("***** LOG VClip CHARGED NOTIFICATION From ANDY *****");

        log.Info("User_ID : " + userId);
        log.Info("chargingValue : " + chargingValue);
        log.Info("chargingAccount : " + chargingAccount);
        log.Info("chargingTime : " + chargingTime);
        log.Info("chargingResponse : " + chargingResponse);

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

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

            var logInfo = new ViSport_S2_Charged_Users_LogInfo();

            logInfo.ID                   = ConvertUtility.ToInt32(registeredId);
            logInfo.User_ID              = userId;
            logInfo.Request_ID           = requestId;
            logInfo.Service_ID           = serviceId;
            logInfo.Command_Code         = "CLIP";
            logInfo.Service_Type         = ConvertUtility.ToInt32(serviceType);
            logInfo.Charging_Count       = 0;
            logInfo.FailedChargingTimes  = 0;
            logInfo.RegisteredTime       = DateTime.Now;
            logInfo.ExpiredTime          = DateTime.Now.AddDays(1);
            logInfo.Registration_Channel = "SMS";
            logInfo.Status               = 1;
            logInfo.Operator             = "vnmobile";
            logInfo.Price                = ConvertUtility.ToInt32(chargingValue);
            logInfo.Reason               = "Succ";

            ViSport_S2_Registered_UsersController.VClipInsertLog(logInfo);

            #endregion
        }
        else //CHARGED THAT BAI
        {
            #region Log Doanh Thu

            var logInfo = new ViSport_S2_Charged_Users_LogInfo();

            logInfo.ID                   = ConvertUtility.ToInt32(registeredId);
            logInfo.User_ID              = userId;
            logInfo.Request_ID           = requestId;
            logInfo.Service_ID           = serviceId;
            logInfo.Command_Code         = "CLIP";
            logInfo.Service_Type         = ConvertUtility.ToInt32(serviceType);
            logInfo.Charging_Count       = 0;
            logInfo.FailedChargingTimes  = 0;
            logInfo.RegisteredTime       = DateTime.Now;
            logInfo.ExpiredTime          = DateTime.Now.AddDays(1);
            logInfo.Registration_Channel = "SMS";
            logInfo.Status               = 1;
            logInfo.Operator             = "vnmobile";
            logInfo.Price                = ConvertUtility.ToInt32(chargingValue);
            logInfo.Reason               = chargingResponse;

            ViSport_S2_Registered_UsersController.VClipInsertLog(logInfo);

            #region Check charging price
            //if (DateTime.Now.Hour <= 22)
            //{
            //    const string userName = "******";
            //    const string userPass = "******";
            //    const string cpId = "1928";
            //    try
            //    {
            //        DataTable dt = ViSport_S2_Registered_UsersController.VClipGetInfo_UserCharg(userId);
            //        if (dt != null && dt.Rows.Count > 0)
            //        {
            //            ViSport_S2_Registered_UsersController.Insert_CharingComand_Retry(
            //                    ConvertUtility.ToInt32(dt.Rows[0]["Id"].ToString()),
            //                    dt.Rows[0]["User_ID"].ToString(),
            //                    dt.Rows[0]["Request_Id"].ToString(),
            //                    ConvertUtility.ToInt32(dt.Rows[0]["Service_ID"].ToString()),
            //                    999,
            //                    1000,
            //                    cpId,
            //                    userName,
            //                    userPass,
            //                    "http://sv167.vmgmedia.vn:8000/JobSubs/VClip/VclipNotification.asmx"
            //                    );
            //        }
            //    }
            //    catch (Exception ex)
            //    {
            //        log.Error("Lỗi charg retry user_ID :" + userId + "--error--" + ex.ToString());
            //    }

            //}
            #endregion

            #endregion
        }

        if (chargingResponse.Trim() == "1")
        {
            return("1");

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

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

            string 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";

            const string commandCode = "CLIP";
            int          value       = objSentMt.sendMT(userId, message, "949", 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
        }

        return("1");
    }
Ejemplo n.º 14
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.º 15
0
    public string SynchronizeUser(string Shortcode, string RequestID, string Msisdn, string Commandcode, string Message, int SyncType, string content, int chargedDay)
    {
        string retVal    = "0|Unidentified";
        var    objSentMt = new ServiceProviderService();

        try
        {
            //  Add
            if (SyncType == 1)
            {
                #region Dang Ky USER (Kich ban moi)

                var regObject = new ViSport_S2_Registered_UsersInfo();

                regObject.User_ID              = Msisdn;
                regObject.Request_ID           = RequestID;
                regObject.Service_ID           = Shortcode;
                regObject.Command_Code         = Commandcode;
                regObject.Service_Type         = 0;
                regObject.Charging_Count       = 0;
                regObject.FailedChargingTimes  = 0;
                regObject.RegisteredTime       = DateTime.Now;
                regObject.ExpiredTime          = DateTime.Now.AddDays(1);
                regObject.Registration_Channel = "wap";
                regObject.Status         = 1;
                regObject.Operator       = "vnmobile";
                regObject.CountTo_Cancel = chargedDay + 1;

                DataTable dt = ViSport_S2_Registered_UsersController.ImportVClip(regObject);

                #region SEND_MT

                objSentMt.sendMT(Msisdn, content, Shortcode, Commandcode, "0", RequestID, "1", "1", "0", "0");
                var objMt = new ViSport_S2_SMS_MTInfo();
                objMt.User_ID       = Msisdn;
                objMt.Message       = content;
                objMt.Service_ID    = Shortcode;
                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      = GetTelco(Msisdn);
                ViSport_S2_SMS_MTController.InsertVClip(objMt);

                #endregion


                #endregion
                retVal = "1";
            }
            else if (SyncType == 0)     // Delete
            {
                var objCancel = new SMS_CancelInfo();

                objCancel.User_ID      = Msisdn;
                objCancel.Service_ID   = Shortcode;
                objCancel.Command_Code = Commandcode;
                objCancel.Service_Type = 0;
                objCancel.Message      = Message;
                objCancel.Request_ID   = RequestID;
                objCancel.Operator     = "vnmobile";
                SMS_MODB.CancelInsert(objCancel);

                retVal = "1";
            }
        }
        catch (Exception ex)
        {
            log.Error(ex.ToString());
            retVal = "0|" + ex.Message;
        }

        return(retVal);
    }
Ejemplo n.º 16
0
    public string SyncSubscriptionData(string Service_ID, string Command_Code, string User_ID, string Message, string Request_ID, string ServiceID, string RefID, string UpdateType, string UpdateDescription)
    {
        string message = "";

        Message = Message.ToUpper();
        string subcode = "";

        if (Message.Trim().Length > Command_Code.Trim().Length)
        {
            subcode = Message.ToUpper().Substring(Command_Code.Length).Replace(" ", "");
        }

        #region VCLIP

        try
        {
            log.Debug(" ");
            log.Debug(" ");
            log.Debug("-------------------VCLIP--------------------------");
            log.Debug("User_ID: " + User_ID);
            log.Debug("Service_ID: " + Service_ID);
            log.Debug("Command_Code: " + Command_Code);
            log.Debug("Message: " + Message.ToUpper());
            log.Debug("Request_ID: " + Request_ID);
            log.Debug(" ");
            log.Debug(" ");

            #region Log MO Message Into Database (SMS_MO_Log)

            var moInfo = new SMS_MOInfo();

            moInfo.User_ID      = User_ID;
            moInfo.Service_ID   = Service_ID;
            moInfo.Command_Code = Command_Code;
            moInfo.Message      = Message;
            moInfo.Request_ID   = Request_ID;
            moInfo.Operator     = GetTelco(User_ID);
            SMS_MODB.InsertVClip(moInfo);

            #endregion

            #region Execute MT



            if (Message.StartsWith("HUY"))
            {
                //return "-5";
                #region Huy DK USER

                var objCancel = new SMS_CancelInfo();

                objCancel.User_ID      = User_ID;
                objCancel.Service_ID   = Service_ID;
                objCancel.Command_Code = Command_Code;
                objCancel.Service_Type = GetServiceTypeVClip(subcode);
                objCancel.Message      = Message;
                objCancel.Request_ID   = Request_ID;
                objCancel.Operator     = GetTelco(User_ID);
                SMS_MODB.CancelInsert(objCancel);

                var regObject = new ViSport_S2_Registered_UsersInfo();

                regObject.User_ID      = User_ID;
                regObject.Status       = 0;
                regObject.Service_Type = objCancel.Service_Type;

                DataTable dt = ViSport_S2_Registered_UsersController.UpdateVClip(regObject);

                var objSentMt = new ServiceProviderService();

                if (dt.Rows[0]["RETURN_ID"].ToString() == "1")
                {
                    message = AppEnv.GetSetting("alert_cancel_success_vclip");
                    objSentMt.sendMT(User_ID, message, Service_ID, Command_Code, "1", Request_ID, "1", "1", "0", "0");
                    //return "-5";
                }
                else
                {
                    message = "Ban chua dk dich vu nay. Xin cam on";
                    objSentMt.sendMT(User_ID, message, Service_ID, Command_Code, "1", Request_ID, "1", "1", "0", "0");
                    //return "-6";
                }



                var objMt = new ViSport_S2_SMS_MTInfo();
                objMt.User_ID       = User_ID;
                objMt.Message       = message;
                objMt.Service_ID    = Service_ID;
                objMt.Command_Code  = Command_Code;
                objMt.Message_Type  = 1;
                objMt.Request_ID    = Request_ID;
                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      = GetTelco(User_ID);

                ViSport_S2_SMS_MTController.InsertVClip(objMt);

                #endregion
            }
            else
            {
                var objSentMt = new ServiceProviderService();

                if (AppEnv.GetSetting("VClip_New") == "1")
                {
                    //Đăng ký kịch bản mới
                    #region Dang Ky USER (Kich ban moi)

                    var regObject = new ViSport_S2_Registered_UsersInfo();

                    regObject.User_ID              = User_ID;
                    regObject.Request_ID           = Request_ID;
                    regObject.Service_ID           = Service_ID;
                    regObject.Command_Code         = Command_Code;
                    regObject.Service_Type         = GetServiceTypeVClip(Command_Code);
                    regObject.Charging_Count       = 0;
                    regObject.FailedChargingTimes  = 0;
                    regObject.RegisteredTime       = DateTime.Now;
                    regObject.ExpiredTime          = DateTime.Now.AddDays(1);
                    regObject.Registration_Channel = "SMS";
                    regObject.Status   = 1;
                    regObject.Operator = moInfo.Operator;

                    DataTable dt = ViSport_S2_Registered_UsersController.InsertVClipNew(regObject);
                    if (dt.Rows[0]["RETURN_ID"].ToString() == "0")
                    {
                        //Đăng ký lần đầu
                        message = "Chuc mung! Quy khach da Dky thanh cong DV VClip. QK duoc mien phi ngay dau tien trong lan dau dang ky. Moi QK truy cap http://kho-clip.com/ de su dung dvu (2.000d/ngay),dvu duoc tu dong gia han. De huy DK, soan:HUY VCLIP gui 949. HT: 19001255.";
                    }
                    else if (dt.Rows[0]["RETURN_ID"].ToString() == "1")
                    {
                        //Double đăng ký
                        message = "Quy Khach da dang ky dich vu VClip truoc do. Moi QK truy cap http://kho-clip.com/ de su dung dvu.. HT: 19001255";
                    }
                    else if (dt.Rows[0]["RETURN_ID"].ToString() == "2")
                    {
                        //Hủy đi đăng ký lại
                        message = "Chuc mung! Quy khach da Dky thanh cong DV VClip. Moi QK truy cap http://kho-clip.com/ de su dung dvu (2.000d/ngay),dvu duoc tu dong gia han. De huy DK, soan:HUY VCLIP gui 949. HT: 19001255.";
                    }

                    #region SEND_MT

                    objSentMt.sendMT(User_ID, message, Service_ID, Command_Code, "0", Request_ID, "1", "1", "0", "0");
                    var objMt = new ViSport_S2_SMS_MTInfo();
                    objMt.User_ID       = User_ID;
                    objMt.Message       = message;
                    objMt.Service_ID    = Service_ID;
                    objMt.Command_Code  = Command_Code;
                    objMt.Message_Type  = 1;
                    objMt.Request_ID    = Request_ID;
                    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      = GetTelco(User_ID);
                    ViSport_S2_SMS_MTController.InsertVClip(objMt);

                    #endregion


                    #endregion
                }
            }


            #endregion

            return("-10");
        }
        catch (Exception ex)
        {
            log.Debug("---------------Error sentMT----------------------");
            log.Debug("Get Error : " + ex.Message);
            return("-20");
        }

        #endregion

        //return "-1";
    }