コード例 #1
0
        public void ProcessRequest(HttpContext context)
        {
            var Source = context.Request.QueryString["source"];

            if (Source != null && Source == "autocomplete")
            {
                var PrefixText = context.Request.QueryString["term"];
                var Country    = context.Request.QueryString["country"];
                var country_id = context.Request.QueryString["country_id"];

                var StateName = context.Request.QueryString["state"];
                RQ = new MDMSVC.DC_Accomodation_AutoComplete_RQ();
                if (!string.IsNullOrWhiteSpace(PrefixText))
                {
                    if (Convert.ToString(PrefixText).Length > 2)
                    {
                        RQ.HotelName = PrefixText.Trim().TrimStart(' ');

                        if (!string.IsNullOrWhiteSpace(Country))
                        {
                            Guid countryId;
                            RQ.Country = Country.Trim().TrimStart(' ');
                            bool resultConversion = Guid.TryParse(country_id, out countryId);
                            if (resultConversion)
                            {
                                RQ.Country_Id = countryId;
                            }
                        }
                        if (!string.IsNullOrWhiteSpace(StateName) && StateName != "---ALL---")
                        {
                            RQ.State = StateName.Trim();
                        }
                        RQ.PageNo = 0;
                        var res = AccoSvc.SearchHotelsAutoComplete(RQ);
                        context.Response.Write(new JavaScriptSerializer().Serialize(res));
                    }
                    else
                    {
                        context.Response.Write(new JavaScriptSerializer().Serialize(null));
                    }
                }
            }
            if (Source != null && Source == "details")
            {
                var accoid = context.Request.QueryString["accoid"];
                if (accoid != null)
                {
                    var res = AccoSvc.GetAccomodationBasicInfo(Guid.Parse(accoid));
                    context.Response.Write(new JavaScriptSerializer().Serialize(res));
                }
                else
                {
                    context.Response.Write(new JavaScriptSerializer().Serialize(null));
                }
            }
        }
