// Update Hotel Geocode Info public bool UpdateHotelGeoDetail(MDMSVC.DC_Accomodation HotelData) { object result = null; ServiceConnection.MDMSvcProxy.PostData(ConfigurationManager.AppSettings["Accomodation_UpdateGeoURI"], HotelData, typeof(MDMSVC.DC_Accomodation), typeof(bool), out result); return((bool)result); }
public void UpdateHotel() { //bool ret = false; MDMSVC.DC_Accomodation OverviewData = new MDMSVC.DC_Accomodation(); OverviewData.Accommodation_Id = new Guid(res[0].AccomodationId); OverviewData.ProductCategory = "Accommodation"; 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.Edit_Date = DateTime.Now; OverviewData.Edit_User = System.Web.HttpContext.Current.User.Identity.Name; OverviewData.IsActive = true; if (AccSvc.UpdateHotelGeoDetail(OverviewData)) { //ret = true; } 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); if (res.Count == 1) { ddlSystemProductName.SelectedIndex = ddlSystemProductName.Items.IndexOf(ddlSystemProductName.Items.FindByText(res[0].HotelName.ToString())); txtSystemProductCode.Text = res[0].CompanyHotelId; } btnAddProduct.Visible = false; this.Parent.Visible = false; // return ret; }
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); }
protected void gvGridExist_RowCommand(object sender, GridViewCommandEventArgs e) { try { GridViewRow row = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer); int index = row.RowIndex; string myHotelName = ""; string myCountryName = ""; string myCityName = ""; Guid myRow_Id = Guid.Parse(gvGridExist.DataKeys[index].Values[0].ToString()); if (e.CommandName == "Select") { myCountryName = gvGridExist.Rows[index].Cells[1].Text; myCityName = gvGridExist.Rows[index].Cells[2].Text; myHotelName = gvGridExist.Rows[index].Cells[3].Text; MDMSVC.DC_Accomodation OverviewData = new MDMSVC.DC_Accomodation(); OverviewData.Accommodation_Id = myRow_Id; OverviewData.ProductCategory = "Accommodation"; 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.Edit_Date = DateTime.Now; OverviewData.Edit_User = System.Web.HttpContext.Current.User.Identity.Name; OverviewData.IsActive = true; if (AccSvc.UpdateHotelGeoDetail(OverviewData)) { 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.FindByText(myCountryName)); ((TLGX_Consumer.controls.staticdata.UpdateSupplierProductMapping) this.Parent.NamingContainer).fillcities(ddlSystemCityName, ddlSystemCountryName); //ddlSystemCityName.SelectedIndex = ddlSystemCityName.Items.IndexOf(ddlSystemCityName.Items.FindByText(myCityName)); ddlSystemCityName.SelectedIndex = ddlSystemCityName.Items.IndexOf(ddlSystemCityName.Items.Cast <ListItem>().FirstOrDefault(i => i.Text.Equals(myCityName, StringComparison.InvariantCultureIgnoreCase))); ((TLGX_Consumer.controls.staticdata.UpdateSupplierProductMapping) this.Parent.NamingContainer).fillproducts(ddlSystemProductName, ddlSystemCityName, ddlSystemCountryName); ddlSystemProductName.SelectedIndex = ddlSystemProductName.Items.IndexOf(ddlSystemProductName.Items.FindByText(myHotelName)); txtSystemProductCode.Text = masterdata.GetCodeById("product", Guid.Parse(ddlSystemProductName.SelectedItem.Value)); btnAddProduct.Visible = false; this.Parent.Visible = false; gvGridExist.DataSource = null; gvGridExist.DataBind(); } } else if (e.CommandName == "OpenDeactivate") { LinkButton btnDeactivate = (LinkButton)row.Cells[7].Controls[1]; DropDownList ddlExistingHotels = (DropDownList)row.Cells[7].Controls[3]; TextBox txtDeactiveRemark = (TextBox)row.Cells[7].Controls[5]; LinkButton btnProceedDeactivate = (LinkButton)row.Cells[7].Controls[7]; LinkButton btnCancel = (LinkButton)row.Cells[7].Controls[9]; if (btnDeactivate != null) { btnDeactivate.Visible = false; } if (ddlExistingHotels != null) { ddlExistingHotels.Visible = true; } if (txtDeactiveRemark != null) { txtDeactiveRemark.Visible = true; } if (btnProceedDeactivate != null) { btnProceedDeactivate.Visible = true; } if (btnCancel != null) { btnCancel.Visible = true; } } else if (e.CommandName == "CancelDeactivate") { LinkButton btnDeactivate = (LinkButton)row.Cells[7].Controls[1]; DropDownList ddlExistingHotels = (DropDownList)row.Cells[7].Controls[3]; TextBox txtDeactiveRemark = (TextBox)row.Cells[7].Controls[5]; LinkButton btnProceedDeactivate = (LinkButton)row.Cells[7].Controls[7]; LinkButton btnCancel = (LinkButton)row.Cells[7].Controls[9]; if (btnDeactivate != null) { btnDeactivate.Visible = true; } if (ddlExistingHotels != null) { ddlExistingHotels.Visible = false; } if (txtDeactiveRemark != null) { txtDeactiveRemark.Visible = false; } if (btnProceedDeactivate != null) { btnProceedDeactivate.Visible = false; } if (btnCancel != null) { btnCancel.Visible = false; } } else if (e.CommandName == "ProceedDeactivate") { LinkButton btnDeactivate = (LinkButton)row.Cells[7].Controls[1]; DropDownList ddlExistingHotels = (DropDownList)row.Cells[7].Controls[3]; TextBox txtDeactiveRemark = (TextBox)row.Cells[7].Controls[5]; LinkButton btnProceedDeactivate = (LinkButton)row.Cells[7].Controls[7]; LinkButton btnCancel = (LinkButton)row.Cells[7].Controls[9]; if (ddlExistingHotels.SelectedItem.Value == "0") { Guid NewHotel_Id = Guid.NewGuid(); ShiftMapping(myRow_Id, NewHotel_Id, txtDeactiveRemark.Text); if (AddHotel(NewHotel_Id)) { if (DeactivateHotel(myRow_Id, txtDeactiveRemark.Text.Trim())) { } } } else { ShiftMapping(myRow_Id, Guid.Parse(ddlExistingHotels.SelectedItem.Value), txtDeactiveRemark.Text.Trim()); if (DeactivateHotel(myRow_Id, txtDeactiveRemark.Text.Trim())) { loadExistingProductGrid(); } } } } catch { //throw ex; } }