private void fillHotelRoom() { string Error = ""; DBHotelRoom roomObj = new DBHotelRoom(); DataTable table = roomObj.getAllHotelRoom(ref Error); GridViewHotelRoom.DataSource = table; GridViewHotelRoom.DataBind(); }
protected void GridViewHotelRoom_RowDeleting(object sender, GridViewDeleteEventArgs e) { int TypeID = Int32.Parse(GridViewHotelRoom.DataKeys[e.RowIndex].Value.ToString()); string Error = ""; DBHotelRoom cityObj = new DBHotelRoom(); cityObj.deleteHotelRoom(TypeID, ref Error); if (Error != "") { Response.Write(Error); } else { fillHotelRoom(); } }
protected void GridViewHotelRoom_RowUpdating(object sender, GridViewUpdateEventArgs e) { int HotelRoomID = Int32.Parse(GridViewHotelRoom.DataKeys[e.RowIndex].Value.ToString()); string Error = ""; DBHotelRoom cityObj = new DBHotelRoom(); int NoOfRoom = Convert.ToInt32(((TextBox)GridViewHotelRoom.Rows[e.RowIndex].FindControl("TextBoxNoOfRoom")).Text); double price = Double.Parse(((TextBox)GridViewHotelRoom.Rows[e.RowIndex].FindControl("TextBoxPrice")).Text); cityObj.updateHotelRoom(HotelRoomID, NoOfRoom, price, ref Error); if (Error != "") { Response.Write(Error); } else { GridViewHotelRoom.EditIndex = -1; fillHotelRoom(); } }
protected void GridViewHotel_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { int HotelID = Convert.ToInt32(GridViewHotel.DataKeys[e.Row.RowIndex].Value.ToString()); string Error = ""; DBHotelRoom roomObj = new DBHotelRoom(); DataTable table = roomObj.getAllHotelRoomByHotel(HotelID, ref Error); if (Error != "") { Response.Write(Error); } else { GridView inner = (GridView)e.Row.FindControl("GridViewRooms"); inner.DataSource = table; inner.DataBind(); } } }
protected void ButtonAdd_Click(object sender, EventArgs e) { string Error = ""; DBHotelRoom typeObj = new DBHotelRoom(); int RoomTypeID = Convert.ToInt32(DropDownListRoomType.SelectedValue); int HotelID = Convert.ToInt32(DropDownListHotel.SelectedValue); int NoOfRoom = Convert.ToInt32(TextBoxNoOFRooms.Text); double RoomPrice = Convert.ToInt64(TextBoxPrice.Text); typeObj.addHotelRoom(RoomTypeID, HotelID, NoOfRoom, RoomPrice, ref Error); if (Error != "") { Response.Write(Error); } else { TextBoxNoOFRooms.Text = ""; TextBoxPrice.Text = ""; fillHotelRoom(); } }