public int Execute(int jobId) { WebServiceCharging3g webServiceCharging3G = new WebServiceCharging3g(); string userName = "******"; string userPass = "******"; string cpId = "1928"; string price = "5000"; try { DataTable dtUsers = VoteRegisterController.NewVoteGetUserByType(false); if (dtUsers != null && dtUsers.Rows.Count > 0) { string message = string.Empty; string returnValue = string.Empty; string notEnoughMoney = "Result:12,Detail:Not enough money."; string serviceType = "HotGirl_QuanTu"; string serviceName = "HotGirl_QuanTu"; string reasonLog = string.Empty; foreach (DataRow dr in dtUsers.Rows) { string userId = dr["User_ID"].ToString(); returnValue = webServiceCharging3G.PaymentVnmWithAccount(userId, price, serviceType, serviceName, userName, userPass, cpId); if (returnValue.Trim() == notEnoughMoney) { price = "3000"; returnValue = webServiceCharging3G.PaymentVnmWithAccount(userId, price, serviceType, serviceName, userName, userPass, cpId); if (returnValue.Trim() == notEnoughMoney) { price = "2000"; returnValue = webServiceCharging3G.PaymentVnmWithAccount(userId, price, serviceType, serviceName, userName, userPass, cpId); if (returnValue.Trim() == notEnoughMoney) { price = "1000"; returnValue = webServiceCharging3G.PaymentVnmWithAccount(userId, price, serviceType, serviceName, userName, userPass, cpId); } } } if (returnValue.Trim() == "1")//CHARGED THANH CONG { reasonLog = "Succ"; } else { reasonLog = returnValue; } #region LOG DOANH THU var logInfo = new VoteChargedUserLogInfo(); logInfo.ID = ConvertUtility.ToInt32(dr["ID"].ToString()); logInfo.User_ID = userId; logInfo.Request_ID = dr["Request_ID"].ToString(); logInfo.Service_ID = dr["Service_ID"].ToString(); logInfo.Command_Code = dr["Command_Code"].ToString(); logInfo.Service_Type = 0;//Charged Sub Service_Type logInfo.Charging_Count = ConvertUtility.ToInt32(dr["Charging_Count"].ToString()); logInfo.FailedChargingTime = ConvertUtility.ToInt32(dr["FailedChargingTimes"].ToString()); logInfo.RegisteredTime = DateTime.Now; logInfo.ExpiredTime = DateTime.Now.AddDays(1); logInfo.Registration_Channel = dr["Registration_Channel"].ToString(); logInfo.Status = ConvertUtility.ToInt32(dr["Status"].ToString()); logInfo.Operator = dr["Operator"].ToString(); logInfo.Price = ConvertUtility.ToInt32(price); logInfo.Vote_PersonId = 1; logInfo.Reason = reasonLog; VoteRegisterController.NewVoteChargedUserLogInsertForSub(logInfo); #endregion #region GUI SMS CHO KHACH_HANG if (returnValue.Trim() == "1") { string serviceId = dr["Service_ID"].ToString(); string commandCode = dr["Command_Code"].ToString(); string requestId = dr["Request_ID"].ToString(); DataTable dt = VoteRegisterController.NewVoteRegisterUserGetInfo(userId); int voteCount = ConvertUtility.ToInt32(dt.Rows[0]["Vote_Count"]); string voteTop = GetTopVote(voteCount); message = "So luot vote cua ban: " + voteCount + ".Ban dang thuoc top: " + voteTop + " nhung nguoi Vote nhieu nhat.Soan: Vote1 gui 8579 de Hen Ho voi 1 trong 5 Hot Girl Xinh Dep.Chi tiet truy cap: http://wap.vietnamobile.com.vn. HT: 19001255"; SendMtNewVote(userId, serviceId, commandCode, message, requestId); } #endregion } } return(1); } catch (Exception ex) { log.Error(ex.ToString()); return(0); } }