protected void frmPassengerOCcupancy_ItemCommand(object sender, FormViewCommandEventArgs e)
        {
            TextBox      txtMAxAdults    = (TextBox)frmPassengerOCcupancy.FindControl("txtMAxAdults");
            TextBox      txtPassengers   = (TextBox)frmPassengerOCcupancy.FindControl("txtPassengers");
            TextBox      txtFromCXBAge   = (TextBox)frmPassengerOCcupancy.FindControl("txtFromCXBAge");
            TextBox      txtToCXBAge     = (TextBox)frmPassengerOCcupancy.FindControl("txtToCXBAge");
            TextBox      txtMaxCXB       = (TextBox)frmPassengerOCcupancy.FindControl("txtMaxCXB");
            TextBox      txtFromCNBAge   = (TextBox)frmPassengerOCcupancy.FindControl("txtFromCNBAge");
            TextBox      txtToCNBAge     = (TextBox)frmPassengerOCcupancy.FindControl("txtToCNBAge");
            TextBox      txtMaxCNB       = (TextBox)frmPassengerOCcupancy.FindControl("txtMaxCNB");
            TextBox      txtFromCIORAge  = (TextBox)frmPassengerOCcupancy.FindControl("txtFromCIORAge");
            TextBox      txtToCIORAge    = (TextBox)frmPassengerOCcupancy.FindControl("txtToCIORAge");
            TextBox      txtMaxCIOR      = (TextBox)frmPassengerOCcupancy.FindControl("txtMaxCIOR");
            TextBox      txtRoomInfoId   = (TextBox)frmPassengerOCcupancy.FindControl("txtRoomInfoId");
            DropDownList ddlRoomCategory = (DropDownList)frmPassengerOCcupancy.FindControl("ddlRoomCategory");
            DropDownList ddlRoomType     = (DropDownList)frmPassengerOCcupancy.FindControl("ddlRoomType");

            Accomodation_ID = new Guid(Request.QueryString["Hotel_Id"]);

            if (e.CommandName == "AddOccupancy")
            {
                MDMSVC.DC_Accommodation_PaxOccupancy newObj = new MDMSVC.DC_Accommodation_PaxOccupancy
                {
                    Accommodation_PaxOccupancy_Id = Guid.NewGuid(),
                    Legacy_Htl_Id             = AccSvc.GetLegacyHotelId(Accomodation_ID),
                    Accommodation_Id          = Accomodation_ID,
                    Accommodation_RoomInfo_Id = new Guid(ddlRoomCategory.SelectedItem.Value),
                    Category           = ddlRoomCategory.SelectedItem.Text,
                    RoomType           = ddlRoomType.SelectedItem.Text,
                    MaxAdults          = Convert.ToInt32(txtMAxAdults.Text),
                    MaxPax             = Convert.ToInt32(txtPassengers.Text),
                    FromAgeForExtraBed = Convert.ToInt32(txtFromCXBAge.Text),
                    ToAgeForExtraBed   = Convert.ToInt32(txtToCXBAge.Text),
                    MaxPaxWithExtraBed = Convert.ToInt32(txtMaxCXB.Text),
                    MaxCNB             = Convert.ToInt32(txtMaxCNB.Text),
                    FromAgeForCNB      = Convert.ToInt32(txtFromCNBAge.Text),
                    ToAgeForCNB        = Convert.ToInt32(txtToCNBAge.Text),
                    MaxChild           = Convert.ToInt32(txtMaxCIOR.Text),
                    FromAgeForCIOR     = Convert.ToInt32(txtFromCIORAge.Text),
                    ToAgeForCIOR       = Convert.ToInt32(txtToCIORAge.Text),
                    Create_Date        = DateTime.Now,
                    Create_User        = System.Web.HttpContext.Current.User.Identity.Name,
                    IsActive           = true
                };
                if (AccSvc.AddAccommodationPaxOccupancyDetail(newObj))
                {
                    frmPassengerOCcupancy.DataBind();
                    fillOccupancy();

                    //ddlRoomCategory = (DropDownList)frmPassengerOCcupancy.FindControl("ddlRoomCategory");
                    //fillcategories(ddlRoomCategory);

                    //ddlRoomType = (DropDownList)frmPassengerOCcupancy.FindControl("ddlRoomType");
                    //filltype(ddlRoomType);
                    hdnFlag.Value = "true";
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), DateTime.Today.Ticks.ToString(), "alert('Hi');", true);
                    BootstrapAlert.BootstrapAlertMessage(dvMsg, "Occupancy has been added successfully", BootstrapAlertType.Success);
                }
                else
                {
                    BootstrapAlert.BootstrapAlertMessage(dvMsg, "Error Occurred", BootstrapAlertType.Warning);
                }
            }
            else if (e.CommandName == "UpdateOccupancy")
            {
                Accomodation_ID = new Guid(Request.QueryString["Hotel_Id"]);
                Guid myRow_Id = Guid.Parse(grdOccupanyDetail.SelectedDataKey.Value.ToString());
                var  result   = AccSvc.GetHotelPaxOccupancyDetails(Accomodation_ID, myRow_Id);
                if (result.Count > 0)
                {
                    MDMSVC.DC_Accommodation_PaxOccupancy newObj = new MDMSVC.DC_Accommodation_PaxOccupancy
                    {
                        Accommodation_PaxOccupancy_Id = myRow_Id,
                        Accommodation_Id          = Accomodation_ID,
                        Legacy_Htl_Id             = AccSvc.GetLegacyHotelId(Accomodation_ID),
                        Accommodation_RoomInfo_Id = new Guid(ddlRoomCategory.SelectedItem.Value),
                        Category           = ddlRoomCategory.SelectedItem.Text,
                        RoomType           = ddlRoomType.SelectedItem.Text,
                        MaxAdults          = Convert.ToInt32(txtMAxAdults.Text),
                        MaxPax             = Convert.ToInt32(txtPassengers.Text),
                        FromAgeForExtraBed = Convert.ToInt32(txtFromCXBAge.Text),
                        ToAgeForExtraBed   = Convert.ToInt32(txtToCXBAge.Text),
                        MaxPaxWithExtraBed = Convert.ToInt32(txtMaxCXB.Text),
                        MaxCNB             = Convert.ToInt32(txtMaxCNB.Text),
                        FromAgeForCNB      = Convert.ToInt32(txtFromCNBAge.Text),
                        ToAgeForCNB        = Convert.ToInt32(txtToCNBAge.Text),
                        MaxChild           = Convert.ToInt32(txtMaxCIOR.Text),
                        FromAgeForCIOR     = Convert.ToInt32(txtFromCIORAge.Text),
                        ToAgeForCIOR       = Convert.ToInt32(txtToCIORAge.Text),
                        Edit_Date          = DateTime.Now,
                        Edit_User          = System.Web.HttpContext.Current.User.Identity.Name,
                        IsActive           = true
                    };
                    if (AccSvc.UpdateHotelPaxOccupancy(newObj))
                    {
                        Accomodation_ID = new Guid(Request.QueryString["Hotel_Id"]);
                        frmPassengerOCcupancy.ChangeMode(FormViewMode.Insert);
                        frmPassengerOCcupancy.DataBind();

                        fillOccupancy();

                        //ddlRoomCategory = (DropDownList)frmPassengerOCcupancy.FindControl("ddlRoomCategory");
                        //fillcategories(ddlRoomCategory);

                        //ddlRoomType = (DropDownList)frmPassengerOCcupancy.FindControl("ddlRoomType");
                        //filltype(ddlRoomType);
                        hdnFlag.Value = "true";
                        BootstrapAlert.BootstrapAlertMessage(dvMsg, "Occupancy has been updated successfully", BootstrapAlertType.Success);
                    }
                    else
                    {
                        BootstrapAlert.BootstrapAlertMessage(dvMsg, "Error Occurred", BootstrapAlertType.Warning);
                    }
                }
            }
        }