Пример #1
0
        private void ShowPerson()
        {
            DataTable myData = StudentManagement.GetPersonDataTable();

            dataGridView1.DataSource = myData;

            int iNumberofStudents = myData.Rows.Count;

            this.groupBox2.Text = "学生列表 共有学生" + iNumberofStudents.ToString() + "名";

            this.dataGridView1.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
            int headerW  = this.dataGridView1.RowHeadersWidth;
            int columnsW = 0;
            DataGridViewColumnCollection columns = this.dataGridView1.Columns;

            for (int i = 0; i < columns.Count; i++)
            {
                columnsW += columns[i].Width;
            }
            if (columnsW + headerW < this.dataGridView1.Width)
            {
                int leftTotalWidht       = this.dataGridView1.Width - columnsW - headerW;
                int eachColumnAddedWidth = leftTotalWidht / columns.Count;
                for (int i = 0; i < columns.Count; i++)
                {
                    columns[i].Width += eachColumnAddedWidth;
                }
            }

            MiddleWareCore.set_mode(MiddleWareMode.学生卡绑定, this);
        }
Пример #2
0
        private void btnBind_Click(object sender, EventArgs e)
        {
            string id = this.txtId.Text;

            if (id == string.Empty || id.Length <= 0)
            {
                MessageBox.Show("请选择一名学生!");
                return;
            }
            string epc = this.txtEpc.Text;

            if (epc == string.Empty || epc.Length <= 0)
            {
                DialogResult dr = MessageBox.Show("当前学生卡号为空,这将会将删除该学生的学生卡信息,确定吗?", "提示", MessageBoxButtons.YesNo);
                if (dr == DialogResult.Yes)
                {
                    StudentManagement.UnbindPersonEPC(id);
                    this.refreshDBInfo();
                }
            }
            else
            {
                StudentManagement.BindPersonEPC(id, epc);
                this.refreshDBInfo();
            }
        }