/// <summary> /// 随机分配座位的业务流程 /// </summary> /// <param name="roomNum">自习室号码</param> /// <param name="sno">学号</param> /// <param name="seatnum">返回分配的座位号,当success为false时,该值没有意义</param> /// <param name="success">是否成功</param> public void RandomSelectSeat(int roomNum, string sno, DateTime start, int during, out int seatnum, out bool success) { seatnum = -1; //赋默认值,以防特殊情况出现失败。 SqlServerHelper.ExeProc_Select_Seat_Random(roomNum, sno, start, during, out seatnum, out success); }
/// <summary> /// 自定义分配座位的业务流程 /// </summary> /// <param name="roomNum">自习室号码</param> /// <param name="sno">学号</param> /// <param name="seatnum">当前选择的座位号,当success为false时,该值没有意义</param> /// <param name="success">是否成功</param> public void CustomSeatSelected(int roomNum, string sno, DateTime start, int during, ref int seatnum, out bool success) { SqlServerHelper.ExePorc_Select_Seat_Custom(roomNum, sno, start, during, ref seatnum, out success); }
/// <summary> /// 指定时间阈值可用座位数 /// </summary> /// <param name="room">自习室编号</param> /// <param name="time">时间阈值</param> /// <param name="now">当前时间</param> /// <returns>座位数</returns> public int SetRedundancy(int room, int time, DateTime now) { return(SqlServerHelper.ExeProc_GetRedundancyAfter(room, now.AddMinutes(time))); }
internal string FindNo(string str) { string sql = "select no from tb_student where card='" + str + "'"; return((string)SqlServerHelper.ExecuteSclar(sql)); }
/// <summary> /// 返回当前可用座位数。 /// </summary> /// <param name="room">自习室编号</param> /// <returns></returns> public int GetRedundancyCur(int room) { return(SqlServerHelper.ExeProc_GetRedundancyCur(room)); }
/// <summary> /// 设置座位状态轮询的执行函数。每个自习室轮询自己的内容。 /// </summary> /// <param name="roomNum">自习室编号</param> /// <param name="SetColor">设置颜色</param> /// <param name="now">当前时间</param> public void SetIsOutDateOnWeb(int roomNum, DateTime now) { SqlServerHelper.ExeProc_SetOutdate(roomNum, DateTime.Now); }
public void SetRoomSeatsClient(int roomNum, int remainCur, int remain15min) { SqlServerHelper.SetRoomSeats(roomNum, remainCur, remain15min); }
public void BookSeat(string sno, DateTime start, int during, out int seatnum, out bool success) { seatnum = -1; SqlServerHelper.IsBookSeat(roomNum, sno, start, during, out seatnum, out success); }
private void startBook(int room) { string sql = "update tb_seat set available=1 where room=@room;delete from tb_order where room=@room;update tb_room set book=total where no=@room"; SqlServerHelper.ExecuteNonQuery(sql, new SqlParameter[] { new SqlParameter("@room", room) }); }