protected void Button_Login_Click(object sender, EventArgs e) { string input_user_id = Input_ID.Text; string input_user_password = Input_UserPassword.Text; string input_user_type_str = account_sort_label_value.Value; if (UserDBUtil.Exists(input_user_id, input_user_type_str) && UserDBUtil.GetPassword(input_user_id, input_user_type_str).Equals(input_user_password)) { Session["account_user_name"] = UserDBUtil.GetName(input_user_id, input_user_type_str); Session["account_user_id"] = input_user_id; Session["account_user_type"] = input_user_type_str; Label1.Text = Session["account_user_name"].ToString() + "登录成功"; switch (input_user_type_str) { case "学生": Response.Redirect("~/Student"); break; case "教师": Response.Redirect("~/Teacher"); break; case "管理员": Response.Redirect("~/Administrator"); break; } } else { Label1.Text = "登录失败"; string toastrScript = ToastrHelper.GetToastrScript("danger", "提示", "登录失败!ID 不存在或密码错误。"); ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "script", toastrScript, true); } }
protected void GridView2_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "DeSelect") { int row; try { row = System.Convert.ToInt32(e.CommandArgument); } catch (Exception ex) { Response.Write(ex.Message); row = -1; } string course_schedule_id = GridView2.Rows[row].Cells[0].Text; string stu_id = Session["account_user_id"].ToString(); bool isChanged = CourseSelectDBUtil.Delete(course_schedule_id + stu_id); if (isChanged) { string toastrScript = ToastrHelper.GetToastrScript("success", "提示", "退选成功。"); ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "script", toastrScript, true); } else { string toastrScript = ToastrHelper.GetToastrScript("danger", "提示", "退选失败。"); ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "script", toastrScript, true); } Data_Bind(); } }
protected void Button_Update_Click(object sender, EventArgs e) { string teacher_id = Input_Update_Teacher_ID.Text; string update_item_select = Input_Update_Item_Select.Value.ToString(); string update_value = Input_Update_Value.Text; bool isChanged = false; switch (update_item_select) { case "教师编号": isChanged = TeacherUserDBUtil.UpdateID(teacher_id, update_value); break; case "姓名": isChanged = TeacherUserDBUtil.UpdateName(teacher_id, update_value); break; case "用户密码": isChanged = TeacherUserDBUtil.UpdatePassword(teacher_id, update_value); break; case "性别": isChanged = TeacherUserDBUtil.UpdateGender(teacher_id, update_value); break; case "出生时间": isChanged = TeacherUserDBUtil.UpdateBirthday(teacher_id, update_value); break; case "用户状态": isChanged = TeacherUserDBUtil.UpdateStatus(teacher_id, update_value); break; case "院系": isChanged = TeacherUserDBUtil.UpdateDepartmentID(teacher_id, update_value); break; } if (isChanged) { string toastrScript = ToastrHelper.GetToastrScript("success", "提示", "修改教师信息成功。"); ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "script", toastrScript, true); } else { string toastrScript = ToastrHelper.GetToastrScript("danger", "提示", "修改教师信息失败。"); ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "script", toastrScript, true); } Data_Bind(); }
protected void Button_Course_Search_Click(object sender, EventArgs e) { course_schedule_id = Input_Course_Schedule_ID.Text; Data_Bind(); if (GridView1.Rows[0].Visible) { string toastrScript = ToastrHelper.GetToastrScript("success", "提示", "查找课程信息成功。"); ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "script", toastrScript, true); } else { string toastrScript = ToastrHelper.GetToastrScript("danger", "提示", "当前教师账户无该课程信息。"); ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "script", toastrScript, true); } }
protected void Button_Delete_Click(object sender, EventArgs e) { string course_schedule_id = Input_Delete_Course_Schedule_ID.Text; bool isChanged = CourseScheduleDBUtil.Delete(course_schedule_id); if (isChanged) { string toastrScript = ToastrHelper.GetToastrScript("success", "提示", "删除课程安排信息成功。"); ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "script", toastrScript, true); } else { string toastrScript = ToastrHelper.GetToastrScript("danger", "提示", "删除课程安排信息失败。"); ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "script", toastrScript, true); } Data_Bind(); }
protected void Button_Update_Click(object sender, EventArgs e) { string course_schedule_id = Input_Update_Course_Schedule_ID.Text; string update_item_select = Input_Update_Item_Select.Value.ToString(); string update_value = Input_Update_Value.Text; bool isChanged = false; switch (update_item_select) { case "课程安排编号": isChanged = CourseScheduleDBUtil.UpdateID(course_schedule_id, update_value); break; case "课程编号": isChanged = CourseScheduleDBUtil.UpdateCourseID(course_schedule_id, update_value); break; case "面向院系编号": isChanged = CourseScheduleDBUtil.UpdateDeptID(course_schedule_id, update_value); break; case "课程安排类型": isChanged = CourseScheduleDBUtil.UpdateType(course_schedule_id, update_value); break; case "课程安排容量": isChanged = CourseScheduleDBUtil.UpdateCapacity(course_schedule_id, update_value); break; case "课程安排状态": isChanged = CourseScheduleDBUtil.UpdateStatus(course_schedule_id, update_value); break; } if (isChanged) { string toastrScript = ToastrHelper.GetToastrScript("success", "提示", "修改课程安排信息成功。"); ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "script", toastrScript, true); } else { string toastrScript = ToastrHelper.GetToastrScript("danger", "提示", "修改课程安排信息失败。"); ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "script", toastrScript, true); } Data_Bind(); }
protected void Button_Course_Application_Click(object sender, EventArgs e) { string course_id = Input_Course_ID.Text; string course_name = Input_Course_Name.Text; string course_credit = Input_Course_Credit.Text; string tch_id = Session["account_user_id"].ToString(); bool isChanged = CourseDBUtil.Add(course_id, course_name, course_credit, tch_id); if (isChanged) { string toastrScript = ToastrHelper.GetToastrScript("success", "提示", "开课申请成功。"); ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "script", toastrScript, true); } else { string toastrScript = ToastrHelper.GetToastrScript("danger", "提示", "开课申请失败。"); ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "script", toastrScript, true); } }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Select") { int row; try { row = System.Convert.ToInt32(e.CommandArgument); } catch (Exception ex) { Response.Write(ex.Message); row = -1; } string course_schedule_id = GridView1.Rows[row].Cells[0].Text; string stu_id = Session["account_user_id"].ToString(); string sql = "SELECT course_schedule.course_schedule_capacity - course_selected_count.selected_count FROM course_schedule INNER JOIN course_selected_count ON course_schedule.course_schedule_id = course_selected_count.course_schedule_id WHERE course_schedule.course_schedule_id = '" + course_schedule_id + "'"; if (!(Int32.Parse(DBUtil.GetSingle(sql).ToString()) > 0)) { string toastrScript = ToastrHelper.GetToastrScript("danger", "提示", "当前课程容量已满。"); ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "script", toastrScript, true); Data_Bind(); return; } bool isChanged = CourseSelectDBUtil.Add(course_schedule_id + stu_id, stu_id, course_schedule_id, "0", "0"); if (isChanged) { string toastrScript = ToastrHelper.GetToastrScript("success", "提示", "选课成功。"); ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "script", toastrScript, true); } else { string toastrScript = ToastrHelper.GetToastrScript("danger", "提示", "选课失败。"); ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "script", toastrScript, true); } Data_Bind(); } }
protected void Button_Score_Entry_Click(object sender, EventArgs e) { course_schedule_id = Input_Course_Schedule_ID.Text; string stu_id = Input_Student_ID.Text; string score = Input_Course_Select_Score.Text; bool isChanged = CourseSelectDBUtil.UpdateScore(course_schedule_id + stu_id, score); if (isChanged) { string toastrScript = ToastrHelper.GetToastrScript("success", "提示", "录入成绩成功。"); ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "script", toastrScript, true); } else { string toastrScript = ToastrHelper.GetToastrScript("danger", "提示", "录入成绩失败。"); ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "script", toastrScript, true); } Data_Bind(); }
protected void Button_Add_Click(object sender, EventArgs e) { string course_id = Input_Add_Course_ID.Text; string course_name = Input_Add_Course_Name.Text; string course_credit = Input_Add_Course_Credit.Text; string tch_id = Input_Add_Tch_ID.Text; bool isChanged = CourseDBUtil.Add(course_id, course_name, course_credit, tch_id); if (isChanged) { string toastrScript = ToastrHelper.GetToastrScript("success", "提示", "添加课程信息成功。"); ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "script", toastrScript, true); } else { string toastrScript = ToastrHelper.GetToastrScript("danger", "提示", "添加课程信息失败。"); ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "script", toastrScript, true); } Data_Bind(); }
protected void Button_Add_Click(object sender, EventArgs e) { string course_select_id = Input_Add_Course_Select_ID.Text; string student_id = Input_Add_Student_ID.Text; string course_schedule_id = Input_Add_Course_Schedule_ID.Text; string course_select_score = Input_Add_Course_Select_Score.Text; string course_select_status = Input_Add_Course_Select_Status.Text; bool isChanged = CourseSelectDBUtil.Add(course_select_id, student_id, course_schedule_id, course_select_score, course_select_status); if (isChanged) { string toastrScript = ToastrHelper.GetToastrScript("success", "提示", "添加选课信息成功。"); ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "script", toastrScript, true); } else { string toastrScript = ToastrHelper.GetToastrScript("danger", "提示", "添加选课信息失败。"); ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "script", toastrScript, true); } Data_Bind(); }
protected void Button_Add_Click(object sender, EventArgs e) { string course_schedule_id = Input_Add_Course_Schedule_ID.Text; string course_id = Input_Add_Course_ID.Text; string department_id = Input_Add_Department_ID.Text; string course_schedule_type = Input_Add_Course_Schedule_Type.Value; string course_schedule_capacity = Input_Add_Course_Schedule_Capacity.Text; string course_schedule_status = Input_Add_Course_Schedule_Status.Text; bool isChanged = CourseScheduleDBUtil.Add(course_schedule_id, course_id, department_id, course_schedule_type, course_schedule_capacity, course_schedule_status); if (isChanged) { string toastrScript = ToastrHelper.GetToastrScript("success", "提示", "添加课程安排信息成功。"); ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "script", toastrScript, true); } else { string toastrScript = ToastrHelper.GetToastrScript("danger", "提示", "添加课程安排信息失败。"); ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "script", toastrScript, true); } Data_Bind(); }
protected void Button_Add_Click(object sender, EventArgs e) { string administrator_id = Input_Add_Administrator_ID.Text; string administrator_name = Input_Add_Administrator_Name.Text; string administrator_password = Input_Add_Administrator_Password.Text; string administrator_gender = Input_Add_Administrator_Gender.Text; string administrator_birthday = Input_Add_Administrator_Birthday.Text; string administrator_status = Input_Add_Administrator_Status.Text; bool isChanged = AdministratorUserDBUtil.Add(administrator_id, administrator_name, administrator_password, administrator_gender, administrator_birthday, administrator_status); if (isChanged) { string toastrScript = ToastrHelper.GetToastrScript("success", "提示", "添加管理员信息成功。"); ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "script", toastrScript, true); } else { string toastrScript = ToastrHelper.GetToastrScript("danger", "提示", "添加管理员信息失败。"); ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "script", toastrScript, true); } Data_Bind(); }
protected void Button_Update_Click(object sender, EventArgs e) { string course_id = Input_Update_Course_ID.Text; string update_item_select = Input_Update_Item_Select.Value.ToString(); string update_value = Input_Update_Value.Text; bool isChanged = false; switch (update_item_select) { case "课程编号": isChanged = CourseDBUtil.UpdateID(course_id, update_value); break; case "课程名称": isChanged = CourseDBUtil.UpdateName(course_id, update_value); break; case "课程学分": isChanged = CourseDBUtil.UpdateCredit(course_id, update_value); break; case "任课教师编号": isChanged = CourseDBUtil.UpdateTchID(course_id, update_value); break; } if (isChanged) { string toastrScript = ToastrHelper.GetToastrScript("success", "提示", "修改课程信息成功。"); ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "script", toastrScript, true); } else { string toastrScript = ToastrHelper.GetToastrScript("danger", "提示", "修改课程信息失败。"); ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "script", toastrScript, true); } Data_Bind(); }
protected void Button_Delete_Click(object sender, EventArgs e) { string administrator_id = Input_Delete_Administrator_ID.Text; if (administrator_id.Equals("1119051")) { string toastrScript = ToastrHelper.GetToastrScript("danger", "提示", "禁止删除该账户信息。"); ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "script", toastrScript, true); return; } bool isChanged = AdministratorUserDBUtil.Delete(administrator_id); if (isChanged) { string toastrScript = ToastrHelper.GetToastrScript("success", "提示", "删除管理员信息成功。"); ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "script", toastrScript, true); } else { string toastrScript = ToastrHelper.GetToastrScript("danger", "提示", "删除管理员信息失败。"); ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "script", toastrScript, true); } Data_Bind(); }
protected void Button_Add_Click(object sender, EventArgs e) { string student_id = Input_Add_Student_ID.Text; string student_name = Input_Add_Student_Name.Text; string student_password = Input_Add_Student_Password.Text; string student_gender = Input_Add_Student_Gender.Text; string student_birthday = Input_Add_Student_Birthday.Text; string student_status = Input_Add_Student_Status.Text; string class_id = Input_Add_Class_ID.Text; bool isChanged = StudentUserDBUtil.Add(student_id, student_name, student_password, student_gender, student_birthday, student_status, class_id); if (isChanged) { string toastrScript = ToastrHelper.GetToastrScript("success", "提示", "添加学生信息成功。"); ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "script", toastrScript, true); } else { string toastrScript = ToastrHelper.GetToastrScript("danger", "提示", "添加学生信息失败。"); ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "script", toastrScript, true); } Data_Bind(); }