示例#1
0
    protected RoomType_OnlineDetails GetRoomTypeOnlineDetails(int roomTypeId)
    {
        RoomType_OnlineDetails dtls = new RoomType_OnlineDetails();

        dtls.RoomType_ID = roomTypeId;
        dtls.SelectOne();
        return(dtls);
    }
    protected void BindRoomType_OnlineDetails(int roomType)
    {
        RoomType_OnlineDetails dtls = new RoomType_OnlineDetails();

        dtls.RoomType_ID = roomType;
        DataTable dt = dtls.SelectOne();

        if (dt.Rows.Count <= 0)
        {
            this.hidRoomTypeOnlineId.Value = "0";
            return;
        }
        this.hidRoomTypeOnlineId.Value = dt.Rows[0]["RoomType_Online_ID"].ToString();
        this.txtDescription.Text       = dt.Rows[0]["RoomType_OnlineDetails"].ToString();
    }
示例#3
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (this.hidRoomTypeId.Value == "0")
        {
            this.lblResult.Text = "Invalid RoomType. Please select a Room Type from Room Types Screen.";
            return;
        }
        RoomType_OnlineDetails details = new RoomType_OnlineDetails();

        details.RoomType_ID = Int32.Parse(this.hidRoomTypeId.Value);

        /* details.Number_of_Rooms = Int32.Parse(drpNumberOfRooms.SelectedValue);
         * details.Number_of_BedRooms = Int32.Parse(drpNumberOfBedRooms.SelectedValue);
         * details.Number_of_BathRooms = Int32.Parse(drpNumberOfBathRooms.SelectedValue);
         * details.Number_of_LivingRooms = Int32.Parse(drpNumberOfLivingRooms.SelectedValue);
         * details.Number_of_Kitchens = Int32.Parse(drpNumberOfKitchens.SelectedValue);
         * details.Number_of_Adults = Int32.Parse(drpNumberOfAdults.SelectedValue);
         * details.Number_of_Children = Int32.Parse(drpNumberOfChildren.SelectedValue);*/
        details.Description = txtDescription.Text;

        if (this.hidRoomTypeOnlineId.Value == "0")
        {
            if (details.Insert())
            {
                this.lblResult.Text            = "Successfully Inserted";
                this.hidRoomTypeOnlineId.Value = details.RoomType_Online_ID.ToString();
            }
            else
            {
                this.lblResult.Text = "Error Code " + details.ErrorCode.ToString() + "; Description " + details.ErrorDesc.ToString();
            }
        }
        else
        {
            details.RoomType_Online_ID = Int32.Parse(this.hidRoomTypeOnlineId.Value);
            if (details.Update())
            {
                this.lblResult.Text = "Successfully Updated";
            }
            else
            {
                this.lblResult.Text = "Error Code " + details.ErrorCode.ToString() + "; Description " + details.ErrorDesc.ToString();
            }
        }
    }
    protected void roomTypesList_ItemDataBound(object sender, DataListItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item ||
            e.Item.ItemType == ListItemType.AlternatingItem)
        {
            int  roomTypeId = Convert.ToInt32(roomTypesList.DataKeys[e.Item.ItemIndex]);
            bool isOnline   = Boolean.Parse(((HiddenField)e.Item.FindControl("hidIsOnline")).Value);
            if (isOnline)
            {
                RoomType_OnlineDetails dtls = GetRoomTypeOnlineDetails(roomTypeId);
                Label lblDeatailsId         = (Label)e.Item.FindControl("lblId");
                Label lblRooms       = (Label)e.Item.FindControl("lblRooms");
                Label lblBedRooms    = (Label)e.Item.FindControl("lblRooms");
                Label lblLivingRooms = (Label)e.Item.FindControl("lblRooms");
                Label lblBathRooms   = (Label)e.Item.FindControl("lblRooms");
                Label lblKitchens    = (Label)e.Item.FindControl("lblKitchens");
                Label lblDetails     = (Label)e.Item.FindControl("lblDetails");
                lblDeatailsId.Text  = dtls.RoomType_Online_ID.ToString();
                lblRooms.Text       = dtls.Number_of_Rooms.ToString();
                lblBedRooms.Text    = dtls.Number_of_BedRooms.ToString();
                lblLivingRooms.Text = dtls.Number_of_LivingRooms.ToString();
                lblBathRooms.Text   = dtls.Number_of_BathRooms.ToString();
                lblKitchens.Text    = dtls.Number_of_Kitchens.ToString();
                lblDetails.Text     = dtls.Description.ToString();

                Label lblRoomTypeId = (Label)e.Item.FindControl("lblRoomTypeId");
                lblRoomTypeId.Text = roomTypeId.ToString();

                DataTable dt           = GetRoomTypeImages(roomTypeId);
                Image     defaultImage = (Image)e.Item.FindControl("roomTypeDefaultImage");
                if (dt.Rows.Count > 0)
                {
                    defaultImage.ImageUrl = dt.Rows[0]["RoomType_ThumbnailPath"].ToString();
                    DataList rptr = (DataList)e.Item.FindControl("roomTypeImages");
                    rptr.DataSource = dt;
                    rptr.DataBind();
                }
            }
        }
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (this.hidRoomTypeId.Value == "0")
        {
            this.lblResult.Text = "Invalid RoomType. Please select a Room Type from Room Types Screen.";
            return;
        }
        RoomType_OnlineDetails details = new RoomType_OnlineDetails();

        details.RoomType_ID = Int32.Parse(this.hidRoomTypeId.Value);
        details.Description = txtDescription.Text;
        //string txt = txtDescriptionExtender.Decode(txtDescription.Text);

        if (this.hidRoomTypeOnlineId.Value == "0")
        {
            if (details.Insert())
            {
                this.lblResult.Text            = "Successfully Inserted";
                this.hidRoomTypeOnlineId.Value = details.RoomType_Online_ID.ToString();
            }
            else
            {
                this.lblResult.Text = "Error Code " + details.ErrorCode.ToString() + "; Description " + details.ErrorDesc.ToString();
            }
        }
        else
        {
            details.RoomType_Online_ID = Int32.Parse(this.hidRoomTypeOnlineId.Value);
            if (details.Update())
            {
                this.lblResult.Text = "Successfully Updated";
            }
            else
            {
                this.lblResult.Text = "Error Code " + details.ErrorCode.ToString() + "; Description " + details.ErrorDesc.ToString();
            }
        }
    }
