/// <summary> /// 更新一条数据 /// </summary> public void Update(BCW.Model.Game.Stone model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update tb_Stone set "); strSql.Append("Types=@Types,"); strSql.Append("StName=@StName,"); strSql.Append("Expir=@Expir,"); strSql.Append("SmallPay=@SmallPay,"); strSql.Append("BigPay=@BigPay,"); strSql.Append("ShotTypes=@ShotTypes"); strSql.Append(" where ID=@ID "); SqlParameter[] parameters = { new SqlParameter("@ID", SqlDbType.Int, 4), new SqlParameter("@Types", SqlDbType.Int, 4), new SqlParameter("@StName", SqlDbType.NVarChar, 50), new SqlParameter("@Expir", SqlDbType.Int, 4), new SqlParameter("@SmallPay", SqlDbType.Int, 4), new SqlParameter("@BigPay", SqlDbType.Int, 4), new SqlParameter("@ShotTypes", SqlDbType.Int, 4) }; parameters[0].Value = model.ID; parameters[1].Value = model.Types; parameters[2].Value = model.StName; parameters[3].Value = model.Expir; parameters[4].Value = model.SmallPay; parameters[5].Value = model.BigPay; parameters[6].Value = model.ShotTypes; SqlHelper.ExecuteSql(strSql.ToString(), parameters); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(BCW.Model.Game.Stone model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into tb_Stone("); strSql.Append("Types,StName,PayCent,OneUsId,TwoUsId,ThrUsId,Expir,OneShot,TwoShot,ThrShot,PkCount,OneStat,TwoStat,ThrStat,IsStatus,Online,NextShot,SmallPay,BigPay)"); strSql.Append(" values ("); strSql.Append("@Types,@StName,@PayCent,@OneUsId,@TwoUsId,@ThrUsId,@Expir,@OneShot,@TwoShot,@ThrShot,@PkCount,@OneStat,@TwoStat,@ThrStat,@IsStatus,@Online,@NextShot,@SmallPay,@BigPay)"); SqlParameter[] parameters = { new SqlParameter("@Types", SqlDbType.Int, 4), new SqlParameter("@StName", SqlDbType.NVarChar, 50), new SqlParameter("@PayCent", SqlDbType.Int, 4), new SqlParameter("@OneUsId", SqlDbType.Int, 4), new SqlParameter("@TwoUsId", SqlDbType.Int, 4), new SqlParameter("@ThrUsId", SqlDbType.Int, 4), new SqlParameter("@Expir", SqlDbType.Int, 4), new SqlParameter("@OneShot", SqlDbType.Int, 4), new SqlParameter("@TwoShot", SqlDbType.Int, 4), new SqlParameter("@ThrShot", SqlDbType.Int, 4), new SqlParameter("@PkCount", SqlDbType.Int, 4), new SqlParameter("@OneStat", SqlDbType.Int, 4), new SqlParameter("@TwoStat", SqlDbType.Int, 4), new SqlParameter("@ThrStat", SqlDbType.Int, 4), new SqlParameter("@IsStatus", SqlDbType.Int, 4), new SqlParameter("@Online", SqlDbType.Int, 4), new SqlParameter("@NextShot", SqlDbType.Int, 4), new SqlParameter("@SmallPay", SqlDbType.Int, 4), new SqlParameter("@BigPay", SqlDbType.Int, 4) }; parameters[0].Value = model.Types; parameters[1].Value = model.StName; parameters[2].Value = model.PayCent; parameters[3].Value = model.OneUsId; parameters[4].Value = model.TwoUsId; parameters[5].Value = model.ThrUsId; parameters[6].Value = model.Expir; parameters[7].Value = model.OneShot; parameters[8].Value = model.TwoShot; parameters[9].Value = model.ThrShot; parameters[10].Value = model.PkCount; parameters[11].Value = model.OneStat; parameters[12].Value = model.TwoShot; parameters[13].Value = model.ThrShot; parameters[14].Value = model.IsStatus; parameters[15].Value = model.Online; parameters[16].Value = model.NextShot; parameters[17].Value = model.SmallPay; parameters[18].Value = model.BigPay; SqlHelper.ExecuteSql(strSql.ToString(), parameters); }
/// <summary> /// 取得每页记录 /// </summary> /// <param name="p_pageIndex">当前页</param> /// <param name="p_pageSize">分页大小</param> /// <param name="p_recordCount">返回总记录数</param> /// <param name="strWhere">查询条件</param> /// <returns>IList Stone</returns> public IList <BCW.Model.Game.Stone> GetStones(int p_pageIndex, int p_pageSize, string strWhere, out int p_recordCount) { IList <BCW.Model.Game.Stone> listStones = new List <BCW.Model.Game.Stone>(); string sTable = "tb_Stone"; string sPkey = "id"; string sField = "ID,StName,OneUsId,TwoUsId,ThrUsId,OneUsName,TwoUsName,ThrUsName,Online,Lines"; string sCondition = strWhere; string sOrder = "ID Asc"; 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(listStones); } while (reader.Read()) { BCW.Model.Game.Stone objStone = new BCW.Model.Game.Stone(); objStone.ID = reader.GetInt32(0); objStone.StName = reader.GetString(1); objStone.OneUsId = reader.GetInt32(2); objStone.TwoUsId = reader.GetInt32(3); objStone.ThrUsId = reader.GetInt32(4); if (!reader.IsDBNull(5)) { objStone.OneUsName = reader.GetString(5); } if (!reader.IsDBNull(6)) { objStone.TwoUsName = reader.GetString(6); } if (!reader.IsDBNull(7)) { objStone.ThrUsName = reader.GetString(7); } objStone.Online = reader.GetInt32(8); if (!reader.IsDBNull(9)) { objStone.Lines = reader.GetString(9); } listStones.Add(objStone); } } return(listStones); }
/// <summary> /// 出手3 /// </summary> public void UpdateThrShot(BCW.Model.Game.Stone model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update tb_Stone set "); strSql.Append("ThrShot=@ThrShot"); strSql.Append(" where ID=@ID "); SqlParameter[] parameters = { new SqlParameter("@ID", SqlDbType.Int, 4), new SqlParameter("@ThrShot", SqlDbType.Int, 4) }; parameters[0].Value = model.ID; parameters[1].Value = model.ThrShot; SqlHelper.ExecuteSql(strSql.ToString(), parameters); }
/// <summary> /// 混战出手2 /// </summary> public void UpdateTwoShot2(BCW.Model.Game.Stone model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update tb_Stone set "); strSql.Append("TwoUsName=@TwoUsName,"); strSql.Append("TwoUsId=@TwoUsId,"); strSql.Append("TwoShot=@TwoShot"); strSql.Append(" where ID=@ID "); SqlParameter[] parameters = { new SqlParameter("@ID", SqlDbType.Int, 4), new SqlParameter("@TwoUsName", SqlDbType.NVarChar, 50), new SqlParameter("@TwoUsId", SqlDbType.Int, 4), new SqlParameter("@TwoShot", SqlDbType.Int, 4) }; parameters[0].Value = model.ID; parameters[1].Value = model.TwoUsName; parameters[2].Value = model.TwoUsId; parameters[3].Value = model.TwoShot; SqlHelper.ExecuteSql(strSql.ToString(), parameters); }
/// <summary> /// 得到一个对象实体 /// </summary> public BCW.Model.Game.Stone GetStone(int ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 ID,Types,StName,PayCent,OneUsName,OneUsId,TwoUsName,TwoUsId,ThrUsName,ThrUsId,Expir,OneShot,TwoShot,ThrShot,OneTime,TwoTime,ThrTime,PkCount,ShotTypes,OneStat,TwoStat,ThrStat,IsStatus,NextShot,SmallPay,BigPay,Online,Lines from tb_Stone "); strSql.Append(" where ID=@ID "); SqlParameter[] parameters = { new SqlParameter("@ID", SqlDbType.Int, 4) }; parameters[0].Value = ID; BCW.Model.Game.Stone model = new BCW.Model.Game.Stone(); using (SqlDataReader reader = SqlHelper.ExecuteReader(strSql.ToString(), parameters)) { if (reader.HasRows) { reader.Read(); model.ID = reader.GetInt32(0); model.Types = reader.GetInt32(1); model.StName = reader.GetString(2); model.PayCent = reader.GetInt32(3); if (!reader.IsDBNull(4)) { model.OneUsName = reader.GetString(4); } model.OneUsId = reader.GetInt32(5); if (!reader.IsDBNull(6)) { model.TwoUsName = reader.GetString(6); } model.TwoUsId = reader.GetInt32(7); if (!reader.IsDBNull(8)) { model.ThrUsName = reader.GetString(8); } model.ThrUsId = reader.GetInt32(9); model.Expir = reader.GetInt32(10); model.OneShot = reader.GetInt32(11); model.TwoShot = reader.GetInt32(12); model.ThrShot = reader.GetInt32(13); if (!reader.IsDBNull(14)) { model.OneTime = reader.GetDateTime(14); } if (!reader.IsDBNull(15)) { model.TwoTime = reader.GetDateTime(15); } if (!reader.IsDBNull(16)) { model.ThrTime = reader.GetDateTime(16); } if (!reader.IsDBNull(17)) { model.PkCount = reader.GetInt32(17); } model.ShotTypes = reader.GetInt32(18); model.OneStat = reader.GetInt32(19); model.TwoStat = reader.GetInt32(20); model.ThrStat = reader.GetInt32(21); model.IsStatus = reader.GetInt32(22); model.NextShot = reader.GetInt32(23); model.SmallPay = reader.GetInt32(24); model.BigPay = reader.GetInt32(25); model.Online = reader.GetInt32(26); if (!reader.IsDBNull(27)) { model.Lines = reader.GetString(27); } return(model); } else { return(null); } } }
/// <summary> /// 坐下位置3 /// </summary> public void UpdateThr(BCW.Model.Game.Stone model) { dal.UpdateThr(model); }
/// <summary> /// 坐下位置1 /// </summary> public void UpdateOne(BCW.Model.Game.Stone model) { dal.UpdateOne(model); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(BCW.Model.Game.Stone model) { dal.Add(model); }
/// <summary> /// 混战出手2 /// </summary> public void UpdateTwoShot2(BCW.Model.Game.Stone model) { dal.UpdateTwoShot2(model); }