Пример #1
0
        /// <summary>
        /// 把教室的座位定义好
        /// </summary>
        /// <param name="_roomConfig"></param>
        /// <param name="_widthOfRoom">整个教室的宽度</param>
        /// <param name="_groupTop">离讲台最近的行与讲台之间的距离</param>
        /// <param name="_groupGap">group之间的距离</param>
        /// <param name="_firstGroupLeft">离教室左边的距离</param>
        private void InitialClassRoom(ClassRoomConfig _roomConfig, int _widthOfRoom, int _groupTop, int _groupGap, int _firstGroupLeft)
        {
            int heightOfDocumentFile = CHAIR_HEIGHT;

            int countOfGroup = _roomConfig.GroupCount;
            int numberOfUnit = _roomConfig.GetTotalColumn();
            int widthOfUnit  = (_widthOfRoom - (countOfGroup - 1) * _groupGap) / numberOfUnit;

            for (int groupIndex = 0; groupIndex < countOfGroup; groupIndex++)
            {
                int countOfColumnInGroup = _roomConfig.GroupList[groupIndex].ColumnCount;
                int countOfFloorInGroup  = _roomConfig.GroupList[groupIndex].RowCount;

                int currentGroupWidth = countOfColumnInGroup * widthOfUnit;

                Carbinet group = new Carbinet(this.Controls);
                group.Left = _firstGroupLeft;
                group.Top  = _groupTop;
                this.groups.Add(group);
                //初始化每一排的行
                int initialTop = 0;
                for (int iFloorIndex = 1; iFloorIndex <= countOfFloorInGroup; iFloorIndex++, initialTop = initialTop + (int)(1.7 * heightOfDocumentFile))
                {
                    group.AddFloor(this.initialFloor(group, iFloorIndex, currentGroupWidth, heightOfDocumentFile, initialTop));

                    for (int columnIndex = 1; columnIndex <= countOfColumnInGroup; columnIndex++)
                    {
                        string _equipmentID = string.Format("{0},{1},{2}", groupIndex, iFloorIndex, columnIndex);
                        group.AddDocFile(this.initialDocumentFile(_equipmentID, iFloorIndex, widthOfUnit, heightOfDocumentFile, groupIndex, iFloorIndex, columnIndex, df_Click));
                    }
                }
                _firstGroupLeft += currentGroupWidth + _groupGap;
            }
        }
        /// <summary>
        /// 从存储教室配置信息的DataTable中获取配置信息
        /// </summary>
        /// <param name="dt"></param>
        /// <returns></returns>
        public static ClassRoomConfig getClassRoomConfigFromDataTable(DataTable dt)
        {
            ClassRoomConfig roomConfig = new ClassRoomConfig();

            foreach (DataRow dr in dt.Rows)
            {
                int index       = ((int)dr["IGROUP"]);
                int rowCount    = (int)dr["IROW"];
                int columnCount = (int)dr["ICOLUMN"];
                roomConfig.GroupList.Add(new ClassRoomGroup(index, rowCount, columnCount));
            }
            return(roomConfig);
        }
Пример #3
0
        /// <summary>
        /// 重置教室座位
        /// </summary>
        public void resetClassRoomConfig()
        {
            ClassRoomConfig roomConfig = ClassRoomConfig.getClassRoomConfigFromDataTable(MemoryTable.dtRoomConfig);
            //ClassRoomConfig roomConfig = new ClassRoomConfig();
            //roomConfig.GroupList.Add(new ClassRoomGroup(0, 6, 2));
            //roomConfig.GroupList.Add(new ClassRoomGroup(1, 6, 2));
            //roomConfig.GroupList.Add(new ClassRoomGroup(2, 6, 2));
            //roomConfig.GroupList.Add(new ClassRoomGroup(3, 6, 2));
            int blackSpace = 100;

            //this.Controls.Clear();
            //this.Controls.Add(this.pictureBox2);
            //this.Controls.Add(this.pictureBox1);
            //this.Controls.Add(this.metroLabel1);
            foreach (Carbinet c in this.groups)
            {
                c.clearDocFiles();
            }
            this.groups.Clear();

            this.InitialClassRoom(roomConfig, this.Width - blackSpace, 250, 40, blackSpace / 2);
        }