예제 #1
0
        private void WorkItemsProducer()
        {
            IWorkItemsGroup workItemsGroup = _workItemsGroup;

            if (null == workItemsGroup)
            {
                _logger.Info("workItemsGroup null mat roi");
                return;
            }

            try
            {
                while (true)
                {
                    if (MSMProccess.MT_PROC_QUE.Count > 0)
                    {
                        ViSport_S2_Registered_UsersInfo info = MSMProccess.MT_PROC_QUE.Dequeue();
                        if (info != null)
                        {
                            WorkItemCallback workItemCallback = new WorkItemCallback(this.DoSomeWork1);
                            workItemsGroup.QueueWorkItem(workItemCallback, info);
                        }
                        else
                        {
                            _logger.Error("Dequeue ViSport_S2_Registered_UsersInfo IS NULL");
                        }
                    }
                    else
                    {
                        Thread.Sleep(50);
                    }
                }
            }
            catch (ObjectDisposedException e)
            {
                e.GetHashCode();
            }
            catch (Exception ex)
            {
                _logger.Error(string.Concat("WorkItemsProducer - ", ex.StackTrace));
                _logger.Error(string.Concat("WorkItemsProducer - ", ex.Message));
            }
        }
예제 #2
0
    private string ExcecuteRequestMoEuro_Wap(string User_ID, string Service_ID, string Command_Code, string Message, string Request_ID)
    {
        string responseValue = "1";
        int    returnValue   = 0;

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

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

        Command_Code = Command_Code.ToUpper();
        Message      = Message.ToUpper();

        try
        {
            log.Debug(" ");
            log.Debug(" ");
            log.Debug("-------------------- CHAY CUNG EURO 2016 -------------------------");
            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)


            //if (AppEnv.GetSetting("TestFlag") == "0")
            //{
            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.InsertSportGameHeroMo(moInfo);
            //}


            #endregion

            string messageReturn = "";

            if (Command_Code == "EU" && subcode == "") //DK DICH VU TRIEU_PHU_BONG_DA
            {
                #region DK DICH VU

                var entity = new ViSport_S2_Registered_UsersInfo();
                entity.User_ID              = User_ID;
                entity.Request_ID           = Request_ID;
                entity.Service_ID           = Service_ID;
                entity.Command_Code         = Command_Code;
                entity.Service_Type         = 1;
                entity.Charging_Count       = 0;
                entity.FailedChargingTimes  = 0;
                entity.RegisteredTime       = DateTime.Now;
                entity.ExpiredTime          = DateTime.Now.AddDays(1);
                entity.Registration_Channel = "WAP";
                entity.Status   = 1;
                entity.Operator = GetTelco(User_ID);
                entity.Point    = 2;

                string passWord = RandomActiveCode.RandomStringNumber(6);
                entity.Password = passWord;

                DataTable value = ViSport_S2_Registered_UsersController.InsertEuroRegisterUser(entity);

                if (value.Rows[0]["RETURN_ID"].ToString() == "0")//DK DICH VU LAN DAU
                {
                    #region DK DV LAN DAU TIEN ==> KM 5 MDT

                    if (AppEnv.GetSetting("CTKM_Flag") == "1")
                    {
                        #region Sinh 5 mã dự thưởng khi đăng ký lần đầu
                        for (int i = 1; i <= 5; i++)
                        {
                            string code = RandomActiveCode.Generate(8);
                            ViSport_S2_Registered_UsersController.SportGameHeroLotteryCodeInsert(User_ID, code);
                        }
                        #endregion
                    }
                    messageReturn = AppEnv.GetSetting("AnhTaiBongDa_DangKyThanhCong");
                    SendMtSportGameHero(User_ID, messageReturn, Service_ID, Command_Code, Request_ID, 0); //SEND MT LAN 1

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

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

                        SendMtSportGameHero(User_ID, messageReturn, Service_ID, Command_Code, Request_ID, 1);                                            //SEND MT LAN 2 : GUI CAU HOI DAU TIEN
                        ViSport_S2_Registered_UsersController.InsertSportGameHeroAnswerLog(User_ID, questionId, messageReturn, answer, DateTime.Now, 0); // LUU LOG Question
                    }
                    #endregion
                }
                else if (value.Rows[0]["RETURN_ID"].ToString() == "2")
                {
                    //Check Đăng ký xong hủy trong ngày đầu tiên hay không
                    #region DA DK DV ROI XONG HUY DK LAI ==> TRA MT WELCOME

                    DataTable dtCheck = ViSport_S2_Registered_UsersController.Euro_Check_Regiter_Cancel_Today(User_ID);
                    if (dtCheck != null && dtCheck.Rows.Count > 0)
                    {
                        //Đăng ký lại trong ngày đầu tiên
                        messageReturn = AppEnv.GetSetting("AnhTaiBongDa_DangKyThanhCongKM");
                        SendMtSportGameHero(User_ID, messageReturn, Service_ID, Command_Code, Request_ID, 0); //SEND MT LAN 1
                    }
                    else
                    {
                        //Đăng ký lại ngày thứ 2 trở đi
                        string val_charge_return = ChuyenGiaBongDaCharged(User_ID, "5000", Request_ID);//Charge khi đăng ký lại ngày thứ 2 trở đi

                        if (val_charge_return == "1")
                        {
                            #region Charged THANHCONG ==> Trả MT

                            #region Sinh 5 mã dự thưởng khi đăng ký lại
                            for (int i = 1; i <= 5; i++)
                            {
                                string code = RandomActiveCode.Generate(8);
                                ViSport_S2_Registered_UsersController.SportGameHeroLotteryCodeInsert(User_ID, code);
                            }
                            #endregion

                            messageReturn = AppEnv.GetSetting("AnhTaiBongDa_DangKyThanhCongNotKM");
                            SendMtSportGameHero(User_ID, messageReturn, Service_ID, Command_Code, Request_ID, 0);// SEND MT GUI msg Thong bao Tra Loi DUNG
                            DataTable dtQuestion = ViSport_S2_Registered_UsersController.GetQuestionInfoEuro();
                            if (dtQuestion != null && dtQuestion.Rows.Count > 0)
                            {
                                messageReturn = dtQuestion.Rows[0]["Question"].ToString();

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

                                SendMtSportGameHero(User_ID, messageReturn, Service_ID, Command_Code, Request_ID, 1);                                            //SEND MT LAN 2 : GUI CAU HOI DAU TIEN
                                ViSport_S2_Registered_UsersController.InsertSportGameHeroAnswerLog(User_ID, questionId, messageReturn, answer, DateTime.Now, 0); // LUU LOG Question
                            }


                            #endregion
                        }
                        else if (val_charge_return == "Result:12,Detail:Not enough money.")
                        {
                            #region Charged THATBAI ==> GUI ALERT THONG BAO NAP TIEN

                            messageReturn = "Thue bao khong du tien. Vui long nap tien de tiep tuc choi !";
                            SendMtSportGameHero(User_ID, messageReturn, Service_ID, Command_Code, Request_ID, 0); //SEND MT THONGBAO

                            #endregion
                        }
                        else
                        {
                            #region Charged THATBAI ==> LOI SYSTEM

                            messageReturn = "He thong dang ban. Vui long tro lai sau it phut !";
                            SendMtSportGameHero(User_ID, messageReturn, Service_ID, Command_Code, Request_ID, 0); //SEND MT THONGBAO

                            #endregion
                        }
                    }
                    //if (DateTime.Now > Convert.ToDateTime(AppEnv.GetSetting("AnhTaiBongDa_StartKM")) && DateTime.Now < Convert.ToDateTime(AppEnv.GetSetting("AnhTaiBongDa_StartKM")))
                    //{
                    //    messageReturn = AppEnv.GetSetting("AnhTaiBongDa_DangKyThanhCongKM");
                    //}
                    //else
                    //{
                    //    messageReturn = AppEnv.GetSetting("AnhTaiBongDa_DangKyThanhCongNotKM");
                    //}



                    #endregion
                }
                else if (value.Rows[0]["RETURN_ID"].ToString() == "1")//DA DK DICH VU
                {
                    #region THUE BAO DANG ACTIVE DV
                    messageReturn = AppEnv.GetSetting("AnhTaiBongDa_DoubleDangKy");
                    SendMtSportGameHero(User_ID, messageReturn, Service_ID, Command_Code, Request_ID, 0);
                    #endregion
                }

                #endregion
            }


            else
            {
                //messageReturn = "Tin nhan sai cu phap. De nhan 2 MDT va co co hoi trung 30 trieu tien mat, iPhone 5S sanh dieu soan TP gui 979 (mien phi dang ky), de biet them thong tin soan: HD gui 979. HT: 19001255";
                messageReturn = "Tin nhan sai cu phap. Chi tiet truy cap http://visport.vn. HT: 19001255";
                SendMtSportGameHero(User_ID, messageReturn, Service_ID, Command_Code, Request_ID, 0);
            }
        }
        catch (Exception ex)
        {
            responseValue = "0";
            log.Debug("---------------Error sentMT Chay cung euro 2016----------------------");
            log.Debug("Get Error : " + ex.Message + ", returnValue: " + returnValue);
        }

        return(responseValue);
    }
