太原理工大学学生公寓管理系统(7)

2019-05-18 22:18

7.2 设计状态栏

状态栏的运行效果如图:

图:

第八章.其它各模块的设计

其他各模块的设计下面以宿舍检查窗体和添加宿舍的设计作为示范。

8.1 宿舍检查窗体如下:

31

8.2 宿社检查窗体的部分代码实现

private void btQuery_Click(object sender, System.EventArgs e) { oleConnection1.Open(); ds = new DataSet(); string sql=\dormID as 宿舍号,CDate as 检查日期,CState as 检查情况,CRemark as 备注,CheckID as 检查编号 from checkinfo\ if (textDormID.Text.Trim()==\ sql=sql; else sql=sql+\ OleDbDataAdapter adp = new OleDbDataAdapter(sql,oleConnection1); ds.Clear(); adp.Fill(ds,\ dataGrid1.DataSource = ds.Tables[0].DefaultView; dataGrid1.CaptionText = \共有\条记录\ oleConnection1.Close(); } CheckModify checkModify; private void btAdd_Click(object sender, System.EventArgs e) { if

(dataGrid1.DataSource!=null&&dataGrid1.CurrentRowIndex>=0&&dataGrid1[dataGrid1.CurrentCell]!=null) { checkModify = new CheckModify(); checkModify.textDormID.Text=

ds.Tables[0].Rows[dataGrid1.CurrentCell.RowNumber][0].ToString().Trim(); checkModify.date1.Text=

ds.Tables[0].Rows[dataGrid1.CurrentCell.RowNumber][1].ToString().Trim(); checkModify.comboState.Text=

ds.Tables[0].Rows[dataGrid1.CurrentCell.RowNumber][2].ToString().Trim(); checkModify.textRemark.Text=

ds.Tables[0].Rows[dataGrid1.CurrentCell.RowNumber][3].ToString().Trim();

32

checkModify.Tag=

ds.Tables[0].Rows[dataGrid1.CurrentCell.RowNumber][4].ToString().Trim(); checkModify.ShowDialog(); } } private void btDel_Click(object sender, System.EventArgs e) { if

(dataGrid1.DataSource!=null&&dataGrid1.CurrentRowIndex>=0&&dataGrid1[dataGrid1.CurrentCell]!=null) { oleConnection1.Open(); string sql = \* from checkinfo where CheckID=\ OleDbCommand cmd = new OleDbCommand(sql,oleConnection1); cmd.ExecuteNonQuery();

}

}

MessageBox.Show(\删除成功\提示\oleConnection1.Close();

private void btClose_Click(object sender, System.EventArgs e) { this.Close(); }

8.3 添加宿舍的窗体如下:

33

8.4 宿舍添加的部分代码实现

private void btAdd_Click(object sender, System.EventArgs e) { if (textDormID.Text.Trim()==\ MessageBox.Show(\填写完整信息\提示\ else { oleConnection1.Open(); string sql = \* from dorm where dormID='\ OleDbCommand cmd = new OleDbCommand(sql,oleConnection1); if (null == cmd.ExecuteScalar()) { sql = \into dorm values ('\\ \

34

xtRemark.Text.Trim()+\ cmd.CommandText=sql; cmd.ExecuteNonQuery(); MessageBox.Show(\添加成功\提示\ clear(); } else MessageBox.Show(\宿舍号重复\提示\ oleConnection1.Close(); } } private void btClose_Click(object sender, System.EventArgs e) { this.Close(); } private void clear() { textDormID.Text=\ textPhone.Text=\ textMoney.Text=\ textBed.Text=\ textChair.Text=\ textDesk.Text=\ textRemark.Text=\ }

35


太原理工大学学生公寓管理系统(7).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:107项素质三级定义词典库

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: