/// <summary>
 /// Create a new SqlAppointments object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="start">Initial value of the Start property.</param>
 /// <param name="end">Initial value of the End property.</param>
 /// <param name="isAllDayEvent">Initial value of the IsAllDayEvent property.</param>
 /// <param name="type">Initial value of the Type property.</param>
 public static SqlAppointment CreateSqlAppointments(global::System.Guid id, global::System.DateTime start, global::System.DateTime end, global::System.Boolean isAllDayEvent, global::System.Int32 type)
 {
     SqlAppointment sqlAppointments = new SqlAppointment();
     sqlAppointments.Id = id;
     sqlAppointments.Start = start;
     sqlAppointments.End = end;
     sqlAppointments.IsAllDayEvent = isAllDayEvent;
     sqlAppointments.Type = type;
     return sqlAppointments;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the SqlAppointments EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToSqlAppointments(SqlAppointment sqlAppointments)
 {
     base.AddObject("SqlAppointments", sqlAppointments);
 }
 private bool FilterSqlAppointments(SqlAppointment entity)
 {
     return (entity.Id == this.SqlAppointmentId);
 }
 private void DetachSqlAppointments1(SqlAppointment entity)
 {
     entity.SqlAppointments2 = null;
 }
 private void AttachSqlAppointments1(SqlAppointment entity)
 {
     entity.SqlAppointments2 = this;
 }
Пример #6
0
        void Scheduler_AppointmentCreated(Appointment addedAppointment)
        {
            var sqlAppointment = new SqlAppointment
            {
                Id = new Guid(addedAppointment.UniqueId),
                Start = addedAppointment.Start,
                End = addedAppointment.End,
                Subject = addedAppointment.Subject,
                Body = addedAppointment.Body,
                IsAllDayEvent = addedAppointment.IsAllDayEvent,
                Location = addedAppointment.Location,
                Url = addedAppointment.Url,
                Type = (int)AppointmentType.Regular,
                TimeZoneString = addedAppointment.TimeZone.ToString(),
                Importance = addedAppointment.Importance.ToString(),
                RecurrencePattern = addedAppointment.IsRecurring() ?
                                    RecurrencePatternHelper.RecurrencePatternToString(addedAppointment.RecurrenceRule.Pattern) :
                                    null,
            };

            foreach (var resource in addedAppointment.Resources)
            {
                var appResource = new AppointmentResource();
                appResource.Id = -1;
                appResource.SqlAppointments = sqlAppointment;
                appResource.Resource = this.domainContext.Resources.Single(r => r.Name == resource.ResourceName);
                sqlAppointment.AppointmentResources.Add(appResource);

                if (appResource.Resource.ResourceTypes.Name == "Team")
                    addedAppointment.Category = CategoryHelper.MakeCategory(appResource.Resource.Color);
            }
            this.domainContext.SqlAppointments.Add(sqlAppointment);
            (this.Scheduler.AppointmentsSource as ObservableCollection<Appointment>).Add(addedAppointment);
            //this.domainContext.SubmitChanges();
        }