예제 #3
0
    private string ExcecuteRequestMoSportGame(string User_ID, string Service_ID, string Command_Code, string Message, string Request_ID)
    {
        string responseValue = "1";
        int    returnValue   = 0;

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

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

        Command_Code = Command_Code.ToUpper();
        Message      = Message.ToUpper();

        try
        {
            log.Debug(" ");
            log.Debug(" ");
            log.Debug("-------------------- CHAY CUNG EURO 2016 -------------------------");
            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)


            //if (AppEnv.GetSetting("TestFlag") == "0")
            //{
            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.InsertSportGameHeroMo(moInfo);
            //}


            #endregion

            string messageReturn = "";

            if (Command_Code == "EU" && subcode == "") //DK DICH VU TRIEU_PHU_BONG_DA
            {
                #region DK DICH VU

                var entity = new ViSport_S2_Registered_UsersInfo();
                entity.User_ID              = User_ID;
                entity.Request_ID           = Request_ID;
                entity.Service_ID           = Service_ID;
                entity.Command_Code         = Command_Code;
                entity.Service_Type         = 1;
                entity.Charging_Count       = 0;
                entity.FailedChargingTimes  = 0;
                entity.RegisteredTime       = DateTime.Now;
                entity.ExpiredTime          = DateTime.Now.AddDays(1);
                entity.Registration_Channel = "SMS";
                entity.Status   = 1;
                entity.Operator = GetTelco(User_ID);
                entity.Point    = 2;

                string passWord = RandomActiveCode.RandomStringNumber(6);
                entity.Password = passWord;

                DataTable value = ViSport_S2_Registered_UsersController.InsertEuroRegisterUser(entity);

                if (value.Rows[0]["RETURN_ID"].ToString() == "0")//DK DICH VU LAN DAU
                {
                    #region DK DV LAN DAU TIEN ==> KM 5 MDT

                    if (AppEnv.GetSetting("CTKM_Flag") == "1")
                    {
                        #region Sinh 5 mã dự thưởng khi đăng ký lần đầu
                        for (int i = 1; i <= 5; i++)
                        {
                            string code = RandomActiveCode.Generate(8);
                            ViSport_S2_Registered_UsersController.SportGameHeroLotteryCodeInsert(User_ID, code);
                        }
                        #endregion
                    }
                    messageReturn = AppEnv.GetSetting("AnhTaiBongDa_DangKyThanhCong");
                    SendMtSportGameHero(User_ID, messageReturn, Service_ID, Command_Code, Request_ID, 0); //SEND MT LAN 1

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

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

                        SendMtSportGameHero(User_ID, messageReturn, Service_ID, Command_Code, Request_ID, 1);                                            //SEND MT LAN 2 : GUI CAU HOI DAU TIEN
                        ViSport_S2_Registered_UsersController.InsertSportGameHeroAnswerLog(User_ID, questionId, messageReturn, answer, DateTime.Now, 0); // LUU LOG Question
                    }
                    #endregion
                }
                else if (value.Rows[0]["RETURN_ID"].ToString() == "2")
                {
                    //Check Đăng ký xong hủy trong ngày đầu tiên hay không
                    #region DA DK DV ROI XONG HUY DK LAI ==> TRA MT WELCOME

                    DataTable dtCheck = ViSport_S2_Registered_UsersController.Euro_Check_Regiter_Cancel_Today(User_ID);
                    if (dtCheck != null && dtCheck.Rows.Count > 0)
                    {
                        //Đăng ký lại trong ngày đầu tiên
                        messageReturn = AppEnv.GetSetting("AnhTaiBongDa_DangKyThanhCongKM");
                        SendMtSportGameHero(User_ID, messageReturn, Service_ID, Command_Code, Request_ID, 0); //SEND MT LAN 1
                    }
                    else
                    {
                        //Đăng ký lại ngày thứ 2 trở đi
                        string val_charge_return = ChuyenGiaBongDaCharged(User_ID, "5000", Request_ID);//Charge khi đăng ký lại ngày thứ 2 trở đi

                        if (val_charge_return == "1")
                        {
                            #region Charged THANHCONG ==> Trả MT

                            #region Sinh 5 mã dự thưởng khi đăng ký lại
                            for (int i = 1; i <= 5; i++)
                            {
                                string code = RandomActiveCode.Generate(8);
                                ViSport_S2_Registered_UsersController.SportGameHeroLotteryCodeInsert(User_ID, code);
                            }
                            #endregion

                            messageReturn = AppEnv.GetSetting("AnhTaiBongDa_DangKyThanhCongNotKM");
                            SendMtSportGameHero(User_ID, messageReturn, Service_ID, Command_Code, Request_ID, 0);// SEND MT GUI msg Thong bao Tra Loi DUNG
                            DataTable dtQuestion = ViSport_S2_Registered_UsersController.GetQuestionInfoEuro();
                            if (dtQuestion != null && dtQuestion.Rows.Count > 0)
                            {
                                messageReturn = dtQuestion.Rows[0]["Question"].ToString();

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

                                SendMtSportGameHero(User_ID, messageReturn, Service_ID, Command_Code, Request_ID, 1);                                            //SEND MT LAN 2 : GUI CAU HOI DAU TIEN
                                ViSport_S2_Registered_UsersController.InsertSportGameHeroAnswerLog(User_ID, questionId, messageReturn, answer, DateTime.Now, 0); // LUU LOG Question
                            }


                            #endregion
                        }
                        else if (val_charge_return == "Result:12,Detail:Not enough money.")
                        {
                            #region Charged THATBAI ==> GUI ALERT THONG BAO NAP TIEN

                            messageReturn = "Thue bao khong du tien. Vui long nap tien de tiep tuc choi !";
                            SendMtSportGameHero(User_ID, messageReturn, Service_ID, Command_Code, Request_ID, 0); //SEND MT THONGBAO

                            #endregion
                        }
                        else
                        {
                            #region Charged THATBAI ==> LOI SYSTEM

                            messageReturn = "He thong dang ban. Vui long tro lai sau it phut !";
                            SendMtSportGameHero(User_ID, messageReturn, Service_ID, Command_Code, Request_ID, 0); //SEND MT THONGBAO

                            #endregion
                        }
                    }
                    //if (DateTime.Now > Convert.ToDateTime(AppEnv.GetSetting("AnhTaiBongDa_StartKM")) && DateTime.Now < Convert.ToDateTime(AppEnv.GetSetting("AnhTaiBongDa_StartKM")))
                    //{
                    //    messageReturn = AppEnv.GetSetting("AnhTaiBongDa_DangKyThanhCongKM");
                    //}
                    //else
                    //{
                    //    messageReturn = AppEnv.GetSetting("AnhTaiBongDa_DangKyThanhCongNotKM");
                    //}



                    #endregion
                }
                else if (value.Rows[0]["RETURN_ID"].ToString() == "1")//DA DK DICH VU
                {
                    #region THUE BAO DANG ACTIVE DV
                    messageReturn = AppEnv.GetSetting("AnhTaiBongDa_DoubleDangKy");
                    SendMtSportGameHero(User_ID, messageReturn, Service_ID, Command_Code, Request_ID, 0);
                    #endregion
                }

                #endregion
            }
            else if (Command_Code.ToUpper() == "DT" && subcode == "")
            {
                #region TRA CUU MADUTHUONG

                DataTable dtCount = ViSport_S2_Registered_UsersController.SportGameHeroCountLotteryCode(User_ID);
                string    count   = "0";
                if (dtCount != null && dtCount.Rows.Count > 0)
                {
                    count = dtCount.Rows[0]["Total"].ToString();
                }

                //messageReturn = "Quy khach dang co " + count + " ma du thuong de quay thuong CTKM Chuyen gia bong da cua Vietnamobile voi co hoi trung thuong 1 dien thoai Samsung Galaxy S4. " +
                //                "Chi tiet truy cap http://visport.vn. HT: 19001255";


                messageReturn = "Quy khach dang co " + count + " ma du thuong de quay thuong  CTKM Chay cung EURO cua Vietnamobile voi co hoi trung thuong 30 trieu tien mat. Chi tiet truy cap http://visport.vn. HT: 19001255";
                SendMtSportGameHero(User_ID, messageReturn, Service_ID, Command_Code, Request_ID, 0);

                #endregion
            }

            else if (Command_Code.ToUpper() == "HDAN" && subcode == "") //HUONG DAN CHUONG TRINH
            {
                #region HUONGDAN DICHVU

                messageReturn = AppEnv.GetSetting("AnhTaiBongDa_HuongDanThanhCong");
                SendMtSportGameHero(User_ID, messageReturn, Service_ID, Command_Code, Request_ID, 0);
                return(responseValue);

                #endregion
            }

            else if (Command_Code.ToUpper() == "HUY" && subcode.ToUpper() == "EU") //HUY DV TRIEU_PHU_BONG_DA
            {
                #region HUY DV Chay cung euro

                DataTable dtUpdate = ViSport_S2_Registered_UsersController.UpdateEuroRegisterUser(User_ID, 0);
                //if (dtUpdate != null && dtUpdate.Rows.Count > 0)
                //{

                if (dtUpdate.Rows[0]["RETURN_ID"].ToString() == "1")
                {
                    messageReturn = AppEnv.GetSetting("AnhTaiBongDa_HuyDichVuThanhCong");
                    SendMtSportGameHero(User_ID, messageReturn, Service_ID, Command_Code, Request_ID, 0);
                }
                else
                {
                    messageReturn = AppEnv.GetSetting("AnhTaiBongDa_ChuaDangKy");
                    SendMtSportGameHero(User_ID, messageReturn, Service_ID, Command_Code, Request_ID, 0);
                }
                //}
                //else
                //{

                //}

                #endregion
            }

            else if ((Command_Code.ToUpper() == "A" || Command_Code.ToUpper() == "B") && subcode == "")
            {
                //string today = DateTime.Now.DayOfWeek.ToString();

                //if(!CheckDayOfWeek(today))
                //{

                DataTable dtCount = ViSport_S2_Registered_UsersController.GetEuroUserInfoActive(User_ID);
                if (dtCount == null || dtCount.Rows.Count == 0)
                {
                    messageReturn = AppEnv.GetSetting("AnhTaiBongDa_ChuaDangKy");
                    //messageReturn = "Quy khach chua su dung dich vu Visport cua Vietnamobile. De dang ky su dung dich vu, soan TP gui 979. Chi tiet truy cap http://visport.vn. HT:19001255";
                    SendMtSportGameHero(User_ID, messageReturn, Service_ID, Command_Code, Request_ID, 0); //SEND MT THONGBAO

                    return(responseValue);
                }

                #region CAU HOI TPBD

                DataTable dtCountQues = ViSport_S2_Registered_UsersController.CountQuestionTodaySportGameHeroRegisterUser(User_ID);
                if (ConvertUtility.ToInt32(dtCountQues.Rows[0]["RETURN_ID"].ToString()) == 0)
                {
                    messageReturn = "Chuong trinh hom nay sap bat dau. San sang san giai thuong Samsung Galaxy S4. chi tiet truy cap http://visport.vn. HT: 19001255";
                    SendMtSportGameHero(User_ID, messageReturn, Service_ID, Command_Code, Request_ID, 0); //SEND MT THONGBAO

                    return(responseValue);
                }

                #region PROCESS CAUHOI

                DataTable dtAnswer = ViSport_S2_Registered_UsersController.GetAnswerSportGameHero(User_ID);
                string    answerMt = Convert_Answer(Command_Code.Trim().ToUpper());

                if (dtAnswer != null && dtAnswer.Rows.Count > 0)
                {
                    string answerDb   = dtAnswer.Rows[0]["True_Answer"].ToString().Trim().ToUpper();
                    int    questionId = ConvertUtility.ToInt32(dtAnswer.Rows[0]["Question_Id"].ToString());

                    if (answerMt == answerDb)//TRA LOI DUNG CAU HOI
                    {
                        DataTable randomMsg = ViSport_S2_Registered_UsersController.GetMessageRandomSportGameHero(3);
                        messageReturn = randomMsg.Rows[0]["Message"].ToString();
                        if (ConvertUtility.ToInt32(dtCountQues.Rows[0]["RETURN_ID"].ToString()) == 5)
                        {
                            #region Du 5 CAUHOI TRONG NGAY

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

                            messageReturn = messageReturn.Replace("xxx", code1);
                            SendMtSportGameHero(User_ID, messageReturn, Service_ID, Command_Code, Request_ID, 0);// SEND MT GUI msg Thong bao Tra Loi DUNG

                            //CONG 1 MDT
                            ViSport_S2_Registered_UsersController.UpdatePointSportGameHeroRegisterUserTp(User_ID, questionId, 40, Request_ID, answerMt, 1);


                            messageReturn = "Quy khach da tra loi het 5 cau hoi mien phi hom nay. Nang cao co hoi trung thuong bang cach thu thach kien thuc cua minh voi cac cau hoi tiep theo (1.000d/cau hoi).";
                            SendMtSportGameHero(User_ID, messageReturn, Service_ID, Command_Code, Request_ID, 0); // SEND MT GUI msg Thong bao Tra Loi Het 5 Cau FREE

                            SendContinueQuestion(User_ID, Service_ID, Command_Code, Request_ID);                  //GUI CAU HOI TIEP THEO

                            #endregion
                        }
                        else if (ConvertUtility.ToInt32(dtCountQues.Rows[0]["RETURN_ID"].ToString()) < 5)
                        {
                            #region CHUA DU 5 CAUHOI TRONG NGAY

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

                            messageReturn = messageReturn.Replace("xxx", code1);
                            SendMtSportGameHero(User_ID, messageReturn, Service_ID, Command_Code, Request_ID, 0);// SEND MT GUI msg Thong bao Tra Loi DUNG

                            //CONG 1 MDT
                            ViSport_S2_Registered_UsersController.UpdatePointSportGameHeroRegisterUserTp(User_ID, questionId, 40, Request_ID, answerMt, 1);

                            SendContinueQuestionTpBd(User_ID, Service_ID, Command_Code, Request_ID);//GUI CAU HOI TIEP THEO

                            #endregion
                        }
                        else if (ConvertUtility.ToInt32(dtCountQues.Rows[0]["RETURN_ID"].ToString()) > 5)
                        {
                            #region CAC CAU HOI TINHPHI

                            if (ChuyenGiaBongDaCharged(User_ID, "1000", Request_ID) == "1")
                            {
                                #region Charged THANHCONG ==> GHI NHAN DAPAN && TRA CAU HOI TIEP

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

                                messageReturn = messageReturn.Replace("xxx", code1);
                                SendMtSportGameHero(User_ID, messageReturn, Service_ID, Command_Code, Request_ID, 0); // SEND MT GUI msg Thong bao Tra Loi DUNG

                                SendContinueQuestionTpBd(User_ID, Service_ID, Command_Code, Request_ID);              //GUI CAU HOI TIEP THEO

                                #endregion
                            }
                            else if (ChuyenGiaBongDaCharged(User_ID, "1000", Request_ID) == "Result:12,Detail:Not enough money.")
                            {
                                #region Charged THATBAI ==> GUI ALERT THONG BAO NAP TIEN

                                messageReturn = "Thue bao khong du tien. Vui long nap tien de tiep tuc choi !";
                                SendMtSportGameHero(User_ID, messageReturn, Service_ID, Command_Code, Request_ID, 0); //SEND MT THONGBAO

                                #endregion
                            }
                            else
                            {
                                #region Charged THATBAI ==> LOI SYSTEM

                                messageReturn = "He thong dang ban. Vui long tro lai sau it phut !";
                                SendMtSportGameHero(User_ID, messageReturn, Service_ID, Command_Code, Request_ID, 0); //SEND MT THONGBAO

                                #endregion
                            }

                            #endregion
                        }
                    }
                    else//TRA LOI SAI
                    {
                        DataTable randomMsg = ViSport_S2_Registered_UsersController.GetMessageRandomSportGameHero(4);
                        messageReturn = randomMsg.Rows[0]["Message"].ToString();

                        if (ConvertUtility.ToInt32(dtCountQues.Rows[0]["RETURN_ID"].ToString()) == 5)
                        {
                            #region DU 5 CAUUHOI TRONG NGAY

                            SendMtSportGameHero(User_ID, messageReturn, Service_ID, Command_Code, Request_ID, 0);// SEND MT GUI msg Thong bao Tra Loi SAI
                            //CONG 0 MDT
                            ViSport_S2_Registered_UsersController.UpdatePointSportGameHeroRegisterUserTp(User_ID, questionId, 20, Request_ID, answerMt, 0);

                            //messageReturn = "Ban da tra loi het so cau hoi mien phi trong ngay (5 cau). Hay tiep tuc tham gia chuong trinh vao ngay mai de tich luy ma du thuong de SO HUU iPhone 5S.";

                            messageReturn = "Quy khach da tra loi het 5 cau hoi mien phi hom nay. Nang cao co hoi trung thuong bang cach thu thach kien thuc cua minh voi cac cau hoi tiep theo (1.000d/cau hoi).";
                            SendMtSportGameHero(User_ID, messageReturn, Service_ID, Command_Code, Request_ID, 0); // SEND MT GUI msg Thong bao Tra Loi Het 5 Cau FREE
                            SendContinueQuestion(User_ID, Service_ID, Command_Code, Request_ID);                  //GUI CAU HOI TIEP THEO
                            #endregion
                        }
                        else if (ConvertUtility.ToInt32(dtCountQues.Rows[0]["RETURN_ID"].ToString()) < 5)
                        {
                            #region CHUA DU 5 CAUHOI TRONG NGAY

                            SendMtSportGameHero(User_ID, messageReturn, Service_ID, Command_Code, Request_ID, 0);// SEND MT GUI msg Thong bao Tra Loi SAI
                            //CONG 0 MDT
                            ViSport_S2_Registered_UsersController.UpdatePointSportGameHeroRegisterUserTp(User_ID, questionId, 20, Request_ID, answerMt, 0);

                            SendContinueQuestionTpBd(User_ID, Service_ID, Command_Code, Request_ID);//GUI CAU HOI TIEP THEO

                            #endregion
                        }
                        else if (ConvertUtility.ToInt32(dtCountQues.Rows[0]["RETURN_ID"].ToString()) > 5)
                        {
                            #region CAC CAU HOI TINHPHI

                            if (ChuyenGiaBongDaCharged(User_ID, "1000", Request_ID) == "1")
                            {
                                #region Charged THANHCONG ==> GHI NHAN DAPAN && TRA CAU HOI TIEP

                                SendMtSportGameHero(User_ID, messageReturn, Service_ID, Command_Code, Request_ID, 0); // SEND MT GUI msg Thong bao Tra Loi SAI

                                SendContinueQuestionTpBd(User_ID, Service_ID, Command_Code, Request_ID);              //GUI CAU HOI TIEP THEO

                                #endregion
                            }
                            else if (ChuyenGiaBongDaCharged(User_ID, "1000", Request_ID) == "Result:12,Detail:Not enough money.")
                            {
                                #region Charged THATBAI ==> GUI ALERT THONG BAO NAP TIEN

                                messageReturn = "Thue bao khong du tien. Vui long nap tien de tiep tuc choi !";
                                SendMtSportGameHero(User_ID, messageReturn, Service_ID, Command_Code, Request_ID, 0); //SEND MT THONGBAO

                                #endregion
                            }
                            else
                            {
                                #region Charged THATBAI ==> LOI SYSTEM

                                messageReturn = "He thong dang ban. Vui long tro lai sau it phut !";
                                SendMtSportGameHero(User_ID, messageReturn, Service_ID, Command_Code, Request_ID, 0); //SEND MT THONGBAO

                                #endregion
                            }

                            #endregion
                        }
                    }
                }

                #endregion


                #endregion
                //}
            }

            else if (Command_Code.ToUpper() == "HD" && subcode.ToUpper() == "EU")
            {
                #region HDSD
                messageReturn = AppEnv.GetSetting("AnhTaiBongDa_HuongDanThanhCong");
                //messageReturn = "Dich vu/dau so 979 dang cung cap cac goi dich vu sau: Goi dich vu Anh tai bong da. Gia cuoc: 5000 dong/ngay. De dang ky dich vu, soan: BD gui 979. De huy dich vu, soan HUY BD gui 979. Truy cap http://visport.vn/ de biet them chi tiet. ";
                SendMtSportGameHero(User_ID, messageReturn, Service_ID, Command_Code, Request_ID, 0);

                #endregion
            }

            else
            {
                //messageReturn = "Tin nhan sai cu phap. De nhan 2 MDT va co co hoi trung 30 trieu tien mat, iPhone 5S sanh dieu soan TP gui 979 (mien phi dang ky), de biet them thong tin soan: HD gui 979. HT: 19001255";
                messageReturn = "Tin nhan sai cu phap. Chi tiet truy cap http://visport.vn. HT: 19001255";
                SendMtSportGameHero(User_ID, messageReturn, Service_ID, Command_Code, Request_ID, 0);
            }
        }
        catch (Exception ex)
        {
            responseValue = "0";
            log.Debug("---------------Error sentMT Chay cung euro 2016----------------------");
            log.Debug("Get Error : " + ex.Message + ", returnValue: " + returnValue);
        }

        return(responseValue);
    }
