//todo 废弃 public void AddDocFile(string name, int floor, int width, int height) { DocumentFile df = new DocumentFile(name, floor); df.Width = width; df.Height = height; this.AddDocFile(df); }
//整理所有物资的位置 private void reIndexDocs() { for (int i = 0; i < this.documentList.Count; i++) { DocumentFile df = this.documentList[i]; #if _debug_carbinetfloor Debug.WriteLine( string.Format("before sort -> i = {0} name = {1}" , i.ToString(), df.name)); #endif } this.documentList.Sort(); for (int i = 0; i < this.documentList.Count; i++) { DocumentFile df = this.documentList[i]; #if _debug_carbinetfloor Debug.WriteLine( string.Format("after sort -> i = {0} name = {1}" , i.ToString(), df.name)); #endif } for (int i = 0; i < this.documentList.Count; i++) { DocumentFile df = this.documentList[i]; if (i > 0) { df.Left = this.documentList[i - 1].Left + this.documentList[i - 1].Width + CarbinetFloor.DOCUMENT_GAP; } else { df.Left = this.Left; #if _debug_carbinetfloor Debug.WriteLine( string.Format("CarbinetFloor.reIndexDocs -> i = {0} Left = {1} Top = {2}" , i.ToString(), df.Left, df.Top)); #endif } } return; //for (int i = 0; i < this.documentList.Count; i++) //{ // DocumentFile df = this.documentList[i]; // df.index = 0; // for (int j = 0; j < this.documentList.Count; j++) // { // if (j == i) // { // continue; // } // if ((df > this.documentList[j]) > 0) // { // df.index++; // } // } //} }
public void AddDocFile(DocumentFile Doc) { foreach (CarbinetFloor cf in this.floors) { if (cf.floorNumber == Doc.floorNumber) { cf.AddDoc(Doc); break; } } }
public void RemoveDoc(DocumentFile doc, int i) { #if _debug_carbinetfloor Debug.WriteLine("footprint -> CarbinetFloor.RemoveDoc"); #endif this.controls.Remove(doc.doc); this.documentList.Remove(doc); //this.chairsList.Remove(this.chairsList[i]); #if _debug_carbinetfloor Debug.WriteLine("RemoveDoc <-"); #endif }
DocumentFile initialDocumentFile(string _equipmentID, int _iFloor, int _dfWidth, int _dfHeight, int _carbinetIndex, int _floorNumber, int _columnNumber, EventHandler handler) { DocumentFile df = new DocumentFile(_equipmentID, _iFloor); df.Width = _dfWidth; df.Height = _dfHeight; df.carbinetIndex = _carbinetIndex; df.floorNumber = _floorNumber; df.columnNumber = _columnNumber; df.indexBase = _columnNumber.ToString(); df.Click += handler; return(df); }
//单击座位时的处理 void df_Click(object sender, EventArgs e) { DocumentFile df = (DocumentFile)sender; string studentID = null; DataRow[] rows = this.mapConfigsTable.Select("EQUIPEMNTID = '" + df.name + "'"); if (rows.Length > 0) { studentID = (string)rows[0]["studenID"]; if (studentID == null || studentID.Length <= 0) { return; } frmShowStudentInfo frm = new frmShowStudentInfo(studentID); frm.ShowDialog(); } }
void df_Click(object sender, EventArgs e) { DocumentFile df = (DocumentFile)sender; carbinetIndex = df.carbinetIndex; floorNumber = df.floorNumber; columnNumber = df.columnNumber; if (this.callBackInvoke != null) { this.callBackInvoke.callback(); } //string studentID = null; //studentID = MemoryTable.getPersonIDByPosition(df.carbinetIndex, df.floorNumber, df.columnNumber); //if (studentID == null || studentID.Length <= 0) //{ // return; //} //frmShowStudentInfo frm = new frmShowStudentInfo(studentID); //frm.ShowDialog(); }
// 添加物资时,将物资重新排序 public void AddDoc(DocumentFile Doc) { #if _debug_carbinetfloor Debug.WriteLine("footprint -> CarbinetFloor.AddDoc"); #endif //检查是否档案数量是否已经超出设置的最大数量或者超出了该层的宽度 int totalDocumentWidth = this.getDocumentsTotalWidth(-1) + (this.documentList.Count - 1) * CarbinetFloor.DOCUMENT_GAP; if (totalDocumentWidth > this.width) { return; } if (this.maxDocNumber != -1 && this.documentList.Count >= this.maxDocNumber) { return; } //检查是否已经存在了 bool bExist = false; foreach (DocumentFile df in this.documentList) { if (Doc.name == df.name) { bExist = true; break; } } if (bExist)//存在的将不再重复添加 { return; } //物资添加到每层的列表中 this.documentList.Add(Doc); Doc.Top = this.top + this.height - Doc.Height; //Doc.Top = this.height - Doc.Height; //重新排序物资 this.reIndexDocs(); this.controls.Add(Doc.doc); }
void doc_Click(object sender, EventArgs e) { DocumentFile doc = (DocumentFile)sender; this.docLink = doc; //string[] strA = doc.doc.Text.Split(','); try { this.numLocofGroup.Value = doc.carbinetIndex; this.numLocofRow.Value = doc.floorNumber; this.numLocofColumn.Value = doc.columnNumber; //this.numLocofGroup.Value = decimal.Parse(strA[0]); //this.numLocofRow.Value = decimal.Parse(strA[1]); //this.numLocofColumn.Value = decimal.Parse(strA[2]); this.txtEquipmentID.Text = doc.Text; } catch (System.Exception ex) { } }
void df_Click(object sender, EventArgs e) { DocumentFile df = (DocumentFile)sender; string studentID = null; DataRow[] rows = this.mapConfigsTable.Select("EQUIPEMNTID = '" + df.name + "'"); if (rows.Length > 0) { //rows[0]["sdudentID"] = data.tagID; //if (((string)rows[0]["studentName"]) == null || ((string)rows[0]["studentName"]).Length <= 0) //{ // rows[0]["studentName"] = data.tagID;//todo 这里应该检索学生信息 //} //rows[0]["status"] = "1"; studentID = (string)rows[0]["studenID"]; if (studentID == null || studentID.Length <= 0) { return; } frmShowStudentInfo frm = new frmShowStudentInfo(studentID); frm.ShowDialog(); } }
public void setChairNotEmpty(DocumentFile df) { this.IsEmpty = false; this.docmentFile = df; }
public void setChairEmpty() { this.IsEmpty = true; this.docmentFile = null; }
public DocumentChair(DocumentFile df, CarbinetFloor cf) { this.docmentFile = df; this.carbinetFloor = cf; }
private void InitialClassRoom() { if (this.dtRoomConfig == null) { return; } this.cmbSelectedRow.SelectedIndexChanged -= this.cmbSelectedRow_SelectedIndexChanged; this.numCountofRow.ValueChanged -= this.numCountofRow_ValueChanged; this.numCountofColumn.ValueChanged -= this.numCountofColumn_ValueChanged; this.pictureBox1.Controls.Clear(); //获取设备和位置的对应数据 DataTable dt = this.ctl.getAllMapConfigs(); int numberOfGroup = dtRoomConfig.Rows.Count; int widthOfRoom = this.pictureBox1.Width; int heightOfRow = 38; int totalColumns = numberOfGroup; DataRow[] rows4Sum = dtRoomConfig.Select("IGROUP=1"); if (rows4Sum.Length > 0) { totalColumns = int.Parse(rows4Sum[0]["totalColumn"].ToString()); } int numberOfUnit = totalColumns + numberOfGroup - 1; int widthOfUnit = widthOfRoom / numberOfUnit; int groupInitialLeft = 0; for (int i = 0; i < numberOfGroup; i++) { int numberofColumn = 1; int numberOfRow = 1; DataRow[] rows = dtRoomConfig.Select(string.Format("IGROUP={0}", i + 1)); if (rows.Length > 0) { numberofColumn = int.Parse(rows[0]["ICOLUMN"].ToString()); numberOfRow = int.Parse(rows[0]["IROW"].ToString()); } int groupWidth = numberofColumn * widthOfUnit; Carbinet group = new Carbinet(this.pictureBox1.Controls); group.Left = groupInitialLeft; group.Top = 67; //this.groups.Add(group); //初始化每一排的行 int initialTop = 0; for (int irow = 1; irow <= numberOfRow; irow++, initialTop = initialTop + (int)(1.7 * heightOfRow)) { CarbinetFloor row = new CarbinetFloor(group, irow, this.pictureBox1.Controls); row.Width = groupWidth; row.Height = heightOfRow; row.relativeTop = initialTop; row.relativeLeft = 0; group.AddFloor(row); for (int k = 1; k <= numberofColumn; k++) { string _equipmentID = i.ToString() + "," + irow.ToString() + "," + k.ToString(); DocumentFile df = new DocumentFile(_equipmentID, irow); df.Width = widthOfUnit; df.Height = heightOfRow; DataRow[] rowsMap = dt.Select( string.Format("IGROUP = {0} and IROW = {1} and ICOLUMN = {2}", i.ToString(), irow.ToString(), k.ToString())); if (rowsMap.Length > 0) { df.Text = (string)rowsMap[0]["EQUIPEMNTID"]; } else { df.Text = ""; } df.carbinetIndex = i; df.floorNumber = irow; df.columnNumber = k; df.indexBase = k.ToString(); //df.doc.Click += new EventHandler(doc_Click); df.Click += new EventHandler(doc_Click); group.AddDocFile(df); } } groupInitialLeft += groupWidth + widthOfUnit; } DataRow[] rows2 = dtRoomConfig.Select("IGROUP=1"); if (rows2.Length > 0) { int column = int.Parse(rows2[0]["ICOLUMN"].ToString()); int row = int.Parse(rows2[0]["IROW"].ToString()); this.numCountofColumn.Value = (decimal)column; this.numCountofRow.Value = (decimal)row; } this.cmbSelectedRow.SelectedIndexChanged += new System.EventHandler(this.cmbSelectedRow_SelectedIndexChanged); this.numCountofRow.ValueChanged += new System.EventHandler(this.numCountofRow_ValueChanged); this.numCountofColumn.ValueChanged += new System.EventHandler(this.numCountofColumn_ValueChanged); return; //int numberOfGroup = (int)this.numCountofGroup.Value; //int numberofColumn = (int)this.numCountofColumn.Value; //int numberOfRow = (int)this.numCountofRow.Value; //int numberOfUnit = numberOfGroup * numberofColumn + numberOfGroup - 1; //int widthOfUnit = widthOfRoom / numberOfUnit; //int groupInitialLeft = 0; //int groupWidth = numberofColumn * widthOfUnit; //for (int i = 0; i < numberOfGroup; i++) //{ // Carbinet group = new Carbinet(this.pictureBox1.Controls); // group.Left = groupInitialLeft; // group.Top = 67; // //this.groups.Add(group); // //初始化每一排的行 // int initialTop = 0; // for (int irow = 1; irow <= numberOfRow; irow++, initialTop = initialTop + (int)(1.7 * heightOfRow)) // { // CarbinetFloor row = new CarbinetFloor(group, irow, this.pictureBox1.Controls); // row.Width = groupWidth; // row.Height = heightOfRow; // row.relativeTop = initialTop; // row.relativeLeft = 0; // group.AddFloor(row); // for (int k = 1; k <= numberofColumn; k++) // { // string _equipmentID = i.ToString() + "," + irow.ToString() + "," + k.ToString(); // DocumentFile df = new DocumentFile(_equipmentID, irow); // df.Width = widthOfUnit; // df.Height = heightOfRow; // DataRow[] rows = dt.Select( // string.Format("IGROUP = {0} and IROW = {1} and ICOLUMN = {2}", // i.ToString(), irow.ToString(), k.ToString())); // if (rows.Length > 0) // { // df.Text = (string)rows[0]["EQUIPEMNTID"]; // } // else // { // df.Text = ""; // } // df.carbinetIndex = i; // df.floorNumber = irow; // df.columnNumber = k; // df.indexBase = k.ToString(); // //df.doc.Click += new EventHandler(doc_Click); // df.Click += new EventHandler(doc_Click); // group.AddDocFile(df); // } // } // groupInitialLeft += groupWidth + widthOfUnit; //} }
private void InitialClassRoom() { this.button6.Left = (this.pictureBox1.Width - this.button6.Width) / 2 + this.pictureBox1.Left; int numberOfGroup = dtRoomConfig.Rows.Count; int widthOfRoom = this.pictureBox1.Width; int heightOfRow = 38; int totalColumns = numberOfGroup; DataRow[] rows4Sum = dtRoomConfig.Select("IGROUP=1"); if (rows4Sum.Length > 0) { totalColumns = int.Parse(rows4Sum[0]["totalColumn"].ToString()); } int numberOfUnit = totalColumns + numberOfGroup - 1; int widthOfUnit = widthOfRoom / numberOfUnit; int groupInitialLeft = 0; for (int i = 0; i < numberOfGroup; i++) { int numberofColumn = 1; int numberOfRow = 1; DataRow[] rows = dtRoomConfig.Select(string.Format("IGROUP={0}", i + 1)); if (rows.Length > 0) { numberofColumn = int.Parse(rows[0]["ICOLUMN"].ToString()); numberOfRow = int.Parse(rows[0]["IROW"].ToString()); } int groupWidth = numberofColumn * widthOfUnit; Carbinet group = new Carbinet(this.pictureBox1.Controls); group.Left = groupInitialLeft; group.Top = 67; this.groups.Add(group); //初始化每一排的行 int initialTop = 0; for (int irow = 1; irow <= numberOfRow; irow++, initialTop = initialTop + (int)(1.7 * heightOfRow)) { CarbinetFloor row = new CarbinetFloor(group, irow, this.pictureBox1.Controls); row.Width = groupWidth; row.Height = heightOfRow; row.relativeTop = initialTop; row.relativeLeft = 0; group.AddFloor(row); for (int k = 1; k <= numberofColumn; k++) { // 如果座位与设备已经设置绑定的话,则在此处将座位与设备ID相挂钩 DataRow[] rowsMap = mapConfigsTable.Select( string.Format("IGROUP = {0} and IROW = {1} and ICOLUMN = {2}", i.ToString(), irow.ToString(), k.ToString())); string _equipmentID = i.ToString() + "," + irow.ToString() + "," + k.ToString(); if (rowsMap.Length > 0) { _equipmentID = (string)rowsMap[0]["EQUIPEMNTID"]; } DocumentFile df = new DocumentFile(_equipmentID, irow); df.Width = widthOfUnit; df.Height = heightOfRow; df.carbinetIndex = i; df.floorNumber = irow; df.columnNumber = k; df.indexBase = k.ToString(); df.Click += new EventHandler(df_Click); group.AddDocFile(df); } } groupInitialLeft += groupWidth + widthOfUnit; } }
// 向柜子的指定层添加档案文件 public void AddDocFile(string name, int floor) { DocumentFile df = new DocumentFile(name, floor); this.AddDocFile(df); }