コード例 #2
0
ファイル: AddNew.ascx.cs プロジェクト: dilip07156/TLGXWebApp
        public bool AddHotel(Guid NewHotel_Id)
        {
            bool ret = false;

            MDMSVC.DC_Accomodation OverviewData = new MDMSVC.DC_Accomodation();

            if (NewHotel_Id == Guid.Empty)
            {
                NewHotel_Id = Guid.NewGuid();
            }
            OverviewData.Accommodation_Id = NewHotel_Id;
            string redirectURL = "~/hotels/manage.aspx?Hotel_Id=" + OverviewData.Accommodation_Id;

            OverviewData.ProductCategory = "Accommodation";
            if (ddlAddProductCategorySubType.SelectedIndex != 0)
            {
                OverviewData.ProductCategorySubType = ddlAddProductCategorySubType.SelectedItem.Text;
            }
            if (ddlAddCountry.SelectedIndex != 0)
            {
                OverviewData.Country = ddlAddCountry.SelectedItem.Text;
            }
            if (ddlAddState.SelectedIndex != 0)
            {
                OverviewData.State_Name = ddlAddState.SelectedItem.Text;
            }
            if (ddlAddCity.SelectedIndex != 0)
            {
                OverviewData.City = ddlAddCity.SelectedItem.Text;
            }
            if (ddlStarRating.SelectedIndex != 0)
            {
                OverviewData.HotelRating = ddlStarRating.SelectedItem.Text;
            }

            if (!string.IsNullOrEmpty(txtCheckinTime.Text))
            {
                OverviewData.CheckInTime = txtCheckinTime.Text.ToString();
            }
            if (!string.IsNullOrEmpty(txtCheckOut.Text))
            {
                OverviewData.CheckOutTime = txtCheckOut.Text.ToString();
            }
            if (!string.IsNullOrEmpty(txtHotelName.Text))
            {
                OverviewData.HotelName = txtHotelName.Text.ToString();
            }
            if (!string.IsNullOrEmpty(txtPostalCode.Text))
            {
                OverviewData.PostalCode = txtPostalCode.Text.ToString();
            }
            if (!string.IsNullOrEmpty(txtStreet.Text))
            {
                OverviewData.StreetName = txtStreet.Text.ToString();
            }
            if (!string.IsNullOrEmpty(txtStreet2.Text))
            {
                OverviewData.StreetNumber = txtStreet2.Text.ToString();
            }
            if (!string.IsNullOrEmpty(txtAddCityPlaceId.Text))
            {
                OverviewData.Google_Place_Id = txtAddCityPlaceId.Text.ToString();
            }
            if (!string.IsNullOrEmpty(hdnLat.Value))
            {
                OverviewData.Latitude = hdnLat.Value.ToString();
            }
            if (!string.IsNullOrEmpty(hdnLng.Value))
            {
                OverviewData.Longitude = hdnLng.Value.ToString();
            }
            OverviewData.Create_Date = DateTime.Now;
            OverviewData.Create_User = System.Web.HttpContext.Current.User.Identity.Name;
            OverviewData.IsActive    = true;
            OverviewData.InsertFrom  = InsertFrom;

            if (AccSvc.AddHotelDetail(OverviewData))
            {
                ret = true;
                string ParentPageName = setParentPage();
                if (ParentPageName == "UpdateSupplierProductMapping.ascx" || ParentPageName == "search.aspx")
                {
                    FormView     frmEditProductMap    = (FormView)((TLGX_Consumer.controls.staticdata.UpdateSupplierProductMapping) this.Parent.NamingContainer).FindControl("frmEditProductMap");
                    DropDownList ddlSystemCountryName = (DropDownList)frmEditProductMap.FindControl("ddlSystemCountryName");
                    DropDownList ddlSystemCityName    = (DropDownList)frmEditProductMap.FindControl("ddlSystemCityName");
                    DropDownList ddlSystemProductName = (DropDownList)frmEditProductMap.FindControl("ddlSystemProductName");
                    TextBox      txtSystemProductCode = (TextBox)frmEditProductMap.FindControl("txtSystemProductCode");



                    Button btnAddProduct = (Button)frmEditProductMap.FindControl("btnAddProduct");

                    ddlSystemCountryName.SelectedIndex = ddlSystemCountryName.Items.IndexOf(ddlSystemCountryName.Items.FindByValue(ddlAddCountry.SelectedItem.Value));
                    ((TLGX_Consumer.controls.staticdata.UpdateSupplierProductMapping) this.Parent.NamingContainer).fillcities(ddlSystemCityName, ddlSystemCountryName);
                    ddlSystemCityName.SelectedIndex = ddlSystemCityName.Items.IndexOf(ddlSystemCityName.Items.FindByValue(ddlAddCity.SelectedItem.Value));

                    ((TLGX_Consumer.controls.staticdata.UpdateSupplierProductMapping) this.Parent.NamingContainer).fillproducts(ddlSystemProductName, ddlSystemCityName, ddlSystemCountryName);
                    ddlSystemProductName.SelectedIndex = ddlSystemProductName.Items.IndexOf(ddlSystemProductName.Items.FindByText(txtHotelName.Text.ToString()));
                    //Added for textbox search product
                    if (ParentPageName == "search.aspx")
                    {
                        TextBox     txtSearchSystemProduct = (TextBox)frmEditProductMap.FindControl("txtSearchSystemProduct");
                        HiddenField hdnSelSystemProduct_Id = (HiddenField)frmEditProductMap.FindControl("hdnSelSystemProduct_Id");
                        txtSearchSystemProduct.Text  = ddlSystemProductName.SelectedItem.Text;
                        hdnSelSystemProduct_Id.Value = ddlSystemProductName.SelectedValue;

                        var res = AccSvc.GetAccomodationBasicInfo(Guid.Parse(hdnSelSystemProduct_Id.Value));
                        if (res != null && res.Count > 0)
                        {
                            Label lblSystemProductAddress = (Label)frmEditProductMap.FindControl("lblSystemProductAddress");
                            Label lblSystemLocation       = (Label)frmEditProductMap.FindControl("lblSystemLocation");
                            Label lblSystemTelephone      = (Label)frmEditProductMap.FindControl("lblSystemTelephone");
                            Label lblSystemLatitude       = (Label)frmEditProductMap.FindControl("lblSystemLatitude");
                            Label lblSystemLongitude      = (Label)frmEditProductMap.FindControl("lblSystemLongitude");
                            lblSystemProductAddress.Text = res[0].FullAddress;
                            lblSystemLocation.Text       = res[0].Location;
                            lblSystemTelephone.Text      = res[0].Telephone_Tx;
                            lblSystemLatitude.Text       = res[0].Latitude;
                            lblSystemLongitude.Text      = res[0].Longitude;
                        }
                    }
                    else
                    {
                    }
                    txtSystemProductCode.Text = masterdata.GetCodeById("product", Guid.Parse(ddlSystemProductName.SelectedItem.Value));
                    btnAddProduct.Visible     = false;
                    this.Parent.Visible       = false;
                }
                else
                {
                    Response.Redirect(redirectURL);
                }
            }
            return(ret);
        }