//constructor public RoomInfo(string name, int current, CrowdRate state, int avaliable) { this.name = name; this.currentPeople = current; this.avaliableTime = avaliable; this.state = state; }
public static int UpdateNumOfStu(string classroom_to_update, int num, DateTime update_time) { int time_now = Tools.TimeToClass(update_time); using (DataClasses1DataContext db = new DataClasses1DataContext()) { // db.Log = Console.Out; var query = from c in db.Tables where c.classroom == classroom_to_update select c; var one = query.First(); // if (Tools.GetBit(one.is_free, time_now) == 0) // { // Console.WriteLine("classrooom {0} is in class!", classroom_to_update); // return 1; // } db.Tables.DeleteOnSubmit(one); one.now = num; CrowdRate state = GetRate(num, one.max); one.state = (int)state; one.update_time = update_time; db.Tables.InsertOnSubmit(one); db.SubmitChanges(); } return(0); }
private void Setup(int timeNeed, string[] building, CrowdRate stateRequired, string name) { this.timeNeed = timeNeed; timeSpecified = true; this.building = building; this.roomName = null; state = stateRequired; stateSpecified = true; }
public QueryInfo(TimeSpan start, TimeSpan end, string[] building, CrowdRate state) { int startNo = 0, endNo = BUAA.course.GetLength(0) - 1; //calculate the start and end number of course among the required time span while ((start >= BUAA.course[startNo, 1] || end <= BUAA.course[startNo, 0]) && startNo <= BUAA.course.GetLength(0)) { ++startNo; } while ((start >= BUAA.course[endNo, 1] || end <= BUAA.course[endNo, 0]) && endNo >= 0) { --endNo; } int timeNeed = 0; for (int k = startNo; k <= endNo && k < BUAA.course.GetLength(0); ++k) { timeNeed = timeNeed | (1 << k); } Setup(timeNeed, building, state, null); }
//constructors public QueryInfo(int timeNeed, string[] building, CrowdRate stateRequired) { Setup(timeNeed, building, stateRequired, null); }