示例#6
0
    protected void BindRoomType_OnlineDetails(int roomType)
    {
        RoomType_OnlineDetails dtls = new RoomType_OnlineDetails();

        dtls.RoomType_ID = roomType;
        DataTable dt = dtls.SelectOne();

        if (dt.Rows.Count <= 0)
        {
            this.hidRoomTypeOnlineId.Value = "0";
            return;
        }
        this.hidRoomTypeOnlineId.Value = dt.Rows[0]["RoomType_Online_ID"].ToString();

        /*this.drpNumberOfRooms.SelectedValue = dt.Rows[0]["Number_Of_Rooms"].ToString();
         * this.drpNumberOfBedRooms.SelectedValue = dt.Rows[0]["Number_Of_BedRooms"].ToString();
         * this.drpNumberOfBathRooms.SelectedValue = dt.Rows[0]["Number_Of_Bathrooms"].ToString();
         * this.drpNumberOfLivingRooms.SelectedValue = dt.Rows[0]["Number_Of_LivingRooms"].ToString();
         * this.drpNumberOfChildren.SelectedValue = dt.Rows[0]["Number_Of_Children"].ToString();
         * this.drpNumberOfAdults.SelectedValue = dt.Rows[0]["Number_Of_Adults"].ToString();
         * this.drpNumberOfKitchens.SelectedValue = dt.Rows[0]["Number_Of_Kitchen"].ToString*/
        this.txtDescription.Text = dt.Rows[0]["RoomType_OnlineDetails"].ToString();
    }
