欢迎来到冰点文库! | 帮助中心 分享价值,成长自我!
冰点文库
全部分类
  • 临时分类>
  • IT计算机>
  • 经管营销>
  • 医药卫生>
  • 自然科学>
  • 农林牧渔>
  • 人文社科>
  • 工程科技>
  • PPT模板>
  • 求职职场>
  • 解决方案>
  • 总结汇报>
  • ImageVerifierCode 换一换
    首页 冰点文库 > 资源分类 > DOCX文档下载
    分享到微信 分享到微博 分享到QQ空间

    学生管理系统web程序设计代码.docx

    • 资源ID:11007187       资源大小:131.48KB        全文页数:30页
    • 资源格式: DOCX        下载积分:3金币
    快捷下载 游客一键下载
    账号登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录 QQ登录
    二维码
    微信扫一扫登录
    下载资源需要3金币
    邮箱/手机:
    温馨提示:
    快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

    加入VIP,免费下载
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    学生管理系统web程序设计代码.docx

    1、学生管理系统web程序设计代码房屋销售管理系统一、HouseMa nagerDAL数据访问层中设计三个类:CustomerService.cs 和 DBhelper.cs 和 houseserver.cs(1)在 CustomerService.cs 中using System;using System.Collections.Generic;using System.Text;using System.Data;using System.Data.SqlClient;using HouseManager.Models;namespace HouseManager.DAL public sta

    2、tic class CustomerService / 根据提供的登录账号查询用户信息public static Customer GetCustomerByLoginName( string name), name);string sql = string .Format( select * from Customers where LoginName=0 return GetCustomerBySQL(sql);III根据用户ID查询用户信息public static Customer GetCustomerById( int id), id);string sql = string .F

    3、ormat( select * from Customers where CustomerId=0 return GetCustomerBySQL(sql);III 私有方法,提供公共方法查询用户信息使用 private static Customer GetCustomerBySQL( string sql)using ( SqlConnection conn = new SqlConnection (DBHelper.connectString) Customer c = null ;tryconn.Open();SqlCommandcmd = new SqlCommand(sql, co

    4、nn); SqlDataReader sdr = cmd.ExecuteReader();c = c.Id = (c.LoginName= sdrc.Password =sdrif (sdr.Read()new Customer();int )sdr CustomerId ;LoginName .ToString();Password .ToString();catch ( Exception ex)Console .WriteLine(ex.Message);finallyconn.Close();return(2)在 DBHelper 中 using System; using Syste

    5、m.Collections.Generic; using System.Text;namespace HouseManager.DALpublic static class DBHelper public static readonly string connectString = server=.;database=HouseDB;uid=sa;pwd=123456 ;(3)在 HouseService 中using System;using System.Collections.Generic;using System.Text;using System.Data;using System

    6、.Data.SqlClient;using HouseManager.Models; namespace HouseManager.DALpublic static class HouseService/ 获取所有发布的房屋信息 public static IList GetAllHouse()List houses = new List ();using ( SqlConnection conn = new SqlConnection (DBHelper.connectString) tryconn.Open();SqlCommandcmd = new SqlCommand( select

    7、* from Houses , conn);SqlDataReader sdr = cmd.ExecuteReader();while (sdr.Read()new House();int )sdr HouseId ;HouseTypeName.ToString();int )sdr Area ;h.Price = h.Address = sdrConvert .ToDouble(sdr Price );Address .ToString(); / 外键对象的处理CustomerId );h.Customer = CustomerService.GetCustomerById( int )sd

    8、rhouses.Add(h);catch ( Exception ex)Console .WriteLine(ex.Message);finallyconn.Close();return houses;/ 根据房屋信息主键 ID 删除发布的房屋信息/ 受影响的行数 public static int DeleteHouseById( int houserId)int count = 0;using ( SqlConnection conn = new SqlConnection (DBHelper.connectString)try, houserId);string sql = string

    9、 .Format( delete from Houses where HouseId=0 conn.Open();SqlCommandcmd = new SqlCommand(sql, conn); count = cmd.ExecuteNonQuery();catch ( Exception ex)Console .WriteLine(ex.Message);finallyconn.Close();return count;/ 增加发布的房屋信息/ 受影响的行数 public static int AddHouse(House house)string sql = string .Forma

    10、t( insert into dbo.Houses + (HouseTypeName,Area,Price,Address,CustomerId)+ values (0,1,2,3,4) ,house.TypeName, house.Area, house.Price, house.Address, house.Customer.Id);int count = 0;using ( SqlConnection conn = new SqlConnection (DBHelper.connectString) try conn.Open();SqlCommandcmd = new SqlComma

    11、nd(sql, conn); count = cmd.ExecuteNonQuery();catch ( Exception ex)Console .WriteLine(ex.Message); return 0;finally conn.Close(); return 1;二、在 HouseManagerModels 模型层中设计两个类: Customer.cs 和 house.cs(1) 在 Customer.cs 中 using System;using System.Collections.Generic;using System.Text;namespace Serializable

    12、 public class Customerprivate int id;public int Idget return id; set id = value ; private string loginName;/ 登录账号public string LoginNameget return loginName; set loginName = value ; private string password;/ 登录密码 public string Password get return password; set password = value ; ( 2)在 house.cs 中usin

    13、g System;using System.Collections.Generic;using System.Text;namespace HouseManager.Models Serializable public class Houseprivate int id;public int Idget return id; set id = value ; private string typeName;/ 房屋类型名称public string TypeNameget return typeName; set typeName = value ; private int area;/ 面积

    14、 public int Areaget return area; set area = value ; private double price;/ 价格public double Priceget return price; set price = value ; private string address;/ 地址public string Addressget return address; set address = value ; private Customer customer;/ 发布人public Customer Customerget return customer;

    15、set customer = value ; 三、在 HouseManagerBLL逻辑业务层中设计两个类: HouseManager.cs 和 LoginManager.cs(1)在 HouseManager.cs 中:using System;using System.Collections.Generic;using System.Text;using HouseManager.Models;using HouseManager.DAL;namespace HouseManager.BLLpublic static class HouseManager/ 查询所有发布的房屋信息publi

    16、c static IList GetAllHouse() return HouseService.GetAllHouse();/ 删除已发布的房屋信息/ 删除是否成功 public static bool DeleteHouse( int houseId) return HouseService.DeleteHouseById(houseId) != 0;/ 发布房屋信息/ 添加是否成功 public static bool AddHouse(House house) return HouseService.AddHouse(house) != 0;(2) 在 LoginManager.cs

    17、中using System;using System.Collections.Generic;using System.Text;using HouseManager.Models;using HouseManager.DAL;namespace HouseManager.BLLpublic static class LoginManager/ 用户登录判断/ 是否登录成功 public static bool Login( string name, string password, out Customer customer) customer = null ;Customer c = Cu

    18、stomerService.GetCustomerByLoginName(name);if (c = null )return false ;if (c.Password.Equals(password)customer = c;return true ;return false ;禾口 LoginPage.aspx 禾口四、在表示层中建立一个空网站:其中包括四个网页窗体: about.aspx和default.aspxReleaseHouse In formati on Page.aspx(1)在 LoginPage.aspx 中1登录窗口登录名密码B 誓1代码如下:using System

    19、;using System.Data;using System.Configuration;using System.Collections;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.Ul.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;using HouseManager.Models;using HouseManager.BLL;public part

    20、ial class Logi nPage : System.Web.UI.Pageprotected void Page_Load( object sender, EventArgs e)if (! thissPostBack)/已登录直接跳转到查看页面if (Session User != null )this .Response.Redirect( /default.aspx );protected void btnLogin_Click( object sender, EventArgs e)Customer cus = null ;/验证登录信息是否正确if (LoginManager

    21、.Login( this .txtLoginName.Text.Trim(),this .txtPassword.Text.Trim(),out cus)/跳转到查看页面Session User = cus;this .Response.Redirect( /default.aspx );else/提示错误信息Warn ningthis .ClientScript.RegisterStartupScript( this .GetType(),alert( 用户信息不正确! ) );(2)在 ReleaseHouseInformationPage.aspx 中:房型面积丄皇_厅耳 1r 平方杷l

    22、i 1价格F 元厂地址UE嘴错误消息工-卅息2-1J代码如下:using System;using System.Data;using System.Configuration;using System.Collections;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.Ul.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;using HouseManage

    23、r.Models;using HouseManager.BLL;public partial class ReleaseHouseInformationPage : System.Web.UI.Page protected void Page_Load( object sender, EventArgs e)if (! this .IsPostBack)/ 没有登录的话,跳转到登录页面if (Session User = null )this .Response.Redirect( /LoginPage.aspx ); protected void btnSubmit_Click( objec

    24、t sender, EventArgs e) / 从界面获取用户输入的信息House house = house.TypeName =new House();this .ddlType.SelectedValue;house.Area = int .Parse( this .txtArea.Text);house.Price = double .Parse( this .txtPrice.Text);( 3)在 default.aspx 中:房屋类型面积 价格 地址数据娜定数据绑定数据绑审数据绑定删除数据绑定数据绑定数据绑定数据绑定删陈数据绑定 数据绑定数据绑定数据绑定删除数据编定数据绑定数据

    25、绑定数据绑定删除 数据绑定建据绑定数据塑数据绑定删除 6bj cCtDat&Sotarce - odsHousft 5具体就是:设置GridView,设置数据源等操作。(4)在about.aspx 中:自动带的。学生管理系统一、StudentDAL数据访问层中设计三个类:AdminDAL.cs 和 DBHelper.cs 和 studentDAL.cs (1) 在 AdminDAL.cs 中using System;using System.Collect ion s.Ge neric;using System.L inq;using System.Text;using Stude ntMod

    26、el;using System.Data;using System.Data.SqlClie nt;n amespace Stude ntDALpublic class Adm in DALpublic static Admin GetAdmi nByLogi nN ame(stri ng n ame)string sql = string.Format(select * from admin where Userld=0, name); return GetAdmi nBySQL(sql);private static Adm in GetAdminBySQL(string sql)usin

    27、g (SqlC onn ectio n conn = new SqlC onn ectio n(DBHelper.c onn ectStri ng) Admin c = nu II;tryconn. Ope n();SqlComma nd cmd = new SqlComma nd(sql, conn);SqlDataReader sdr = cmd.ExecuteReader();if (sdr.Read()c = new Admi n();c.Userld = sdrUserld.ToStri ng().Trim();c.UserPwd = sdrUserPwd.ToStri ng().T

    28、rim();catch (Exception ex)Console.WriteLine(ex.Message);finally conn.Close();return c;(2) 在 DBHelper 中using System;using System.Collections.Generic;using System.Text;namespace StudentDALpublic static class DBHelperpublic static readonly string connectString = DataSource=PC-201012101127SQLEXPRESS;Initial Catalog=StudDB;Integrated Security=True; (3)在 studentDAL.cs 中using System;using System.Collections.Generic;using Sy


    注意事项

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

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

    copyright@ 2008-2023 冰点文库 网站版权所有

    经营许可证编号:鄂ICP备19020893号-2


    收起
    展开