ImageVerifierCode 换一换
格式:DOCX , 页数:28 ,大小:50.36KB ,
资源ID:21486518      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/21486518.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(学生管理系统web程序设计代码文档格式.docx)为本站会员(b****5)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

学生管理系统web程序设计代码文档格式.docx

1、 private static Customer GetCustomerBySQL(string sql) using (SqlConnection conn = new SqlConnection(DBHelper.connectString) Customer c = null; try conn.Open(); SqlCommand cmd = new SqlCommand(sql, conn); SqlDataReader sdr = cmd.ExecuteReader(); if (sdr.Read() c = new Customer(); c.Id = (int)sdrCusto

2、merId; c.LoginName = sdrLoginName.ToString(); c.Password = sdrPassword catch (Exception ex) Console.WriteLine(ex.Message); finally conn.Close(); return c;(2)在DBHelper中 public static class DBHelper public static readonly string connectString = server=.;database=HouseDB;uid=sa;pwd=123456;(3)在HouseServ

3、ice中 public static class HouseService / 获取所有发布的房屋信息 public static IList GetAllHouse() List houses = new List();SqlCommand cmd = new SqlCommand(select * from Houses, conn); while (sdr.Read() House h = new House(); h.Id = (int)sdrHouseId h.TypeName = sdrHouseTypeName h.Area = (int)sdrArea h.Price = Co

4、nvert.ToDouble(sdrPrice); h.Address = sdrAddress/外键对象的处理 h.Customer = CustomerService.GetCustomerById(int)sdr houses.Add(h); return houses; / 根据房屋信息主键ID删除发布的房屋信息 / 受影响的行数 public static int DeleteHouseById(int houserId) int count = 0;using (SqlConnection conn = new SqlConnection(DBHelper.connectStrin

5、g)delete from Houses where HouseId=0, houserId); count = cmd.ExecuteNonQuery(); return count; / 增加发布的房屋信息 public static int AddHouse(House house)insert into dbo.Houses+ (HouseTypeName,Area,Price,Address,CustomerId) + values (,1,2,3,4), house.TypeName, house.Area, house.Price, house.Address, house.Cu

6、stomer.Id); return 0; return 1;二、在HouseManagerModels模型层中设计两个类:Customer.cs和house.cs (1)在Customer.cs中namespace Serializable public class Customer private int id; public int Id get return id; set id = value; private string loginName; / 登录账号 public string LoginName get return loginName; set loginName =

7、value; private string password; / 登录密码 public string Password get return password; set password = value;(2)在house.cs中namespace HouseManager.Models public class House private string typeName; / 房屋类型名称 public string TypeName get return typeName; set typeName = value; private int area; / 面积 public int

8、Area get return area; set area = value; private double price; / 价格 public double Price get return price; set price = value; private string address; / 地址 public string Address get return address; set address = value; private Customer customer; / 发布人 public Customer Customer get return customer; set c

9、ustomer = value;三、在HouseManagerBLL逻辑业务层中设计两个类:HouseManager.cs和LoginManager.cs(1)在HouseManager.cs中:using HouseManager.DAL;namespace HouseManager.BLL public static class HouseManager / 查询所有发布的房屋信息 return HouseService.GetAllHouse(); / 删除已发布的房屋信息删除是否成功 public static bool DeleteHouse(int houseId) return

10、HouseService.DeleteHouseById(houseId) != 0; / 发布房屋信息添加是否成功 public static bool AddHouse(House house) return HouseService.AddHouse(house) !(2)在LoginManager.cs中 public static class LoginManager / 用户登录判断是否登录成功 public static bool Login(string name, string password, out Customer customer) customer = null;

11、 Customer c = CustomerService.GetCustomerByLoginName(name); if (c = null) return false; if (c.Password.Equals(password) customer = c; return true;四、在表示层中建立一个空网站:其中包括四个网页窗体:about.aspx和default.aspx和LoginPage.aspx和ReleaseHouseInformationPage.aspx(1)在LoginPage.aspx中代码如下:using System.Configuration;using

12、System.Collections;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;using HouseManager.BLL;public partial class LoginPage : System.Web.UI.Page protected void Page_Load(object sende

13、r, EventArgs e) if (!this.IsPostBack) /已登录直接跳转到查看页面 if (SessionUser != null) this.Response.Redirect(/default.aspx); protected void btnLogin_Click(object sender, EventArgs e) Customer cus = null; /验证登录信息是否正确 if (LoginManager.Login(this.txtLoginName.Text.Trim(), this.txtPassword.Text.Trim(), out cus)

14、/跳转到查看页面 Session = cus; else /提示错误信息 this.ClientScript.RegisterStartupScript(this.GetType(), Warnning alert(用户信息不正确!)(2)在ReleaseHouseInformationPage.aspx中:public partial class ReleaseHouseInformationPage : /没有登录的话,跳转到登录页面 = null)/LoginPage.aspx protected void btnSubmit_Click(object sender, EventArgs

15、 e) /从界面获取用户输入的信息 House house = new House(); house.TypeName = this.ddlType.SelectedValue; house.Area = int.Parse(this.txtArea.Text); house.Price = double.Parse(this.txtPrice.Text); house.Address = this.txtAddress.Text; Customer customer = Session as Customer; house.Customer = customer; /判断保存信息是否成功 i

16、f (HouseManager.BLL.HouseManager.AddHouse(house) /提示成功信息并跳转到查看页面Alert房屋信息增加成功!window.location.href=default.aspx房屋信息增加失败!(3)在default.aspx中:具体就是:设置GridView,设置数据源等操作。(4)在about.aspx中:自动带的。学生管理系统一、StudentDAL数据访问层中设计三个类:AdminDAL.cs和DBHelper.cs和studentDAL.cs (1)在AdminDAL.cs中using System.Linq;using StudentM

17、odel;namespace StudentDAL public class AdminDAL public static Admin GetAdminByLoginName(string name)select * from admin where UserId= return GetAdminBySQL(sql); private static Admin GetAdminBySQL(string sql) Admin c = null; c = new Admin(); c.UserId = sdrUserId.ToString().Trim(); c.UserPwd = sdrUserPwd

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1