protected void ctlDeleteCountry_Click(object sender, ImageClickEventArgs e) { foreach (GridViewRow row in ctlCountryGrid.Rows) { if ((row.RowType == DataControlRowType.DataRow) && (((CheckBox)row.FindControl("ctlSelect")).Checked)) { try { long Id = UIHelper.ParseLong(ctlCountryGrid.DataKeys[row.RowIndex]["ID"].ToString()); FnPerdiemProfileCountry ppc = ScgeAccountingQueryProvider.FnPerdiemProfileCountryQuery.FindByID(Id); FnPerdiemProfileCountryService.Delete(ppc); } catch (Exception ex) { if (((System.Data.SqlClient.SqlException)(ex.GetBaseException())).Number == 547) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "AlertInUseData", "alert('This data is now in use.');", true); ctlUpdatePanelCountryGrid.Update(); } } } } BindCountryGrid(UIHelper.ParseLong(foreignPerdiemRateProfileCode3.Value)); ctlUpdatePanelCountryGrid.Update(); }
protected void ctlAdd_Click(object sender, ImageClickEventArgs e) { FnPerdiemProfileCountry ppc; try { ppc = new FnPerdiemProfileCountry(); ppc.PerdiemProfileID = PPFID; ppc.CountryID = Helper.UIHelper.ParseShort(ctlCountryNameDropdown.SelectedItem.Value); ppc.ZoneID = Helper.UIHelper.ParseShort(ctlZoneDropdown.SelectedItem.Value); ppc.UpdBy = UserAccount.UserID; ppc.UpdDate = DateTime.Now.Date; ppc.UpdPgm = ProgramCode; ppc.CreBy = UserAccount.UserID; ppc.CreDate = DateTime.Now.Date; FnPerdiemProfileCountryService.AddFnPerdiemProfileCountry(ppc); Notify_Ok(sender, e); } catch (ServiceValidationException ex) { ValidationErrors.MergeErrors(ex.ValidationErrors); ctlUpdatePanel.Update(); } }