Пример #1
0
        public bool ReadByteR1(byte[] buf,ref int offs)
        {
            if (buf.Length - offs < 4)
            {
                return(true);
            }
            int rId;

            if ((rId = BitConverter.ToInt32(buf,offs)) < 0)
            {
                return(true);
            }
            offs += 4;
            ExamRoom r;

            if (Rooms.TryGetValue(rId,out r))
            {
                if (r.ReadByte1(buf,ref offs))
                {
                    return(true);
                }
            }
            else
            {
                r    = new ExamRoom();
                r.ID = rId;
                if (r.ReadByte1(buf,ref offs))
                {
                    return(true);
                }
                Rooms.Add(rId,r);
            }
            return(false);
        }
Пример #2
0
        public int DBInsRoom_and_Examinee()
        {
            Random        rand = new Random();
            int           v    = 1;
            StringBuilder sb   = new StringBuilder();

            foreach (ExamRoom r in Rooms.Values)
            {
                int  n       = 0;
                bool isExist = DBConnect.IsExist("sqz_slot_room",
                                                 "dt='" + mDt.ToString(DT._) + "' AND t='" + mDt.ToString(DT.hh) +
                                                 "' AND rid=" + r.ID);
                if (!isExist)
                {
                    DBConnect.Ins("sqz_slot_room",
                                  "dt,t,rid,pw,qpkalt", "('" + mDt.ToString(DT._) + "','" + mDt.ToString(DT.hh) +
                                  "'," + r.ID + ",'" + ExamRoom.GeneratePw(rand) + "',0)");
                }
                n = r.SaveExaminees();
                if (n < 0)
                {
                    sb.AppendFormat(Txt.s._[(int)TxI.ROOM_DB_NOK] + '\n', r.ID + 1,
                                    Txt.s._[(int)TxI.NEE_EXIST]);
                    v = 0;
                }
            }
            return(v);
        }
Пример #3
0
        public void DBSelectRoomID()
        {
            List <int> rids = ExamRoom.DBSelectRoomIDs();

            foreach (int i in rids)
            {
                ExamRoom r = new ExamRoom();
                r.ID = i;
                r.DBSelTimeAndPw(mDt);
                if (!Rooms.ContainsKey(i))
                {
                    Rooms.Add(i, r);
                }
            }
        }