// GET: Rooms/Delete/5 public ActionResult Delete(int id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var roomBll = new RoomBLL(); Room room = roomBll.GetById(id); if (room == null) { return(HttpNotFound()); } return(View(room)); }
protected void ddlRt_Id_SelectedIndexChanged(object sender, EventArgs e) { ddlR_Id.DataSource = RoomBLL.AllData(" and Rt_Id=" + ddlRt_Id.SelectedValue + " and R_State='空'"); ddlR_Id.DataTextField = "R_No"; ddlR_Id.DataValueField = "R_Id"; ddlR_Id.DataBind(); if (ddlR_Id.Items.Count == 0) { btnUpdate.Enabled = false; } else { btnUpdate.Enabled = true; } }
public ActionResult GetUnitInfo(string building_id) { RoomBLL bll = new RoomBLL(); int ret = bll.GetUnitInfo(Utils.GetCookie("property_id"), building_id); if (ret == 0) { return(Error("未找到该楼栋下空房间!")); } else { return(Success("导出成功。")); } }
public ActionResult GetPageListByRoomJson(Pagination pagination, string queryJson) { var watch = CommonHelper.TimerStart(); RoomBLL bll = new RoomBLL(); var data = bll.GetPageList(pagination, queryJson); var jsonData = new { rows = data, total = pagination.total, page = pagination.page, records = pagination.records, costtime = CommonHelper.TimerEnd(watch) }; return(ToJsonResult(jsonData)); }
/// <summary> /// 获取列表 /// </summary> /// <param name="type">leix</param> /// <param name="id">查询参数</param> /// <returns>返回列表Json</returns> public ActionResult GetListJson(int type, string id) { RoomBLL bll = new RoomBLL(); if (type == 2) { if (!string.IsNullOrEmpty(Utils.GetCookie("property_id"))) { id = Utils.GetCookie("property_id"); } } bll.GetListByFee(type, id); return(Success("导出成功。")); }
public void updateState(RoomBLL updatedRoom) { RoomDAL roomDAL = new RoomDAL { number = updatedRoom.number, stage = updatedRoom.stage, state = updatedRoom.state, block = updatedRoom.block, capacity = updatedRoom.capacity, amountOfStudents = updatedRoom.amountOfStudents }; PGRoomRepository repository = repositoryFactory.getRoomRepository(); repository.updateState(roomDAL); }
//显示房间信息 public void ShowRoom() { this.dgvRooms.AutoGenerateColumns = false; if (this.txtSearchByRoomId.Text.Trim().Length == 0) { try { this.dgvRooms.DataSource = new BindingList <Room>(RoomBLL.GetRoomsByRoomType()); Showtext(); } catch (Exception ex) { MessageBox.Show("获取房间信息出现异常\n" + ex.Message, "系统提示 ", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { try { this.dgvRooms.DataSource = new BindingList <Room>(RoomBLL.GetRoomsByRoomType(null, this.txtSearchByRoomId.Text.Trim())); Showtext(); } catch (Exception ex) { MessageBox.Show("获取房间信息出现异常\n" + ex.Message, "系统提示 ", MessageBoxButtons.OK, MessageBoxIcon.Information); } } if (this.dgvRooms.RowCount < 1) { return; } //判断是否结账来显示不同的颜色 foreach (DataGridViewRow row in this.dgvRooms.Rows) { if (row.Cells["colReside"].Value.ToString() == "维修") { row.DefaultCellStyle.ForeColor = Color.Red;//DataGridViewRow的字体风格、颜色 } if (row.Cells["colReside"].Value.ToString() == "入住") { row.DefaultCellStyle.ForeColor = Color.Blue; } } }
/// <summary> /// GridView绑定 /// </summary> /// <param name="intCurrentIndex"></param> private void Bind(int intCurrentIndex) { TB_Room mTB_Room = new TB_Room(); RoomBLL mRoomBLL = new RoomBLL(); Pager pager = new Pager(); pager.CurrentPageIndex = intCurrentIndex; pager.srcOrder = " ID desc"; mTB_Room.SiteID = (base.UserInfo == null ? base.SystemAdminInfo.SiteID : base.UserInfo.SiteID); mTB_Room.DormAreaID = Convert.ToInt32(this.ddlDormArea.SelectedValue); mTB_Room.BuildingID = Convert.ToInt32(Request.Form[this.ddlBuildingName.UniqueID.ToString()]); mTB_Room.UnitID = Convert.ToInt32(Request.Form[this.ddlUnit.UniqueID.ToString()]); mTB_Room.FloorID = Convert.ToInt32(Request.Form[this.ddlFloor.UniqueID.ToString()]); GridView1.DataSource = mRoomBLL.GetDormInfoBySiteID(2);// GetUnLockRoom(mTB_Room, ref pager); GridView1.DataBind(); MergeRow(GridView1, 0, 3); }
public ActionResult GetInfoJson(string keyValue) { string property_id = ""; if (!string.IsNullOrEmpty(Utils.GetCookie("property_id"))) { property_id = Utils.GetCookie("property_id"); } RoomBLL bll = new RoomBLL(); var data = bll.GetInfo(keyValue, property_id); RoomModelEntity rm = new RoomModelEntity(); foreach (RoomModelEntity item in data) { rm = item; break; } return(ToJsonResult(rm)); }
/// <summary> /// 添加,修改 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnUpdate_Click(object sender, EventArgs e) { if (btnUpdate.Text == "添加") { Room model = new Room(); model.R_No = txtNo.Value.Trim(); model.R_State = ddlState.SelectedValue; model.R_Tel = txtTel.Value.Trim(); model.Rt_Id = Convert.ToInt32(ddlRt_Id.SelectedValue); if (RoomBLL.AddRoom(model) > 0) { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('添加成功!');window.location.replace('RoomManage.aspx');</script>"); return; } else { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('添加失败!');</script>"); return; } } else { Room model = RoomBLL.GetIdByRoom(Convert.ToInt32(Request.QueryString["id"])); model.R_No = txtNo.Value.Trim(); model.R_State = ddlState.SelectedValue; model.R_Tel = txtTel.Value.Trim(); model.Rt_Id = Convert.ToInt32(ddlRt_Id.SelectedValue); if (RoomBLL.UpdateRoom(model) > 0) { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('修改成功!');window.location.replace('RoomManage.aspx');</script>"); return; } else { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('修改失败!');</script>"); return; } } }
public ActionResult SaveOutForm(string owner_id, string room_id) { if (!string.IsNullOrEmpty(owner_id) && !string.IsNullOrEmpty(room_id)) { FeeincomeBLL bll = new FeeincomeBLL(); int count = bll.IsQianFei(room_id, owner_id, 1); if (count > 0) { return(Error("该单元业主还有未收费用不能出户!")); } else { RoomBLL bll_r = new RoomBLL(); bll_r.SaveOutFrom(room_id, owner_id); return(Success("操作成功。")); } } else { return(Error("请选择出户单元!")); } }
/// <summary> /// 显示房间下拉框 /// </summary> public void ShowRoom() { try { this.cboRooms.DisplayMember = "Description"; this.cboRooms.ValueMember = "RoomID"; List <Room> rooms = RoomBLL.GetNullRooms(); if (rooms.Count <= 0) { rooms.Insert(0, new Room(-1, "房间已满")); this.btnOk.Enabled = false; } else { rooms.Insert(0, new Room(-1, "请选择房间")); } this.cboRooms.DataSource = new BindingList <Room>(rooms); } catch (Exception ex) { MessageBox.Show("获取房间下拉框出现异常\n" + ex.Message, "系统提示 ", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
protected void ddlRt_Id_SelectedIndexChanged(object sender, EventArgs e) { if (ddlRt_Id.SelectedValue != "0") { lblShow.Visible = true; List <Room> listCount = RoomBLL.AllData(" and Rt_Id =" + ddlRt_Id.SelectedValue + " and R_State='空'"); if (listCount.Count != 0) { lblShow.Text = "仅剩" + +listCount.Count + "间空房"; btnUpdate.Enabled = true; } else { lblShow.Text = "已无空房"; btnUpdate.Enabled = false; } } else { btnUpdate.Enabled = true; lblShow.Visible = false; } }
public ActionResult GetRoomTreeJson(string keyValue, int Type = 1) { RoomBLL bll = new RoomBLL(); var data = bll.GetTreeList(keyValue, Type); var treeList = new List <TreeEntity>(); foreach (RoomEntity item in data) { TreeEntity tree = new TreeEntity(); bool hasChildren = false;//data.Count(t => t.ParentId == item.ItemDetailId) == 0 ? false : true; tree.id = item.room_id; tree.text = item.room_name; tree.value = item.owner_id; tree.Attribute = "building_dim"; tree.AttributeValue = string.Format("{0:0.##}", item.building_dim); tree.parentId = "0"; tree.isexpand = true; tree.complete = true; tree.hasChildren = hasChildren; treeList.Add(tree); } return(Content(treeList.TreeToJson())); }
private void btnAdd_Click(object sender, RoutedEventArgs e) { var op = RoomBLL.Add(new Room() { Availaibility = Models.Enums.Availability.Available, RoomNumber = txtRoomNumber.Text, RoomDescription = txtDesc.Text, Occupants = txtOccupants.Text, Pricing = int.Parse(txtPrice.Text) }); if (op.Code != "200") { MessageBox.Show("Error : " + op.Message); } else { MessageBox.Show("Customer is successfully added to table"); } myParentWindow.showData(); this.Close(); }
private void BindDDLRoomByBuildingID(int intBuildingID) { if (intBuildingID > 0) { RoomBLL mRoomBLL = new RoomBLL(); this.ddlRoom.DataValueField = TB_Room.col_ID; this.ddlRoom.DataTextField = TB_Room.col_Name; this.ddlRoom.DataSource = mRoomBLL.GetRoomByBuildingID(intBuildingID); this.ddlRoom.DataBind(); this.ddlRoom.Items.Insert(0, new ListItem() { Value = "0", Text = "--请选择--" }); } else { this.ddlRoom.Items.Clear(); this.ddlRoom.Items.Insert(0, new ListItem() { Value = "0", Text = "--请选择--" }); } }
private void LoadListRoom() { RoomBLL roomBll = new RoomBLL(); // load list room in house dgvRoom.DataSource = null; dgvRoom.DataSource = roomBll.findByHouseId(houseId); dgvRoom.Columns["Id"].Visible = false; dgvRoom.Columns["HouseId"].Visible = false; dgvRoom.Columns["ElectricMoney"].Visible = false; dgvRoom.Columns["WaterMoney"].Visible = false; dgvRoom.Columns["NetworkMoney"].Visible = false; dgvRoom.Columns["OtherMoney"].Visible = false; dgvRoom.Columns["NetworkMoneyType"].Visible = false; dgvRoom.Columns["WaterMoneyType"].Visible = false; dgvRoom.Columns["LastElectricNumber"].Visible = false; dgvRoom.Columns["LastWaterNumber"].Visible = false; dgvRoom.Columns[2].HeaderCell.Value = "Tên phòng"; dgvRoom.Columns[3].HeaderCell.Value = "Tiền phòng"; dgvRoom.Columns[12].HeaderCell.Value = "Người thuê"; dgvRoom.Columns[13].HeaderCell.Value = "Mô tả"; dgvRoom.Columns[14].HeaderCell.Value = "Trạng thái"; }
//删除选中项 protected void BtnAllDel_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(HSelectID.Value.Trim())) { try { string a = HSelectID.Value.Trim(); string[] b = a.Split(new char[] { ',' }); int i = 0; foreach (string c in b) { i++; RoomBLL.DeleteRoom(Convert.ToInt32(c)); } this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('已成功删除" + i + "条!');location=location;</script>"); return; } catch { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('删除失败,请与技术人员联系!');</script>"); return; } } }
/// <summary> /// 添加,修改 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnUpdate_Click(object sender, EventArgs e) { if (btnUpdate.Text == "添加") { Live model = new Live(); model.L_Deposit = Convert.ToDecimal(txtDeposit.Value.Trim()); model.L_IdCard = txtIdCard.Value.Trim(); model.L_Name = txtName.Value.Trim(); model.L_No = txtNo.Value.Trim(); model.L_OutTime = Convert.ToDateTime("1900-01-01"); model.L_Pay = 0; model.L_State = "未结算"; model.L_Tel = txtTel.Value.Trim(); model.L_Time = Convert.ToDateTime(txtTime.Value); model.L_Total = 0; model.R_Id = Convert.ToInt32(ddlR_Id.SelectedValue); model.U_Id = users.U_Id; if (LiveBLL.AddLive(model) > 0) { Room room = RoomBLL.GetIdByRoom(Convert.ToInt32(ddlR_Id.SelectedValue)); room.R_State = "入住"; RoomBLL.UpdateRoom(room); Orders ord = OrdersBLL.GetIdByOrders(Convert.ToInt32(Request.QueryString["id"])); ord.O_State = "已入住"; OrdersBLL.UpdateOrders(ord); this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('添加成功!');window.location.replace('OrdersJoin.aspx');</script>"); return; } else { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('添加失败!');</script>"); return; } } }
// GET: Rooms public ActionResult Index() { var roomBll = new RoomBLL(); return(View(roomBll.List())); }
//保存 private void tsmiSave_Click(object sender, EventArgs e) { if (this.txtRoomName.Text.Trim().Length == 0) { MessageBox.Show("房号不能为空!", "系统提示 ", MessageBoxButtons.OK, MessageBoxIcon.Information); this.txtRoomName.Focus(); return; } if (this.txtBedNum.Text.Trim().Length == 0) { MessageBox.Show("床位数不能为空!", "系统提示 ", MessageBoxButtons.OK, MessageBoxIcon.Information); this.txtBedNum.Focus(); return; } if (this.txtDescription.Text.Trim().Length == 0) { MessageBox.Show("房间描述不能为空!", "系统提示 ", MessageBoxButtons.OK, MessageBoxIcon.Information); this.txtDescription.Focus(); return; } if (!CheckNum.CheckStringIsNum(this.txtBedNum.Text.Trim()) || this.txtBedNum.Text.Contains(".")) { MessageBox.Show("您的输入有误,床位数必须为数字类型,不能包含其他字符!", "系统提示 ", MessageBoxButtons.OK, MessageBoxIcon.Information); this.txtBedNum.Clear(); this.txtBedNum.Focus(); return; } if (Convert.ToInt32(this.txtBedNum.Text.Trim()) <= 0) { MessageBox.Show("床位数必须大于0!", "系统提示 ", MessageBoxButtons.OK, MessageBoxIcon.Information); this.txtBedNum.Clear(); this.txtBedNum.Focus(); return; } //根据新增或修改分开操作 //修改 if (this.FormType == "修改") { if (!Checkdgv()) { return; } if (this.dgvRooms.CurrentRow.DataBoundItem == null) { return; } //判断是否有这个房间号 try { if (this.txtRoomName.Text.Trim() != (this.dgvRooms.CurrentRow.DataBoundItem as Room).RoomName) { if (RoomBLL.CheckRoomNameByEditRoom(this.txtRoomName.Text.Trim())) { MessageBox.Show("对不起,已经有这个房间号了!", "系统提示 ", MessageBoxButtons.OK, MessageBoxIcon.Information); this.txtRoomName.Clear(); this.txtRoomName.Focus(); return; } } } catch (Exception ex) { MessageBox.Show("判断是否有这个房间号出现异常\n" + ex.Message, "系统提示 ", MessageBoxButtons.OK, MessageBoxIcon.Information); } int roomId = (this.dgvRooms.CurrentRow.DataBoundItem as Room).RoomId; Room room = new Room( roomId, this.txtRoomName.Text.Trim(), Convert.ToInt32(this.txtBedNum.Text.Trim()), this.txtDescription.Text.Trim(), this.cboRoomType.SelectedItem as RoomType//下拉框当前房间类型对象 ); try { if (RoomBLL.UpdateRoom(room)) { ShowRoom(); ExeuceTextReanOnly(); this.tsmiSave.Enabled = false; this.tsmiAdd.Enabled = true; } else { MessageBox.Show("您的操作有误,修改房间失败!", "系统提示 ", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show("修改房间出现异常\n" + ex.Message, "系统提示 ", MessageBoxButtons.OK, MessageBoxIcon.Information); } } //新增 else if (this.FormType == "新建") { if (RoomBLL.CheckRoomNameByEditRoom(this.txtRoomName.Text.Trim())) { MessageBox.Show("对不起,已经有这个房间号了!", "系统提示 ", MessageBoxButtons.OK, MessageBoxIcon.Information); this.txtRoomName.Clear(); this.txtRoomName.Focus(); return; } Room room = new Room( 0, this.txtRoomName.Text.Trim(), Convert.ToInt32(this.txtBedNum.Text.Trim()), this.txtDescription.Text.Trim(), this.cboRoomType.SelectedItem as RoomType//下拉框当前房间类型对象 ); try { if (RoomBLL.AddRoom(room)) { ShowRoom(); ExeuceTextReanOnly(); this.tsmiSave.Enabled = false; this.tsmiUpdate.Enabled = true; } else { MessageBox.Show("您的操作有误,新增房间失败!", "系统提示 ", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show("新增房间出现异常\n" + ex.Message, "系统提示 ", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
public FormSearchRoom() { InitializeComponent(); _roomBLL = new RoomBLL(); room = new Room(); }
public FormRegisterRoom() { InitializeComponent(); _roomBLL = new RoomBLL(); }
//分页查找 private void BindData(string strClass) { int nowPage = 1; switch (strClass) { case "next": nowPage = Convert.ToInt32(HNowPage.Value) + 1; break; case "up": nowPage = Convert.ToInt32(HNowPage.Value) - 1; break; case "end": nowPage = Convert.ToInt32(HAllPage.Value); break; default: nowPage = 1; break; } if (Convert.ToInt32(HAllPage.Value) <= 1) { LBEnd.Enabled = false; LBHome.Enabled = false; LBNext.Enabled = false; LBUp.Enabled = false; } else if (nowPage == 1) { LBHome.Enabled = false; LBUp.Enabled = false; LBNext.Enabled = true; LBEnd.Enabled = true; } else if (nowPage == Convert.ToInt32(HAllPage.Value)) { LBHome.Enabled = true; LBUp.Enabled = true; LBNext.Enabled = false; LBEnd.Enabled = false; } else { LBEnd.Enabled = true; LBHome.Enabled = true; LBNext.Enabled = true; LBUp.Enabled = true; } if (ddlRt_Id.SelectedValue != "全部") { strWhere += " and Rt_Id=" + ddlRt_Id.SelectedValue; } if (ddlState.SelectedValue != "全部") { strWhere += " and R_State= '" + ddlState.SelectedValue + "'"; } if (txtNo.Value.Length != 0) { strWhere += " and R_No like '%" + txtNo.Value.Trim() + "%'"; } if (txtTel.Value.Length != 0) { strWhere += " and R_Tel like '%" + txtTel.Value.Trim() + "%'"; } this.RpNews.DataSource = RoomBLL.PageSelectRoom(Convert.ToInt32(HCount.Value), nowPage, strWhere, "R_Id", "asc"); this.RpNews.DataBind(); HNowPage.Value = nowPage.ToString(); PageMes.Text = string.Format("每页{0}条 第{1}页/共{2}页 共{3}条", HCount.Value, nowPage.ToString(), HAllPage.Value, HPageSize.Value); }