コード例 #1
0
        protected void frmContactDetaiil_ItemCommand(object sender, FormViewCommandEventArgs e)
        {
            // dvMsg.Style.Add("display", "none");
            TextBox txtTelCountryCode = (TextBox)frmContactDetaiil.FindControl("txtTelCountryCode");
            TextBox txtTelCityCode    = (TextBox)frmContactDetaiil.FindControl("txtTelCityCode");
            TextBox txtTelLocalNUmber = (TextBox)frmContactDetaiil.FindControl("txtTelLocalNUmber");
            TextBox txtFaxCountryCode = (TextBox)frmContactDetaiil.FindControl("txtFaxCountryCode");
            TextBox txtFaxCityCode    = (TextBox)frmContactDetaiil.FindControl("txtFaxCityCode");
            TextBox txtFaxLocalNUmber = (TextBox)frmContactDetaiil.FindControl("txtFaxLocalNUmber");
            TextBox txtWebsite        = (TextBox)frmContactDetaiil.FindControl("txtWebsite");
            TextBox txtEmail          = (TextBox)frmContactDetaiil.FindControl("txtEmail");
            TextBox txtLegacyHtlId    = (TextBox)frmContactDetaiil.FindControl("txtLegacyHtlId");

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

            if (e.CommandName == "Add")
            {
                MDMSVC.DC_Accommodation_Contact newObj = new MDMSVC.DC_Accommodation_Contact
                {
                    Accommodation_Contact_Id = Guid.NewGuid(),
                    Legacy_Htl_Id            = AccSvc.GetLegacyHotelId(Accomodation_ID),
                    Telephone        = txtTelCountryCode.Text + "-" + txtTelCityCode.Text + "-" + txtTelLocalNUmber.Text,
                    Fax              = txtFaxCountryCode.Text + "-" + txtFaxCityCode.Text + "-" + txtFaxLocalNUmber.Text,
                    Accommodation_Id = Accomodation_ID,
                    Create_Date      = DateTime.Now,
                    Create_User      = System.Web.HttpContext.Current.User.Identity.Name,
                    Email            = txtEmail.Text,
                    WebSiteURL       = txtWebsite.Text,
                    IsActive         = true
                };
                if (AccSvc.AddHotelContactsDetails(newObj))
                {
                    frmContactDetaiil.DataBind();
                    fillcontactdetails();
                    BootstrapAlert.BootstrapAlertMessage(dvMsgContact, "Contact has been added successfully", BootstrapAlertType.Success);
                }
                else
                {
                    BootstrapAlert.BootstrapAlertMessage(dvMsgContact, "Error Occurred", BootstrapAlertType.Warning);
                }
            }
            else if (e.CommandName == "Edit")
            {
                Accomodation_ID = new Guid(Request.QueryString["Hotel_Id"]);
                Guid myRow_Id = Guid.Parse(grdContactDetails.SelectedDataKey.Value.ToString());

                var result = AccSvc.GetHotelContactDetails(Accomodation_ID, myRow_Id);
                if (result.Count > 0)
                {
                    MDMSVC.DC_Accommodation_Contact newObj = new MDMSVC.DC_Accommodation_Contact
                    {
                        Accommodation_Contact_Id = myRow_Id,
                        Accommodation_Id         = Accomodation_ID,
                        Legacy_Htl_Id            = AccSvc.GetLegacyHotelId(Accomodation_ID),
                        Email      = txtEmail.Text,
                        WebSiteURL = txtWebsite.Text,
                        Telephone  = txtTelCountryCode.Text + "-" + txtTelCityCode.Text + "-" + txtTelLocalNUmber.Text,
                        Fax        = txtFaxCountryCode.Text + "-" + txtFaxCityCode.Text + "-" + txtFaxLocalNUmber.Text,
                        Edit_Date  = DateTime.Now,
                        Edit_User  = System.Web.HttpContext.Current.User.Identity.Name,
                        IsActive   = true
                    };
                    if (AccSvc.UpdateHotelContactDetails(newObj))
                    {
                        frmContactDetaiil.ChangeMode(FormViewMode.Insert);
                        fillcontactdetails();
                        BootstrapAlert.BootstrapAlertMessage(dvMsgContact, "Contact has been updated successfully", BootstrapAlertType.Success);
                    }
                    else
                    {
                        BootstrapAlert.BootstrapAlertMessage(dvMsgContact, "Error Occurred", BootstrapAlertType.Warning);
                    }
                }
            }
        }
コード例 #2
0
        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);
                    }
                }
            }
        }