private void fillHotel()
    {
        int       HotelID  = Convert.ToInt32(Session["HotelID"].ToString());
        string    Error    = "";
        DBHotel   hotelObj = new DBHotel();
        DataTable table    = hotelObj.getHotelData(HotelID, ref Error);

        if (Error != "")
        {
            Response.Write(Error);
        }
        else
        {
            DataRow row = table.Rows[0];

            TextBoxName.Text  = row["HotelName"].ToString();
            TextBoxPhone.Text = row["Phone"].ToString();
            TextBoxState.Text = row["State"].ToString();
            TextBoxEmail.Text = row["Email"].ToString();
            TextBoxDesc.Text  = row["HotelDiscription"].ToString();
            TextBoxAdd.Text   = row["Address"].ToString();
            int CityID = Convert.ToInt32(row["CityID"].ToString());
            DropDownListCity.Items.FindByValue(CityID.ToString()).Selected = true;
            ImageHotel.ImageUrl = row["ImageUrl"].ToString();
        }
    }
    protected void ButtonAdd_Click(object sender, EventArgs e)
    {
        string  Error    = "";
        DBHotel hotelObj = new DBHotel();
        string  path     = Server.MapPath("~/HotelImage/");
        string  fileName = FileUploadImage.FileName;
        string  DBPath   = "";

        if (fileName.Trim().Equals(""))
        {
            DBPath = ImageHotel.ImageUrl;
        }
        else
        {
            string FullPath = path + fileName;

            FileUploadImage.SaveAs(FullPath);
            DBPath = "~/HotelImage/" + fileName;
        }
        int CityID  = Convert.ToInt32(DropDownListCity.SelectedValue);
        int HotelID = Convert.ToInt32(Session["HotelID"].ToString());

        hotelObj.updateHotel(HotelID, CityID, TextBoxName.Text, TextBoxAdd.Text, TextBoxState.Text, TextBoxPhone.Text, TextBoxDesc.Text, TextBoxEmail.Text, DBPath, ref Error);

        if (Error != "")
        {
            Response.Write(Error);
        }
        else
        {
            fillHotel();
        }
    }
        public async void CanGetHotelsWithRooms()
        {
            var hotel = await CreateAndSaveTestHotel();

            var rooms = await CreateAndSaveTestRoom();

            var hotelRoom = await CreateAndSaveTestHotelRoom();

            _db.HotelRooms.Add(new HotelRoom
            {
                HotelId     = 1,
                RoomNumber  = 69,
                RoomId      = 1,
                PetFriendly = true,
                Rate        = 69.00m
            });

            _db.Hotels.Add(new Hotel
            {
                Name          = "Love Shack",
                StreetAddress = "6969 Doggy Street",
                City          = "Ballplay",
                State         = State.AL,
                Country       = "USA",
                Phone         = "555-000-6969"
            });

            await _db.SaveChangesAsync();

            var repository = new DBHotel(_db);

            var dto = repository.GetOneByIdAsync(hotel.Id);

            Assert.NotNull(dto);
        }
Beispiel #4
0
    private void fillName()
    {
        int     HotelId  = Convert.ToInt32(Session["HotelID"]);
        string  Error    = "";
        DBHotel hotelObj = new DBHotel();

        TextBoxHotelName.Text = hotelObj.getHotelName(HotelId, ref Error);
    }
Beispiel #5
0
    private void fillHotel()
    {
        string    Error    = "";
        DBHotel   hotelObj = new DBHotel();
        DataTable table    = hotelObj.getAllHotelData(ref Error);

        DataListHotel.DataSource = table;
        DataListHotel.DataBind();
    }
Beispiel #6
0
    private void fillHotel(int CityID)
    {
        string    Error    = "";
        DBHotel   hotelObj = new DBHotel();
        DataTable table    = hotelObj.getAllHotelDataByCity(CityID, ref Error);

        GridViewHotel.DataSource = table;
        GridViewHotel.DataBind();
    }
Beispiel #7
0
    private void fillHotel()
    {
        string    Error   = "";
        DBHotel   typeObj = new DBHotel();
        DataTable table   = typeObj.getAllHotelData(ref Error);

        DropDownListHotel.DataSource     = table;
        DropDownListHotel.DataTextField  = "HotelName";
        DropDownListHotel.DataValueField = "HotelID";
        DropDownListHotel.DataBind();
    }
Beispiel #8
0
    protected void GridViewHotel_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int     hotelID = Convert.ToInt32(GridViewHotel.DataKeys[e.RowIndex].Value.ToString());
        string  Error   = "";
        DBHotel obj     = new DBHotel();

        obj.deleteHotel(hotelID, ref Error);
        if (Error != "")
        {
            Response.Write(Error);
        }
        else
        {
            fillHotel();
        }
    }
Beispiel #9
0
    protected void ButtonAdd_Click(object sender, EventArgs e)
    {
        string  Error    = "";
        DBHotel hotelObj = new DBHotel();
        string  path     = Server.MapPath("~/HotelImage/");
        string  fileName = FileUploadImage.FileName;
        string  FullPath = path + fileName;

        FileUploadImage.SaveAs(FullPath);
        string DBPath = "~/HotelImage/" + fileName;
        int    CityID = Convert.ToInt32(DropDownListCity.SelectedValue);

        hotelObj.addHotel(TextBoxName.Text, TextBoxAdd.Text, TextBoxState.Text, TextBoxPhone.Text, TextBoxDesc.Text, TextBoxEmail.Text, DBPath, CityID, ref Error);
        if (Error != "")
        {
            Response.Write(Error);
        }
        else
        {
        }
    }