private void InsertCoursesSimpleMap(List <string> strDistinctTeacherID) { for (int i = 0; i < strDistinctTeacherID.Count; i++) { List <string> strDD = new List <string>(); strDD = AddSQLStringToDAL.GetDistinctStrings("TabAllCourses", "TimeAndArea", "TeacherID", strDistinctTeacherID[i].ToString());//获取TimeAndArea for (int k = 0; k < strDD.Count; k++) { List <string> strResult = new List <string>(); strResult = SplitString.GetSplitCountAndDetails(strDD[k]); DataTable dt = AddSQLStringToDAL.GetDataTableBysql("select * from TabAllCourses where TeacherID = '" + strDistinctTeacherID[i].ToString() + "' and TimeAndArea = '" + strDD[k].ToString() + "'"); for (int j = 0; j < (strResult.Count / 4); j++) { string WeekRange = SplitString.GetWithoutWeek(strResult[j * 4 + 0].ToString());//如果想用空格隔开,只是在最后加一个空格(以,作为例子试的) string Week = strResult[j * 4 + 1].ToString(); string Time = strResult[j * 4 + 2].ToString(); string Area = strResult[j * 4 + 3].ToString(); string Course = dt.Rows[0]["Course"].ToString().Trim(); if (AddSQLStringToDAL.InsertTabTeachers("TabTeacherCourseSimpleMap", strDistinctTeacherID[i].ToString(), dt.Rows[0]["TeacherName"].ToString(), Course, WeekRange, Week, Time, strDD[k].ToString(), dt.Rows[0]["Class"].ToString(), dt.Rows.Count.ToString(), dt.Rows[0]["TeacherDepartment"].ToString(), dt.Rows[0]["StudentDepartment"].ToString(), Area)) { } } dt.Clear(); } } }
public void CurrentWeek() { Session["CurrentWeek"] = "0"; try { DataTable dt = AddSQLStringToDAL.GetDataTableBysql("select * from [校历] "); for (int i = 0; i < dt.Rows.Count; i++) { if (Convert.ToDateTime(dt.Rows[i]["StartWeek"]) < DateTime.Now && Convert.ToDateTime(dt.Rows[i]["EndWeek"]) > DateTime.Now) { string strWeekNumber = dt.Rows[i]["WeekNumber"].ToString(); if (strWeekNumber.Length == 1) { strWeekNumber = "0" + strWeekNumber; } Session["CurrentWeek"] = strWeekNumber; break; } else { Session["CurrentWeek"] = "0";//不满足所有周次 } } } catch { Session["CurrentWeek"] = "0"; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["CurrentWeek"].ToString() != "") { btnClose.Visible = true; Label1.Visible = false; } else { Response.Redirect("~\\登录.aspx"); } string LastWeek = (Convert.ToInt32(Session["CurrentWeek"].ToString()) - 1).ToString(); DataTable dt = AddSQLStringToDAL.GetDataTableBysql("select * from [TabTeacherAttendance] where TeacherID = '" + Session["UserID"].ToString() + "' and CurrentWeek = '" + LastWeek + "' and Course = '" + Session["CurrentCourse"].ToString() + "' and Week = '" + Session["Week"].ToString() + "' and Time = '" + Session["Time"].ToString() + "' and Count = '已布置作业'"); if (dt.Rows.Count == 0) { lblResultMessage.Text = "您已经批改本次作业!"; lblHomeWorkMessage.Visible = false; gvHomeworkDetails.Visible = false; btnAttdance.Visible = false; } else { string strCourse = Session["CurrentCourse"].ToString(); lblMessage.Text = Session["Week"].ToString() + Session["Time"].ToString() + "|" + strCourse.Substring(8, strCourse.Length - 11) + "|" + this.gvHomeworkDetails.Rows.Count.ToString() + "人"; c = this.gvHomeworkDetails.BackColor; } } }
private DataTable GetHomeworkDt(string Week, string Department) { DataTable dt; dt = AddSQLStringToDAL.GetDataTableBysql("SELECT [TeacherID] as '教师工号',[TeacherName] as '教师姓名',[Course] as '课程名称',[CurrentWeek] as '周次',[Week] as '星期',[Time] as '节次',[StudentDepartment] as '学生系部',[StudentClass] as '课程信息',[StudentID] as '学生学号',[StudentName] as '学生姓名',[HomeworkType] as '异常类型' FROM [TabStudentHomework] where StudentDepartment = '" + Department + "' and CONVERT(int,CurrentWeek) <= '" + Week + "'"); return(dt); }
private void GetTeacherCourseSimpleMap() { DataTable dt = AddSQLStringToDAL.GetDataTableBysql("select * from TabTeacherCourseSimpleMap"); foreach (DataRow dr in dt.Rows) { string[] strT = dr["WeekRange"].ToString().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < strT.Length; i++) { string WeekNumber = ""; string TeacherDepartment = dr["TeacherDepartment"].ToString(); string TeacherID = dr["TeacherID"].ToString(); string TeacherName = dr["TeacherName"].ToString(); string Week = dr["Week"].ToString(); switch (Week) { case "星期一": WeekNumber = "1"; break; case "星期二": WeekNumber = "2"; break; case "星期三": WeekNumber = "3"; break; case "星期四": WeekNumber = "4"; break; case "星期五": WeekNumber = "5"; break; case "星期六": WeekNumber = "6"; break; default: WeekNumber = "7"; break; } string Time = dr["Time"].ToString(); string Course = dr["Course"].ToString(); string Area = dr["Area"].ToString(); if (strT[i].Length == 1) { strT[i] = "0" + strT[i]; } if (AddSQLStringToDAL.InsertTabTeachers("TabTeacherAttendance", WeekNumber, TeacherDepartment, TeacherID, TeacherName, strT[i].ToString(), Week, Time, Course, Area, "未考勤", "", dr["WithoutWeek"].ToString(), "", "")) { } } lblMessage7.Text = "数据处理完毕!"; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["Role"].ToString() != "院系领导") { Response.Redirect("~\\登录.aspx"); } else { Label1.Visible = false; //多出来的没用 //填充DDL DataTable DTWeek = AddSQLStringToDAL.GetDataTableBysql("select distinct CurrentWeek from TabTeacherAttendance where [IsAttendance] = '未考勤' and CONVERT(int,CurrentWeek) < '" + Session["CurrentWeek"].ToString() + "' order by CurrentWeek"); //查找小于本周的周次并排序 ddlWeek.Items.Add(Session["CurrentWeek"].ToString()); for (int i = 0; i < DTWeek.Rows.Count; i++) { ddlWeek.Items.Add(DTWeek.Rows[i]["CurrentWeek"].ToString()); } DataTable DTDepartment = AddSQLStringToDAL.GetDataTableBysql("select distinct TeacherDepartment from TabTeacherAttendance"); ddlDepartment.Items.Add("所有系部"); for (int i = 0; i < DTDepartment.Rows.Count; i++) { ddlDepartment.Items.Add(DTDepartment.Rows[i]["TeacherDepartment"].ToString()); } Clear(); DataTable dt1 = GetStudentDt(Session["CurrentWeek"].ToString(), "所有系部"); if (dt1.Rows.Count == 0) { lblStudent.Visible = true; } else { btnStudent.Visible = true; gvStudent.Visible = true; gvStudent.DataSource = dt1; gvStudent.DataBind(); } DataTable dt2 = GetStudentDt(Session["CurrentWeek"].ToString(), "所有系部"); if (dt2.Rows.Count == 0) { lblHomework.Visible = true; } else { btnHomework.Visible = true; gvHomework.Visible = true; gvHomework.DataSource = dt2; gvHomework.DataBind(); } } } }
protected void Button2_Click(object sender, EventArgs e)//分析入库信息,给密码加密 { DataTable dt = AddSQLStringToDAL.GetDataTableBysql("select * from TabAllTeachers"); if (dt.Rows.Count > 0) { if (dt.Rows[0]["UserID"].ToString() == dt.Rows[0]["UserPWD"].ToString()) { InitialPWD(); } } InsertTeacherStatus(); }
private void Bind() { DataTable dt = AddSQLStringToDAL.GetDataTableBysql("select * from TabMessage where UserID = '" + Session["UserID"].ToString() + "' and MessageStatus = 'false'"); if (dt.Rows.Count == 0) { } else { rptMessage.DataSource = dt; rptMessage.DataBind(); } }
protected void Button2_Click(object sender, EventArgs e)//分析入库信息,给密码加密 { DataTable dt = AddSQLStringToDAL.GetDataTableBysql("select * from TabTeachers where UserID = UserPWD"); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { string pwd = dt.Rows[i]["UserPWD"].ToString(); AddSQLStringToDAL.Update("update TabTeachers set UserPWD = '" + FormsAuthentication.HashPasswordForStoringInConfigFile(pwd, "MD5").ToString() + "'where UserPWD = '" + pwd + "'"); } } }
private DataTable GetTeacherDt(string Week, string Department) { DataTable dt; if (Department == "所有系部") { dt = AddSQLStringToDAL.GetDataTableBysql("SELECT [TeacherDepartment] as '所属部门',[TeacherID] as '教师工号',[TeacherName] as '教师姓名',[CurrentWeek] as '周次',[Week] as '星期',[Time] as '节次' ,[Course] as '课程名称' ,[Area] as '上课地点' ,[IsAttendance] as '考勤情况',[Count] as '作业情况',[StudentIDList] as '课程信息' FROM [TabTeacherAttendance]where [IsAttendance] = '未考勤' and CONVERT(int,CurrentWeek) <= '" + Week + "'"); } else { dt = AddSQLStringToDAL.GetDataTableBysql("SELECT [TeacherDepartment] as '所属部门',[TeacherID] as '教师工号',[TeacherName] as '教师姓名',[CurrentWeek] as '周次',[Week] as '星期',[Time] as '节次' ,[Course] as '课程名称' ,[Area] as '上课地点' ,[IsAttendance] as '考勤情况',[Count] as '作业情况',[StudentIDList] as '课程信息' FROM [TabTeacherAttendance] where [IsAttendance] = '未考勤' and [TeacherDepartment] = '" + Department + "' and CONVERT(int,CurrentWeek) <= '" + Week + "'"); } return(dt); }
private DataTable GetStudentDt(string Week, string Department) { DataTable dt; if (Department == "所有系部") { dt = AddSQLStringToDAL.GetDataTableBysql("SELECT [TeacherID] as '教师工号',[TeacherName] as '教师姓名',[Course] as '课程名称',[CurrentWeek] as '周次',[Week] as '星期',[Time] as '节次',[StudentDepartment] as '学生系部',[StudentClass] as '课程信息',[StudentID] as '学生学号',[StudentName] as '学生姓名',[AttendanceType] as '异常类型' FROM [TabStudentAttendance] where CONVERT(int,CurrentWeek) <= '" + Week + "'"); } else { dt = AddSQLStringToDAL.GetDataTableBysql("SELECT [TeacherID] as '教师工号',[TeacherName] as '教师姓名',[Course] as '课程名称',[CurrentWeek] as '周次',[Week] as '星期',[Time] as '节次',[StudentDepartment] as '学生系部',[StudentClass] as '课程信息',[StudentID] as '学生学号',[StudentName] as '学生姓名',[AttendanceType] as '异常类型' FROM [TabStudentAttendance] where StudentDepartment = '" + Department + "' and CONVERT(int,CurrentWeek) <= '" + Week + "'"); } return(dt); }
private bool CheckIsRecord() { string strSQL = "select * from [TabTeacherAttendance] where TeacherID = '" + Session["UserID"].ToString() + "' and CurrentWeek = '" + Session["CurrentWeek"].ToString() + "' and Course = '" + Session["CurrentCourse"].ToString() + "' and Week = '" + Session["Week"].ToString() + "' and Time = '" + Session["Time"].ToString() + "'"; DataTable dt = AddSQLStringToDAL.GetDataTableBysql(strSQL); if (dt.Rows[0]["IsAttendance"].ToString().Trim() == "未考勤") { return(false); } else { return(true); } }
protected void Bind() //查询 { if (ddlLimit.SelectedItem.ToString() == "所有记录") { DataTable dt = AddSQLStringToDAL.GetDataTableBysql("select * from TabTeachers"); BindToGridView(dt); } else if (ddlLimit.SelectedItem.ToString() != "所有记录") //按条件查询 { Label3.Visible = true; DataTable dt; string str = ""; if (ddlLimit.SelectedItem.ToString() == "按权限查询") { ddlRole.Visible = true; str = "Role"; dt = AddSQLStringToDAL.GetDataTableBysql("TabTeachers", str, Convert.ToInt32(ddlRole.SelectedItem.ToString())); } else if (ddlLimit.SelectedItem.ToString() == "按部门查询") { ddlDepartment.Visible = true; str = "Department"; dt = AddSQLStringToDAL.GetDataTableBysql("TabTeachers", str, ddlDepartment.SelectedItem.ToString().Trim()); } else if (ddlLimit.SelectedItem.ToString() == "按教师工号查询") { txtLimit.Visible = true; str = "UserID"; dt = AddSQLStringToDAL.GetDataTableBysql("TabTeachers", str, txtLimit.Text.ToString().Trim()); } else //按教师姓名查询 { txtLimit.Visible = true; str = "UserName"; dt = AddSQLStringToDAL.GetDataTableBysql("select * from TabTeachers where " + str + " like '%" + txtLimit.Text.ToString().Trim() + "%'"); } if (dt.Rows.Count == 0) { lblMessage.Visible = true; lblMessage.Text = "暂无查询结果!"; } else { BindToGridView(dt); gvTeachers.Visible = true; lblMessage.Visible = false; } } }
private void Bind() { DataTable dt = AddSQLStringToDAL.GetDataTableBysql("select * from TabTeacherAttendance where TeacherID = '" + Session["UserID"].ToString() + "' and CurrentWeek = '" + Session["CurrentWeek"].ToString() + "'"); if (dt.Rows.Count == 0) { lblTeacherName.Text = Session["UserName"].ToString() + "您好"; lblTest.Text = "您本周无授课安排!"; } else { rptCourse.DataSource = dt; rptCourse.DataBind(); } int ICurrentWeek = Convert.ToInt32(Session["CurrentWeek"].ToString()); int ILastWeek = 0; string SLastWeek = ""; if (ICurrentWeek > 1) { ILastWeek = ICurrentWeek - 1; if (ILastWeek <= 9) { SLastWeek = "0" + ILastWeek.ToString(); } else { SLastWeek = ILastWeek.ToString(); } } if (SLastWeek != "") { Session["HomeWorkWeek"] = SLastWeek; DataTable dt2 = AddSQLStringToDAL.GetDataTableBysql("select * from TabTeacherAttendance where TeacherID = '" + Session["UserID"].ToString() + "' and CurrentWeek = '" + SLastWeek + "' and Count = '已布置作业'"); if (dt2.Rows.Count == 0) { lblTeacherName.Text = Session["UserName"].ToString() + "您好!"; lblTest.Text = "上周作业没有未批改情况!"; } else { rptHomework.DataSource = dt2; rptHomework.DataBind(); } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["Role"].ToString() != "系统管理员") { Response.Redirect("~\\登录.aspx"); } else { DataTable dt = AddSQLStringToDAL.GetDataTableBysql("select * from TabTeachers"); Label3.Visible = false; txtLimit.Visible = false; ddlDepartment.Visible = false; ddlRole.Visible = false; lblMessage.Visible = false; } }
private void GetDataTable() { string queryDepartment = Server.UrlDecode(Request.QueryString["queryDepartment"]).ToString(); //获取系部 string queryWeek = Request.QueryString["queryWeek"].ToString(); //获取周次 DataTable dt = AddSQLStringToDAL.GetDataTableBysql("TabStudentAttendance", "StudentDepartment", queryDepartment, "CurrentWeek", queryWeek); //获取缺勤学生信息 dt.Columns.Add(new DataColumn("SumAttendance", typeof(int))); //添加一行 for (int i = 0; i < dt.Rows.Count; i++) //填充dt { int zz = dt.Rows[i]["Course"].ToString().Length; dt.Rows[i]["Course"] = dt.Rows[i]["Course"].ToString().Substring(8, zz - 11); int zzCount = AddSQLStringToDAL.GetRecordCount("TabStudentAttendance", "StudentID", dt.Rows[i]["StudentID"].ToString()); dt.Rows[i]["SumAttendance"] = zzCount; } gvStudentAttendance.DataSource = dt; gvStudentAttendance.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //绑定ddl DataTable DTWeek = AddSQLStringToDAL.GetDataTableBysql("select distinct CurrentWeek from TabTeacherAttendance where [IsAttendance] = '未考勤' and CONVERT(int,CurrentWeek) < '" + Session["CurrentWeek"].ToString() + "' order by CurrentWeek");//查找小于本周的周次并排序 DDL1.Items.Add(Session["CurrentWeek"].ToString()); for (int i = 0; i < DTWeek.Rows.Count; i++) { DDL1.Items.Add(DTWeek.Rows[i]["CurrentWeek"].ToString()); } lblMessage.Visible = false; GetDataAndCreateChartBySun(Session["CurrentWeek"].ToString());//一开始要查询01-当前周次的数据 } if (Session["Role"].ToString() == "") { Response.Redirect("~\\登录.aspx"); } }
private DataTable GetTeacherDt() { DataTable dt = AddSQLStringToDAL.GetDataTableBysql("select * from TabTeacherAttendance where [IsAttendance] = '未考勤'"); return(dt); }
protected void btnlogin_Click(object sender, EventArgs e) { //防止SQL注入式攻击 if (txtUserID.Text.ToString().ToLower().IndexOf("delete") != -1 || txtUserID.Text.ToString().ToLower().IndexOf(";") != -1 || txtUserID.Text.ToString().ToLower().IndexOf("select") != -1 || txtUserID.Text.ToString().ToLower().IndexOf("insert") != -1 || txtUserID.Text.ToString().ToLower().IndexOf("update") != -1 || txtUserPWD.Text.ToString().ToLower().IndexOf("select") != -1 || txtUserPWD.Text.ToString().ToLower().IndexOf(";") != -1 || txtUserPWD.Text.ToString().ToLower().IndexOf("delete") != -1 || txtUserPWD.Text.ToString().ToLower().IndexOf("insert") != -1 || txtUserPWD.Text.ToString().ToLower().IndexOf("update") != -1) { lblMessage.Visible = true; lblMessage.Text = "(含有关键词)请正确输入账号或密码!"; } else { if (txtUserID.Text == "")//没有输入账户 { lblMessage.Visible = true; lblMessage.Text = "账户为空!"; } else//账号不为空 { if (txtUserPWD.Text == "")//没有输入密码 { lblMessage.Visible = true; lblMessage.Text = "密码为空!"; } else//输入了密码 { if (txtCode.Visible == false)//还没显示出来验证码 { //labCode.Visible = true; //txtCode.Visible = true; //imgCode.Visible = true; } else//显示出来了验证码 { if (txtCode.Text == "")//验证码为空 { lblMessage.Visible = true; lblMessage.Text = "验证码为空!"; } else//验证码不为空 { if (txtCode.Text.ToUpper() != Session["Code"].ToString().ToUpper())//验证码输入错误,并且忽略大小写 { lblMessage.Visible = true; lblMessage.Text = "验证码错误!请重新输入!"; txtCode.Text = ""; } else//验证码输入正确 { DataTable dt = AddSQLStringToDAL.GetDataTableBysql("select * from TabTeachers where UserID = '" + txtUserID.Text + "'"); if (dt.Rows.Count == 1)//账户存在 { if (dt.Rows[0]["Time"] == DBNull.Value || dt.Rows[0]["Count"] == DBNull.Value) { dt.Rows[0]["Time"] = "1997-04-12 00:00:00"; dt.Rows[0]["Count"] = 5; } DateTime LastTime = Convert.ToDateTime(dt.Rows[0]["Time"]); DateTime CurrentTime = Convert.ToDateTime(System.DateTime.Now.ToString()); TimeSpan ShiJian = CurrentTime - LastTime; if (Convert.ToInt32(ShiJian.TotalMinutes) > 15) //大于15分钟 { AddSQLStringToDAL.Update("update TabTeachers set Count = 5 where UserID = '" + txtUserID.Text + "'"); //次数还原为5 if (FormsAuthentication.HashPasswordForStoringInConfigFile(txtUserPWD.Text, "MD5").ToString() == dt.Rows[0]["UserPWD"].ToString()) //密码正确 { AddSQLStringToDAL.Update("update TabTeachers set Count = 5,Time = '" + CurrentTime.ToString("yyyy-MM-dd HH:mm:ss") + "' where UserID = '" + txtUserID.Text + "'"); CurrentWeek(); lblMessage.Visible = true; lblMessage.Text = "登陆成功!"; Loginaspx(dt); } else//密码错误 { AddSQLStringToDAL.Update("update TabTeachers set Count = 4,Time = '" + CurrentTime.ToString("yyyy-MM-dd HH:mm:ss") + "' where UserID = '" + txtUserID.Text + "'"); lblMessage.Visible = true; txtCode.Text = ""; txtUserPWD.Text = ""; lblMessage.Text = "密码错误!您还剩4次尝试机会"; } } else//小于等于15分钟 { if (Convert.ToInt32(dt.Rows[0]["Count"]) > 1)//次数大于0 { if (dt.Rows[0]["UserPWD"].ToString() == FormsAuthentication.HashPasswordForStoringInConfigFile(txtUserPWD.Text, "MD5").ToString()) //密码正确 { AddSQLStringToDAL.Update("update TabTeachers set Count = 5,Time = '" + CurrentTime.ToString("yyyy-MM-dd HH:mm:ss") + "' where UserID = '" + txtUserID.Text + "'"); //次数还原为5,时间改为这次的 CurrentWeek(); lblMessage.Visible = true; lblMessage.Text = "登陆成功!"; Loginaspx(dt); } else//密码不正确 { AddSQLStringToDAL.Update("update Tabteachers set Count = '" + (Convert.ToInt32(dt.Rows[0]["Count"]) - 1).ToString() + "',Time = '" + CurrentTime.ToString("yyyy-MM-dd HH:mm:ss") + "' where UserID = '" + txtUserID.Text + "'");//次数-1,时间改为这次的 lblMessage.Visible = true; txtUserPWD.Text = ""; txtCode.Text = ""; lblMessage.Text = "密码错误!您还有" + (Convert.ToInt32(dt.Rows[0]["Count"]) - 1).ToString() + "次尝试机会"; } } else//次数小于等于0 { lblMessage.Visible = true; lblMessage.Text = "请" + (15 - Convert.ToInt32(ShiJian.TotalMinutes)) + "分钟后重试"; } } } else//账户不存在 { lblMessage.Visible = true; lblMessage.Text = "账户不存在!"; txtCode.Text = ""; txtUserID.Text = ""; txtUserPWD.Text = ""; } } } } } } } }
private void GetDataAndCreateChartBySun(string Week) { if (Week == "0")//没有校历的情况 { } else { DataTable dtCount = AddSQLStringToDAL.GetDataTableBysql("select * from TabDepartmentSum"); string[] AllCount = new string[dtCount.Rows.Count]; for (int i = 0; i < dtCount.Rows.Count; i++) { AllCount[i] = dtCount.Rows[i]["Sum"].ToString(); } string[] AllDepartment = { "会计系", "信息工程系", "经济管理系", "商务外语系", "食品工程系", "机械工程系", "建筑工程系" }; string[] AllData = new string[AllDepartment.Length]; string[] AllLate = new string[AllDepartment.Length]; string[] AllAttendance = new string[AllDepartment.Length]; string[] AllEarly = new string[AllDepartment.Length]; string[] AllLeave = new string[AllDepartment.Length]; for (int i = 0; i < AllDepartment.Length; i++) { DataTable dt = InitialDataTable(AllDepartment[i], Week); AllData[i] = dt.Rows[dt.Rows.Count - 1]["合计"].ToString(); //最后一行 AllLeave[i] = dt.Rows[dt.Rows.Count - 1]["请假人数"].ToString(); AllAttendance[i] = dt.Rows[dt.Rows.Count - 1]["旷课人数"].ToString(); AllEarly[i] = dt.Rows[dt.Rows.Count - 1]["早退人数"].ToString(); AllLate[i] = dt.Rows[dt.Rows.Count - 1]["迟到人数"].ToString(); } DataTable dt111 = DataAnalysis.CreateDataTableReplaceChart(AllDepartment, AllCount, AllAttendance, AllLate, AllEarly, AllLeave, AllData); string[] AllDataRate = new string[AllDepartment.Length]; string[] AllAttendanceRate = new string[AllDepartment.Length]; string[] AllLeaveRate = new string[AllDepartment.Length]; string[] AllLateRate = new string[AllDepartment.Length]; string[] AllEarlyRate = new string[AllDepartment.Length]; for (int i = 0; i < dt111.Rows.Count; i++) { AllDataRate[i] = dt111.Rows[i]["总缺勤率"].ToString(); AllAttendanceRate[i] = dt111.Rows[i]["旷课率"].ToString(); AllLeaveRate[i] = dt111.Rows[i]["请假率"].ToString(); AllLateRate[i] = dt111.Rows[i]["迟到率"].ToString(); AllEarlyRate[i] = dt111.Rows[i]["早退率"].ToString(); } GridView1.DataSource = dt111; GridView1.DataBind(); if (Week.Length == 1) { Week = "0" + Week; } if (Week == "01") { string s1 = DrawChart("总缺勤率", AllDepartment, AllDataRate, Week); this.phDepartmentEachCompare.Controls.Add(new LiteralControl(s1)); string s2 = DrawChart("旷课率", AllDepartment, AllAttendanceRate, Week); this.phAttendance.Controls.Add(new LiteralControl(s2)); string s3 = DrawChart("请假率", AllDepartment, AllLeaveRate, Week); this.phLeave.Controls.Add(new LiteralControl(s3)); string s4 = DrawChart("迟到率", AllDepartment, AllLateRate, Week); this.phLate.Controls.Add(new LiteralControl(s4)); string s5 = DrawChart("早退率", AllDepartment, AllEarlyRate, Week); this.phEarly.Controls.Add(new LiteralControl(s5)); } else { string s1 = DrawChart("总缺勤率", AllDepartment, AllDataRate, "01-" + Week); this.phDepartmentEachCompare.Controls.Add(new LiteralControl(s1)); string s2 = DrawChart("旷课率", AllDepartment, AllAttendanceRate, "01-" + Week); this.phAttendance.Controls.Add(new LiteralControl(s2)); string s3 = DrawChart("请假率", AllDepartment, AllLeaveRate, "01-" + Week); this.phLeave.Controls.Add(new LiteralControl(s3)); string s4 = DrawChart("迟到率", AllDepartment, AllLateRate, "01-" + Week); this.phLate.Controls.Add(new LiteralControl(s4)); string s5 = DrawChart("早退率", AllDepartment, AllEarlyRate, "01-" + Week); this.phEarly.Controls.Add(new LiteralControl(s5)); } } }
private DataTable GetStudentDt() { DataTable dt = AddSQLStringToDAL.GetDataTableBysql("SELECT [TeacherID],[TeacherName],[Course],[CurrentWeek],[Week],[Time],[StudentDepartment],[StudentClass],[StudentID],[StudentName],[AttendanceType] FROM [TabStudentAttendance]"); return(dt); }