//增加用户 Student public static bool AddStudent(student_users user) { string sql = "insert into student_information(Sid,Sname,Sclass,Sgrade,Ssystem,id,Sphone,Sbirth)" + "values(@Sid,@Sname,@Sclass,@Sgrade,@Ssystem,@id,@Sphone,@Sbirth)"; //sql语句字符串 SqlParameter[] para = new SqlParameter[] //存储相应参数的容器 { new SqlParameter("@Sid", user.Sid1), new SqlParameter("@Sname", user.Sname1), new SqlParameter("@Sclass", user.Sclass1), new SqlParameter("@Sgrade", user.Sgrade1), new SqlParameter("@Ssystem", user.Ssystem1), new SqlParameter("@id", user.id1), new SqlParameter("@Sphone", user.Sphone1), new SqlParameter("@Sbirth", user.Sbirth1), }; int count = ExecuteCommand(sql, para);//调用执行sql语句函数 if (count > 0) { return(true); } else { return(false); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/html"; string statecode = context.Request["statecode"]; string sid = context.Request["sid"]; string sname = context.Request["sname"]; string sclass = context.Request["sclass"]; string sgrade = context.Request["sgrade"]; string ssystem = context.Request["ssystem"]; string state = new BLL.UserManage().select_statecode(statecode); if (state == "超级管理员" || state == "管理员" && sid != null && sname != null && sclass != null && sgrade != null && ssystem != null) { student_users us = new student_users(); us.Sid1 = Convert.ToInt32(sid); us.Sname1 = sname; us.Sclass1 = sclass; us.Sgrade1 = sgrade; us.Ssystem1 = ssystem; if (new BLL.UserManage().modify_student(us)) { context.Response.Write("修改成功"); } } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/html"; string statecode = context.Request["statecode"]; string sid = context.Request["sid"]; string sname = context.Request["sname"]; string sclass = context.Request["sclass"]; string sgrade = context.Request["sgrade"]; string ssystem = context.Request["ssystem"]; string id = context.Request["id"]; string sphone = context.Request["sphone"]; string sbirth = context.Request["sbirth"]; string state = new BLL.UserManage().select_statecode(statecode); int Sid = Convert.ToInt32(sgrade + new BLL.UserManage().judgeclass(sclass) + new BLL.UserManage().judgesystem(ssystem) + sid); if (new BLL.UserManage().select_sid_student(Sid)) { if (state == "超级管理员" || state == "管理员" && sid != null && sname != null && sclass != null && sgrade != null && ssystem != null) { student_users us = new student_users(); us.Sid1 = Sid; us.Sname1 = sname; us.Sclass1 = sclass; us.Sgrade1 = sgrade; us.Ssystem1 = ssystem; us.id1 = id; us.Sphone1 = sphone; us.Sbirth1 = sbirth; if (new BLL.UserManage().add_student(us)) { context.Response.Write("添加成功"); } } } else { context.Response.Write("学号已存在"); } }
//修改学生信息 public static bool ModifyStudent1(student_users user) { string sql = "update student_information set Sname = @Sname,Sclass = @Sclass,Sgrade = @Sgrade,Ssystem = @Ssystem where Sid = @Sid"; SqlParameter[] para = new SqlParameter[] { new SqlParameter("@Sid", user.Sid1), new SqlParameter("@Sname", user.Sname1), new SqlParameter("@Sclass", user.Sclass1), new SqlParameter("@Sgrade", user.Sgrade1), new SqlParameter("@Ssystem", user.Ssystem1) }; int count = ExecuteCommand(sql, para); if (count > 0) { return(true); } else { return(false); } }
public bool modify_student(student_users user) { return(UserService.ModifyStudent1(user)); }
public bool add_student(student_users user) { return(UserService.AddStudent(user)); }