示例#7
0
    protected void roomTypesList_ItemDataBound(object sender, DataListItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item ||
            e.Item.ItemType == ListItemType.AlternatingItem)
        {
            int      roomTypeId = Convert.ToInt32(roomTypesList.DataKeys[e.Item.ItemIndex]);
            bool     isOnline   = Boolean.Parse(((HiddenField)e.Item.FindControl("hidIsOnline")).Value);
            DateTime fromDate   = DateTime.Parse(txtFromDate.Text);
            DateTime toDate     = DateTime.Parse(txtToDate.Text);
            if (isOnline)
            {
                RoomType_OnlineDetails dtls = GetRoomTypeOnlineDetails(roomTypeId);
                //Label lblDeatailsId = (Label)e.Item.FindControl("lblId");
                Label lblRooms       = (Label)e.Item.FindControl("lblRooms");
                Label lblBedRooms    = (Label)e.Item.FindControl("lblBedRooms");
                Label lblLivingRooms = (Label)e.Item.FindControl("lblRooms");
                Label lblBathRooms   = (Label)e.Item.FindControl("lblBathRooms");
                Label lblKitchens    = (Label)e.Item.FindControl("lblKitchens");
                Label lblDetails     = (Label)e.Item.FindControl("lblDetails");
                //lblDeatailsId.Text = dtls.RoomType_Online_ID.ToString();
                //lblRooms.Text = dtls.Number_of_Rooms.ToString();
                //lblBedRooms.Text = dtls.Number_of_BedRooms.ToString();
                //lblLivingRooms.Text = dtls.Number_of_LivingRooms.ToString();
                //lblBathRooms.Text = dtls.Number_of_BathRooms.ToString();
                //lblKitchens.Text = dtls.Number_of_Kitchens.ToString();
                lblDetails.Text = dtls.Description.ToString();

                //Label lblRoomTypeId = (Label)e.Item.FindControl("lblRoomTypeId");
                //lblRoomTypeId.Text = roomTypeId.ToString();

                Bookings bookings = new Bookings();
                if (this.AvailableRooms == null)
                {
                    this.AvailableRooms = bookings.SelectAvailableRooms(this.FromDate, this.ToDate, roomTypeId);
                }
                //Session.Add("AvailableRooms", this.AvailableRooms);

                if (this.AvailableRooms.Rows.Count > 0)
                {
                    Label  lblRate = (Label)e.Item.FindControl("lblRate");
                    Double rate    = Convert.ToDouble(this.AvailableRooms.Rows[0]["Rate"]);
                    lblRate.Text = "KD " + rate.ToString();
                    HiddenField hidRate = (HiddenField)e.Item.FindControl("hidRate");
                    hidRate.Value = rate.ToString();
                    HiddenField hidRateType = (HiddenField)e.Item.FindControl("hidRateType");
                    hidRateType.Value = this.AvailableRooms.Rows[0]["RateType_ID"].ToString();
                    HiddenField hidRateId = (HiddenField)e.Item.FindControl("hidRateId");
                    hidRateId.Value = this.AvailableRooms.Rows[0]["Rate_ID"].ToString();

                    Label lblBookingDays     = (Label)e.Item.FindControl("lblBookingDays");
                    int   numberOfDaysBooked = Utility.GetNumberOfDaysFromRange(fromDate, toDate);
                    lblBookingDays.Text = numberOfDaysBooked.ToString();
                    HiddenField hidBookingDays = (HiddenField)e.Item.FindControl("hidBookingDays");
                    hidBookingDays.Value = numberOfDaysBooked.ToString();
                    HiddenField hidRoomId = (HiddenField)e.Item.FindControl("hidRoomId");
                    hidRoomId.Value = this.AvailableRooms.Rows[0]["Room_ID"].ToString();

                    Label  lblPrice  = (Label)e.Item.FindControl("lblCostAfterDiscount");
                    Double totalCost = rate * numberOfDaysBooked;
                    lblPrice.Text = "KD " + totalCost.ToString();
                    HiddenField hidCostAfterDiscount = (HiddenField)e.Item.FindControl("hidCostAfterDiscount");
                    hidCostAfterDiscount.Value = totalCost.ToString();

                    HiddenField hidDiscountOffered = (HiddenField)e.Item.FindControl("hidDiscountOffered");
                    hidDiscountOffered.Value = "0";
                    HiddenField hidTotalCost = (HiddenField)e.Item.FindControl("hidTotalCost");
                    hidTotalCost.Value = totalCost.ToString();
                    HiddenField hidDiscountId = (HiddenField)e.Item.FindControl("hidDiscountId");
                    hidDiscountId.Value = "0";
                }

                DataTable dt = GetRoomTypeImages(roomTypeId);
                System.Web.UI.WebControls.Image defaultImage = (System.Web.UI.WebControls.Image)e.Item.FindControl("roomTypeDefaultImage");
                if (dt.Rows.Count > 0)
                {
                    defaultImage.ImageUrl = dt.Rows[0]["RoomType_ThumbnailPath"].ToString();
                    DataList rptr = (DataList)e.Item.FindControl("roomTypeImages");
                    rptr.DataSource = dt;
                    rptr.DataBind();
                }
            }
        }
    }
    protected void roomTypesList_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            int         roomTypeId = Convert.ToInt32(roomTypesList.DataKeys[e.Row.RowIndex].Values[0].ToString());
            bool        isOnline   = Boolean.Parse(((HiddenField)e.Row.FindControl("hidIsOnline")).Value);
            DateTime    fromDate   = DateTime.Parse(txtFromDate.Text);
            DateTime    toDate     = DateTime.Parse(txtToDate.Text);
            SqlDateTime sFromDate  = Utility.GetSqlDateTimeFromDateTime(fromDate);
            SqlDateTime sToDate    = Utility.GetSqlDateTimeFromDateTime(toDate);
            if (isOnline)
            {
                RoomType_OnlineDetails dtls = GetRoomTypeOnlineDetails(roomTypeId);
                //Label lblDeatailsId = (Label)e.Item.FindControl("lblId");
                Label lblRooms       = (Label)e.Row.FindControl("lblRooms");
                Label lblBedRooms    = (Label)e.Row.FindControl("lblBedRooms");
                Label lblLivingRooms = (Label)e.Row.FindControl("lblRooms");
                Label lblBathRooms   = (Label)e.Row.FindControl("lblBathRooms");
                Label lblKitchens    = (Label)e.Row.FindControl("lblKitchens");
                Label lblDetails     = (Label)e.Row.FindControl("lblDetails");
                lblDetails.Text = dtls.Description.ToString();
                Bookings  bookings       = new Bookings();
                DataTable availableRooms = new DataTable();
                if (Session["AvailableRooms"] == null)
                {
                    availableRooms = bookings.SelectAvailableRooms(sFromDate, sToDate, roomTypeId);
                }

                if (availableRooms.Rows.Count > 0)
                {
                    Label  lblRate = (Label)e.Row.FindControl("lblRate");
                    Double rate    = Convert.ToDouble(availableRooms.Rows[0]["Rate"]);
                    lblRate.Text = "KD " + rate.ToString();
                    HiddenField hidRate = (HiddenField)e.Row.FindControl("hidRate");
                    hidRate.Value = rate.ToString();
                    HiddenField hidRateType = (HiddenField)e.Row.FindControl("hidRateType");
                    hidRateType.Value = availableRooms.Rows[0]["RateType_ID"].ToString();
                    HiddenField hidRateId = (HiddenField)e.Row.FindControl("hidRateId");
                    hidRateId.Value = availableRooms.Rows[0]["Rate_ID"].ToString();

                    Label lblBookingDays     = (Label)e.Row.FindControl("lblBookingDays");
                    int   numberOfDaysBooked = Utility.GetNumberOfDaysFromRange(fromDate, toDate);
                    lblBookingDays.Text = numberOfDaysBooked.ToString();
                    HiddenField hidBookingDays = (HiddenField)e.Row.FindControl("hidBookingDays");
                    hidBookingDays.Value = numberOfDaysBooked.ToString();
                    HiddenField hidRoomId = (HiddenField)e.Row.FindControl("hidRoomId");
                    hidRoomId.Value = availableRooms.Rows[0]["Room_ID"].ToString();

                    Label  lblPrice  = (Label)e.Row.FindControl("lblCostAfterDiscount");
                    Double totalCost = rate * numberOfDaysBooked;
                    lblPrice.Text = "KD " + totalCost.ToString();
                    HiddenField hidCostAfterDiscount = (HiddenField)e.Row.FindControl("hidCostAfterDiscount");
                    hidCostAfterDiscount.Value = totalCost.ToString();

                    HiddenField hidDiscountOffered = (HiddenField)e.Row.FindControl("hidDiscountOffered");
                    hidDiscountOffered.Value = "0";
                    HiddenField hidTotalCost = (HiddenField)e.Row.FindControl("hidTotalCost");
                    hidTotalCost.Value = totalCost.ToString();
                    HiddenField hidDiscountId = (HiddenField)e.Row.FindControl("hidDiscountId");
                    hidDiscountId.Value = "0";
                }
                DataTable dt   = GetRoomTypeImages(roomTypeId);
                DataList  rptr = (DataList)e.Row.FindControl("roomTypeImages");
                //Repeater rptr = (Repeater)e.Row.FindControl("roomTypeImages");
                System.Web.UI.WebControls.Image defaultImage = (System.Web.UI.WebControls.Image)e.Row.FindControl("roomTypeDefaultImage");
                if (dt.Rows.Count > 0)
                {
                    defaultImage.ImageUrl = dt.Rows[0]["RoomType_ThumbnailPath"].ToString();
                    rptr.DataSource       = dt;
                    rptr.DataBind();
                }

                /*
                 * CollapsiblePanelExtender cpe = new CollapsiblePanelExtender();
                 * cpe.ID = "cpeDemo";
                 * cpe.CollapseControlID = "roomTypeDefaultImage";
                 * cpe.Collapsed = true;
                 * cpe.CollapsedImage = "~/images/expand_blue.jpg";
                 * cpe.CollapsedText = "(Show Pictures...)";
                 * cpe.ExpandControlID = "roomTypeDefaultImage";
                 * cpe.ExpandedImage = "~/images/collapse_blue.jpg";
                 * cpe.ExpandedText = "(Hide Pictures...)";
                 * cpe.ImageControlID = "Image1";
                 * cpe.SuppressPostBack = true;
                 * cpe.TargetControlID = "imagePanel";
                 * cpe.TextLabelID = "Label1";
                 *
                 * Panel imagePanel = new Panel();
                 * imagePanel.ID = "imagePanel";
                 * imagePanel.CssClass = "collapsePanel";
                 * imagePanel.Height = 0;
                 *
                 * DataList roomTypeImages = new DataList();
                 * roomTypeImages.ID = "roomTypeImages";
                 * roomTypeImages.RepeatDirection = System.Web.UI.WebControls.RepeatDirection.Horizontal;
                 * roomTypeImages.RepeatLayout = RepeatLayout.Flow;
                 *
                 * HiddenField hidRoomTypeId = new HiddenField();
                 * hidRoomTypeId.ID = "hidRoomTypeId";
                 * hidRoomTypeId.Value = roomTypeId.ToString();
                 *
                 * ImageButton imgRoomType = new ImageButton();
                 * imgRoomType.ID = "imgRoomType";
                 * imgRoomType.Height = 100;
                 *
                 * DataTable dt = GetRoomTypeImages(roomTypeId);
                 * //DataList rptr = (DataList)e.Row.FindControl("roomTypeImages");
                 * System.Web.UI.WebControls.Image defaultImage = (System.Web.UI.WebControls.Image)e.Row.FindControl("roomTypeDefaultImage");
                 * if (dt.Rows.Count > 0)
                 * {
                 *  defaultImage.ImageUrl = dt.Rows[0]["RoomType_ThumbnailPath"].ToString();
                 *  //imgRoomType.ImageUrl = "RoomType_ThumbnailPath";
                 *  roomTypeImages.Controls.Add(hidRoomTypeId);
                 *  roomTypeImages.Controls.Add(imgRoomType);
                 *  roomTypeImages.DataSource = dt;
                 *  roomTypeImages.DataBind();
                 * }
                 * imagePanel.Controls.Add(roomTypeImages);
                 *
                 *
                 * TableCell tc = new TableCell();
                 * tc.Text = "&nbsp;";
                 * //tc.Height = Unit.Pixel(10);//you can change this to adjust to the space you want
                 * GridView gv = (GridView)sender;
                 * tc.ColumnSpan = gv.Columns.Count;
                 * tc.Controls.Add(cpe);
                 * tc.Controls.Add(imagePanel);
                 * tc.Controls.Add(imagePanel);
                 *
                 * GridViewRow gr = new GridViewRow(-1, -1, DataControlRowType.DataRow, DataControlRowState.Normal);
                 * gr.Cells.Add(tc);
                 *
                 * Table gvTable = (Table)e.Row.Parent;
                 * gvTable.Controls.Add(gr);
                 */
            }
        }
    }