Esempio n. 1
0
    /// <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 = "客房类型创建失败!";
            }
        }
    }
Esempio n. 2
0
 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);
     }
 }
Esempio n. 3
0
        /// <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);
        }