/// <summary> /// 返回列表 /// </summary> /// <param name="managerId"></param> /// <returns></returns> public IList<CY.HotelBooking.Core.Business.Manager> GetList(int managerId) { IList<CY.HotelBooking.Core.Business.Manager> list = new List<CY.HotelBooking.Core.Business.Manager>(); SqlServerUtility DB = new SqlServerUtility(); DB.AddParameter("@Manage_ID", SqlDbType.Int, managerId); SqlDataReader reader=DB.ExecuteSqlReader(SqlSelectManager); if (reader != null) { while (reader.Read()) { CY.HotelBooking.Core.Business.Manager manager = new CY.HotelBooking.Core.Business.Manager(); if (!reader.IsDBNull(0)) manager.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) manager.Code = reader.GetString(1); if (!reader.IsDBNull(2)) manager.Pass = reader.GetString(2); if (!reader.IsDBNull(3)) manager.RealName = reader.GetString(3); if (!reader.IsDBNull(4)) manager.AddDate = reader.GetDateTime(4); if (!reader.IsDBNull(5)) manager.Role = reader.GetString(5); list.Add(manager); } reader.Close(); return list; } else { reader.Close(); return null; } }
protected void btnSubmit_Click(object sender, EventArgs e) { string code = textmanagerID.Text.Trim(); string pass = textpass.Text.Trim(); pass = CY.HotelBooking.Core.Business.PasswordEncrypt.DESEncryptMethod(pass); CY.HotelBooking.Core.Business.Manager manager = new CY.HotelBooking.Core.Business.Manager(); IList<CY.HotelBooking.Core.Business.Manager> list= manager.GetListByName(code); if (list == null) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('该管理员信息不存在!');</script>"); } else if(pass==list[0].Pass) { Session["UserInfo_ttt"] = list[0]; Response.Redirect("~/Default.aspx");//成功,页面跳转 } else { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('密码输入不正确!');</script>"); } }
public CY.HotelBooking.Core.Business.Manager SelectByCode(string code) { SqlServerUtility DB = new SqlServerUtility(); DB.AddParameter("@Manager_Code", SqlDbType.VarChar, code); SqlDataReader reader = DB.ExecuteSqlReader(SqlSelectManagerByCode); if (reader != null && !reader.IsClosed && reader.Read()) { CY.HotelBooking.Core.Business.Manager manager = new CY.HotelBooking.Core.Business.Manager(); if (!reader.IsDBNull(0)) manager.Id = reader.GetInt32(0); if (!reader.IsDBNull(1)) manager.Code = reader.GetString(1); if (!reader.IsDBNull(2)) manager.Pass = reader.GetString(2); if (!reader.IsDBNull(3)) manager.RealName = reader.GetString(3); if (!reader.IsDBNull(4)) manager.AddDate = reader.GetDateTime(4); if (!reader.IsDBNull(5)) manager.Role = reader.GetString(5); reader.Close(); return manager; } else { reader.Close(); return null; } }
public IList<CY.HotelBooking.Core.Business.Manager> GetSearchByName(string name) { SqlServerUtility db = new SqlServerUtility(); db.AddParameter("@Manager_Code", SqlDbType.VarChar, name); IList<CY.HotelBooking.Core.Business.Manager> list = new List<CY.HotelBooking.Core.Business.Manager>(); SqlDataReader reader = db.ExecuteSqlReader(SqlSeach); if (reader != null) { CY.HotelBooking.Core.Business.Manager m ; while (reader.Read()) { m=new CY.HotelBooking.Core.Business.Manager(); if (!reader.IsDBNull(0)) { m = CY.HotelBooking.Core.Business.Manager.Load(reader.GetInt32(0)); list.Add(m); } } reader.Close(); } return list; }