protected void btnUpdateZoneMaster_Click(object sender, EventArgs e) { dvUpdateMsg.Style.Add("display", "none"); dvmsgUpdateZone.Style.Add("display", "none"); string lat = txtEditLatitude.Text; string longg = txtEditLongitude.Text; double zoneRadius = Convert.ToDouble(ddlZoneRadius.SelectedValue); var searchZone = masterSVc.SearchZone(new MDMSVC.DC_ZoneRQ { Zone_id = Zone_Id }); if (searchZone != null) { var ExistingZone = (from a in searchZone select a).First(); if (ExistingZone.Latitude != lat || ExistingZone.Longitude != longg) { var deletezone = masterSVc.DeleteZoneHotelsInTable(new MDMSVC.DC_ZoneRQ { Zone_id = Zone_Id }); } if (ExistingZone.Zone_Radius != zoneRadius) { var updateZone = masterSVc.UpdateZoneHotelsInTable(new MDMSVC.DC_ZoneRQ { Zone_id = Zone_Id, Zone_Radius = zoneRadius }); } } MDMSVC.DC_ZoneRQ UPdparam = new MDMSVC.DC_ZoneRQ(); UPdparam.Action = "UPDATE"; UPdparam.Zone_id = Zone_Id; UPdparam.Zone_Name = txtEditZoneName.Text; UPdparam.Latitude = lat; UPdparam.Longitude = longg; UPdparam.Edit_Date = DateTime.Now; UPdparam.Edit_User = System.Web.HttpContext.Current.User.Identity.Name; if (ddlEditZoneType.SelectedItem.Value != "0") { UPdparam.Zone_Type = ddlEditZoneType.SelectedItem.Text; } if (ddlEditZoneSubType.SelectedItem.Value != "0") { UPdparam.Zone_SubType = ddlEditZoneSubType.SelectedItem.Text; } if (ddlMasterCountryEdit.SelectedItem.Value != "0") { UPdparam.CountryName = ddlMasterCountryEdit.SelectedItem.Text; UPdparam.Country_id = Guid.Parse(ddlMasterCountryEdit.SelectedValue); } UPdparam.Zone_Radius = zoneRadius; var result = masterSVc.AddzoneMaster(UPdparam); var addZone = masterSVc.InsertZoneHotelsInTable(UPdparam); getZoneInfo(string.Empty); }
protected void btnSaveZoneMaster_Click(object sender, EventArgs e) { MDMSVC.DC_ZoneRQ param = new MDMSVC.DC_ZoneRQ(); var Zone_id = Guid.NewGuid(); param.Action = "ADD"; param.Zone_Radius = 4.0; param.Zone_id = Zone_id; param.Create_Date = DateTime.Now; param.Create_User = System.Web.HttpContext.Current.User.Identity.Name; if (ddlMasterCountryAddModal.SelectedItem.Value != "0") { param.CountryName = ddlMasterCountryAddModal.SelectedItem.Text; param.Country_id = new Guid(ddlMasterCountryAddModal.SelectedValue); } if (ddlMasterCityAddModal.SelectedItem.Value != "0") { param.City_id = new Guid(ddlMasterCityAddModal.SelectedValue); } if (ddlAddZoneType.SelectedItem.Value != "0") { param.Zone_Type = ddlAddZoneType.SelectedItem.Text; } if (ddlAddZoneSubType.SelectedItem.Value != "0") { param.Zone_SubType = ddlAddZoneSubType.SelectedItem.Text; } if (ddlAddHotelIncludeRange.SelectedItem.Value != "0") { param.Zone_Radius = Convert.ToDouble(ddlAddHotelIncludeRange.SelectedValue); } //else param.Zone_Radius = 4; param.Zone_Name = txtAddZoneName.Text; param.Latitude = txtLatitude.Text; param.Longitude = txtLongitude.Text; var result = masterSVc.AddzoneMaster(param); if (result != null) { if (result.StatusCode == MDMSVC.ReadOnlyMessageStatusCode.Success) { BootstrapAlert.BootstrapAlertMessage(dvmsgAdd, "Zone has been added successfully", BootstrapAlertType.Success); var addHotels = masterSVc.InsertZoneHotelsInTable(param); string strQueryString = GetQueryString(Zone_id.ToString(), "0"); Response.Redirect(strQueryString, true); } else { BootstrapAlert.BootstrapAlertMessage(dvmsgAdd, result.StatusMessage, (BootstrapAlertType)result.StatusCode); } } }