/// <summary> /// add /// </summary> /// <param name="OrderFoods"></param> /// <returns></returns> public int Add(OrderFoods model) { var str = GetInsertStr(model) + " select @@identity"; var dict = GetParameters(model); return(Convert.ToInt32(SqlHelperHere.ExecuteScalar(str, dict))); }
/// <summary> /// 获取已发布的文章数量 /// </summary> /// <returns></returns> public int GetArticleCount() { string str = "select Count(*) from articleInfo where isarticle=1 and status=1 and isdeleted=0 "; var dt = SqlHelperHere.ExecuteScalar(str); return(Convert.ToInt32(dt)); }
/// <summary> /// 根据用户id获取的最新的一个订单 status 1或2 /// </summary> /// <param name="userId"></param> /// <returns></returns> public int GetSendingOrderIdsByUserId(int userId) { string str = "select top 1 id from orderinfo where isdeleted = 0 and status in (1,2) and userid=@userId order by id desc"; var dict = new Dictionary <string, string>(); dict.Add("@userId", userId.ToString()); return(Convert.ToInt32(SqlHelperHere.ExecuteScalar(str, dict))); }
public int[] GetIdsByTs(string ts) { string str = "select top 1 ids from coupon where batch=@ts"; var dict = new Dictionary <string, string>(); dict.Add("@ts", ts); var idsStr = SqlHelperHere.ExecuteScalar(str, dict); var r = idsStr.Split(','); return(Array.ConvertAll(r, int.Parse)); //return r; }
public int GetLastCoupon() { string str = "select top 1 id from coupon order by id desc"; return(Convert.ToInt32(SqlHelperHere.ExecuteScalar(str))); }