⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 index.aspx.cs

📁 XStuMan学生管理系统是面向中小学信息化管理的一套学生管理系统
💻 CS
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Xml;

namespace stuman
{
	/// <summary>
	/// index 的摘要说明。
	/// </summary>
	public class index : System.Web.UI.Page
	{
		protected System.Web.UI.WebControls.Label lblgrade;
		protected System.Web.UI.WebControls.Label lblclass;
		protected System.Web.UI.WebControls.Label lblstu;
		protected System.Web.UI.WebControls.Label lblteach;
		protected System.Web.UI.WebControls.Label lblnow;
		protected System.Web.UI.WebControls.Label lblterm;

		private string datafile_stumain="stumain.xml";
		private string datafile_stusrc="stusrc.xml";
		private string datafile_stusum="stusum.xml";
		private string datafile_class="class.xml";
		private string datafile_teach="teacher.xml";

		private void create_data()
		{
			try
			{
				FileStream xmlfile;
				xmlfile=new FileStream(Server.MapPath(datafile_stumain),FileMode.Open,FileAccess.Read,FileShare.ReadWrite);
				DataSet ds=new DataSet();
				ds.ReadXml(xmlfile,XmlReadMode.ReadSchema);
				xmlfile.Close();
				int count=ds.Tables["Tbstumain"].Rows.Count;
				int gcount=0;
				int cgrade=0;
				for (int i=0;i<count;i++)
				{
					if (Convert.ToDateTime(ds.Tables["Tbstumain"].Rows[i]["schooldate"]).Year!=cgrade)
					{
						cgrade=Convert.ToDateTime(ds.Tables["Tbstumain"].Rows[i]["schooldate"]).Year;
						gcount++;
					}
				}
				int ccount=ds.Tables["Tbstumain"].Rows.Count;
				int stucount=ds.Tables["stu"].Rows.Count;
				this.lblgrade.Text=Convert.ToString(gcount);
				this.lblclass.Text=Convert.ToString(ccount);
				this.lblstu.Text=Convert.ToString(stucount);
				this.lblnow.Text=DateTime.Now.ToString("d");
			}
			catch (Exception ex)
			{
				this.Response.Write(ex.ToString());
			}
		}

		private void create_teach()
		{
			FileStream xmlfile;
			xmlfile=new FileStream(Server.MapPath(datafile_teach),FileMode.Open,FileAccess.Read,FileShare.ReadWrite);
			DataSet ds=new DataSet();
			ds.ReadXml(xmlfile,XmlReadMode.ReadSchema);
			xmlfile.Close();
			int count=ds.Tables["Tbteacher"].Rows.Count;
			this.lblteach.Text=Convert.ToString(count);
		}

		private void getterm()
		{
			DateTime date=DateTime.Now;
			if (date.Month>=9)
			{
				this.lblterm.Text="现在是"+Convert.ToString(date.Year)+"-"+Convert.ToString(date.Year+1)+"学年"+"第一学期";
			}
			else
			{
				if (date.Month<=2)
				{
					this.lblterm.Text="现在是"+Convert.ToString(date.Year-1)+"-"+Convert.ToString(date.Year)+"学年"+"第一学期";
				}
				else
				{
					this.lblterm.Text="现在是"+Convert.ToString(date.Year-1)+"-"+Convert.ToString(date.Year)+"学年"+"第二学期";
				}
			}
		}
					
		private void Page_Load(object sender, System.EventArgs e)
		{
			this.create_data();
			this.getterm();
			this.create_teach();
		}

		#region Web 窗体设计器生成的代码
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{    
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -