/// <summary> /// 更新平盘业务 /// </summary> /// <param name="model"></param> /// <returns></returns> public void UpdatePPCase(TPR3.Model.guess.BaPay model) { //更新此记录得到的币 StringBuilder strSql = new StringBuilder(); strSql.Append("update tb_ZBaPay set "); strSql.Append("p_getMoney=@p_getMoney,"); strSql.Append("p_case=@p_case,"); strSql.Append("p_result_one=@p_result_one,"); strSql.Append("p_result_two=@p_result_two,"); strSql.Append("p_active=@p_active"); strSql.Append(" where ID=@ID "); SqlParameter[] parameters = { new SqlParameter("@ID", SqlDbType.Int, 4), new SqlParameter("@p_getMoney", SqlDbType.Money, 8), new SqlParameter("@p_case", SqlDbType.Int, 4), new SqlParameter("@p_result_one", SqlDbType.Int, 4), new SqlParameter("@p_result_two", SqlDbType.Int, 4), new SqlParameter("@p_active", SqlDbType.Int, 4) }; parameters[0].Value = model.ID; parameters[1].Value = model.p_getMoney; parameters[2].Value = 0; parameters[3].Value = model.p_result_one; parameters[4].Value = model.p_result_two; parameters[5].Value = model.p_active; SqlHelper.ExecuteSql(strSql.ToString(), parameters); }
/// <summary> /// 得到一个对象实体 /// </summary> public TPR3.Model.guess.BaPay GetModelIsCase(int ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 ID,payview,p_getMoney,pType,bcid,types,paycent,payusid,payusname from tb_ZBaPay "); strSql.Append(" where ID=@ID "); SqlParameter[] parameters = { new SqlParameter("@ID", SqlDbType.Int, 4) }; parameters[0].Value = ID; TPR3.Model.guess.BaPay model = new TPR3.Model.guess.BaPay(); DataSet ds = SqlHelper.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["ID"].ToString() != "") { model.ID = int.Parse(ds.Tables[0].Rows[0]["ID"].ToString()); } model.payview = ds.Tables[0].Rows[0]["payview"].ToString(); if (ds.Tables[0].Rows[0]["p_getMoney"].ToString() != "") { model.p_getMoney = decimal.Parse(ds.Tables[0].Rows[0]["p_getMoney"].ToString()); } if (ds.Tables[0].Rows[0]["pType"].ToString() != "") { model.pType = int.Parse(ds.Tables[0].Rows[0]["pType"].ToString()); } if (ds.Tables[0].Rows[0]["bcid"].ToString() != "") { model.bcid = int.Parse(ds.Tables[0].Rows[0]["bcid"].ToString()); } if (ds.Tables[0].Rows[0]["types"].ToString() != "") { model.Types = int.Parse(ds.Tables[0].Rows[0]["types"].ToString()); } if (ds.Tables[0].Rows[0]["paycent"].ToString() != "") { model.payCent = decimal.Parse(ds.Tables[0].Rows[0]["paycent"].ToString()); } if (ds.Tables[0].Rows[0]["payusid"].ToString() != "") { model.payusid = int.Parse(ds.Tables[0].Rows[0]["payusid"].ToString()); } model.payusname = ds.Tables[0].Rows[0]["payusname"].ToString(); return(model); } else { return(null); } }
/// <summary> /// 更新开奖业务 /// </summary> /// <param name="model"></param> /// <param name="p_strVal"></param> /// <returns></returns> public void UpdateCase(TPR3.Model.guess.BaPay model, string p_strVal, out decimal p_intDuVal, out int p_intWin) { string[] strVal = { }; decimal duVal = 0; if (!string.IsNullOrEmpty(p_strVal)) { strVal = p_strVal.Split("|".ToCharArray()); duVal = Convert.ToDecimal(strVal[0]); p_intWin = 1; p_intDuVal = duVal; } else { p_intWin = 0; p_intDuVal = 0; } //更新此记录得到的币 StringBuilder strSql = new StringBuilder(); strSql.Append("update tb_ZBaPay set "); strSql.Append("p_getMoney=@p_getMoney,"); strSql.Append("p_case=@p_case,"); strSql.Append("p_result_one=@p_result_one,"); strSql.Append("p_result_two=@p_result_two,"); strSql.Append("p_active=@p_active"); strSql.Append(" where ID=@ID "); SqlParameter[] parameters = { new SqlParameter("@ID", SqlDbType.Int, 4), new SqlParameter("@p_getMoney", SqlDbType.Money, 8), new SqlParameter("@p_case", SqlDbType.Int, 4), new SqlParameter("@p_result_one", SqlDbType.Int, 4), new SqlParameter("@p_result_two", SqlDbType.Int, 4), new SqlParameter("@p_active", SqlDbType.Int, 4) }; parameters[0].Value = model.ID; parameters[1].Value = duVal; parameters[2].Value = 0; parameters[3].Value = model.p_result_one; parameters[4].Value = model.p_result_two; parameters[5].Value = model.p_active; SqlHelper.ExecuteSql(strSql.ToString(), parameters); }
public static string getLqdxCase(TPR3.Model.guess.BaPay model) { string strVal = ""; /*---------------------------大小盘----------------------------------------------*/ if (model.p_result_one + model.p_result_two - model.p_dx_pk == 0) { strVal = model.payCent + "|平盘";//平盘 } else if ((model.p_result_one + model.p_result_two) - model.p_dx_pk > 0 && model.PayType == 3) { strVal = model.payCent * model.payonLuone + "|全赢";//大盘全赢 } else if ((model.p_result_one + model.p_result_two) - model.p_dx_pk < 0 && model.PayType == 4) { strVal = model.payCent * model.payonLutwo + "|全赢";//小盘全赢 } /*-------------------------------------------------------------------------------*/ return(strVal); }
/// <summary> /// 篮球让球逻辑类 /// </summary> /// <param name="model"></param> /// <returns></returns> public static string getLqsxCase(TPR3.Model.guess.BaPay model) { string strVal = ""; /*---------------------------让球盘----------------------------------------------*/ if (model.p_result_one - model.p_result_two == model.p_pk) { strVal = model.payCent + "|平盘";//平盘 } else if ((model.p_result_one - model.p_result_two) - model.p_pk > 0 && model.PayType == 1) { strVal = model.payCent * model.payonLuone + "|全赢";//上盘全赢 } else if ((model.p_result_one - model.p_result_two) - model.p_pk < 0 && model.PayType == 2) { strVal = model.payCent * model.payonLutwo + "|全赢";//下盘全赢 } /*--------------------------------------------------------------------------------*/ return(strVal); }
public static string getLqdsCase(TPR3.Model.guess.BaPay model) { string strVal = ""; int intone, inttwo; intone = Convert.ToInt32(model.p_result_one); inttwo = Convert.ToInt32(model.p_result_two); /*---------------------------单双盘----------------------------------------------*/ int result = Convert.ToInt32(intone + inttwo); if (result % 2 != 0 && model.PayType == 8) { strVal = model.payCent * model.payonLuone + "|全赢";//单全赢 } else if (result % 2 == 0 && model.PayType == 9) { strVal = model.payCent * model.payonLutwo + "|全赢";//双全赢 } /*-------------------------------------------------------------------------------*/ return(strVal); }
/// <summary> /// 取得每页记录 /// </summary> /// <param name="p_pageIndex">当前页</param> /// <param name="p_pageSize">分页大小</param> /// <param name="p_recordCount">返回总记录数</param> /// <returns>IList BaPay</returns> public IList <TPR3.Model.guess.BaPay> GetBaPays(int p_pageIndex, int p_pageSize, string strWhere, out int p_recordCount) { IList <TPR3.Model.guess.BaPay> listBaPays = new List <TPR3.Model.guess.BaPay>(); string sTable = "tb_ZBaPay"; string sPkey = "id"; string sField = "id,payview,payusid,payusname,pType,PayType,payCent,payonLuone,payonLutwo,payonLuthr,p_pk,p_dx_pk,p_pn,p_result_one,p_result_two,p_getMoney,paytimes,p_active,p_result_temp1,p_result_temp2,itypes,types,state"; string sCondition = strWhere; string sOrder = "id desc"; int iSCounts = 0; using (SqlDataReader reader = SqlHelper.RunProcedureMe(sTable, sPkey, sField, p_pageIndex, p_pageSize, sCondition, sOrder, iSCounts, out p_recordCount)) { //计算总页数 if (p_recordCount > 0) { int pageCount = BasePage.CalcPageCount(p_recordCount, p_pageSize, ref p_pageIndex); } else { return(listBaPays); } while (reader.Read()) { TPR3.Model.guess.BaPay objBaPay = new TPR3.Model.guess.BaPay(); objBaPay.ID = reader.GetInt32(0); objBaPay.payview = reader.GetString(1); objBaPay.payusid = reader.GetInt32(2); objBaPay.payusname = reader.GetString(3); objBaPay.pType = reader.GetInt32(4); objBaPay.PayType = reader.GetInt32(5); objBaPay.payCent = reader.GetDecimal(6); objBaPay.payonLuone = reader.GetDecimal(7); objBaPay.payonLutwo = reader.GetDecimal(8); objBaPay.payonLuthr = reader.GetDecimal(9); objBaPay.p_pk = reader.GetDecimal(10); objBaPay.p_dx_pk = reader.GetDecimal(11); objBaPay.p_pn = reader.GetInt32(12); if (reader.IsDBNull(13)) { objBaPay.p_result_one = null; } else { objBaPay.p_result_one = reader.GetInt32(13); } if (reader.IsDBNull(14)) { objBaPay.p_result_two = null; } else { objBaPay.p_result_two = reader.GetInt32(14); } objBaPay.p_getMoney = reader.GetDecimal(15); objBaPay.paytimes = reader.GetDateTime(16); objBaPay.p_active = reader.GetInt32(17); if (reader.IsDBNull(18)) { objBaPay.p_result_temp1 = null; } else { objBaPay.p_result_temp1 = reader.GetInt32(18); } if (reader.IsDBNull(19)) { objBaPay.p_result_temp2 = null; } else { objBaPay.p_result_temp2 = reader.GetInt32(19); } objBaPay.itypes = reader.GetInt32(20); objBaPay.Types = reader.GetInt32(21); if (reader.IsDBNull(22)) { objBaPay.state = 0; } else { objBaPay.state = reader.GetInt32(22); } listBaPays.Add(objBaPay); } } return(listBaPays); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(TPR3.Model.guess.BaPay model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into tb_ZBaPay("); strSql.Append("payview,payusid,payusname,bcid,pType,PayType,payCent,payonLuone,payonLutwo,payonLuthr,p_pk,p_dx_pk,p_pn,paytimes,p_result_temp1,p_result_temp2,itypes,types,state,p_oncetime2,p_TPRtime)"); strSql.Append(" values ("); strSql.Append("@payview,@payusid,@payusname,@bcid,@pType,@PayType,@payCent,@payonLuone,@payonLutwo,@payonLuthr,@p_pk,@p_dx_pk,@p_pn,@paytimes,@p_result_temp1,@p_result_temp2,@itypes,@types,@state,@p_oncetime2,@p_TPRtime)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@payview", SqlDbType.NVarChar, 500), new SqlParameter("@payusid", SqlDbType.Int, 4), new SqlParameter("@payusname", SqlDbType.NVarChar, 500), new SqlParameter("@bcid", SqlDbType.Int, 4), new SqlParameter("@pType", SqlDbType.Int, 4), new SqlParameter("@PayType", SqlDbType.Int, 4), new SqlParameter("@payCent", SqlDbType.Money, 8), new SqlParameter("@payonLuone", SqlDbType.Money, 8), new SqlParameter("@payonLutwo", SqlDbType.Money, 8), new SqlParameter("@payonLuthr", SqlDbType.Money, 8), new SqlParameter("@p_pk", SqlDbType.Money, 8), new SqlParameter("@p_dx_pk", SqlDbType.Money, 8), new SqlParameter("@p_pn", SqlDbType.Int, 4), new SqlParameter("@paytimes", SqlDbType.DateTime), new SqlParameter("@p_result_temp1", SqlDbType.Int, 4), new SqlParameter("@p_result_temp2", SqlDbType.Int, 4), new SqlParameter("@itypes", SqlDbType.Int, 4), new SqlParameter("@types", SqlDbType.Int, 4), new SqlParameter("@state", SqlDbType.Int, 4), new SqlParameter("@p_oncetime2", SqlDbType.DateTime), new SqlParameter("@p_TPRtime", SqlDbType.DateTime) }; parameters[0].Value = model.payview; parameters[1].Value = model.payusid; parameters[2].Value = model.payusname; parameters[3].Value = model.bcid; parameters[4].Value = model.pType; parameters[5].Value = model.PayType; parameters[6].Value = model.payCent; parameters[7].Value = model.payonLuone; parameters[8].Value = model.payonLutwo; parameters[9].Value = model.payonLuthr; parameters[10].Value = model.p_pk; parameters[11].Value = model.p_dx_pk; parameters[12].Value = model.p_pn; parameters[13].Value = model.paytimes; parameters[14].Value = model.p_result_temp1; parameters[15].Value = model.p_result_temp2; parameters[16].Value = model.itypes; parameters[17].Value = model.Types; parameters[18].Value = model.state; parameters[19].Value = model.p_oncetime2; parameters[20].Value = model.p_TPRtime; object obj = SqlHelper.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(1); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 取得详细排行榜记录 /// </summary> /// <param name="p_pageIndex">当前页</param> /// <param name="p_pageSize">分页大小</param> /// <param name="p_recordCount">返回总记录数</param> /// <returns>IList BaPayTop</returns> public IList <TPR3.Model.guess.BaPay> GetBaPayTop2(int p_pageIndex, int p_pageSize, string strWhere, int itype, out int p_recordCount) { IList <TPR3.Model.guess.BaPay> listBaPayTop = new List <TPR3.Model.guess.BaPay>(); if (strWhere != "") { strWhere = strWhere + " and itypes=0 and Types=0"; } else { strWhere = "itypes=0 and Types=0"; } // 计算记录数 string countString = "SELECT COUNT(DISTINCT payusid) FROM tb_ZBaPay where " + strWhere + ""; p_recordCount = Convert.ToInt32(SqlHelper.GetSingle(countString)); if (p_recordCount > 0) { //if (p_recordCount > 100) // p_recordCount = 100; int pageCount = BasePage.CalcPageCount(p_recordCount, p_pageSize, ref p_pageIndex); } else { return(listBaPayTop); } // 取出相关记录 string queryString = ""; if (itype != 1) { queryString = "SELECT payusid,count(payusid) as payCount,sum(payCent) as payCents FROM tb_ZBaPay where " + strWhere + " group by payusid Order by Count(ID) desc"; } else { queryString = "SELECT payusid,sum(p_getMoney-payCent) as payCents FROM tb_ZBaPay where " + strWhere + " group by payusid Order by sum(p_getMoney-payCent) desc"; } using (SqlDataReader reader = SqlHelper.ExecuteReader(queryString)) { int stratIndex = (p_pageIndex - 1) * p_pageSize; int endIndex = p_pageIndex * p_pageSize; int k = 0; while (reader.Read()) { if (k >= stratIndex && k < endIndex) { TPR3.Model.guess.BaPay objBaPay = new TPR3.Model.guess.BaPay(); objBaPay.payusid = reader.GetInt32(0); if (itype != 1) { objBaPay.payCount = Convert.ToDecimal(reader.GetInt32(1)); } else { objBaPay.payCount = reader.GetDecimal(1); } listBaPayTop.Add(objBaPay); } if (k == endIndex) { break; } k++; } } return(listBaPayTop); }