This is a migrated thread and some comments may be shown as answers.

IAppointment implementation and drag & drop problem

2 Answers 65 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Krzysztof
Top achievements
Rank 1
Krzysztof asked on 23 Aug 2012, 01:14 PM
Dear Telerik Team!

I have successfuly implemented drag and drop operation between ListBox and ScheduleView. I use custom appointment. Everything works fine when my custom appointment inherits from Appointment class. Unfortunately I need to use a class which inherits from EntityObject class so my custom appointment class must implement IAppointment interface instead of inheriting Appointment base class. After that drag and drop stopped working. Could you please provide me with some samples of correct IAppointment interface implementation. You can find a class I use for now down below:
public class WMSAppointment : IAppointment
    {
        public string Body { get; set; }
        public ICategory Category { get; set; }
        public Importance Importance { get; set; }
        public DateTime End { get; set; }
        public DateTime Start { get; set; }
        public string Subject { get; set; }
        public IList Resources { get; set; }
        public int JobId { get; set; }
        public bool IsAllDayEvent { get; set; }
        public IRecurrenceRule RecurrenceRule { get; set; }
        public ITimeMarker TimeMarker { get; set; }
        public TimeZoneInfo TimeZone { get; set; }
 
        public event EventHandler RecurrenceRuleChanged;
        public event PropertyChangedEventHandler PropertyChanged;
 
        public bool Equals(IAppointment other)
        {
            var otherAppointment = other as WMSAppointment;
            return otherAppointment != null &&
                other.Start == this.Start &&
                other.End == this.End &&
                other.Subject == this.Subject &&
                this.JobId == otherAppointment.JobId &&
                this.TimeMarker == otherAppointment.TimeMarker &&
                this.TimeZone == otherAppointment.TimeZone &&
                this.IsAllDayEvent == other.IsAllDayEvent &&
                this.RecurrenceRule == other.RecurrenceRule;
        }
 
        public void BeginEdit()
        {
            throw new NotImplementedException();
        }
 
        public void CancelEdit()
        {
            throw new NotImplementedException();
        }
 
        public void EndEdit()
        {
            throw new NotImplementedException();
        }
 
        public IAppointment Copy()
        {
            IAppointment appointment = new WMSAppointment();
            appointment.CopyFrom(this);
 
            return appointment;
        }
 
        public void CopyFrom(IAppointment other)
        {
            this.IsAllDayEvent = other.IsAllDayEvent;
            this.Start = other.Start;
            this.End = other.End;
            this.Subject = other.Subject;
 
            var otherAppointment = other as WMSAppointment;
            if (otherAppointment == null)
                return;
 
            this.JobId = otherAppointment.JobId;
            this.TimeMarker = otherAppointment.TimeMarker;
 
            this.Resources.Clear();
            this.Resources.AddRange(otherAppointment.Resources);
 
            this.Body = otherAppointment.Body;
        }
    }


Thank you very much and best regards
Krzysztof Ka┼║mierczak

2 Answers, 1 is accepted

Sort by
0
Accepted
Ventzi
Telerik team
answered on 27 Aug 2012, 12:55 PM
Hi Krzysztof,

I am sending you attached your new ScheduleView example. It's real-world example, but it's still in test phase. Inside the project you'll see our implementation of SqlAppointment which inherits from EntityObject and also implements IAppointment.

I hope this will bring you further.

Greetings,
Ventzi
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Krzysztof
Top achievements
Rank 1
answered on 13 Nov 2012, 01:09 PM
Thank you very much!

Very best regards
Krzysztof Ka┼║mierczak
Tags
ScheduleView
Asked by
Krzysztof
Top achievements
Rank 1
Answers by
Ventzi
Telerik team
Krzysztof
Top achievements
Rank 1
Share this question
or