private bool IsModified(CXLFEE record) { //Type-specific routine that takes into account relationships that should also be considered //when deciding if there are unsaved changes. The entity properties also return true if the //record is new or deleted. return(record.IsModified(_context)); }
void FindOrAddCxlfee(ICoreSys sys, FlextourEntities context, string code, int ntsPrior, decimal pctPenalty) { CXLFEE cxlFee = context.CXLFEE.FirstOrDefault(c => c.TYPE == "OPT" && c.CODE == code && c.CAT == null && c.START_DATE == null && c.END_DATE == null && c.AGENCY == sys.Settings.DefaultAgency); if (cxlFee == null) { cxlFee = new CXLFEE() { TYPE = "OPT", CODE = code, CAT = null, START_DATE = null, END_DATE = null, AGENCY = sys.Settings.DefaultAgency, }; context.CXLFEE.AddObject(cxlFee); } cxlFee.NTS_PRIOR = (short)ntsPrior; cxlFee.Description = null; cxlFee.NonRefundable = (ntsPrior == 999) || pctPenalty == 100; cxlFee.PCT_AMT = (float)pctPenalty; cxlFee.FLAT_FEE = null; cxlFee.NBR_NTS = null; cxlFee.TimeBasis = (short)Enumerations.FlexCancelFeeTimeBasis.flxCancelFeeTimeBasisBeforeArrival; cxlFee.TimeUnits = (short)Enumerations.FlexTimeUnits.flxTimeUnitsDays; MediaHelper.SetCxlfeeChgDate(context, cxlFee, _update, _sys.User.Name); }
internal static void SetCxlfeeChgDate(FlextourEntities context, CXLFEE cxlFee, DateTime updated, string user) { if (cxlFee.IsModified(context)) { cxlFee.LAST_UPD = updated; cxlFee.UPD_INIT = user; } }
void ClearBindings() { _ignoreLeaveRow = true; _ignorePositionChange = true; _selectedRecord = null; SetReadOnly(true); BarButtonItemDelete.Enabled = false; BarButtonItemSave.Enabled = false; BindingSource.DataSource = typeof(CXLFEE); _ignoreLeaveRow = false; _ignorePositionChange = false; }
void SetBindings() { if (BindingSource.Current == null) { ClearBindings(); } else { _selectedRecord = ((CXLFEE)BindingSource.Current); SetReadOnly(false); BarButtonItemDelete.Enabled = true; BarButtonItemSave.Enabled = true; //SetTimeFieldsState(_selectedRecord.TimeBasis); } ErrorProvider.Clear(); }
private void GridViewLookup_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { if (!_ignoreLeaveRow) { GridView view = (GridView)sender; object row = view.GetRow(e.FocusedRowHandle); if (row != null && row.GetType() != typeof(DevExpress.Data.NotLoadedObject)) { ReadonlyThreadSafeProxyForObjectFromAnotherThread proxy = (ReadonlyThreadSafeProxyForObjectFromAnotherThread)view.GetRow(e.FocusedRowHandle); CXLFEE record = (CXLFEE)proxy.OriginalRow; BindingSource.DataSource = _context.CXLFEE.Where(c => c.ID == record.ID); } else { ClearBindings(); } } }
private void PurgeButton_Click(object sender, System.EventArgs e) { if (gridView1.SelectedRowsCount == 0) { MessageBox.Show("Please select at least one row before attempting to purge records."); return; } List <int> values = new List <int>(); foreach (int val in gridView1.GetSelectedRows()) { values.Add((int)gridView1.GetRowCellValue(val, "ID")); } foreach (int ID in values) { CXLFEE rec = (from hratRec in context.CXLFEE where hratRec.ID == ID select hratRec).FirstOrDefault(); context.CXLFEE.DeleteObject(rec); context.SaveChanges(); } }
private void BarButtonItemNew_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { _ignoreLeaveRow = true; //so that when the grid row changes it doesn't try to save again if (SaveRecord(true)) { //For some reason when there is no existing record in the binding source the Add method does not //trigger the CurrentChanged event, but AddNew does so use that instead _selectedRecord = (CXLFEE)BindingSource.AddNew(); //With the instant feedback data source, the new row is not immediately added to the grid, so move //the focused row to the filter row just so that no other existing row is visually highlighted GridViewLookup.FocusedRowHandle = DevExpress.Data.BaseListSourceDataController.FilterRow; BarButtonItemDelete.Enabled = true; BarButtonItemSave.Enabled = true; SetReadOnly(false); SetTimeFieldsState(_selectedRecord.TimeBasis); } ErrorProvider.Clear(); _ignoreLeaveRow = false; BarButtonItemDelete.Enabled = true; BarButtonItemSave.Enabled = true; }
private void SetUpdateFields(CXLFEE record) { record.LAST_UPD = DateTime.Now; record.UPD_INIT = _username; }