public int UpdateLotteryNums(LotteryNumsInfo info) { LotteryNumsInfo lottery = SqlHelper.getInstance.ExcuteForList<LotteryNumsInfo>(string.Format("select * from LotteryNumsInfo where IssueNo='{0}' and LotteryTypeID={1}", info.IssueNo, info.LotteryTypeID)).FirstOrDefault(); if (lottery.LotteryNums == null || lottery.LotteryNums.Trim() == "") { string sql = string.Format("update LotteryNumsInfo set LotteryNums='{0}',UpdateTime='{1}',UpdateUser='******' where IssueNo='{3}' and LotteryTypeID={4}", info.LotteryNums, info.UpdateTime.ToString("yyyy-MM-dd HH:mm:ss"), info.UpdateUser, info.IssueNo, info.LotteryTypeID); return SqlHelper.getInstance.ExcuteNonQuery(sql); } else { return 0; } }
public int InsertLotteryNums(LotteryNumsInfo info) { LotteryNumsInfo lottery = GetCurrenIssuNo(Convert.ToInt32(info.LotteryTypeID)); if (lottery != null && lottery.IssueNo == info.IssueNo && (lottery.LotteryNums == null || lottery.LotteryNums.Trim() == "")) { return 0; } else { string sql = string.Format(@"insert into oddsInfo(PlayTypeID,PlayTypeRadioID,Num,NumOdds,RemainderCount,IssueNo) select PlayTypeID,PlayTypeRadioID,Num,NumOdds, Allcount, '{0}' as IssueNo from defaultoddsinfo where playTypeID in(select distinct PlayTypeID from PlayTypeInfo where LotteryTypeID in (select LotteryTypeID from LotteryTypeInfo where LotteryID={1}))", info.IssueNo, info.LotteryTypeID); if (SqlHelper.getInstance.ExcuteScalar("select IssueNo from oddsInfo where IssueNo='" + info.IssueNo + "'") == null) SqlHelper.getInstance.ExcuteNonQuery(sql); return SqlHelper.getInstance.ExcuteInsert<LotteryNumsInfo>(info, "LotteryNumsInfo", "LotteryNums,UpdateTime,UpdateUser,Size,Parity"); } }