protected void Button1_Click(object sender, EventArgs e) { TeacherComm context = new TeacherComm(); int id = Int32.Parse(Session["id"].ToString()); //var user = context.teacher.Where(x => x.gonghao == id).FirstOrDefault(); var user = context.teacher.Find(id); try { user.gonghao = Int32.Parse(t_number.Text.Trim()); user.name = t_name.Text; user.name2 = t_name2.Text; user.sex = t_sex.SelectedValue; user.shenfennu = t_category.Text.Trim(); user.jiguan = t_jiguan.Text; user.minzu = t_minzu.Text; user.hunyin = t_hunyiin.SelectedValue; //var aa = Request["t_worktime"].ToString(); user.worktime = Convert.ToDateTime(t_worktime.Text); //var bb = Request["t_birthday"].ToString(); user.birthday = Convert.ToDateTime(t_birthday.Text); user.birthplace = t_birthplace.Text; user.zhengzhi = t_zhengzhi.Text; user.jiankang = t_health.Text; user.teachertype = t_cate.SelectedValue; user.cellphone = t_phone.Text; user.mail = t_mail.Text; context.SaveChanges(); Response.Write("<script>alert('保存成功!')</script>"); } catch { Response.Write("<script>alert('保存失败!!!')</script>"); } }
protected void Button1_Click(object sender, EventArgs e) { try { if (Session["id"] != null) { int id = Int32.Parse(Session["id"].ToString()); TeacherComm context = new TeacherComm(); var task = new keti(); task.title = t_title.Text; task.people = t_people.Text; task.shenbaodate = Convert.ToDateTime(t_shen.Text); task.startdate = Convert.ToDateTime(t_start.Text); task.enddate = Convert.ToDateTime(t_end.Text); task.gonghao = id; context.keti.Add(task); context.SaveChanges(); Response.Write("<script>alert('添加成功!');window.location.href='task_info.aspx';</script>"); } } catch { Response.Write("<script>alert('添加成失败!')</script>"); } }
protected void Button1_Click(object sender, EventArgs e) { try { if (k_title.Text == "" || k_title.Text == null) { TeacherComm context = new TeacherComm(); var keti_ = context.keti.ToList(); GridView1.DataSource = keti_; GridView1.DataBind(); } else { string _title = k_title.Text; TeacherComm context = new TeacherComm(); var keti_ = context.keti.Where(x => x.title == _title).FirstOrDefault(); if (keti_ == null) { Response.Write("<script>alert('没有记录!')</script>"); } else { var keti__ = context.keti.Where(x => x.title == _title).ToList(); GridView1.DataSource = keti__; GridView1.DataBind(); } } } catch { Response.Write("<script>alert('查找失败!')</script>"); } }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { int xibuid = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Value.ToString()); TeacherComm context = new TeacherComm(); var user = context.teacher.Where(x => x.xibuId == xibuid).FirstOrDefault(); int t_id = 0; if (user != null) { t_id = user.gonghao; } var t_rongyu = context.rongyu.Where(x => x.gonghao == t_id).FirstOrDefault(); if (t_rongyu != null) { context.rongyu.Remove(t_rongyu); } var t_keti = context.keti.Where(x => x.gonghao == t_id).FirstOrDefault(); if (t_keti != null) { context.keti.Remove(t_keti); } if (user != null) { context.teacher.Remove(user); } var xibu = context.xibu.Where(x => x.ID == xibuid).FirstOrDefault(); context.xibu.Remove(xibu); context.SaveChanges(); Response.Write("<script>alert('删除成功!');window.location.href='xibu_info.aspx';</script>"); }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { int t_gonghao = Int32.Parse(GridView1.DataKeys[e.RowIndex].Value.ToString()); TeacherComm context = new TeacherComm(); var t_rongyu = context.rongyu.Where(x => x.gonghao == t_gonghao).FirstOrDefault(); if (t_rongyu != null) { context.rongyu.Remove(t_rongyu); } var t_keti = context.keti.Where(x => x.gonghao == t_gonghao).FirstOrDefault(); if (t_keti != null) { context.keti.Remove(t_keti); } var user = context.teacher.Where(x => x.gonghao == t_gonghao).FirstOrDefault(); context.teacher.Remove(user); context.SaveChanges(); Response.Redirect("/web/admins_layout/usertype_info.aspx"); } catch { Response.Write("<script>alert('删除失败!');window.location.href='usertype_info.aspx';</script>"); } }
protected void Page_Load(object sender, EventArgs e) { TeacherComm context = new TeacherComm(); var xibu = context.xibu.ToList(); GridView1.DataSource = xibu; GridView1.DataBind(); }
protected void btn_1_Click(object sender, EventArgs e) { TeacherComm context = new TeacherComm(); var xibu = new xibu(); xibu.xibuNa = t_xibuna.Text; context.xibu.Add(xibu); context.SaveChanges(); Response.Write("<script>alert('添加成功');window.location.href='xibu_info.aspx';</script>"); }
protected void Button1_Click(object sender, EventArgs e) { int id = Int32.Parse(Request.QueryString["gonghao"].ToString()); TeacherComm context = new TeacherComm();; var user = context.teacher.Where(x => x.gonghao == id).FirstOrDefault(); user.usertype = t_usertype.SelectedValue; context.SaveChanges(); Response.Write("<script>alert('修改成功!')</script>"); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { TeacherComm context = new TeacherComm(); var user = context.teacher.ToList(); GridView1.DataSource = user; GridView1.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { UnobtrusiveValidationMode = UnobtrusiveValidationMode.None; if (!IsPostBack) { TeacherComm context = new TeacherComm(); t_xibu.DataSource = context.xibu.Select(x => x.xibuNa).ToList(); t_xibu.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack && Session["id"] != null) { int id = Int32.Parse(Session["id"].ToString()); TeacherComm context = new TeacherComm(); var user = context.teacher.Where(x => x.gonghao == id).FirstOrDefault(); TextBox2.Text = user.twork; TextBox1.Text = user.twork; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack && Request.QueryString["idd"] != null) { int idd = Int32.Parse(Request.QueryString["idd"].ToString()); TeacherComm context = new TeacherComm(); var xibu = context.xibu.Where(x => x.ID == idd).FirstOrDefault(); t_id.Text = xibu.ID.ToString(); t_xibuna.Text = xibu.xibuNa; } }
protected void Page_Load(object sender, EventArgs e) { if (Session["id"] != null) { int id = Int32.Parse(Session["id"].ToString()); TeacherComm context = new TeacherComm(); var task = context.keti.Where(x => x.gonghao == id).ToList(); GridView1.DataSource = task; GridView1.DataBind(); } }
protected void Button1_Click(object sender, EventArgs e) { try { if (t_input.Text == "" || t_input.Text == null) { TeacherComm context = new TeacherComm(); var user = context.teacher.ToList(); GridView1.DataSource = user; GridView1.DataBind(); } else { if (DropDownList1.SelectedValue == "工号查找") { int t_id = Int32.Parse(t_input.Text); TeacherComm context = new TeacherComm(); var user = context.teacher.Where(x => x.gonghao == t_id).FirstOrDefault(); if (user == null) { Response.Write("<script>alert('没有记录!')</script>"); } else { var user_ = context.teacher.Where(x => x.gonghao == t_id).ToList(); GridView1.DataSource = user_; GridView1.DataBind(); } } else if (DropDownList1.SelectedValue == "姓名查找") { string t_name = t_input.Text; TeacherComm context = new TeacherComm(); var user = context.teacher.Where(x => x.name == t_name).FirstOrDefault(); if (user == null) { Response.Write("<script>alert('没有记录!')</script>"); } else { var user_ = context.teacher.Where(x => x.name == t_name).ToList(); GridView1.DataSource = user_; GridView1.DataBind(); } } } } catch { Response.Write("<script>alert('查找失败!')</script>"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack && Session["id"] != null) { int id = Int32.Parse(Session["id"].ToString()); TeacherComm context = new TeacherComm(); //GridView1.DataSource = (from a in context.rongyu // where a.gonghao == id // select new { a.title, a.text }).ToList(); GridView1.DataSource = context.rongyu.Where(x => x.gonghao == id).ToList(); GridView1.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["gonghao"] != null) { int id = Int32.Parse(Request.QueryString["gonghao"].ToString()); TeacherComm context = new TeacherComm();; var user = context.teacher.Where(x => x.gonghao == id).FirstOrDefault(); t_gonghao.Text = user.gonghao.ToString(); t_name.Text = user.name; t_sex.Text = user.name2; t_usertype.SelectedValue = user.usertype; } }
protected void Page_Load(object sender, EventArgs e) { UnobtrusiveValidationMode = UnobtrusiveValidationMode.None; if (Session["id"] != null) { int id = Int32.Parse(Session["id"].ToString()); TeacherComm context = new TeacherComm(); var user = context.teacher.Where(x => x.gonghao == id).FirstOrDefault(); t_gonghao.Text = user.gonghao.ToString(); t_name.Text = user.name; t_sex.Text = user.sex; t_usertype.Text = user.usertype; } }
protected void Page_Load(object sender, EventArgs e) { if (Session["id"] != null) { int id = int.Parse(Session["id"].ToString()); TeacherComm context = new TeacherComm(); var user = context.teacher.Where(x => x.gonghao == id).FirstOrDefault(); t_name.Text = user.name; t_type.Text = user.usertype; } else { Response.Redirect("/web/Index.aspx"); } }
protected void Button1_Click(object sender, EventArgs e) { try { int idd = Int32.Parse(Request.QueryString["idd"].ToString()); TeacherComm context = new TeacherComm(); var xibu = context.xibu.Where(x => x.ID == idd).FirstOrDefault(); xibu.xibuNa = t_xibuna.Text.Trim(); context.SaveChanges(); Response.Write("<script>alert('保存成功!');window.location.href='xibu_info.aspx';</script>"); } catch { Response.Write("<script>alert('保存失败!')</script>"); } }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["id"] != null) { int id = int.Parse(Request.QueryString["id"].ToString()); TeacherComm context = new TeacherComm();; var task = context.keti.Where(x => x.id == id).ToList(); GridView1.DataSource = task; GridView1.DataBind(); //t_title.Text = task.title; //t_people.Text = task.people; //t_shen.Text = task.shenbaodate.ToString(); //t_start.Text = task.startdate.ToString(); //t_end.Text = task.enddate.ToString(); } }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { TeacherComm context = new TeacherComm(); int idd = int.Parse(GridView1.DataKeys[e.RowIndex].Value.ToString()); var task = context.keti.Where(x => x.id == idd).FirstOrDefault(); context.keti.Remove(task); context.SaveChanges(); Response.Write("<script>alert('删除成功!');window.location.href='task_info.aspx';</script>"); } catch { Response.Write("<script>alert('删除失败!')</script>"); } }
protected void btn_login_Click(object sender, EventArgs e) { if (Session["CheckCode"] != null && Session["CheckCode"].ToString() != "") { if (Session["CheckCode"].ToString().ToLower() != verify.Text.ToLower()) { Session["CheckCode"] = null; verify.Text = ""; Response.Write("<script>alert('验证码输入错误')</script>"); return; } else { Entity.TeacherComm context = new TeacherComm(); var Login_id = Int32.Parse(login_id.Text); var user = context.teacher.Where(x => x.gonghao == Login_id).FirstOrDefault(); if (user != null && user.pwd == login_pwd.Text.Trim()) { if (user.usertype == "教师") { Session["CheckCode"] = null; Session["id"] = login_id.Text; Response.Write("<script>alert('欢迎 " + user.name + "老师 登录教师管理系统');window.location.href='Users.aspx'</script>"); } else if (user.usertype == "管理员") { Session["CheckCode"] = null; Session["id"] = login_id.Text; Response.Write("<script>alert('欢迎 管理员 登录后台');window.location.href='Admins.aspx'</script>"); } else { Response.Write("<script>alert('用户被禁用')</script>"); } } else { Response.Write("<script>alert('用户名或密码错误!!')</script>"); } } } else { Response.Write("<script>alert('请输入验证码!!')</script>"); } }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["idd"] != null) { int idd = Int32.Parse(Request.QueryString["idd"].ToString()); TeacherComm context = new TeacherComm(); var user = context.teacher.Where(x => x.gonghao == idd).FirstOrDefault(); int id = user.xibuId; var xibu_ = context.xibu.Where(x => x.ID == id).FirstOrDefault(); string xibuna = xibu_.xibuNa; t_gonghao.Text = user.gonghao.ToString(); t_name.Text = user.name; t_name2.Text = user.name2; t_sex.Text = user.sex; t_xibu.Text = xibuna; t_shenfennu.Text = user.shenfennu; if (user.birthday == null) { t_birthdate.Text = ""; } else { t_birthdate.Text = user.birthday.Value.ToShortDateString(); } t_birthplace.Text = user.birthplace; t_cellphone.Text = user.cellphone; t_classname.Text = user.classname; t_hunyin.Text = user.hunyin; t_jiankang.Text = user.jiankang; t_jiguan.Text = user.jiguan; t_minzu.Text = user.minzu; t_project.Text = user.project; t_season.Text = user.season; t_teachertype.Text = user.teachertype; if (user.worktime == null) { t_worktime.Text = ""; } else { t_worktime.Text = user.worktime.Value.ToShortDateString(); } t_zhengzhi.Text = user.zhengzhi; } }
protected void Button1_Click(object sender, EventArgs e) { if (Session["id"] != null) { int id = Int32.Parse(Session["id"].ToString()); string na = DropDownList1.SelectedValue; TeacherComm context = new TeacherComm(); var xibu_ = context.xibu.Where(x => x.xibuNa == na).FirstOrDefault(); int idd = xibu_.ID; var user = context.teacher.Where(x => x.gonghao == id).FirstOrDefault(); user.classname = t_class.Text; user.project = t_kemu.Text; user.xibuId = idd; user.season = t_xueqi.SelectedValue; context.SaveChanges(); Response.Write("<script>alert('保存成功!!!')</script>"); } }
protected void t_pwd_TextChanged(object sender, EventArgs e) { TeacherComm context = new TeacherComm(); if (Session["id"] != null) { int id = Int32.Parse(Session["id"].ToString()); var user = context.teacher.Where(x => x.gonghao == id).FirstOrDefault(); if (t_pwd.Text == user.pwd) { test1.Text = "密码正确!"; } else { test1.Text = "密码错误!"; } } }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["id"] != null) { int idd = Int32.Parse(Request.QueryString["id"].ToString()); TeacherComm context = new TeacherComm(); var t_keti = context.keti.Where(x => x.id == idd).FirstOrDefault(); int id = t_keti.gonghao; var user = context.teacher.Where(x => x.gonghao == id).FirstOrDefault(); string na = user.name; t_shen.Text = t_keti.shenbaodate.ToShortDateString(); t_start.Text = t_keti.startdate.ToShortDateString(); t_end.Text = t_keti.enddate.ToShortDateString(); t_people.Text = " " + t_keti.people; t_teacher.Text = " " + na; t_title.Text = " " + t_keti.title; } }
protected void Button1_Click(object sender, EventArgs e) { try { if (Session["id"] != null) { int id = Int32.Parse(Session["id"].ToString()); TeacherComm context = new TeacherComm(); var user = context.teacher.Where(x => x.gonghao == id).FirstOrDefault(); user.twork = TextBox1.Text; context.SaveChanges(); Response.Write("<script>alert('编辑成功!')</script>"); } } catch { Response.Write("<script>alert('编辑失败!')</script>"); } }
protected void Page_Load(object sender, EventArgs e) { UnobtrusiveValidationMode = UnobtrusiveValidationMode.None; if (!IsPostBack && Session["id"] != null) { TeacherComm context = new TeacherComm(); DropDownList1.DataSource = context.xibu.Select(x => x.xibuNa).ToList(); DropDownList1.DataBind(); int id = Int32.Parse(Session["id"].ToString()); var user = context.teacher.Where(x => x.gonghao == id).FirstOrDefault(); int idd = user.xibuId; var xibu = context.xibu.Where(x => x.ID == idd).FirstOrDefault(); DropDownList1.SelectedValue = xibu.xibuNa; t_class.Text = user.classname; t_kemu.Text = user.project; t_xueqi.Text = user.season; } }
protected void btn_1_Click(object sender, EventArgs e) { if (Session["id"] != null) { int id = Int32.Parse(Session["id"].ToString()); TeacherComm context = new TeacherComm(); var user = context.teacher.Where(x => x.gonghao == id).FirstOrDefault(); if (t_pwd.Text == user.pwd) { user.pwd = t_pwd2.Text; context.SaveChanges(); Session.Remove("id"); Response.Write("<script>alert('修改成功')</script>"); } else { Response.Write("<script>alert('密码不正确!')</script>"); } } }
protected void Page_Load(object sender, EventArgs e) { UnobtrusiveValidationMode = UnobtrusiveValidationMode.None; if (!IsPostBack && Session["id"] != null) { TeacherComm context = new TeacherComm(); int id = Int32.Parse(Session["id"].ToString()); var user = context.teacher.Where(x => x.gonghao == id).FirstOrDefault(); t_number.Text = user.gonghao.ToString(); t_name.Text = user.name; t_name2.Text = user.name2; t_sex.SelectedValue = user.sex.ToString(); t_category.Text = user.shenfennu; t_jiguan.Text = user.jiguan; t_minzu.Text = user.minzu; t_hunyiin.SelectedValue = user.hunyin; if (user.worktime == null) { t_worktime.Text = ""; } else { t_worktime.Text = user.worktime.Value.ToShortDateString(); } if (user.birthday == null) { t_birthday.Text = ""; } else { t_birthday.Text = user.birthday.Value.ToShortDateString(); } t_birthplace.Text = user.birthplace; t_zhengzhi.Text = user.zhengzhi; t_health.Text = user.jiankang; t_cate.SelectedValue = user.teachertype; t_phone.Text = user.cellphone; t_mail.Text = user.mail; } }