Ejemplo n.º 1
0
 protected override void OnDeleting()
 {
     try
     {
         HotelFolio hotelFolio = HotelBooking.Folios.FirstOrDefault(f => f.HotelSharing == this);
         Session.Delete(hotelFolio);
     }
     catch { }
     base.OnDeleting();
 }
        void foliosListView_SelectionChanged(object sender, EventArgs e)
        {
            ListView foliosListView = sender as ListView;

            try
            {
                _Folio = foliosListView.Editor.GetSelectedObjects()[0] as HotelFolio;
            }
            catch { _Folio = null; }
        }
Ejemplo n.º 3
0
        //private string _PersistentProperty;
        //[XafDisplayName("My display name"), ToolTip("My hint message")]
        //[ModelDefault("EditMask", "(000)-00"), Index(0), VisibleInListView(false)]
        //[Persistent("DatabaseColumnName"), RuleRequiredField(DefaultContexts.Save)]
        //public string PersistentProperty {
        //    get { return _PersistentProperty; }
        //    set { SetPropertyValue("PersistentProperty", ref _PersistentProperty, value); }
        //}

        //[Action(Caption = "My UI Action", ConfirmationMessage = "Are you sure?", ImageName = "Attention", AutoCommit = true)]
        //public void ActionMethod() {
        //    // Trigger a custom business logic for the current record in the UI (http://documentation.devexpress.com/#Xaf/CustomDocument2619).
        //    this.PersistentProperty = "Paid";
        //}


        #region Logic

        protected override void OnSaving()
        {
            try
            {
                HotelFolio hotelFolio = HotelBooking.Folios.FirstOrDefault(f => f.HotelSharing == this);
                if (hotelFolio == null)
                {
                    hotelFolio = new HotelFolio(Session);
                    hotelFolio.HotelSharing = this;
                    hotelFolio.Booking      = this.HotelBooking;
                    hotelFolio.GuestName    = FullName;
                    hotelFolio.Name         = "Folio";
                }
                else
                {
                    hotelFolio.GuestName = FullName;
                }
                hotelFolio.Save();
            }
            catch { }
            base.OnSaving();
        }