public int Execute(int jobID) { WebServiceCharging3g webServiceCharging3G = new WebServiceCharging3g(); string userName = "******"; string userPass = "******"; string cpId = "1930"; string price = "4000"; try { DataTable dtUsers = ViSport_S2_Registered_UsersController.GetSportGameUserByType(false); if (dtUsers != null && dtUsers.Rows.Count > 0) { string message = string.Empty; string returnValue = string.Empty; string notEnoughMoney = AppEnv.GetSetting("NotEnoughMoney"); string serviceType = "Charge Hero"; string serviceName = "ViSport_Hero"; string reasonLog = string.Empty; for (int i = 0; i < dtUsers.Rows.Count; i++) { try { #region TIEN HANH CHARGED price = "5000"; returnValue = webServiceCharging3G.PaymentVnmWithAccount(dtUsers.Rows[i]["User_ID"].ToString(), price, "Charged Sub Anh Tai", "Anh_Tai_Sub", userName, userPass, cpId); if (returnValue.Trim() == notEnoughMoney) { price = "3000"; returnValue = webServiceCharging3G.PaymentVnmWithAccount(dtUsers.Rows[i]["User_ID"].ToString(), price, "Charged Sub Anh Tai", "Anh_Tai_Sub", userName, userPass, cpId); if (returnValue.Trim() == notEnoughMoney) { price = "2000"; returnValue = webServiceCharging3G.PaymentVnmWithAccount(dtUsers.Rows[i]["User_ID"].ToString(), price, "Charged Sub Anh Tai", "Anh_Tai_Sub", userName, userPass, cpId); if (returnValue.Trim() == notEnoughMoney) { price = "1000"; returnValue = webServiceCharging3G.PaymentVnmWithAccount(dtUsers.Rows[i]["User_ID"].ToString(), price, "Charged Sub Anh Tai", "Anh_Tai_Sub", userName, userPass, cpId); } } } if (returnValue == "1") { #region LOG DOANH THU var logInfo = new SportGameHeroChargedUserLogInfo(); logInfo.ID = ConvertUtility.ToInt32(dtUsers.Rows[i]["ID"].ToString()); logInfo.User_ID = dtUsers.Rows[i]["User_ID"].ToString(); logInfo.Request_ID = dtUsers.Rows[i]["Request_ID"].ToString(); logInfo.Service_ID = dtUsers.Rows[i]["Service_ID"].ToString(); logInfo.Command_Code = dtUsers.Rows[i]["Command_Code"].ToString(); logInfo.Service_Type = ConvertUtility.ToInt32(dtUsers.Rows[i]["Service_Type"].ToString()); logInfo.Charging_Count = ConvertUtility.ToInt32(dtUsers.Rows[i]["Charging_Count"].ToString()); logInfo.FailedChargingTime = ConvertUtility.ToInt32(dtUsers.Rows[i]["FailedChargingTimes"].ToString()); logInfo.RegisteredTime = ConvertUtility.ToDateTime(dtUsers.Rows[i]["RegisteredTime"].ToString()); logInfo.ExpiredTime = DateTime.Now.AddDays(1); logInfo.Registration_Channel = dtUsers.Rows[i]["Registration_Channel"].ToString(); logInfo.Status = ConvertUtility.ToInt32(dtUsers.Rows[i]["Status"].ToString()); logInfo.Operator = dtUsers.Rows[i]["Operator"].ToString(); logInfo.Price = ConvertUtility.ToInt32(price); logInfo.Reason = "Succ"; ViSport_S2_Registered_UsersController.InsertSportGameHeroChargedUserLogForSub(logInfo); #endregion } else { #region LOG DOANH THU var logInfo = new SportGameHeroChargedUserLogInfo(); logInfo.ID = ConvertUtility.ToInt32(dtUsers.Rows[i]["ID"].ToString()); logInfo.User_ID = dtUsers.Rows[i]["User_ID"].ToString(); logInfo.Request_ID = dtUsers.Rows[i]["Request_ID"].ToString(); logInfo.Service_ID = dtUsers.Rows[i]["Service_ID"].ToString(); logInfo.Command_Code = dtUsers.Rows[i]["Command_Code"].ToString(); logInfo.Service_Type = ConvertUtility.ToInt32(dtUsers.Rows[i]["Service_Type"].ToString()); logInfo.Charging_Count = ConvertUtility.ToInt32(dtUsers.Rows[i]["Charging_Count"].ToString()); logInfo.FailedChargingTime = ConvertUtility.ToInt32(dtUsers.Rows[i]["FailedChargingTimes"].ToString()); logInfo.RegisteredTime = ConvertUtility.ToDateTime(dtUsers.Rows[i]["RegisteredTime"].ToString()); logInfo.ExpiredTime = DateTime.Now.AddDays(1); logInfo.Registration_Channel = dtUsers.Rows[i]["Registration_Channel"].ToString(); logInfo.Status = ConvertUtility.ToInt32(dtUsers.Rows[i]["Status"].ToString()); logInfo.Operator = dtUsers.Rows[i]["Operator"].ToString(); logInfo.Price = ConvertUtility.ToInt32(price); logInfo.Reason = returnValue; ViSport_S2_Registered_UsersController.InsertSportGameHeroChargedUserLogForSub(logInfo); #endregion } if (returnValue == "1")//CHARGED THANH CONG { #region SEND MT CHO USER //SEND MT CHO KHACH HANG DataTable dtQuestion = ViSport_S2_Registered_UsersController.GetQuestionInfoSportGameHero(); if (dtQuestion != null && dtQuestion.Rows.Count > 0) { message = dtQuestion.Rows[0]["Question"].ToString(); int questionIdnew = ConvertUtility.ToInt32(dtQuestion.Rows[0]["Id"].ToString()); string answer = dtQuestion.Rows[0]["Answer"].ToString(); string serviceId = dtUsers.Rows[i]["Service_ID"].ToString(); string commandCode = dtUsers.Rows[i]["Command_Code"].ToString(); string requestId = dtUsers.Rows[i]["Request_ID"].ToString(); ViSport_S2_Registered_UsersController.InsertSportGameHeroAnswerLog(dtUsers.Rows[i]["User_ID"].ToString(), questionIdnew, message, answer, DateTime.Now, 0); // LUU LOG Question SendMtSportGame(dtUsers.Rows[i]["User_ID"].ToString(), message, serviceId, commandCode, requestId); } //END SEND MT CHO KHACH HANG #endregion } #endregion } catch (Exception ex) { log.Error("Anh tai bong da Loi charged : " + ex); continue; } } } return(1); } catch (Exception ex) { log.Error("Anh tai bong da Loi lay tap User : " + ex); return(0); } }