protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { RoomTypeManager rtmanager = new RoomTypeManager(); ddlType.DataSource = rtmanager.GetAllType(); ddlType.DataTextField = "typename"; ddlType.DataValueField = "typeid"; ddlType.DataBind(); //如果传过来的roomid是空则执行添加代码 if (Request.QueryString["roomid"] == null) { txtNumber.Visible = true; } else { lblNumber.Visible = true; int roomid = Convert.ToInt32(Request.QueryString["roomid"]); Room room = new Room(); room = roommanager.GetRoomById(roomid); lblNumber.Text = room.Number; ddlType.Text = room.type.TypeName; ddlState.SelectedValue = room.State; ddlType.SelectedValue = room.TypeId.ToString(); txtBednumber.Text = room.BedNumber.ToString(); txtGuestnumber.Text = room.GuestNumber.ToString(); txtdes.Text = room.Description.ToString(); } } }
/// <summary> /// 绑定客房类型信息 /// </summary> public void BindRoomType() { this.ddlRoomType.DataSource = RoomTypeManager.GetAllRoomTypes(); this.ddlRoomType.DataTextField = "TypeName"; this.ddlRoomType.DataValueField = "TypeID"; this.DataBind(); }
private void frmRppmInfo_Load(object sender, EventArgs e) { //添加树形菜单 DataSet ds = new DataSet(); //获取房间类型 ds = RoomTypeManager.GetAllRoomTypeList(); //创建根节点 TreeNode root = new TreeNode(); root.Text = "房间类型"; tvRoom.Nodes.Add(root); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { //创建子节点对象 TreeNode tr = new TreeNode(); //显示字节点的文本 tr.Text = ds.Tables[0].Rows[i]["TypeName"].ToString(); //保存子节点对应节点的值 tr.Tag = int.Parse(ds.Tables[0].Rows[i]["TypeID"].ToString()); //添加子子节点 root.Nodes.Add(tr); } tvRoom.Nodes.Add(root); }
protected void gvRoomType_RowCommand(object sender, GridViewCommandEventArgs e) { string cmd = e.CommandName; int typeID = Convert.ToInt32(e.CommandArgument); if (cmd == "cmdDelete") { int obj; obj = Convert.ToInt32(RoomTypeManager.GetScalarRoomByTypeID(typeID)); if (obj > 0) { Response.Write("<script>alert('此类型房间已存在,禁止删除!')</script>"); return; } else { RoomTypeManager.DeleteRoomTypeByTypeID(typeID); } } else if (cmd == "cmdEdit") { Response.Redirect("~/AddRoomType.aspx"); } BindRoomType(); }
/// <summary> /// 模糊查询 /// </summary> public void getRoomTypeName() { //接收输入的类型 string typename = txtTypeName.Text.Trim(); dgvshow.DataSource = RoomTypeManager.GetRoomTypeListByName(typename); }
/// <summary> /// 提交客房类型信息 /// </summary> protected void tbnSave_Click(object sender, EventArgs e) { //根据类型名称得到类型ID int typeId = RoomTypeManager.GetTypeIdTypeName(this.txtTypeName.Text.Trim()); if (typeId > 0) { this.lblResult.Text = "此客房类型已存在!"; } else { roomType.TypeName = this.txtTypeName.Text.Trim(); roomType.TypePrice = Convert.ToDecimal(this.txtTypePrice.Text.Trim()); roomType.IsAddBed = this.rdolstIsAddBed.SelectedValue; if (roomType.IsAddBed.Trim() == "否") { roomType.AddBedPrice = 0; } else { roomType.AddBedPrice = Convert.ToDecimal(this.txtAddBedPrice.Text.Trim()); } roomType.Remark = this.txtRemark.Text.Trim(); typeId = RoomTypeManager.AddRoomType(roomType); if (typeId > 0) { Page.Server.Transfer("ViewRoomType.aspx"); } else { this.lblResult.Text = "客房类型创建失败!"; } } }
private void FrmCheckIn_Load(object sender, EventArgs e) { txtRoomNo.Text = ucRoomList.rm_RoomNo; Room r = RoomManager.SelectRoomByRoomNo(txtRoomNo.Text); RoomType t = RoomTypeManager.SelectRoomTypeByRoomNo(txtRoomNo.Text); txtType.Text = t.RoomName; txtMoney.Text = r.RoomMoney.ToString(); txtRoomPosition.Text = r.RoomPosition; txtState.Text = r.RoomState; txtState.Text = RoomManager.SelectRoomStateNameByRoomNo(txtRoomNo.Text).ToString(); List <Custo> ctos = CustoService.SelectCanUseCustoAll(); List <Room> roms = RoomManager.SelectCanUseRoomAll(); for (int i = 0; i < roms.Count; i++) { txtRoomNo.AutoCompleteCustomSource.Add(roms[i].RoomNo); } for (int j = 0; j < ctos.Count; j++) { txtCustoNo.AutoCompleteCustomSource.Add(ctos[j].CustoNo); } try { txtCustoNo.Text = ""; } catch { txtCustoNo.Text = ucRoomList.rm_CustoNo; } }
/// <summary> /// 窗体加载时执行 /// </summary> private void RoomSettingForm_Load(object sender, EventArgs e) { //绑定客房类型数据 this.cboTypeName.DataSource = RoomTypeManager.GetAllRoomTypes(); this.cboTypeName.DisplayMember = "TypeName"; //绑定客房信息 BindRoomInfoList(); }
/// <summary> /// 绑定类型信息 /// </summary> public void BindRoomType() { roomType = RoomTypeManager.GetRoomTypeByTypeID(TypeID); this.lblTypeName.Text = roomType.TypeName; this.txtTypePrice.Text = Convert.ToString(roomType.TypePrice); this.txtAddBedPrice.Text = Convert.ToString(roomType.AddBedPrice); this.rdolstIsAddBed.SelectedValue = roomType.IsAddBed.Trim(); this.txtRemark.Text = roomType.Remark; }
private void FrmRoomManager_Load_1(object sender, EventArgs e) { CmpSetDgv(); cboReserWay.SelectedIndex = 0; dgvBou.DataSource = ReserService.SelectReserAll(); Type.DataSource = RoomTypeManager.SelectRoomTypesAll(); Type.DisplayMember = "RoomName"; //显示的列名 Type.ValueMember = "Roomtype"; //绑定的值 }
private void FrmAddRoom_Load(object sender, EventArgs e) { CmpSetDgv(); dgvRoomList.AutoGenerateColumns = false; dgvRoomList.DataSource = RoomService.SelectCanUseRoomAll(); cboRoomType.DataSource = RoomTypeManager.SelectRoomTypesAll(); cboRoomType.DisplayMember = "RoomName"; cboRoomType.ValueMember = "RoomType"; }
//显示所有房间类型信息 private void getAllRoomTyoe() { //定义数据集 DataSet ds = new DataSet(); ds = RoomTypeManager.GetAllRoomTypeList(); //绑定数据源 dgvshow.DataSource = ds.Tables[0]; }
/// <summary> /// 绑定客房类型 /// </summary> public void BindRoomType() { ddlType.DataSource = RoomTypeManager.GetAllRoomTypes(); ddlType.DataTextField = "TypeName"; ddlType.DataValueField = "TypeId"; ddlType.DataBind(); ListItem item = new ListItem(); item.Text = "--选择--"; item.Value = "-1"; ddlType.Items.Insert(0, item); }
/// <summary> /// 绑定客房类型信息列表 /// </summary> public void BindRoomTypeList() { //取消DataGridView自动生成列功能 this.dgvRoomType.AutoGenerateColumns = false; if (string.IsNullOrEmpty(this.txtTypeName.Text.Trim())) { this.dgvRoomType.DataSource = RoomTypeManager.GetRoomTypeList(); } else { this.dgvRoomType.DataSource = RoomTypeManager.GetRoomTypeListByTypeName(this.txtTypeName.Text.Trim()); } }
public void OnEntered(BaseRoomTrigger baseRoomTrigger) { RoomTypeManager roomtypeManager = SceneUtils.FindObjectOf <RoomTypeManager>(); if (roomtypeManager) { roomtypeManager.OnRoomFinished(this.roomType); } baseRoomTrigger.RemoveEventListener(this.gameObject); player.OnEnterRoom(this.roomType); DoExtraOnEntered(); DispatchMessage("OnRoomEntered", this); }
/// <summary> /// 执行GridView数据行按钮事件 /// </summary> protected void gvRoomType_RowCommand(object sender, GridViewCommandEventArgs e) { //获取按钮命令名称 string cmd = e.CommandName; int typeId = Convert.ToInt32(e.CommandArgument);//获取命令参数 if (cmd == "De") { //根据类型ID删除类型信息 RoomTypeManager.DeleteRoomTypeByTypeId(typeId); } else if (cmd == "Ed") { //转向类型信息编辑页 Page.Server.Transfer("EditRoomType.aspx?typeId=" + Convert.ToString(typeId)); } BindRoomType(); }
/// <summary> /// 删除客房类型信息 /// </summary> private void tsbtnDelete_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(typeID) && !string.IsNullOrEmpty(txtType.Text.Trim())) { //调用业务逻辑层客房信息删除功能 DialogResult result = MessageBox.Show("您确实要删除此信息吗?", "提交提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); if (result == DialogResult.OK) { RoomTypeManager.DeleteRoomTypeByTypeId(Convert.ToInt32(typeID)); //刷新房屋信息列表 BindRoomTypeList(); MessageBox.Show("信息删除成功!", "提交提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("请选择要删除的信息!", "提交提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void btnadd_Click(object sender, EventArgs e) { try { Check(); //实例化实体对象 RoomType rt = new RoomType(); rt.TypeName = txtname.Text.Trim(); rt.TypePrice = Convert.ToDecimal(txtprice.Text.Trim()); //调用添加方法 RoomTypeManager.AddRoomType(rt); getAllRoomTyoe(); MessageBox.Show("添加成功"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// 提交类型信息 /// </summary> protected void tbnSave_Click(object sender, EventArgs e) { roomType.TypeId = TypeID; roomType.TypeName = this.lblTypeName.Text.Trim(); roomType.TypePrice = Convert.ToDecimal(this.txtTypePrice.Text.Trim()); roomType.IsAddBed = this.rdolstIsAddBed.SelectedValue; if (roomType.IsAddBed.Trim() == "否") { roomType.AddBedPrice = 0; } else { roomType.AddBedPrice = Convert.ToDecimal(this.txtAddBedPrice.Text.Trim()); } roomType.Remark = this.txtRemark.Text.Trim(); //修改类型信息 RoomTypeManager.ModifyRoomType(roomType); //转向类型信息预览页 Page.Server.Transfer("ViewRoomType.aspx"); }
private void btndelete_Click(object sender, EventArgs e) { if (dgvshow.SelectedCells.Count == 0) { return; } if (DialogResult.Yes == MessageBox.Show("你确定要删除吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)) { int roomTypeid = Convert.ToInt32(dgvshow.CurrentRow.Cells["TypeID"].Value); if (RoomTypeManager.DeleteRoomType(roomTypeid) > 0) { MessageBox.Show("删除成功"); getAllRoomTyoe(); } else { MessageBox.Show("删除失败"); } } }
public void RoomtyoeName() { //创建数据集 DataSet ds = new DataSet(); ds = RoomTypeManager.GetAllRoomTypeList(); DataRow row = ds.Tables[0].NewRow(); row[0] = -1; row[1] = "--请选择--"; //向第一回添加请选择 ds.Tables[0].Rows.InsertAt(row, 0); //指定数据源 cmbTypeName.DataSource = ds.Tables[0]; //显示的值 cmbTypeName.DisplayMember = "TypeName"; //实际值 cmbTypeName.ValueMember = "TypeID"; }
private void txtRoomNo_TextChanged(object sender, EventArgs e) { try { Room r = RoomManager.SelectRoomByRoomNo(txtRoomNo.Text); RoomType t = RoomTypeManager.SelectRoomTypeByRoomNo(txtRoomNo.Text); txtType.Text = t.RoomName; txtMoney.Text = r.RoomMoney.ToString(); txtRoomPosition.Text = r.RoomPosition; txtState.Text = r.RoomState; txtState.Text = RoomManager.SelectRoomStateNameByRoomNo(txtRoomNo.Text).ToString(); } catch { txtType.Text = ""; txtMoney.Text = ""; txtRoomPosition.Text = ""; txtState.Text = ""; txtState.Text = ""; } }
/// <summary> /// 根据所选客房类型动态得到客房价格 /// </summary> //private void cboTypeName_SelectedIndexChanged(object sender, EventArgs e) //{ // if (!String.IsNullOrEmpty(this.cboTypeName.Text)) // { // this.txtPrice.Text = RoomTypeManager.GetRoomPriceByTypeName(this.cboTypeName.Text.Trim()); // } //} /// <summary> /// 通过单击客房信息得到客房ID /// </summary> private void dgvRoom_CellClick(object sender, DataGridViewCellEventArgs e) { //设置内容编辑区 this.Height = 531; this.pnlContent.Visible = true; //获取双击客房信息的ID roomId = dgvRoom.Rows[e.RowIndex].Cells["ID"].Value.ToString(); //调用业务逻辑层通过客房ID得到客房信息 room = RoomManager.GetRoomByRoomId(Convert.ToInt32(roomId)); //将客房信息回绑到编辑控件 this.txtRoomNO.Text = room.Number; this.txtGuestNumber.Text = Convert.ToString(room.GuestNumber); this.txtBed.Text = Convert.ToString(room.BedNumber); this.cboState.Text = room.State; this.txtDescription.Text = room.Description; //调用业务逻辑层通过客房类型ID得到客房类型信息 roomType = RoomTypeManager.GetRoomTypeByTypeID(room.TypeID); //回绑客房类型信息 this.cboTypeName.Text = roomType.TypeName; this.txtPrice.Text = Convert.ToString(roomType.TypePrice); }
/// <summary> /// 保存客房类型信息 /// </summary> private void tsbtnSave_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.txtType.Text)) { MessageBox.Show("类型名称不能为空!", "提交提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (IsWholeNumber(this.txtPrice.Text.Trim())) { MessageBox.Show("请输入有效的价格!", "提交提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (IsWholeNumber(this.txtAddBedPrice.Text.Trim())) { MessageBox.Show("请输入有效的加床价格!", "提交提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } //提示信息 string message = string.Empty; //用实体对象封装信息 roomType.TypeName = this.txtType.Text.Trim(); roomType.TypePrice = Convert.ToDecimal(this.txtPrice.Text.Trim()); roomType.AddBedPrice = Convert.ToDecimal(this.txtAddBedPrice.Text.Trim()); if (this.chkIsAddBed.Checked) { roomType.IsAddBed = "是"; } else { roomType.IsAddBed = "否"; } roomType.Remark = this.txtRemark.Text.Trim(); //调用业务逻辑客房类型信息增加功能 message = RoomTypeManager.AddRoomType(roomType).ToString(); //刷新房屋信息列表 BindRoomTypeList(); //弹出提示信息框 MessageBox.Show(message, "提交提示", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void btnxg_Click(object sender, EventArgs e) { try { Check(); //实例化实体对象 RoomType rt = new RoomType(); //把dgvshow行中列名TypeID的值赋给TypeID rt.TypeID = Convert.ToInt32(dgvshow.CurrentRow.Cells["TypeID"].Value); rt.TypeName = txtname.Text.Trim(); rt.TypePrice = Convert.ToDecimal(txtprice.Text.Trim()); //调用添加方法 RoomTypeManager.UpdateRoomType(rt); getAllRoomTyoe(); MessageBox.Show("修改成功"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// 单击客房信息列表某行获得客房类型ID /// </summary> private void dgvRoomType_CellClick(object sender, DataGridViewCellEventArgs e) { //显示编辑区 this.pnlRoomTypeContent.Visible = true; this.Height = 498; //获取客房类型ID typeID = dgvRoomType.Rows[e.RowIndex].Cells["ID"].Value.ToString(); //调用业务逻辑层通过类型ID得到客房类型信息 roomType = RoomTypeManager.GetRoomTypeByTypeID(Convert.ToInt32(typeID)); //回绑数据 this.txtType.Text = roomType.TypeName.Trim(); this.txtPrice.Text = Convert.ToString(roomType.TypePrice); this.txtAddBedPrice.Text = Convert.ToString(roomType.AddBedPrice); if (roomType.IsAddBed.Trim() == "是") { this.chkIsAddBed.Checked = true; } else { this.chkIsAddBed.Checked = false; } this.txtRemark.Text = roomType.Remark; }
/// <summary> /// 根据类型ID得到类型名称 /// </summary> public string GetRoomType(string typeID) { return(RoomTypeManager.GetTypeNameByTypeID(Convert.ToInt32(typeID))); }
public void BindRoomType() { this.gvRoomType.DataSource = RoomTypeManager.GetAllRoomType(); this.gvRoomType.DataBind(); }