示例#1
0
        public override object ConvertTo(object data, string format)
        {
            if (format == typeof(IDateRange).FullName)
            {
                var draggedProjectItem = (DataObjectHelper.GetData(data, typeof(Project), true) as List <object>).First() as Project;
                var task = new GanttTask {
                    Title = draggedProjectItem.Name, Start = draggedProjectItem.Start, End = draggedProjectItem.End
                };

                return(task);
            }
            else if (DataObjectHelper.GetDataPresent(data, typeof(ScheduleViewDragDropPayload), false))
            {
                ScheduleViewDragDropPayload payload = (ScheduleViewDragDropPayload)DataObjectHelper.GetData(data, typeof(ScheduleViewDragDropPayload), false);
                if (payload != null)
                {
                    return(payload.DraggedAppointments);
                }
            }
            else if (format == typeof(ScheduleViewDragDropPayload).FullName)
            {
                var customers = DataObjectHelper.GetData(data, typeof(Project), true) as IEnumerable;
                if (customers != null)
                {
                    return(customers.OfType <Project>().Select(c => new Appointment {
                        Subject = c.Name
                    }).ToList());
                }
            }

            return(null);
        }
示例#2
0
        public override IEnumerable <IOccurrence> ConvertDraggedData(object data)
        {
            var payload = DataObjectHelper.GetData(data, typeof(SchedulingDragOperationPayload), true) as SchedulingDragOperationPayload;

            if (payload != null)
            {
                return(payload.DraggedItems.OfType <IGanttTask>().Select(p => new Appointment {
                    Subject = p.Title, Start = p.Start, End = p.End
                }).ToList <IOccurrence>());
            }
            else
            {
                var project = ((List <object>)DataObjectHelper.GetData(data, typeof(Project), true)).FirstOrDefault() as Project;
                if (project != null)
                {
                    return(new List <IOccurrence> {
                        new Appointment {
                            Subject = project.Name, Start = project.Start, End = project.End
                        }
                    });
                }
            }

            return(base.ConvertDraggedData(data));
        }
        public override object ConvertTo(object data)
        {
            var draggedProjectItem = (DataObjectHelper.GetData(data, typeof(Project), true) as List <object>).First() as Project;
            var task = new GanttTask {
                Title = draggedProjectItem.Name, Start = draggedProjectItem.Start, End = draggedProjectItem.End
            };

            return(task);
        }
示例#4
0
	public override object ConvertTo(object data, string format)
	{

		var payload = DataObjectHelper.GetData(data, typeof(ScheduleViewDragDropPayload), false) as ScheduleViewDragDropPayload;
		if (payload != null)
		{
			var customers = payload.DraggedAppointments;
			return customers.OfType<Appointment>().Select(a => new Customer { Name = a.Subject });
		}		
		return null;
	}
示例#5
0
        public override object ConvertTo(object data, string format)
        {
            if (format == typeof(string).FullName && DataObjectHelper.GetDataPresent(data, "DragData", false))
            {
                var customer       = DataObjectHelper.GetData(data, "DragData", false) as Customer;
                var fullInfoString = "Name: " + customer.FirstName + " " + customer.LastName + ", Age: " + customer.Age;
                return(fullInfoString);
            }

            return(null);
        }
 public override object ConvertTo(object data, string format)
 {
     if (format == typeof(ScheduleViewDragDropPayload).FullName && DataObjectHelper.GetDataPresent(data, typeof(Appointment), false))
     {
         var appointments = (IEnumerable)DataObjectHelper.GetData(data, typeof(Appointment), false);
         if (appointments != null)
         {
             return(new ScheduleViewDragDropPayload(null, appointments.OfType <IOccurrence>().ToList()));
         }
     }
     return(null);
 }
示例#7
0
        public override IEnumerable <IOccurrence> ConvertDraggedData(object data)
        {
            var payload = DataObjectHelper.GetData(data, typeof(SchedulingDragOperationPayload), true) as SchedulingDragOperationPayload;

            if (payload != null)
            {
                return(payload.DraggedItems.OfType <IGanttTask>().Select(p => new Appointment {
                    Subject = p.Title, Start = p.Start, End = p.End
                }).ToList <IOccurrence>());
            }

            return(base.ConvertDraggedData(data));
        }
        public override IEnumerable <IOccurrence> ConvertDraggedData(object data)
        {
            if (DataObjectHelper.GetDataPresent(data, typeof(Appointment), false))
            {
                var appointments = DataObjectHelper.GetData(data, typeof(Appointment), true) as IEnumerable;
                if (appointments != null)
                {
                    return(appointments.OfType <IOccurrence>());
                }
            }

            return(base.ConvertDraggedData(data));
        }
示例#9
0
        public override object ConvertTo(object data, string format)
        {
            var payload = DataObjectHelper.GetData(data, typeof(ScheduleViewDragDropPayload), false) as ScheduleViewDragDropPayload;

            if (payload != null)
            {
                var cdm = payload.DraggedAppointments;
                return(cdm.OfType <ScheduleAppointment>().Select(a => new ClassDisplayModel {
                    Name = a.Subject, Id = a.ClassId
                }));
            }
            return(null);
        }
示例#10
0
	public override IEnumerable<IOccurrence> ConvertDraggedData(object data)
	{

		if (DataObjectHelper.GetDataPresent(data, typeof(Customer), false))
		{
			var customers = DataObjectHelper.GetData(data, typeof(Customer), true) as IEnumerable;
			if (customers != null)
			{
				var newApp = customers.OfType<Customer>().Select(c => new Appointment { Subject = c.Name });
				return newApp;
			}
		}

		return base.ConvertDraggedData(data);
	}
        public override object ConvertTo(object data, string format)
        {
            if (format == typeof(Project).FullName)
            {
                var project = DataObjectHelper.GetData(data, typeof(SchedulingDragOperationPayload), true) as SchedulingDragOperationPayload;
                if (project != null)
                {
                    return(project.DraggedItems.OfType <IGanttTask>().Select(p => new Project {
                        Name = p.Title, Start = p.Start, End = p.End
                    }));
                }
            }

            return(null);
        }
示例#12
0
        public override IEnumerable <IOccurrence> ConvertDraggedData(object data)
        {
            if (DataObjectHelper.GetDataPresent(data, typeof(ClassDisplayModel), false))
            {
                var cdms = DataObjectHelper.GetData(data, typeof(ClassDisplayModel), false) as IEnumerable;
                if (cdms != null)
                {
                    return(cdms.OfType <ClassDisplayModel>().Select(c => new ScheduleAppointment {
                        Subject = c.Name, ClassId = c.Id
                    }));;
                }
            }

            return(base.ConvertDraggedData(data));
        }
示例#13
0
        public override object ConvertTo(object data, string format)
        {
            var result           = new List <Project>();
            var draggedCustomers = ((List <object>)DataObjectHelper.GetData(data, typeof(Customer), false)).OfType <Customer>();

            foreach (var customer in draggedCustomers)
            {
                result.Add(new Project()
                {
                    Name   = customer.Project,
                    Id     = customer.Id,
                    Person = customer.Name
                });
            }

            return(result);
        }
        public override object ConvertTo(object data, string format)
        {
            var result          = new List <Customer>();
            var draggedProjects = ((List <object>)DataObjectHelper.GetData(data, typeof(Project), false)).OfType <Project>();

            foreach (var project in draggedProjects)
            {
                result.Add(new Customer()
                {
                    Name    = project.Person,
                    Id      = project.Id,
                    Project = project.Name
                });
            }

            return(result);
        }