public bool UpdateGridlzs(Userlzs u) { string sql = string.Format("update StudentResultlzs set Chinese='{0}',Math='{1}',English='{2}',Computer='{3}' where rid='{4}'" , u.Chinese, u.Math, u.English, u.Computer, u.rid); return(new DBhelper().Excute(sql)); }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "del") { Userlzs u = new Userlzs(); u.rid = Convert.ToInt32(e.CommandArgument.ToString()); bool flag = new UserInfoBLLlzs().DelGridlzs(u); if (flag) { Response.Write("<script>alert('删除成功')</script>"); ShowGrid(); } } if (e.CommandName == "XiuGai") { Response.Redirect(string.Format("CJJSlzs.aspx?rid={0}", Convert.ToInt32(e.CommandArgument.ToString()))); } if (e.CommandName == "CJJS") { Userlzs u = new Userlzs(); u.rid = Convert.ToInt32(e.CommandArgument.ToString()); bool flag = new UserInfoBLLlzs().JieSuanBLL(u); if (flag) { ShowGrid(); } } }
protected void Button1_Click(object sender, EventArgs e) { Userlzs u = new Userlzs(); u.UserName = this.TextBox1.Text; bool flag = new UserInfoBLLlzs().AddMsglzs(u); if (flag) { u.sClassId = Convert.ToInt32(this.DropDownList1.SelectedValue); u.Chinese = Convert.ToInt32(this.TextBox2.Text); u.Math = Convert.ToInt32(this.TextBox3.Text); u.English = Convert.ToInt32(this.TextBox4.Text); u.Computer = Convert.ToInt32(this.TextBox5.Text); bool flag2 = new UserInfoBLLlzs().AddMsglzs(u); if (flag2) { Response.Redirect("indexlzs.aspx"); } else { Response.Write("<script>alert('添加失败')</script>"); } } else { Response.Write("<script>alert('添加失败')</script>"); } }
protected void Button1_Click(object sender, EventArgs e) { Userlzs u = new Userlzs(); u.UserName = this.TextBox1.Text; u.sClassId = Convert.ToInt32(this.DropDownList1.SelectedValue); u.IfPass = this.RadioButton1.Checked ? 0 : this.RadioButton2.Checked ? 2 : this.RadioButton3.Checked ? 1 : 9; u.Rlevel = this.RadioButton4.Checked ? 0 : this.RadioButton5.Checked ? 4 : this.RadioButton6.Checked ? 3 : this.RadioButton7.Checked ? 2 : this.RadioButton8.Checked ? 1 : 9; DataTable dt = new UserInfoBLLlzs().ShowGridlzs(u); this.GridView1.DataSource = dt; this.GridView1.DataBind(); }
private void LoadMsg() { Userlzs u = new Userlzs(); u.rid = Convert.ToInt32(Request.QueryString["rid"].ToString()); DataTable dt = new UserInfoBLLlzs().ShowGridlzs(u); this.Label1.Text = dt.Rows[0]["UserName"].ToString(); this.Label2.Text = dt.Rows[0]["ClassName"].ToString(); this.TextBox1.Text = dt.Rows[0]["Chinese"].ToString(); this.TextBox2.Text = dt.Rows[0]["Math"].ToString(); this.TextBox3.Text = dt.Rows[0]["English"].ToString(); this.TextBox4.Text = dt.Rows[0]["Computer"].ToString(); }
protected void Button1_Click(object sender, EventArgs e) { Userlzs u = new Userlzs(); u.UserName = this.TextBox1.Text; u.UserPsw = this.TextBox2.Text; DataTable dt = new UserInfoBLLlzs().LoginBLLlzs(u); if (dt.Rows.Count > 0 && dt != null) { Response.Redirect("indexlzs.aspx"); } else { Response.Write("<script>alert('登陆失败')</script>"); } }
public bool AddMsglzs(Userlzs u) { string sql = ""; int sid = 0; if (u.sClassId != 0) { sid = Convert.ToInt32(getSid().Rows[0][0].ToString()); sql = string.Format(" insert into StudentResultlzs values('{0}','{1}','{2}','{3}','{4}',default,null,default,default,'{5}')" , sid, u.Chinese, u.Math, u.English, u.Computer, u.sClassId); } else { sql = string.Format("insert into UserInfolzs values('{0}','123456')", u.UserName); } return(new DBhelper().Excute(sql)); }
public bool JieSuanDAL(Userlzs u) { string sql = string.Format(" update StudentResultlzs set TScore=Chinese+Math+English+Computer where rid ='{0}'", u.rid); bool flag = new DBhelper().Excute(sql); if (flag) { int TScore = Convert.ToInt32(new DBhelper().Get(string.Format("select TScore from StudentResultlzs where rid ='{0}'", u.rid)).Rows[0][0].ToString()); u.IfPass = TScore >= 240 ? 1 : 2; u.Rlevel = TScore < 240 ? 1 : TScore < 320 ? 2 : TScore < 360 ? 3 : 4; flag = new DBhelper().Excute(string.Format("update StudentResultlzs set IfPass='******',Rlevel='{1}' where rid ='{2}'", u.IfPass, u.Rlevel, u.rid)); return(flag); } else { return(false); } }
protected void Button1_Click(object sender, EventArgs e) { Userlzs u = new Userlzs(); u.rid = Convert.ToInt32(Request.QueryString["rid"].ToString()); u.Chinese = Convert.ToInt32(this.TextBox1.Text); u.Math = Convert.ToInt32(this.TextBox2.Text); u.English = Convert.ToInt32(this.TextBox3.Text); u.Computer = Convert.ToInt32(this.TextBox4.Text); bool flag = new UserInfoBLLlzs().UpdateGridlzs(u); if (flag) { Response.Redirect("indexlzs.aspx"); } else { Response.Write("<script>alert('修改失败')</script>"); } }
public DataTable ShowGridlzs(Userlzs u) { string sql = @"select *,case when IfPass='******' then '未统计' when IfPass='******' then '及格' when IfPass='******' then '不及格' end as IFPAS, case when Rlevel='0' then '未统计' when Rlevel='1' then '差' when Rlevel='2' then '一般' when Rlevel='3' then '良好' when Rlevel='4' then '优秀' end as CJDJ from StudentResultlzs a,ClassInfolzs b,UserInfolzs c where a.Sid=c.UserId and a.ClassId=b.ClassId "; if (u != null) { if (u.UserName != "") { sql += string.Format("and UserName like '%{0}%'", u.UserName); } if (u.sClassId != 0) { sql += string.Format("and a.ClassId = '{0}'", u.sClassId); } if (u.IfPass != 9 && u.IfPass != 0) { sql += string.Format("and IfPass = '******'", u.IfPass); } if (u.Rlevel != 9 && u.Rlevel != 0) { sql += string.Format("and Rlevel = '{0}'", u.Rlevel); } if (u.rid != 0) { sql += string.Format("and rid='{0}'", u.rid); } } return(new DBhelper().Get(sql)); }
public DataTable LoginDALlzs(Userlzs u) { return(new DBhelper().Get(string.Format("select * from UserInfolzs where UserName='******' and UserPsw='{1}'", u.UserName, u.UserPsw))); }
public DataTable LoginBLLlzs(Userlzs u) { return(new UserInfoDALlzs().LoginDALlzs(u)); }
public DataTable ShowGridlzs(Userlzs u) { return(new UserInfoDALlzs().ShowGridlzs(u)); }
public bool DelGridlzs(Userlzs u) { return(new DBhelper().Excute(string.Format("delete StudentResultlzs where rid='{0}'", u.rid))); }
public bool AddMsglzs(Userlzs u) { return(new UserInfoDALlzs().AddMsglzs(u)); }
public bool JieSuanBLL(Userlzs u) { return(new UserInfoDALlzs().JieSuanDAL(u)); }
public bool UpdateGridlzs(Userlzs u) { return(new UserInfoDALlzs().UpdateGridlzs(u)); }
public bool DelGridlzs(Userlzs u) { return(new UserInfoDALlzs().DelGridlzs(u)); }