We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Bind Schedule Appointment to Model class

Thread ID:

Created:

Platform:

Replies:

127998 Dec 23,2016 09:50 AM ASP.NET MVC 0
loading
Tags: Schedule
CLAUDIO RICCARDI
Asked On December 23, 2016 09:50 AM

Hi,

I have a Model class Work like this:

    public class Work
    {
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int WorkId { get; set; }

        public string WorkCode { get; set; }

        public DateTime? WorkPlanningDate { get; set; }

        public DateTime? WorkStartPlanningDate { get; set; }

        public DateTime? WorkEndPlanningDate { get; set; }

        public int WorkYear { get; set; }

        public int WorkMonth { get; set; }

        public string WorkDescription { get; set; }

        [ScriptIgnore]
        public virtual ICollection<WorkOperator> WorkOperators { get; set; }
    }

    public class WorkOperator
    {
        public int WorkOperatorId { get; set; }

        public int WorkId { get; set; }
        public virtual Work Work { get; set; }

        public int OperatorId { get; set; }
        public virtual Operator Operator { get; set; }
    }

Is it possible to bind Schedule appointments so that the list of WorkOperator objects are considered as multiple resources?

Something like this:

    @(Html.EJ().Schedule("WorkSchedule")
          .Width("100%")
          .Height("800px")
          .Views(view)
          .Orientation(Orientation.Horizontal)
          .ShowCurrentTimeIndicator(true)
          .CategorizeSettings(fields => fields.Datasource(ViewBag.categorize).Enable(true).AllowMultiple(false).Id("id").Text("text").Color("color").FontColor("fontColor"))
          .DateFormat("dd/MM/yyyy")
          .AllowDragDrop(true)
          .CurrentDate(System.DateTime.Now)
          .Resources(res =>
          {
              res.Field("OperatorId").Title("Operator").Name("Operators").AllowMultiple(true)
              .ResourceSettings(flds => flds.Datasource((IEnumerable<WorkOperator>)Model.WorkOperators).Text("text").Id("id").GroupId("groupId").Color("color")).Add();
          })
          .Group(gr =>
          {
              gr.Resources(ViewBag.Resources);
          })
          .AppointmentSettings(fields => fields.Datasource(ds => ds.Json((IEnumerable<Work>)Model).Adaptor(AdaptorType.UrlAdaptor))
        .Id("WorkId")
        .Subject("WorkCode")
        .StartTime("WorkStartPlanningDate")
        .EndTime("WorkEndPlanningDate")
        .Description("WorkCode")
        .AllDay("False")
        .Recurrence("")
        .RecurrenceRule("")
        .Categorize("Categorize")
        //.Categorize("Categorize")
        .ResourceFields("OperatorId")
        )
        .AppointmentTemplateId("#WorkTemplate")
        .ScheduleClientSideEvents(evt =>
        evt.Create("onCreate")
        .CellClick("onCellClick")
        .AppointmentClick("onAppointmentClick")
        .AppointmentSaved("onAppointmentSaved")
        .AppointmentEdited("onAppointmentEdited")
        .ResizeStop("onResizeStop")
        .ActionComplete("onActionComplete")
        .DragStop("onDragStop")
        ))

Thanks in advance.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;