private void Update() { try { int result = 0; CountryRegionMapDal = new CountryRegionMapDal(); bool IsInsert = false; CountryRegionMapBDto = new CountryRegionMapBDto(); if (ViewState["SrNo"] != null) { CountryRegionMapBDto.SrNO = Convert.ToInt32(ViewState["SrNo"]); } if (radAirline.SelectedValue != "0") CountryRegionMapBDto.RegionId = Convert.ToInt32(radAirline.SelectedValue); if (radCmbDestination.SelectedValue != "0") CountryRegionMapBDto.CountryId = Convert.ToInt32(radCmbDestination.SelectedValue); result = CountryRegionMapDal.UpdateRegionCountryMap(CountryRegionMapBDto); if (result > 0) { IsInsert = true; } else { IsInsert = false; } if (IsInsert) { Master.DisplayMessage(ConfigurationSettings.AppSettings[SuccessMessage.Update].ToString()); Master.MessageCssClass = "successMessage"; acbGDSCode.SaveButton.CommandName = "Update"; BindGrid(); } else { Master.DisplayMessage(ConfigurationSettings.AppSettings[GeneralMessage.ExistRecord].ToString()); Master.MessageCssClass = "errorMessage"; } } catch (Exception ex) { bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME); if (rethrow) { throw ex; } } }
private void BindGrid() { CountryRegionMapDal = new CountryRegionMapDal(); DataTable dsGDSCode = CountryRegionMapDal.FindCountryRegionMap(""); radgrdGDSCode.DataSource = dsGDSCode; radgrdGDSCode.DataBind(); ViewState[vsGDSAirport] = dsGDSCode; pnlGrid.Visible = true; }
protected void acbGDSCode_SearchClick(object sender, EventArgs e) { try { CountryRegionMapDal = new CountryRegionMapDal(); DataTable dsGDSCode = CountryRegionMapDal.FindCountryRegionMap(acbGDSCode.SearchTextBox.Text); radgrdGDSCode.DataSource = dsGDSCode; radgrdGDSCode.DataBind(); ViewState[vsGDSAirport] = dsGDSCode; Reset(); } catch (Exception ex) { bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME); if (rethrow) { throw ex; } } }
protected void acbGDSCode_EditClick(object sender, EventArgs e) { try { if (ViewState[PageConstants.vsItemIndexes] != null) { htItemIndex = (Hashtable)ViewState[PageConstants.vsItemIndexes]; } if (htItemIndex != null) { for (int i = 0; i < htItemIndex.Count; i++) { int DestinationCityID = 0; int AirLineId = 0; GridDataItem item = radgrdGDSCode.Items[int.Parse(htItemIndex[i].ToString())]; Label lblGDSCodeItem = (Label)item.FindControl("lblGDSCodeItem"); Label lblAirLineId = (Label)item.FindControl("lblAirLineId"); Label lblDestinationCity = (Label)item.FindControl("lblDestinationCity"); ViewState.Remove("SrNo"); ViewState.Add("SrNo", lblGDSCodeItem.Text); DestinationCityID = Convert.ToInt32(lblDestinationCity.Text); AirLineId = Convert.ToInt32(lblAirLineId.Text); try { radCmbDestination.ClearSelection(); radCmbDestination.SelectedValue = DestinationCityID.ToString(); radAirline.ClearSelection(); radAirline.SelectedValue = AirLineId.ToString(); } catch { } } CountryRegionMapDal = new CountryRegionMapDal(); } bisEdit = true; pnlAddNewMode.Visible = true; pnlGrid.Visible = false; acbGDSCode.EditableMode = true; acbGDSCode.SaveButton.CommandName = "Update"; acbGDSCode.SaveNewButton.Visible = false; } catch (Exception ex) { bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME); if (rethrow) { throw ex; } } }
protected void acbGDSCode_DeleteClick(object sender, EventArgs e) { try { StringBuilder GDSCode = new StringBuilder(); int result = 0; if (ViewState[PageConstants.vsItemIndexes] != null) htItemIndex = (Hashtable)ViewState[PageConstants.vsItemIndexes]; if (htItemIndex != null) { foreach (int i in htItemIndex.Values) { Label lblGDSCode = (Label)radgrdGDSCode.Items[i].FindControl("lblGDSCodeItem"); if (lblGDSCode != null) { GDSCode.Append(lblGDSCode.Text + ","); } } } CountryRegionMapDal = new CountryRegionMapDal(); String CodeId = GDSCode.ToString().TrimEnd(','); result = CountryRegionMapDal.DeleteCountryRegionMap(CodeId); if (result == 1) { Master.DisplayMessage(ConfigurationSettings.AppSettings[SuccessMessage.Delete].ToString()); Master.MessageCssClass = "successMessage"; ViewState[PageConstants.vsItemIndexes] = null; BindGrid(); } else if (result == 547) { Master.DisplayMessage(ConfigurationSettings.AppSettings[FailureMessage.Delete].ToString()); Master.MessageCssClass = "errorMessage"; } } catch (Exception ex) { bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME); if (rethrow) { throw ex; } } }