/// <summary> /// 添加一个新订单 /// </summary> public object AddOrderInfo(OrderInfo order) { var sql = "insert into OrderInfo(SubTime, Remark, OrderState, DelFlag, SubBy,BeginTime) values(@SubTime, @Remark, @OrderState, @DelFlag, @SubBy,@BeginTime);select last_insert_rowid();"; var ps = new SQLiteParameter[] { new SQLiteParameter("@SubTime", order.SubTime), new SQLiteParameter("@Remark", order.Remark), new SQLiteParameter("@OrderState", order.OrderState), new SQLiteParameter("@DelFlag", order.DelFlag), new SQLiteParameter("@SubBy", order.SubBy), new SQLiteParameter("@BeginTime", order.BeginTime) }; return(SqliteHelper.ExecuteScalar(sql, ps)); }
/// <summary> /// 插入一个订单,返回该订单的id对象 /// </summary> /// <param name="order"></param> /// <returns></returns> public int AddOrderInfo(OrderInfo order) { string sql = "insert into OrderInfo(SubTime,Remark,OrderState,DelFlag,SubBy) values(@SubTime,@Remark,@OrderState,@DelFlag,@SubBy);select last_insert_rowid();"; SQLiteParameter[] param = { new SQLiteParameter("@SubTime", order.SubTime), new SQLiteParameter("@Remark", order.Remark), new SQLiteParameter("@OrderState", order.OrderState), new SQLiteParameter("@DelFlag", order.DelFlag), new SQLiteParameter("@SubBy", order.SubBy), }; return(Convert.ToInt32(SqliteHelper.ExecuteScalar(sql, param))); }
/// <summary> /// 查询一个CatId下产品的数量 /// </summary> /// <param name="id"></param> /// <returns></returns> public object GetProductInfoCountByCatId(int id) { var sql = "select count(*) from ProductInfo where DelFlag=0 and CatId=" + id; return(SqliteHelper.ExecuteScalar(sql)); }
/// <summary> /// 根据餐桌的ID查询该餐桌是不是空闲的 /// </summary> /// <param name="id"></param> /// <returns></returns> public object SerachDeskById(int id) { string sql = "select count(*) from DeskInfo where DelFlag=0 and DeskId=@DeskId and DeskState=0"; return(SqliteHelper.ExecuteScalar(sql, new SQLiteParameter("@DeskId", id))); }
/// <summary> /// 查询该房间下是否有正在使用的餐桌 /// </summary> /// <param name="roomId">房间的Id</param> /// <returns></returns> public object GetDeskInfoStateByRoomId(int roomId) { string sql = "select count(*) from DeskInfo where DelFlag=0 and deskState=1 and RoomId=@RoomId"; return(SqliteHelper.ExecuteScalar(sql, new SQLiteParameter("@RoomId", roomId))); }
/// <summary> /// 通过会员级别查询级别名称 /// </summary> /// <param name="type"></param> /// <returns></returns> public object GetMemberTypeByType(int type) { var sql = "select MemTpName from MemmberType where MemType=" + type; return(SqliteHelper.ExecuteScalar(sql)); }
/// <summary> /// 通过OrderId查询订单金额 /// </summary> /// <param name="orderId"></param> /// <returns></returns> public object GetMoneyByOrderId(int orderId) { var sql = "select OrderMoney from OrderInfo where DelFlag=0 and OrderId=" + orderId; return(SqliteHelper.ExecuteScalar(sql)); }
/// <summary> /// 根据餐桌的id查询正在使用的订单的id /// </summary> /// <param name="deskId"></param> /// <returns></returns> public int GetOrderIdByDeskId(int deskId) { string sql = "select OrderInfo.OrderId from R_Order_Desk inner join OrderInfo on OrderInfo.OrderId=R_Order_Desk.OrderId where OrderState=1 and DeskId=@DeskId"; return(Convert.ToInt32(SqliteHelper.ExecuteScalar(sql, new SQLiteParameter("@DeskId", deskId)))); }