Giter Site home page Giter Site logo

devexpress-examples / how-to-determine-whether-or-not-a-specific-appointment-property-value-is-changed-e4446 Goto Github PK

View Code? Open in Web Editor NEW
0.0 57.0 0.0 37 KB

.NET, WinForms, XtraScheduler Suite

License: Other

C# 69.82% Visual Basic .NET 30.18%
dotnet xtrascheduler-suite winforms

how-to-determine-whether-or-not-a-specific-appointment-property-value-is-changed-e4446's Introduction

Files to look at:

How to determine whether or not a specific appointment property value is changed

Starting with v18.1

Cast PersistentObjectCancelEventArgs objects to the AdvPersistentObjectCancelEventArgs type to access additional information about the appointment being modified.

  • PropertyName - returns the name of the modified appointment property.
  • OldValue - the previous value of the modified appointment property.
  • NewValue - the new value of the modified appointment property.

Use PropertyName to determine the name of the modified property:

        private void SchedulerStorage1_AppointmentChanging(object sender, PersistentObjectCancelEventArgs e) {
            if (((DevExpress.XtraScheduler.AdvPersistentObjectCancelEventArgs)e).PropertyName == "LabelKey") {
               
            }
        }
        Private Sub SchedulerStorage1_AppointmentChanging(ByVal sender As Object, ByVal e As PersistentObjectCancelEventArgs)
            If CType(e, DevExpress.XtraScheduler.AdvPersistentObjectCancelEventArgs).PropertyName = "LabelKey" Then
                
            End If
        End Sub    

For versions older than v18.1

This example illustrates how to determine whether or not the specific appointment property (the Appointment.LabelId in this example) value is changed without creating a Custom Appointment Form. We handle the SchedulerStorageBase.AppointmentChanging Event for this purpose and examine the e.Object's parameter value and the value returned by the PersistentObject.GetSourceObject Method. The first one represents a new value whereas the second one represents the previous value. Note that the GetSourceObject() method works even in unbound mode because in this mode a hidden data layer still exist in the Scheduler context (see Logical Layers). Here is a corresponding code snippet:

        private void schedulerStorage1_AppointmentChanging(object sender, PersistentObjectCancelEventArgs e) {
            int oldLabel = Convert.ToInt32(((DataRowView)((Appointment)e.Object).GetSourceObject((SchedulerStorageBase)sender)).Row["Label"]);
            int newLabel = ((Appointment)e.Object).LabelId;

            if (!newLabel.Equals(oldLabel))
                MessageBox.Show("Label was changed!");
        }

Note that a similar technique is used in the How to split appointments into groups example.


how-to-determine-whether-or-not-a-specific-appointment-property-value-is-changed-e4446's People

Contributors

alexmedusa avatar devexpressexamplebot avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.