protected void ctlAdd_Click(object sender, ImageClickEventArgs e) { FnPerdiemProfile fp; try { if (Mode.Equals(FlagEnum.EditFlag)) { fp = ScgeAccountingQueryProvider.FnPerdiemProfileQuery.FindByIdentity(PPFID); } else { fp = new FnPerdiemProfile(); } fp.PerdiemProfileName = ctlPerdiemProfileName.Text; fp.Description = ctlDescription.Text; fp.Active = ctlActive.Checked; if (Mode.Equals(FlagEnum.EditFlag)) { fp.UpdBy = UserAccount.UserID; fp.UpdDate = DateTime.Now.Date; fp.UpdPgm = ProgramCode; FnPerdiemProfileService.UpdateFnPerdiemProfile(fp); } else if (Mode.Equals(FlagEnum.NewFlag)) { fp.UpdBy = UserAccount.UserID; fp.UpdDate = DateTime.Now.Date; fp.UpdPgm = ProgramCode; fp.CreBy = UserAccount.UserID; fp.CreDate = DateTime.Now.Date; FnPerdiemProfileService.AddFnPerdiemProfile(fp); } Notify_Ok(sender, e); } catch (ServiceValidationException ex) { ValidationErrors.MergeErrors(ex.ValidationErrors); ctlUpdatePanel.Update(); } }
protected void ctlForeignPerdiemRateProfileGrid_RowCommand(object sender, GridViewCommandEventArgs e) { int rowIndex; if (e.CommandName.Equals("ForeignPerdiemRateProfileEdit")) { rowIndex = ((GridViewRow)((ImageButton)e.CommandSource).NamingContainer).RowIndex; ForeignPerdiemRateProfileCode = UIHelper.ParseLong(ctlForeignPerdiemRateProfileGrid.DataKeys[rowIndex].Values["PerdiemProfileID"].ToString()); ctlForeignPerdiemRateProfileEditor.Initialize(FlagEnum.EditFlag, ForeignPerdiemRateProfileCode); ctlForeignPerdiemRateProfileEditor.ShowPopUp(); } if (e.CommandName.Equals("ForeignPerdiemRateProfileDelete")) { try { rowIndex = ((GridViewRow)((ImageButton)e.CommandSource).NamingContainer).RowIndex; ForeignPerdiemRateProfileCode = UIHelper.ParseLong(ctlForeignPerdiemRateProfileGrid.DataKeys[rowIndex].Value.ToString()); FnPerdiemProfile fp = ScgeAccountingQueryProvider.FnPerdiemProfileQuery.FindByIdentity(ForeignPerdiemRateProfileCode); FnPerdiemProfileService.Delete(fp); DetailGridClose(); } 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); ctlForeignPerdiemRateProfileGrid.DataCountAndBind(); } } ctlForeignPerdiemRateProfileGrid.DataCountAndBind(); ctlUpdatePanel.Update(); } if (e.CommandName.Equals("Detail")) { rowIndex = ((GridViewRow)((LinkButton)e.CommandSource).NamingContainer).RowIndex; long PofileID = UIHelper.ParseLong(ctlForeignPerdiemRateProfileGrid.DataKeys[rowIndex].Value.ToString()); ctlForeignPerdiemRateProfileGrid.SelectedIndex = rowIndex; foreignPerdiemRateProfileCode2.Value = PofileID.ToString(); BindDetailGrid(PofileID); ctlDetailGrid.Visible = true; ctlDetailTools.Visible = true; CountryGridClose(); ctlUpdatePanel.Update(); ctlUpdatePanelDetailGrid.Update(); } if (e.CommandName.Equals("Country")) { rowIndex = ((GridViewRow)((LinkButton)e.CommandSource).NamingContainer).RowIndex; long PofileID = UIHelper.ParseLong(ctlForeignPerdiemRateProfileGrid.DataKeys[rowIndex].Value.ToString()); ctlForeignPerdiemRateProfileGrid.SelectedIndex = rowIndex; foreignPerdiemRateProfileCode3.Value = PofileID.ToString(); BindCountryGrid(PofileID); ctlCountryGrid.Visible = true; ctlCountryTools.Visible = true; DetailGridClose(); ctlUpdatePanel.Update(); ctlUpdatePanelCountryGrid.Update(); } }