private string ExcecuteRequestMoCauHoiMayMan(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(" ", ""); } try { log.Debug(" "); log.Debug(" "); log.Debug("-------------------- CAU HOI MAY MAN -------------------------"); 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); moInfo.Type = 2; SMS_MODB.InsertCauHoiMayManMo(moInfo); #endregion string messageReturn; if (Command_Code.ToUpper() == "HD") { if (subcode == "MM") { messageReturn = "Dich vu Quay So May Man cua Vietnamobile tang ban co hoi so huu iPhone 6s sanh dieu hang quy. Dong thoi moi tuan, KH dat diem so cao nhat se gianh giai thuong 1 trieu dong tien mat. KH tham gia bang cach soan DK MM gui 949 (2000d/ngay), moi ngay KH se nhan 5 cau hoi mien phi. KH truy cap http://visport.vn/Wap/cauhoi.aspx de tra loi cau hoi va nhan diem. Tra loi dung duoc 1 diem, tra loi sai khong duoc diem. Mua them cau hoi voi gia 1000d/cau hoi."; SendMtCauHoiMayMan(User_ID, messageReturn, Service_ID, Command_Code, Request_ID); } else { messageReturn = "Tin nhan sai cu phap. HT: 19001255"; SendMtCauHoiMayMan(User_ID, messageReturn, Service_ID, Command_Code, Request_ID); } } //else if (Command_Code.ToUpper() == "DIEM") //{ // DataTable dtDiem = ThanTai_MT_Controller.Diem_CauHoiMayMan(User_ID); // int diem = 0; // int stt = 0; // if (dtDiem != null && dtDiem.Rows.Count > 0) // { // diem = ConvertUtility.ToInt32(dtDiem.Rows[0]["Diem"].ToString()); // stt = ConvertUtility.ToInt32(dtDiem.Rows[0]["Stt"].ToString()); // if (diem > 0) // { // messageReturn = "Ban dang co " + diem + " diem va xep thu " + stt + " trong bang xep hang de nhan giai thuong 1 trieu dong tuan nay va iPhone 6s cua quy. Chi tiet soan HD MM (MIEN PHI) gui 949 hoac truy cap <landing page>"; // SendMtCauHoiMayMan(User_ID, messageReturn, Service_ID, Command_Code, Request_ID); // } // else // { // messageReturn = "Ban chua danh duoc diem nao. Co gang len !."; // SendMtCauHoiMayMan(User_ID, messageReturn, Service_ID, Command_Code, Request_ID); // } // } // else // { // messageReturn = "Ban chua dang ky dich vu, KH tham gia bang cach soan DK MM gui 949 (2000d/ngay) !"; // SendMtCauHoiMayMan(User_ID, messageReturn, Service_ID, Command_Code, Request_ID); // } //} else { messageReturn = "Tin nhan sai cu phap. HT: 19001255"; SendMtCauHoiMayMan(User_ID, messageReturn, Service_ID, Command_Code, Request_ID); } } catch (Exception ex) { log.Debug("--------------- CAU HOI MAY MAN ----------------------"); log.Debug("Get Error : " + ex.Message + ", returnValue: " + returnValue); } return(responseValue); }
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); }
private string ExcecuteMo(string User_ID, string Service_ID, string Command_Code, string Message, string Request_ID) { 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(); #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 = "VNM"; SMS_MODB.InsertSportGameHeroMo(moInfo); #endregion #region CALL to Partner WS RegGate ws = new RegGate(); string resVal; string res; string message; string packageName = subcode; const string promotion = "0"; const string trial = "0"; const string bundle = "0"; string note = Message; const string application = "VMGPORTAL"; const string channel = "SMS"; const string userName = "******"; const string userId = "sv167.vmgmedia.vn"; const string policy = "0"; if (Command_Code == "DK") { #region DK //103|INVALID_IP resVal = ws.register(Request_ID, User_ID, packageName, promotion, trial, bundle, note, application, channel, userName, userId); res = resVal.Split('|')[0].Trim(); _log.Debug("Vnpt_media response ws register : " + resVal + "; Message : " + Message); if (res == "0") { #region "Đăng ký thành công dịch vụ" message = "Chuc mung, Quy khach dang ky thanh cong goi xem " + subcode + " va duoc " + GetDay(subcode) + " ngay xem MIEN PHI cac kenh truyen hinh cap VTV tren dich vu Mobile TV cua VNM. " + "Goi cuoc se duoc tu dong gia han theo <Ngay/Tuan> " + "khi het mien phi, cuoc gia han: (Giá gói DV), soan HUY " + subcode + " gui 444 de huy dich vu. " + "Truy cap http://mtv.vietnamobile.com.vn/ de xem ngay cac kenh truyen hinh Cap VTV dac sac nhat hien nay. " + "Dac biet, dich vu hoan toan mien phi cuoc GPRS/3G. Tran trong cam on!"; SendMtVnptMedia(User_ID, message, Service_ID, Command_Code, Request_ID); #endregion } else if (res == "1") { #region Thuê bao này đã tồn tại message = "Dang ky khong thanh cong do Quy khach dang su dung goi ngay cua dich vu MobileTV. Truy cap http://mtv.vietnamobile.com.vn/ de su dung dich vu. Chi tiet lien he 19001255. Tran trong cam on!"; SendMtVnptMedia(User_ID, message, Service_ID, Command_Code, Request_ID); #endregion } else if (res == "2") { #region Đăng ký rồi và đăng ký lại dịch vụ message = "Dang ky khong thanh cong do Quy khach dang su dung goi ngay cua dich vu MobileTV. Truy cap http://mtv.vietnamobile.com.vn/ de su dung dich vu. Chi tiet lien he 19001255. Tran trong cam on!"; SendMtVnptMedia(User_ID, message, Service_ID, Command_Code, Request_ID); #endregion } else if (res == "3") { #region Đăng ký thành công dịch vụ và không bị trừ cước đăng ký #endregion } else if (res == "4") { #region Đăng ký thành công dịch vụ và bị trừ cước đăng ký #endregion } else if (res == "5") { #region Đăng ký không thành công do không đủ tiền trong tài khoản message = "Dang ky khong thanh cong do tai khoan khong du tien. Xin cam on"; SendMtVnptMedia(User_ID, message, Service_ID, Command_Code, Request_ID); #endregion } else if (res == "101") { #region Sai cu PHAP message = "Tin nhan sai cu phap. xin cam on"; SendMtVnptMedia(User_ID, message, Service_ID, Command_Code, Request_ID); #endregion } else if (res == "103") { #region IP Khong duoc phep message = "IP khong duoc phep. xin cam on"; SendMtVnptMedia(User_ID, message, Service_ID, Command_Code, Request_ID); #endregion } else if (res == "100") { #region Loi khong xac dinh message = "Loi khong xac dinh. xin cam on"; SendMtVnptMedia(User_ID, message, Service_ID, Command_Code, Request_ID); #endregion } else { #region Đều là đăng ký không thành công message = "He thong dang ban. xin cam on"; //SendMtVnptMedia(User_ID, message, Service_ID, Command_Code, Request_ID); SendMtVnptMedia(User_ID, res, Service_ID, Command_Code, Request_ID); #endregion } #endregion } else if (Command_Code == "HUY") { #region HUY resVal = ws.cancelService(Request_ID, User_ID, packageName, policy, promotion, note, application, channel, userName, userId); res = resVal.Split('|')[0].Trim(); _log.Debug("Vnpt_media response ws cancel : " + resVal + "; Message : " + Message); if (res == "0") { #region "Success" message = "Quy khach da huy thanh cong goi " + subcode + " cua dich vu MobileTV. De dang ky lai soan DK " + subcode + " gui 444. " + "Cac noi dung Quy khach da mua van duoc tiep tuc su dung. Cam on Quy khach da su dung dich vu. " + "Chi tiet truy cap http://mtv.vietnamobile.com.vn/ hoac lien he ho tro 19001255. Tran trong cam on!"; SendMtVnptMedia(User_ID, message, Service_ID, Command_Code, Request_ID); #endregion } else if (res == "1") { #region Thuê bao này không tồn tại message = "Quy khach chua dang ky dich vu MobileTV cua VNM. " + "De dang ky dich vu, Quy khach vui long soan: PHIM cho goi ngay hoac PHIM PHIM cho goi tuan gui 444. " + "Xem huong dan soan HD gui 444. " + "Chi tiet truy cap http://mtv.vietnamobile.com.vn/ hoac lien he ho tro 19001255. Tran trong cam on!"; SendMtVnptMedia(User_ID, message, Service_ID, Command_Code, Request_ID); #endregion } else { #region Đều là đăng ký không thành công message = "He thong dang ban. xin cam on"; //SendMtVnptMedia(User_ID, message, Service_ID, Command_Code, Request_ID); SendMtVnptMedia(User_ID, res, Service_ID, Command_Code, Request_ID); #endregion } #endregion } else if (Command_Code == "MK") { #region MAT KHAU resVal = ws.getPassOtp(User_ID, "Lay pass nguoi dung"); res = resVal.Split('|')[0].Trim(); _log.Debug("Vnpt_media response ws password : "******"; Message : " + Message); if (res == "0") { string pass = resVal.Split('|')[1].Trim(); message = "Mat khau de su dung dich vu MobileTV cua Quy khach la: " + pass + ".Truy cap http://mtv.vietnamobile.com.vn/ de su dung dich vu. Lien he ho tro 19001255. Tran trong cam on!"; SendMtVnptMedia(User_ID, message, Service_ID, Command_Code, Request_ID); } else { message = "Quy khach chua dang ky dich vu MobileTV cua VNM. De dang ky dich vu, Quy khach vui long soan: DK TenGoi gui 444 hoac truy cap dia chi http://mtv.vietnamobile.com.vn/ va lam theo huong dan. Lien he ho tro 19001255. Tran trong cam on!"; SendMtVnptMedia(User_ID, message, Service_ID, Command_Code, Request_ID); } #endregion } #endregion return("1"); }
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); }
private string ExcecuteRequestMoThanTai(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(" ", ""); } try { log.Debug(" "); log.Debug(" "); log.Debug("-------------------- CAP SO THAN TAI -------------------------"); 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.InsertThanTaiMo(moInfo); #endregion string messageReturn; if (Command_Code.ToUpper() == "TT") { DateTime nowTime = DateTime.Now; if (nowTime.Hour >= 17 && nowTime.Hour <= 24) { messageReturn = "Co hoi ngay hom nay cua ban da het roi. Quay lai voi chung toi vao ngay mai va lua chon cap so tu 00h den 17h hang ngay nhe"; SendMtThanTai(User_ID, messageReturn, Service_ID, Command_Code, Request_ID); } else { //DataTable dt = ViSport_S2_Registered_UsersController.ThanTai_DemLuot(User_ID); //if (ConvertUtility.ToInt32(dt.Rows[0]["RETURN_ID"].ToString()) >= 10) //{ // messageReturn = "Ban da lua chon 10 cap so may man va het luot lua chon trong hom nay. Cung cho don ket qua nhe, may man dang cho ban."; // SendMtThanTai(User_ID, messageReturn, Service_ID, Command_Code, Request_ID); //} //else //{ //string numberregex = "[0-9]{2}"; string numberregex = "^[0-9]+$"; if (Regex.IsMatch(subcode, numberregex) && subcode.Length == 2) { DataTable dtCheckSub = ViSport_S2_Registered_UsersController.ThanTai_CheckExistSubRegister(User_ID); if (dtCheckSub != null && dtCheckSub.Rows.Count > 0) { DataTable dt = ViSport_S2_Registered_UsersController.ThanTai_DemLuot(User_ID); if (ConvertUtility.ToInt32(dt.Rows[0]["RETURN_ID"].ToString()) >= 10) { messageReturn = "Ban da lua chon 10 cap so may man va het luot lua chon trong hom nay. Cung cho don ket qua nhe, may man dang cho ban."; SendMtThanTai(User_ID, messageReturn, Service_ID, Command_Code, Request_ID); } else { //if (ViSport_S2_Registered_UsersController.ThanTai_CheckExistMng(User_ID)) //{ if (ConvertUtility.ToInt32(dt.Rows[0]["RETURN_ID"].ToString()) < 4) { messageReturn = "Ban da lua chon cap so " + subcode + ". May man dang cho ban. TT <cap so> de lua chon cap so tiep theo nang cao co hoi trung thuong."; SendMtThanTai(User_ID, messageReturn, Service_ID, Command_Code, Request_ID); ThanTai_MT_Controller.Insert_CapSo(User_ID, subcode); } else if (ConvertUtility.ToInt32(dt.Rows[0]["RETURN_ID"].ToString()) == 4) { messageReturn = "Ban da lua chon cap so " + subcode + ".Ban da het 5 luot lua chon mien phi. TT <cap so> de nang cao diem va co hoi trung thuong (1000d/tin, toi da duọc chon them 5 lan)"; SendMtThanTai(User_ID, messageReturn, Service_ID, Command_Code, Request_ID); ThanTai_MT_Controller.Insert_CapSo(User_ID, subcode); } else { //Charged #region Tinh tien tin nhan le if (CapSoThanTaiCharged(User_ID, Request_ID, Service_ID) == "1") { #region Charged THANHCONG messageReturn = "Ban da lua chon cap so " + subcode + ". May man dang cho ban. TT <cap so> de lua chon cap so tiep theo nang cao co hoi trung thuong."; SendMtThanTai(User_ID, messageReturn, Service_ID, Command_Code, Request_ID); ThanTai_MT_Controller.Insert_CapSo(User_ID, subcode); #endregion } else if (CapSoThanTaiCharged(User_ID, Request_ID, Service_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 !"; SendMtThanTai(User_ID, messageReturn, Service_ID, Command_Code, Request_ID); //SEND MT THONGBAO #endregion } else { #region Charged THATBAI ==> LOI SYSTEM messageReturn = "He thong dang ban. Vui long tro lai sau it phut !"; SendMtThanTai(User_ID, messageReturn, Service_ID, Command_Code, Request_ID); //SEND MT THONGBAO #endregion } #endregion } } } else { #region Tinh tien tin nhan le if (CapSoThanTaiCharged(User_ID, Request_ID, Service_ID) == "1") { #region Charged THANHCONG messageReturn = "Ban da lua chon cap so " + subcode + ". May man dang cho ban. TT <cặp số> de lua chon cap so tiep theo nang cao co hoi trung thuong."; SendMtThanTai(User_ID, messageReturn, Service_ID, Command_Code, Request_ID); ThanTai_MT_Controller.Insert_CapSo(User_ID, subcode); #endregion } else if (CapSoThanTaiCharged(User_ID, Request_ID, Service_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 !"; SendMtThanTai(User_ID, messageReturn, Service_ID, Command_Code, Request_ID); //SEND MT THONGBAO #endregion } else { #region Charged THATBAI ==> LOI SYSTEM messageReturn = "He thong dang ban. Vui long tro lai sau it phut !"; SendMtThanTai(User_ID, messageReturn, Service_ID, Command_Code, Request_ID); //SEND MT THONGBAO #endregion } #endregion } } else { messageReturn = "Tin nhan sai cu phap. HT: 19001255"; SendMtThanTai(User_ID, messageReturn, Service_ID, Command_Code, Request_ID); } //} } } else if (Command_Code.ToUpper() == "DIEM") { DataTable dtDiem = ThanTai_MT_Controller.SumPointByDay(User_ID); int diem = 0; int stt = 0; DateTime nowTime = DateTime.Now; if (nowTime.Hour >= 19 && nowTime.Hour <= 24) { if (dtDiem != null && dtDiem.Rows.Count > 0) { diem = ConvertUtility.ToInt32(dtDiem.Rows[0]["Point"].ToString()); stt = ConvertUtility.ToInt32(dtDiem.Rows[0]["Top"].ToString()); if (diem > 0) { messageReturn = "Ban dang co " + diem + " diem va nam trong top " + stt + " diem cao nhat. Co gang len nao. De xem so diem tong dang co, soan TONG gui 949"; SendMtThanTai(User_ID, messageReturn, Service_ID, Command_Code, Request_ID); } else { messageReturn = "Ban chua danh duoc diem nao. Co gang len nao."; SendMtThanTai(User_ID, messageReturn, Service_ID, Command_Code, Request_ID); } } } else { messageReturn = "Ket qua xo so se duoc cap nhat vao toi nay. Ban hay theo doi de biet so diem cua minh. Soan tin DK XS MB de theo doi ket qua xo so"; SendMtThanTai(User_ID, messageReturn, Service_ID, Command_Code, Request_ID); } } else if (Command_Code.ToUpper() == "TONG") { DataTable dtDiem = ThanTai_MT_Controller.SumPoint(User_ID); int tong = 0; int stt = 0; DateTime nowTime = DateTime.Now; if (dtDiem != null && dtDiem.Rows.Count > 0) { tong = ConvertUtility.ToInt32(dtDiem.Rows[0]["Tong"].ToString()); stt = ConvertUtility.ToInt32(dtDiem.Rows[0]["Top"].ToString()); if (tong > 0) { messageReturn = "Ban dang co " + tong + " diem va nam trong top " + stt + " diem cao nhat. Co gang len de gianh 30 trieu dong."; SendMtThanTai(User_ID, messageReturn, Service_ID, Command_Code, Request_ID); } else { messageReturn = "Ban chua danh duoc diem nao. Co gang len de gianh 30 trieu dong."; SendMtThanTai(User_ID, messageReturn, Service_ID, Command_Code, Request_ID); } } } else { messageReturn = "Tin nhan sai cu phap. HT: 19001255"; SendMtThanTai(User_ID, messageReturn, Service_ID, Command_Code, Request_ID); } } catch (Exception ex) { log.Debug("--------------- CAP SO THAN TAI ----------------------"); log.Debug("Get Error : " + ex.Message + ", returnValue: " + returnValue); } return(responseValue); }
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); }
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); }
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"; }