예제 #1
0
 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));
 }
예제 #2
0
        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);
        }
예제 #3
0
 internal static void SetCxlfeeChgDate(FlextourEntities context, CXLFEE cxlFee, DateTime updated, string user)
 {
     if (cxlFee.IsModified(context))
     {
         cxlFee.LAST_UPD = updated;
         cxlFee.UPD_INIT = user;
     }
 }
예제 #4
0
 void ClearBindings()
 {
     _ignoreLeaveRow       = true;
     _ignorePositionChange = true;
     _selectedRecord       = null;
     SetReadOnly(true);
     BarButtonItemDelete.Enabled = false;
     BarButtonItemSave.Enabled   = false;
     BindingSource.DataSource    = typeof(CXLFEE);
     _ignoreLeaveRow             = false;
     _ignorePositionChange       = false;
 }
예제 #5
0
 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();
 }
예제 #6
0
 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();
         }
     }
 }
예제 #7
0
        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();
            }
        }
예제 #8
0
 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;
 }
예제 #9
0
 private void SetUpdateFields(CXLFEE record)
 {
     record.LAST_UPD = DateTime.Now;
     record.UPD_INIT = _username;
 }