Ejemplo n.º 1
0
        public bool RequestClassRoom(int groupId, int groupSize, bool whiteboard, bool monitor, bool projector)
        {
            bool didRequest = false;

            using (var con = new DBCon())
            {
                int whiteboardInt = 0, monitorInt = 0, projectorInt = 0;

                if (whiteboard)
                {
                    whiteboardInt = 1;
                }

                if (monitor)
                {
                    monitorInt = 1;
                }

                if (projector)
                {
                    projectorInt = 1;
                }

                string exString = string.Format("INSERT INTO ClassRoomWaitingList(groupId, size, whiteboard, monitor, projector) VALUES ({0}, {1}, {2}, {3}, {4});", groupId, groupSize, whiteboardInt, monitorInt, projectorInt);
                didRequest = con.ExecuteStringPut(exString);
            }
            return(didRequest);
        }
Ejemplo n.º 2
0
        public bool CreateGroupRoom(string name, bool whiteboard, bool monitor)
        {
            bool didCreate = false;

            using (var con = new DBCon())
            {
                string bitWhiteboard = "0";
                string bitMonitor    = "0";

                if (whiteboard)
                {
                    bitWhiteboard = "1";
                }
                if (monitor)
                {
                    bitMonitor = "1";
                }

                String command = string.Format(
                    "insert into GroupRoom (name, whiteboard, monitor) VALUES ('{0}', {1}, {2});",
                    name, bitWhiteboard, bitMonitor);
                didCreate = con.ExecuteStringPut(command);
            }
            return(didCreate);
        }
Ejemplo n.º 3
0
        public bool CreateGroup(string name, List <int> studentId)
        {
            int  groupId   = 0;
            int  groupSize = studentId.Count();
            bool done      = false;

            using (var con = new DBCon())
            {
                SqlDataReader rs = con.ExecuteStringGet("INSERT INTO [Group] (name, size) OUTPUT Inserted.id VALUES('" + name + "', '" + groupSize + "');");

                while (rs.Read())
                {
                    groupId = (int)rs.GetValue(0);
                    done    = true;
                }
            }
            using (var con = new DBCon())
            {
                foreach (int id in studentId)
                {
                    done = con.ExecuteStringPut("UPDATE Student SET groupId = " + groupId + " WHERE id = " + id + ";");
                }
            }
            return(done);
        }
Ejemplo n.º 4
0
        public bool ClearRents()
        {
            bool didClear = false;

            using (var con = new DBCon())
            {
                string sqlCmd = "DELETE FROM Rent WHERE ClassRoomId is not null";
                didClear = con.ExecuteStringPut(sqlCmd);
            }
            return(didClear);
        }
Ejemplo n.º 5
0
        internal bool UpdateGroupRoom(string name, bool whiteboard, bool monitor)
        {
            bool didUpdate = false;

            using (var con = new DBCon())
            {
                int whiteboardBit = 0;
                int monitorBit    = 0;

                if (whiteboard)
                {
                    whiteboardBit = 1;
                }
                if (monitor)
                {
                    monitorBit = 1;
                }

                string sqlCommand = string.Format("UPDATE GroupRoom SET whiteboard={0}, monitor={1} WHERE name='{2}'", whiteboardBit, monitorBit, name);
                didUpdate = con.ExecuteStringPut(sqlCommand);
            }
            return(didUpdate);
        }