예제 #4
0
    public string MOreceiver_VoiceChat(String Command_Code, String Service_ID, String User_ID, String Message, String Request_ID, String Channel)
    {
        string messageReturn = "";
        string responseValue = "";

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

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

        Command_Code = Command_Code.ToUpper();
        Message      = Message.ToUpper();
        try
        {
            log.Debug(" ");
            log.Debug(" ");
            log.Debug("-------------------- TRIEU PHU BONG DA -------------------------");
            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)


            if (AppEnv.GetSetting("TestFlag") == "0")
            {
                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.InsertSportGameHeroMo(moInfo);
            }

            if (Command_Code == "TP" && subcode == "" && Service_ID == "979") //DK DICH VU TRIEU_PHU_BONG_DA
            {
                #region DK DICH VU

                var entity = new ViSport_S2_Registered_UsersInfo();
                entity.User_ID              = User_ID;
                entity.Request_ID           = Request_ID;
                entity.Service_ID           = Service_ID;
                entity.Command_Code         = Command_Code;
                entity.Service_Type         = 1;
                entity.Charging_Count       = 0;
                entity.FailedChargingTimes  = 0;
                entity.RegisteredTime       = DateTime.Now;
                entity.ExpiredTime          = DateTime.Now.AddDays(1);
                entity.Registration_Channel = Channel;
                entity.Status   = 1;
                entity.Operator = GetTelco(User_ID);
                entity.Point    = 2;

                string passWord = RandomActiveCode.RandomStringNumber(6);
                entity.Password = passWord;

                DataTable value = ViSport_S2_Registered_UsersController.InsertSportGameHeroRegisterUser(entity);

                if (value.Rows[0]["RETURN_ID"].ToString() == "0")//DK DICH VU LAN DAU
                {
                    #region DK DV LAN DAU TIEN

                    messageReturn = "Chuc mung ban da tham gia CTKM Trieu phu bong da cua Vietnamobile. ";
                    if (DateTime.Now > Convert.ToDateTime(AppEnv.GetSetting("StartKM")) && DateTime.Now < Convert.ToDateTime(AppEnv.GetSetting("EndKM")))
                    {
                        messageReturn = messageReturn + "Ban co 5.000 diem voi co hoi trung thuong 1 dien thoai Samsung Galaxy A5. ";
                    }
                    messageReturn = messageReturn + "Moi ngay ban se nhan duoc nhung tin tuc the thao nong hoi (5000d/ngay). " +
                                    "Truy cap: http://visport.vn de su dung dich vu. " +
                                    "De huy dvu soan: HUY TP gui 979, xem diem va so diem cao nhat hien tai soan TOP gui 979 HT: 19001255";

                    SendMtSportGameHero(User_ID, messageReturn, Service_ID, Command_Code, Request_ID, 0);

                    responseValue = "1|Success";
                    #endregion
                }
                else if (value.Rows[0]["RETURN_ID"].ToString() == "2")
                {
                    #region DA DK DV ROI XONG HUY DK LAI ==> TRA MT WELCOME

                    messageReturn = "Chuc mung ban da tham gia  CTKM Trieu phu bong da cua Vietnamobile.";
                    if (DateTime.Now > Convert.ToDateTime(AppEnv.GetSetting("StartKM")) && DateTime.Now < Convert.ToDateTime(AppEnv.GetSetting("EndKM")))
                    {
                        messageReturn = messageReturn + "  Ban co 5.000 diem voi co hoi trung thuong 1 dien thoai Samsung Galaxy A5.";
                    }
                    messageReturn = messageReturn + "Moi ngay ban se nhan duoc nhung tin tuc the thao nong hoi. Truy cap: http://visport.vn de su dung dvu. De huy dvu soan: HUY TP gui 979. HT: 19001255";

                    SendMtSportGameHero(User_ID, messageReturn, Service_ID, Command_Code, Request_ID, 0); //SEND MT LAN 1

                    responseValue = "1|Success";
                    #endregion
                }
                else if (value.Rows[0]["RETURN_ID"].ToString() == "1")//DA DK DICH VU
                {
                    #region THUE BAO DANG ACTIVE DV

                    messageReturn = "Ban da tham gia  CTKM Trieu phu bong da cua Vietnamobile.";
                    if (DateTime.Now > Convert.ToDateTime(AppEnv.GetSetting("StartKM")) && DateTime.Now < Convert.ToDateTime(AppEnv.GetSetting("EndKM")))
                    {
                        messageReturn = messageReturn + " Ban co 5.000 diem voi co hoi trung thuong 1 dien thoai Samsung Galaxy A5.";
                    }
                    messageReturn = messageReturn + "Moi ngay ban se nhan duoc nhung tin tuc the thao nong hoi. Truy cap: http://visport.vn de su dung dvu. De huy dvu soan: HUY TP gui 979. HT: 19001255";
                    SendMtSportGameHero(User_ID, messageReturn, Service_ID, Command_Code, Request_ID, 0);

                    responseValue = "0|DoubleRegister";
                    #endregion
                }

                #endregion
            }
            else
            {
                messageReturn = "Tin nhan sai cu phap.";
                SendMtSportGameHero(User_ID, messageReturn, Service_ID, Command_Code, Request_ID, 0);
                responseValue = "-1|WrongSyntax";
            }

            #endregion
        }
        catch (Exception ex)
        {
            log.Error(ex.ToString());
            responseValue = "-2|System busy";
        }

        return(responseValue);
    }
예제 #5
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);
    }
예제 #6
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";
    }