/// <summary> /// 修改房间信息 /// </summary> private void UpdateRoom() { //得到表单提交的值 RoomTypeBean rb = new RoomTypeBean(); RoomTypeBLL bll = new RoomTypeBLL(); //分别给实体Bean赋值 //rb.TypeName = Request.Form["TypeName"]; rb.TypeId = int.Parse(Request.Form["TypeId"].ToString()); rb.TypePrice = double.Parse(Request.Form["TypePrice"].ToString()); //rb.IsTv = Request.Form["IsTv"]; //rb.IsKongTiao = Request.Form["IsKongTiao"]; rb.Remark = Request.Form["remark"]; string json; //如果success为true,则表示服务器端处理成功 if (bll.UpdateRoomType(rb)) { json = @"{success: true}"; } else { json = @"{success: false}"; } Response.Write(json); }
/// <summary> /// 绑定类型 /// </summary> private void BindType() { ddlRt_Id.DataSource = RoomTypeBLL.AllData(""); ddlRt_Id.DataTextField = "Rt_Name"; ddlRt_Id.DataValueField = "Rt_Id"; ddlRt_Id.DataBind(); }
private void 设置_Load(object sender, EventArgs e) { comboBox1.Items.Clear(); comboBox1.Items.Add("全部"); List <RoomTypeMDL> list = RoomTypeBLL.getlist(); foreach (RoomTypeMDL item in list) { ListViewItem lv = new ListViewItem(item.rtname.ToString()); lv.SubItems.Add(item.rtmount.ToString()); lv.SubItems.Add(item.rtid.ToString()); listView1.Items.Add(lv); comboBox1.Items.Add(item.rtname); } comboBox1.SelectedIndex = 0; List <TablesMDL> list1 = TablesBLL.getlist(null); listView2.Items.Clear(); foreach (TablesMDL item in list1) { ListViewItem lv = new ListViewItem(item.tablename.ToString()); lv.SubItems.Add(item.rtid); lv.SubItems.Add(item.tablestate.ToString()); lv.SubItems.Add(item.tablearea.ToString()); lv.SubItems.Add(item.tableid.ToString()); listView2.Items.Add(lv); } }
private void button3_Click(object sender, EventArgs e) { if (this.lv1.SelectedItems.Count != 1) { MessageBox.Show("还没选择项"); } else { DialogResult a = MessageBox.Show(this, "是否删除", "删除", MessageBoxButtons.YesNo, MessageBoxIcon.Stop); if (a == DialogResult.Yes) { Comm.name = this.lv1.SelectedItems[0].Text; // MessageBox.Show(comm.name); bool b = RoomTypeBLL.database(Comm.name); if (b == true) { MessageBox.Show("成功"); this.lv1.Items.Clear(); SX(); } else { MessageBox.Show("失败"); } } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["Users"] != null) { users = (Users)Session["Users"]; } else { users = null; Response.Write("<script>parent.window.location.href='Login.aspx'</script>"); } if (!IsPostBack) { if (Request.QueryString["id"] != null) { RoomType model = RoomTypeBLL.GetIdByRoomType(Convert.ToInt32(Request.QueryString["id"])); if (model != null && model.Rt_Id != 0) { txtName.Value = model.Rt_Name.Trim(); txtPrice.Value = model.Rt_Price.ToString().Trim(); txtNote.Value = model.Rt_Note.Trim(); } strNav = "修改客房类型"; btnUpdate.Text = "修改"; } } }
/// <summary> /// 查询今日房价 /// </summary> private void GetTodyPrice() { RoomTypeBLL rtBll = new RoomTypeBLL(); string str = rtBll.GetTodyPrice(); strJson = str; }
//删除 private void toolStripButton4_Click(object sender, EventArgs e) { if (!Checkdgv()) { return; } if (MessageBox.Show("您确认要删除此房间类型吗?", "系统提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } if (this.dgvRoomTypes.CurrentRow.DataBoundItem == null) { return; } RoomType rt = this.dgvRoomTypes.CurrentRow.DataBoundItem as RoomType; try { if (RoomTypeBLL.DelRoomType(rt.TypeID)) { ShowRoomTypes(); } else { MessageBox.Show("该房间类型的房间正在使用中,不能删除", "系统提示 ", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show("删除房间类型出现异常\n" + ex.Message, "系统提示 ", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// 绑定类型 /// </summary> private void BindType() { ddlRt_Id.DataSource = RoomTypeBLL.AllData(""); ddlRt_Id.DataTextField = "Rt_Name"; ddlRt_Id.DataValueField = "Rt_Id"; ddlRt_Id.DataBind(); ddlRt_Id.Items.Insert(0, new ListItem("全部", "全部")); }
//分页查找 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; } this.RpNews.DataSource = RoomTypeBLL.PageSelectRoomType(Convert.ToInt32(HCount.Value), nowPage, strWhere, "Rt_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); }
/// <summary> /// 下拉框绑定 /// </summary> private void ddlBind(DataTable dtBuildingName) { Pager mPager = null; #region 宿舍区 //DormAreaBLL mDormAreaBLL = new DormAreaBLL(); //this.ddlDormArea.DataValueField = TB_DormArea.col_ID; //this.ddlDormArea.DataTextField = TB_DormArea.col_Name; //this.ddlDormArea.DataSource = mDormAreaBLL.GetTable(new TB_DormArea() { SiteID = (base.UserInfo == null ? base.SystemAdminInfo.SiteID : base.UserInfo.SiteID) }, ref mPager); //this.ddlDormArea.DataBind(); //this.ddlDormArea.Items.Insert(0, new ListItem() { Value = "0", Text = "--请选择--" }); #endregion #region 楼栋 this.ddlBuildingName.DataSource = dtBuildingName.DefaultView; this.ddlBuildingName.DataValueField = TB_DormArea.col_ID; this.ddlBuildingName.DataTextField = TB_DormArea.col_Name; this.ddlBuildingName.DataBind(); this.ddlBuildingName.Items.Insert(0, new ListItem() { Value = "0", Text = "--请选择--" }); #endregion #region 单元 this.ddlUnit.Items.Insert(0, new ListItem() { Value = "0", Text = "--请选择--" }); #endregion #region 楼层 this.ddlFloor.Items.Insert(0, new ListItem() { Value = "0", Text = "--请选择--" }); #endregion #region 房间类型 RoomTypeBLL mRoomTypeBLL = new RoomTypeBLL(); this.ddlRoomType.DataValueField = TB_RoomType.col_ID; this.ddlRoomType.DataTextField = TB_RoomType.col_Name; this.ddlRoomType.DataSource = mRoomTypeBLL.GetTable(base.UserInfo == null ? base.SystemAdminInfo.SiteID : base.UserInfo.SiteID); this.ddlRoomType.DataBind(); this.ddlRoomType.Items.Insert(0, new ListItem() { Value = "0", Text = "--请选择--" }); #endregion #region 房间号 this.ddlRoom.Items.Insert(0, new ListItem() { Value = "0", Text = "--请选择--" }); #endregion }
/// <summary> /// 加载绑定 /// </summary> public void BindLoad() { int DataCount = RoomTypeBLL.CountNumber(strWhere); //共多少条记录 int hPageSize = (DataCount % Convert.ToInt32(HCount.Value)) != 0 ? DataCount / Convert.ToInt32(HCount.Value) + 1 : DataCount / Convert.ToInt32(HCount.Value); //共多少页 HPageSize.Value = DataCount.ToString(); HAllPage.Value = hPageSize.ToString(); this.RpNews.DataSource = RoomTypeBLL.PageSelectRoomType(Convert.ToInt32(HCount.Value), Convert.ToInt32(HNowPage.Value), strWhere, "Rt_Id", "asc"); this.RpNews.DataBind(); }
/// <summary> /// 绑定类型 /// </summary> private void BindType() { ddlRt_Id.DataSource = RoomTypeBLL.AllData(""); ddlRt_Id.DataTextField = "Rt_Name"; ddlRt_Id.DataValueField = "Rt_Id"; ddlRt_Id.DataBind(); 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(); }
private void FrmChangeTable_Load(object sender, EventArgs e) { this.tbOldName.Text = table.TName; this.cboArea.Text = "一楼"; List <RoomType> list = RoomTypeBLL.selectall(); this.cboRoomType.DisplayMember = "RTNAME"; string id = Comm.id; this.cboRoomType.ValueMember = "RTID"; // this.cboRlou.DisplayMember = "TableArea"; this.cboRoomType.DataSource = list; }
//显示房间类型列表 public void ShowRoomTypes(string roomTypeName = null) { this.dgvRoomTypes.AutoGenerateColumns = false; try { this.dgvRoomTypes.DataSource = new BindingList <RoomType>(RoomTypeBLL.GetRoomType(roomTypeName)); Showtext(); } catch (Exception ex) { MessageBox.Show("查询房间类型出现异常\n" + ex.Message, "系统提示 ", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void FrmTableTs_Load(object sender, EventArgs e) { this.comblou.Text = "一楼"; List <RoomType> list = RoomTypeBLL.selectall(); this.cboRname.DisplayMember = "RTNAME"; string id = Comm.id; this.cboRname.ValueMember = "RTID"; // this.cboRlou.DisplayMember = "TableArea"; this.cboRname.DataSource = list; }
private void frmRoom_Load(object sender, EventArgs e) { try { this.cboRoomType.DisplayMember = "TypeName"; this.cboRoomType.ValueMember = "TypeId"; this.cboRoomType.DataSource = new BindingList <RoomType>(RoomTypeBLL.GetRoomType()); } catch (Exception ex) { MessageBox.Show("获取房间类型下拉框出现异常\n" + ex.Message, "系统提示 ", MessageBoxButtons.OK, MessageBoxIcon.Information); } ShowRoom(); }
//删除 protected void ibDel_ItemDeleting(object sender, EventArgs e) { try { int Id = Convert.ToInt32((sender as LinkButton).CommandArgument); RoomTypeBLL.DeleteRoomType(Id); Response.Write("<script>alert('删除成功!');location=location;</script>"); } catch { Response.Write("<script>alert('删除失败!');</script>"); } }
/// <summary> /// 删除房间类型(根据类型Id) /// </summary> private void DelRoomType() { RoomTypeBLL rtBll = new RoomTypeBLL(); //得到表单提交的值 int TypeId = int.Parse(Request.Form["TypeId"].ToString()); string json; //如果success为true,则表示服务器端处理成功 if (rtBll.DelRoomType(TypeId)) { json = @"{success: true}"; } else { json = @"{success: false}"; } Response.Write(json); }
private void FrmTableX_Load(object sender, EventArgs e) { ///显示组合框 this.txtTname.Text = Comm.name; List <RoomType> list = RoomTypeBLL.selectall(); this.cboRname.DisplayMember = "RTNAME"; string id = Comm.id; this.cboRname.ValueMember = "RTID"; ///默认显示 /// //this.comblou.Text = comm.qu; //this.cboRname.Text = comm.qu; this.comblou.Text = Comm.qu; this.cboRname.DataSource = list; //for (int i = 0; i < this.cboRname.Items.Count; i++) //{ // //this.cboRname.SelectedIndex = i; // if (this.cboRname.SelectedValue.ToString() == comm.leibie.ToString()) // { // //this.cboRname.ValueMember // if (i != 0) // this.cboRname.SelectedIndex = i - 1; // else // this.cboRname.SelectedIndex = i; // } //} string newname = this.txtTname.Text; // string lei = this.cboRname.Text; string shi = this.cboRname.DisplayMember; // int yin=Convert.ToInt32(this.cboRname.ValueMember); //查找类别 }
/// <summary> /// 添加,修改 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnUpdate_Click(object sender, EventArgs e) { if (btnUpdate.Text == "添加") { RoomType model = new RoomType(); model.Rt_Name = txtName.Value.Trim(); model.Rt_Price = Convert.ToDecimal(txtPrice.Value.Trim()); model.Rt_Note = txtNote.Value.Trim(); if (RoomTypeBLL.AddRoomType(model) > 0) { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('添加成功!');window.location.replace('RoomTypeManage.aspx');</script>"); return; } else { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('添加失败!');</script>"); return; } } else { RoomType model = RoomTypeBLL.GetIdByRoomType(Convert.ToInt32(Request.QueryString["id"])); model.Rt_Name = txtName.Value.Trim(); model.Rt_Price = Convert.ToDecimal(txtPrice.Value.Trim()); model.Rt_Note = txtNote.Value.Trim(); if (RoomTypeBLL.UpdateRoomType(model) > 0) { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('修改成功!');window.location.replace('RoomTypeManage.aspx');</script>"); return; } else { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('修改失败!');</script>"); return; } } }
private void button1_Click(object sender, EventArgs e) { string name = this.txtRname.Text; string shu = this.txtcount.Text; if (name == "" && shu == "") { MessageBox.Show(this, "数据不能为空!", "提示"); return; } bool count = RoomTypeBLL.insert(name, shu); if (count == true) { MessageBox.Show("成功"); this.Close(); } else { MessageBox.Show("失败"); } }
private void AddYD_Load(object sender, EventArgs e) { string MaxCB = ConsumerBillBLL.GetMaxDT(); if (MaxCB == "") { MaxCB = "ZD" + DateTime.Now.ToString("yyyyMMdd") + "0000"; } int day = int.Parse(MaxCB.Substring(MaxCB.Length - 4, 4)) + 1; string dayCB = "YD" + DateTime.Now.ToString("yyyyMMdd") + day.ToString().PadLeft(4, '0'); label9.Text = dayCB; List <RoomTypeMDL> list_rt = RoomTypeBLL.selectRoom(); foreach (RoomTypeMDL item in list_rt) { TreeNode tr_r = new TreeNode(); tr_r.Text = item.RTName; tr_r.Tag = item.RTID; List <TablesMDL> list_tb = TablesBLL.selectTable(item.RTID); foreach (TablesMDL item_tb in list_tb) { //只添加可用桌子 if (item_tb.TableState == 0) { TreeNode tr_t = new TreeNode(); tr_t.Text = item_tb.TableName; tr_t.Tag = item_tb.TableID; tr_r.Nodes.Add(tr_t); } } treeView1.Nodes.Add(tr_r); } }
//显示所有房间类型菜单 public void ShowRoomType() { this.tvRoomType.Nodes.Clear(); TreeNode tnRoomType = new TreeNode("房间类型"); try { List <RoomType> roomType = RoomTypeBLL.GetRoomType(); foreach (RoomType rt in roomType) { TreeNode tn = new TreeNode(rt.TypeName); tn.Tag = rt; tnRoomType.Nodes.Add(tn); } tnRoomType.ExpandAll(); this.tvRoomType.Nodes.Add(tnRoomType); } catch (Exception ex) { MessageBox.Show("绑定房间类型菜单出现异常\n" + ex.Message, "系统提示 ", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void button1_Click(object sender, EventArgs e) { if (textBox1.Text == "") { errorProvider1.SetError(textBox1, "房间名称不允许为空"); return; } if (textBox2.Text == "") { errorProvider1.SetError(textBox2, "容纳人数不允许为空"); return; } try { if (RoomTypeMDL.ui == 1) { RoomTypeMDL rt = new RoomTypeMDL(); rt.rtname = textBox1.Text; rt.rtmount = int.Parse(textBox2.Text); RoomTypeBLL.insertroom(rt); this.Close(); } else { List <RoomTypeMDL> list = new List <RoomTypeMDL>(); RoomTypeMDL rt = new RoomTypeMDL(); rt.rtname = textBox1.Text; rt.rtmount = int.Parse(textBox2.Text); rt.rtid = RoomTypeMDL.tid; RoomTypeBLL.updateroom(rt); this.Close(); } } catch (Exception) { MessageBox.Show("发生未只的异常,请联系开发者", "未知异常", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void FrmBatchAddTable_Load(object sender, EventArgs e) { foreach (Control item in this.Controls) { if (item is ComboBox) { item.BackColor = Color.White; } } comboBox2.Items.Add("一楼"); comboBox2.Items.Add("二楼"); comboBox2.Items.Add("三楼"); comboBox2.SelectedIndex = 0; List <RoomTypeMDL> list = RoomTypeBLL.getlist(); comboBox1.DataSource = list; comboBox1.DisplayMember = "RTName"; comboBox1.ValueMember = "RTID"; comboBox1.SelectedIndex = 0; }
//删除选中项 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++; RoomTypeBLL.DeleteRoomType(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; } } }
private void SX() { List <RoomType> list = RoomTypeBLL.selectall(); RoomType p = new RoomType(); p.RTID = "0"; p.RTName = "全部"; list.Add(p); list.Reverse(); this.cbotype.DisplayMember = "RTNAME"; //this.cbotype.ValueMember = " RTID"; string id = Comm.id; this.cbotype.ValueMember = "RTID"; this.cbotype.DataSource = list; foreach (var item in list) { ListViewItem lvi = new ListViewItem(item.RTName.ToString()); lvi.SubItems.Add(item.RTMount); this.lv1.Items.Add(lvi); } }
/// <summary> /// 添加房间类型 /// </summary> private void AddRoomType() { RoomTypeBLL rtBll = new RoomTypeBLL(); RoomTypeBean rtb = new RoomTypeBean(); //得到表单提交的值 rtb.TypeName = Request.Form["TypeName"]; rtb.TypePrice = double.Parse(Request.Form["TypePrice"].ToString()); rtb.IsTv = Request.Form["IsTv"]; rtb.IsKongTiao = Request.Form["IsKongTiao"]; rtb.Remark = Request.Form["remark"]; string json; //如果success为true,则表示服务器端处理成功 if (rtBll.AddRoomType(rtb)) { json = @"{success: true}"; } else { json = @"{success: false}"; } Response.Write(json); }
private void FrmEditTable_Load(object sender, EventArgs e) { comboBox2.Items.Add("一楼"); comboBox2.Items.Add("二楼"); comboBox2.Items.Add("三楼"); comboBox2.SelectedIndex = 0; List <RoomTypeMDL> list = RoomTypeBLL.getlist(); comboBox1.DataSource = list; comboBox1.DisplayMember = "RTName"; comboBox1.ValueMember = "RTID"; comboBox1.SelectedIndex = 0; if (TablesMDL.ui == 1) { this.Text = "餐台添加"; label4.Text = "餐台添加"; } else { this.Text = "修改餐台"; label4.Text = "修改餐台"; textBox1.Text = TablesMDL.tbname; } }
private void button3_Click(object sender, EventArgs e) { if (listView1.SelectedItems.Count > 0) { //判断房间类型是否有桌子 List <TablesMDL> list = TablesBLL.selectTable(Convert.ToInt32(listView1.SelectedItems[0].SubItems[2].Text)); //判断 if (list.Count > 0) { new Warning("无法删除有餐桌的房间", 图标.Erro).Show(); return; } RoomTypeMDL rt1 = new RoomTypeMDL(); rt1.rtid = Convert.ToInt32(listView1.SelectedItems[0].SubItems[2].Text); RoomTypeBLL.deleteroom(rt1); listView1.Items.Clear(); listView2.Items.Clear(); 设置_Load(null, null); } else { MessageBox.Show("请选中一项数据"); } }