/// <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> /// 按照TypeID,更新 /// </summary> /// <returns></returns> public bool UpdateRoomType(RoomTypeBean data) { if (rtd.UpdateRoomInfo(data) > 0) { return(true); } return(false); }
RoomTypeDAO rtd = new RoomTypeDAO(); //数据层 /// <summary> /// 添加房间类型 /// </summary> /// <param name="rtb"></param> /// <returns></returns> public bool AddRoomType(RoomTypeBean rtb) { if (rtd.AddRoomType(rtb) > 0) { return(true); } return(false); }
private SqlParameter para; //参数 /// <summary> /// 添加房间类型 /// </summary> /// <param name="rtb"></param> /// <returns></returns> public int AddRoomType(RoomTypeBean rtb) { int count = 0; try { SqlParameter[] sp = { para = new SqlParameter("@TypeName", rtb.TypeName), para = new SqlParameter("@TypePrice", rtb.TypePrice), para = new SqlParameter("@IsTv", rtb.IsTv), para = new SqlParameter("@IsKongTiao", rtb.IsKongTiao), para = new SqlParameter("@Remark", rtb.Remark) }; count = sh.RunSql("AddRoomType", sp); } catch (Exception ex) { throw ex; } return(count); }
/// <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); }