private void fillRoomType()
    {
        string      Error = "";
        DBHotelType obj   = new DBHotelType();
        DataTable   table = obj.getAllRoomType(ref Error);

        GridViewRoomType.DataSource = table;
        GridViewRoomType.DataBind();
    }
Exemple #2
0
    private void fillRoomType()
    {
        string      Error   = "";
        DBHotelType typeObj = new DBHotelType();
        DataTable   table   = typeObj.getAllRoomType(ref Error);

        DropDownListRoomType.DataSource     = table;
        DropDownListRoomType.DataTextField  = "RoomTypeName";
        DropDownListRoomType.DataValueField = "RoomTypeID";
        DropDownListRoomType.DataBind();
    }
    protected void ButtonAdd_Click(object sender, EventArgs e)
    {
        string      Error   = "";
        DBHotelType typeObj = new DBHotelType();

        typeObj.addRoomType(TextBoxRoomType.Text, ref Error);
        if (Error != "")
        {
            Response.Write(Error);
        }
        else
        {
            TextBoxRoomType.Text = "";
            fillRoomType();
        }
    }
    protected void GridViewRoomType_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int         TypeID  = Int32.Parse(GridViewRoomType.DataKeys[e.RowIndex].Value.ToString());
        string      Error   = "";
        DBHotelType cityObj = new DBHotelType();

        cityObj.deleteRoomType(TypeID, ref Error);

        if (Error != "")
        {
            Response.Write(Error);
        }
        else
        {
            fillRoomType();
        }
    }
    protected void GridViewRoomType_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        int         RoomTypeID = Int32.Parse(GridViewRoomType.DataKeys[e.RowIndex].Value.ToString());
        string      Error      = "";
        DBHotelType cityObj    = new DBHotelType();
        string      RoomType   = ((TextBox)GridViewRoomType.Rows[e.RowIndex].FindControl("TextBoxRoomType")).Text;

        cityObj.updateRoomType(RoomTypeID, RoomType, ref Error);
        if (Error != "")
        {
            Response.Write(Error);
        }
        else
        {
            GridViewRoomType.EditIndex = -1;
            fillRoomType();
        }
    }