private static EntityObject CreateEntityObject(SyncTransferData transferData) { EntityObject retVal = null; string entityName; if (_transfer2entity.TryGetValue(transferData.SyncDataName, out entityName)) { switch (entityName) { case CalendarEventEntity.ClassName: retVal = new CalendarEventEntity(); break; case CalendarEventRecurrenceEntity.ClassName: retVal = new CalendarEventRecurrenceEntity(); break; case CalendarEventResourceEntity.ClassName: retVal = new CalendarEventResourceEntity(); break; } if (retVal != null) { CopyProperies(transferData, retVal); } } return(retVal); }
public override void DataBind() { if (DataItem != null) { CalendarEventEntity ceo = (CalendarEventEntity)DataItem; FilterElementCollection fec = new FilterElementCollection(); FilterElement fe = FilterElement.EqualElement("EventId", ((VirtualEventId)ceo.PrimaryKeyId).RealEventId); fec.Add(fe); fe = FilterElement.EqualElement("PrincipalId", Mediachase.IBN.Business.Security.CurrentUser.UserID); fec.Add(fe); EntityObject[] list = BusinessManager.List(CalendarEventResourceEntity.ClassName, fec.ToArray()); if (list.Length > 0) { CalendarEventResourceEntity cero = (CalendarEventResourceEntity)list[0]; _resId = cero.PrimaryKeyId.Value; if (cero.Status.HasValue) { if (cero.Status.Value == (int)eResourceStatus.Accepted) { btnAccept.Disabled = true; } if (cero.Status.Value == (int)eResourceStatus.Tentative) { btnTentative.Disabled = true; } if (cero.Status.Value == (int)eResourceStatus.Declined) { btnDecline.Disabled = true; } } } } base.DataBind(); }
public void UpdateItem(string uid, string title, string startDate, string endDate, string description, bool isAllDay, object extentions, object calendarExtension) { DateTime viewStartDate = DateTime.Now; DateTime viewEndDate = DateTime.Now; string[] arr = startDate.Split(new char[] { '.' }); viewStartDate = new DateTime(int.Parse(arr[0]), int.Parse(arr[1]), int.Parse(arr[2]), int.Parse(arr[3]), int.Parse(arr[4]), int.Parse(arr[5])); arr = endDate.Split(new char[] { '.' }); viewEndDate = new DateTime(int.Parse(arr[0]), int.Parse(arr[1]), int.Parse(arr[2]), int.Parse(arr[3]), int.Parse(arr[4]), int.Parse(arr[5])); CalendarEventEntity ceo = (CalendarEventEntity)BusinessManager.Load(CalendarEventEntity.ClassName, PrimaryKeyId.Parse(uid)); if (((VirtualEventId)ceo.PrimaryKeyId.Value).RealEventId == ceo.PrimaryKeyId && extentions != null && extentions.ToString() == "resize") { arr = startDate.Split(new char[] { '.' }); viewStartDate = DateTime.MinValue.AddHours(int.Parse(arr[3])).AddMinutes(int.Parse(arr[4])); arr = endDate.Split(new char[] { '.' }); viewEndDate = DateTime.MinValue.AddHours(int.Parse(arr[3])).AddMinutes(int.Parse(arr[4])); } ceo.Start = viewStartDate; ceo.End = viewEndDate; BusinessManager.Update(ceo); }
/// <summary> setups the sync logic for member _calendarEvent</summary> /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param> private void SetupSyncCalendarEvent(IEntityCore relatedEntity) { if (_calendarEvent != relatedEntity) { DesetupSyncCalendarEvent(true, true); _calendarEvent = (CalendarEventEntity)relatedEntity; this.PerformSetupSyncRelatedEntity(_calendarEvent, new PropertyChangedEventHandler(OnCalendarEventPropertyChanged), "CalendarEvent", MonoSoftware.MonoX.DAL.RelationClasses.StaticCalendarEventEntryRelations.CalendarEventEntityUsingCalendarEventIdStatic, true, new string[] { }); } }
protected void btnSave_ServerClick(object sender, EventArgs e) { DataTable dt = ((DataTable)ViewState["Resources"]).Copy(); List <CalendarEventResourceEntity> list = new List <CalendarEventResourceEntity>(); foreach (DataRow dr in dt.Rows) { CalendarEventResourceEntity cero = BusinessManager.InitializeEntity <CalendarEventResourceEntity>(CalendarEventResourceEntity.ClassName); string[] elem = dr["Id"].ToString().Split(new string[] { "::" }, StringSplitOptions.RemoveEmptyEntries); if (elem[1] != "0") { MetaClass mcEl = MetaDataWrapper.GetMetaClassByName(elem[1]); if (mcEl.IsCard) { elem[1] = mcEl.CardOwner.Name; } } if (elem[1] == "0") { cero.Email = elem[0]; } else if (elem[1] == Principal.GetAssignedMetaClass().Name) { cero.PrincipalId = PrimaryKeyId.Parse(elem[0]); } else if (elem[1] == ContactEntity.GetAssignedMetaClassName()) { cero.ContactId = PrimaryKeyId.Parse(elem[0]); } else if (elem[1] == OrganizationEntity.GetAssignedMetaClassName()) { cero.OrganizationId = PrimaryKeyId.Parse(elem[0]); } cero.Name = dr["Name"].ToString(); cero.Status = (int)eResourceStatus.NotResponded; list.Add(cero); } CalendarEventEntity ceo = (CalendarEventEntity)BusinessManager.Load(CalendarEventEntity.ClassName, _workObjectId); CalendarEventUpdateResourcesRequest req = new CalendarEventUpdateResourcesRequest(ceo, list.ToArray()); BusinessManager.Execute(req); if (Request["CommandName"] != null) { CommandParameters cp = new CommandParameters(Request["CommandName"]); Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString()); } else { Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, String.Empty); } }
public void CreateIBN_Event() { CalendarEventEntity eventEntity = new CalendarEventEntity(); eventEntity.Subject = "Test ibn"; eventEntity.Start = DateTime.UtcNow; eventEntity.End = eventEntity.Start.AddHours(1); eventEntity.Body = "is ibn event"; BusinessManager.Create(eventEntity); }
/// <summary> /// Creates the entity object. /// </summary> /// <param name="metaClassName">Name of the meta class.</param> /// <param name="primaryKeyId">The primary key id.</param> /// <returns></returns> protected override EntityObject CreateEntityObject(string metaClassName, PrimaryKeyId?primaryKeyId) { if (metaClassName == CalendarEventEntity.ClassName) { CalendarEventEntity retVal = new CalendarEventEntity(); retVal.PrimaryKeyId = primaryKeyId; return(retVal); } return(base.CreateEntityObject(metaClassName, primaryKeyId)); }
/// <summary> /// Gets the event viewer URL. /// </summary> /// <param name="eventEntity">Calendar event entity.</param> /// <returns>Event viewer URL.</returns> protected virtual string GetEventViewUrl(CalendarEventEntity eventEntity) { string eventViewerURL = Paths.MonoX.Pages.SocialNetworking.EventCalendar_aspx; if (ProviderAttributes[CalendarEventPreviewPagePathParam] != null) { eventViewerURL = ProviderAttributes[CalendarEventPreviewPagePathParam]; } return(UrlFormatter.ResolveServerUrl(eventViewerURL).Append(UrlParams.EntityId, eventEntity.Id)); }
public async Task UpdateCalendarEntryAsync(CalendarEventEntity entity) { // Get entity var result = await _entityRepository.FindAsync(entity.Id); // Map var updatedResult = _mapper.Map(result, entity); // Update await _entityRepository.UpdateAsync(updatedResult); }
public override bool CheckVisibility(object dataItem) { if (dataItem != null) { CalendarEventEntity ceo = (CalendarEventEntity)dataItem; if (ceo.CalendarEventExceptionId.HasValue) { return(false); } } return(base.CheckVisibility(dataItem)); }
protected void SendEmailСonfirmation(Order order, User user) { var Event = new CalendarEventEntity() { Summary = $"Booking the desk {order.Desk.Title}.", Start = order.DateTime.Date.AddHours(+10), End = order.DateTime.Date.AddHours(+18), Location = $"Desk located on the {order.Desk.Room.Floor} floor in the {order.Desk.RoomId} room." }; EmailService.SendСonfirmation(user.Email, Event); }
public async Task AddOrUpdateCalendarEntryAsync(CalendarEventEntity entity) { var isFound = (await _entityRepository.FindAsync(entity.Id)) != null; if (isFound) { await UpdateCalendarEntryAsync(entity); } else { await AddCalendarEntryAsync(entity); } }
protected override void Update(BusinessContext context) { CalendarEventEntity eventEntity = context.Request.Target as CalendarEventEntity; UpdateRequest updateRequest = context.Request as UpdateRequest; bool forceBase = updateRequest.Parameters.GetValue <bool>(EventHelper.FORCE_BASE_PARAM, false); if (!forceBase) { Mediachase.Ibn.Events.CustomMethods.EventHelper.PrepareUpdateEventRequest(updateRequest); } else { base.Update(context); } }
public async void SendСonfirmation(string to, CalendarEventEntity eventInfo) { MailMessage message = new MailMessage(); message.To.Add(to); // Тоже нужно под нормальную почту настраивать и выносить константы message.From = new MailAddress(myEmail, displayName); message.Subject = "Notification"; message.Body = "Dear user, information about your booking is in the attached ics file."; message.IsBodyHtml = true; MemoryStream EventICS = new MemoryStream(Encoding.UTF8.GetBytes(eventInfo.ToICS())); Attachment attachment = new Attachment(EventICS, "event.ics", "text/calendar"); message.Attachments.Add(attachment); await Task.Run(() => Send(message)); }
/// <summary> /// Возвращает список событий как виртуальных так и реальных. /// </summary> /// <param name="filterColl">The filter coll.</param> /// <param name="request">The request.</param> /// <returns></returns> private static IEnumerable <CalendarEventEntity> ListEvents(FilterElementCollection filterColl, CalendarEventListRequest request) { McEvent mcEvent = null; //Конструируем стандартный запрос LIST без критериев содержащих дату начала и конца события ListRequest moListRequest = (ListRequest)EventHelper.ConstructRequest <ListRequest>(request.Target, true); moListRequest.Filters = filterColl.ToArray(); moListRequest.Sorting = request.Sorting; //выполняем стандартный запрос ListResponse listResp = (ListResponse)BusinessManager.Execute(moListRequest); if (listResp != null && listResp.EntityObjects != null) { //Пробегаем по реальным events foreach (CalendarEventEntity entity in listResp.EntityObjects) { mcEvent = EventHelper.LoadCalEvent(entity.PrimaryKeyId.Value); if (mcEvent.IsReccuring) { iCalDateTime dtReccurBase = mcEvent.DTStart; //Пробегаем по виртуальным events foreach (Occurrence occur in mcEvent.GetOccurrences(mcEvent.DTStart, mcEvent.RecurrenceSeriesEndDate)) { //Создаем виртуальные события VirtualEventId vEventId = (VirtualEventId)entity.PrimaryKeyId; vEventId.RecurrenceId = EventHelper.iCalDateTime2Recurrence(dtReccurBase, occur.Period.StartTime); //Set virtual id mcEvent.UID = vEventId.ToString(); //Set recurrence-ID mcEvent.Recurrence_ID = occur.Period.StartTime; mcEvent.DTStart = occur.Period.StartTime; mcEvent.DTEnd = occur.Period.EndTime; EntityObjectHierarchy recurrenceEntity = EventHelper.ConstructEntityHierarchy(mcEvent); CalendarEventEntity occurEventEntity = recurrenceEntity.InnerEntity as CalendarEventEntity; if (occurEventEntity != null) { yield return(occurEventEntity); } } } else { yield return(entity); } } } }
/// <summary> /// Создает событие. Логика регистрация в метаданных происходит в базовом классе /// </summary> /// <param name="change">The change.</param> /// <param name="data">The data.</param> /// <returns></returns> protected override void CreateDataItem(ItemChange change, ItemMetadata item, EntityObjectHierarchy data) { if (data == null) { throw new ArgumentNullException("data"); } EntityObject eventEntity = data.InnerEntity; //Дата начала события DateTime eventDtStart = (DateTime)eventEntity[CalendarEventEntity.FieldStart]; //В начале создаем событие без регистрации в мета данных события PrimaryKeyId?eventId = eventEntity.PrimaryKeyId = BusinessManager.Create(eventEntity); //Устанавливаем отношение родительского элемента с дочерними EventHelper.NormailzeReferences(data); foreach (EntityObjectHierarchy child in data.Childrens) { CalendarEventEntity exceptionEvent = child.InnerEntity as CalendarEventEntity; if (exceptionEvent != null) { //Формируем id exception в соответвии принятым форматом DateTime recurrenceId = exceptionEvent.RecurrenceId; exceptionEvent.PrimaryKeyId = EventHelper.CreateExceptionId(eventId.Value, eventDtStart, recurrenceId); } //Вызываем создание дочерних элементов BusinessManager.Create(child.InnerEntity); //создаем дочерние элементы exception if (exceptionEvent != null) { foreach (EntityObjectHierarchy exceptionChild in child.Childrens) { CalendarEventResourceEntity exceptionResource = exceptionChild.InnerEntity as CalendarEventResourceEntity; if (exceptionResource != null) { //устанавливаем связь ресурса с event (exception) exceptionResource.EventId = exceptionEvent.PrimaryKeyId.Value; BusinessManager.Create(exceptionChild.InnerEntity); } } } } item.SetCustomField(SyncReplicaMetadata.URI_COLUMNNAME, (Guid)eventId); }
protected CalendarEventEntryEntity(SerializationInfo info, StreamingContext context) : base(info, context) { if (SerializationHelper.Optimization != SerializationOptimization.Fast) { _calendar = (CalendarEntity)info.GetValue("_calendar", typeof(CalendarEntity)); if (_calendar != null) { _calendar.AfterSave += new EventHandler(OnEntityAfterSave); } _calendarEvent = (CalendarEventEntity)info.GetValue("_calendarEvent", typeof(CalendarEventEntity)); if (_calendarEvent != null) { _calendarEvent.AfterSave += new EventHandler(OnEntityAfterSave); } this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance()); } // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor // __LLBLGENPRO_USER_CODE_REGION_END }
public CalendarItem[] LoadItems(string startDate, string endDate, object calendarExtension) { DateTime viewStartDate = DateTime.Now; DateTime viewEndDate = DateTime.Now; string[] arr = startDate.Split(new char[] { '.' }); viewStartDate = new DateTime(int.Parse(arr[0]), int.Parse(arr[1]), int.Parse(arr[2]), int.Parse(arr[3]), int.Parse(arr[4]), int.Parse(arr[5])); arr = endDate.Split(new char[] { '.' }); viewEndDate = new DateTime(int.Parse(arr[0]), int.Parse(arr[1]), int.Parse(arr[2]), int.Parse(arr[3]), int.Parse(arr[4]), int.Parse(arr[5])); List <CalendarItem> al = new List <CalendarItem>(); FilterElementCollection fec = new FilterElementCollection(); FilterElement fe = new FilterElement(); fe.Type = FilterElementType.GreaterOrEqual; fe.Source = CalendarEventEntity.FieldStart; fe.Value = viewStartDate; fec.Add(fe); fe = new FilterElement(); fe.Type = FilterElementType.LessOrEqual; fe.Source = CalendarEventEntity.FieldStart; fe.Value = viewEndDate; fec.Add(fe); EntityObject[] calList = BusinessManager.List(CalendarEventEntity.ClassName, fec.ToArray()); foreach (EntityObject eo in calList) { CalendarEventEntity info = eo as CalendarEventEntity; CalendarItem it = new CalendarItem(); it.Uid = info.PrimaryKeyId.ToString(); it.StartDate = info.Start.ToString("yyyy.M.d.H.m.s"); it.EndDate = info.End.ToString("yyyy.M.d.H.m.s");; it.Title = String.Format("<div class=\"ibn-propertysheet2\"><a href='{1}{2}'>{0}</a></div>", info.Subject, CHelper.GetAbsolutePath("/Apps/MetaUIEntity/Pages/EntityView.aspx?ClassName=CalendarEvent&ObjectId="), it.Uid); it.Description = info.Body; it.Extensions = (info.RecurrenceId == DateTime.MinValue) ? "0" : "1"; al.Add(it); } return(al.ToArray()); }
public override bool CheckVisibility(object dataItem) { if (dataItem != null) { CalendarEventEntity ceo = (CalendarEventEntity)dataItem; FilterElementCollection fec = new FilterElementCollection(); FilterElement fe = FilterElement.EqualElement("EventId", ((VirtualEventId)ceo.PrimaryKeyId).RealEventId); fec.Add(fe); fe = FilterElement.EqualElement("PrincipalId", Mediachase.IBN.Business.Security.CurrentUser.UserID); fec.Add(fe); EntityObject[] list = BusinessManager.List(CalendarEventResourceEntity.ClassName, fec.ToArray()); if (list.Length == 0) { return(false); } } return(base.CheckVisibility(dataItem)); }
protected void btnDelete_Click(object sender, System.EventArgs e) { CalendarEventEntity ceo = BusinessManager.Load(CalendarEventEntity.ClassName, EventId) as CalendarEventEntity; if (ceo != null) { FilterElementCollection fec = new FilterElementCollection(); PrimaryKeyId realKey = ((VirtualEventId)EventId).RealEventId; FilterElement fe = FilterElement.EqualElement("EventId", realKey); fec.Add(fe); EntityObject[] list = BusinessManager.List(CalendarEventRecurrenceEntity.ClassName, fec.ToArray()); if (list.Length > 0) { CalendarEventRecurrenceEntity cero = (CalendarEventRecurrenceEntity)list[0]; BusinessManager.Delete(cero); Response.Redirect("~/Apps/MetaUIEntity/Pages/EntityView.aspx?ClassName=CalendarEvent&ObjectId=" + realKey.ToString()); } } }
public bool IsEnable(object Sender, object Element) { if (Element is CommandParameters) { CommandParameters cp = (CommandParameters)Element; string uid = ((Control)Sender).Page.Request["ObjectId"]; PrimaryKeyId pKey = PrimaryKeyId.Parse(uid); EntityObject eo = BusinessManager.Load(CalendarEventEntity.ClassName, pKey); if (eo != null) { CalendarEventEntity ceo = eo as CalendarEventEntity; if (ceo.CalendarEventExceptionId.HasValue) { return(false); } } return(((VirtualEventId)pKey).IsRecurrence); } return(false); }
protected void Page_Load(object sender, EventArgs e) { CalendarEventEntity ceo = (CalendarEventEntity)BusinessManager.Load(CalendarEventEntity.ClassName, PrimaryKeyId.Parse(Request["ObjectId"])); lblTitle.Text = String.Format("<a href=\"javascript:{{window.parent.location.href='{1}';}}\">{0}</a>", ceo.Subject, CHelper.GetAbsolutePath("/Apps/MetaUIEntity/Pages/EntityView.aspx?ClassName=CalendarEvent&ObjectId=" + ceo.PrimaryKeyId.Value.ToString())); if (ceo.Start.Date == ceo.End.Date) { lblTime.Text = ceo.Start.ToString("ddd, MMM dd") + ", " + ceo.Start.ToShortTimeString() + " - " + ceo.End.ToShortTimeString(); } else { lblTime.Text = ceo.Start.ToShortDateString() + " " + ceo.Start.ToShortTimeString() + " - " + ceo.End.ToShortDateString() + " " + ceo.End.ToShortTimeString(); } divSeries.Visible = false; spanDelete2.Visible = false; if (((VirtualEventId)ceo.PrimaryKeyId).RealEventId == ceo.PrimaryKeyId || ceo.CalendarEventExceptionId.HasValue) { lbGoToEdit.Text = GetGlobalResourceObject("IbnFramework.Calendar", "EditEventDetails").ToString(); lbDelete.Text = GetGlobalResourceObject("IbnFramework.Calendar", "DeleteQuick").ToString(); } else { lbGoToEdit.Text = GetGlobalResourceObject("IbnFramework.Calendar", "EditOnlyThisEventInstance").ToString(); lbEditSeries.Text = GetGlobalResourceObject("IbnFramework.Calendar", "EditAllEventInstances").ToString(); lbDelete.Text = GetGlobalResourceObject("IbnFramework.Calendar", "DeleteQuickThisInstance").ToString(); lbDeleteSeries.Text = GetGlobalResourceObject("IbnFramework.Calendar", "DeleteQuickAllInstances").ToString(); divSeries.Visible = true; spanDelete2.Visible = true; } lbDelete.Click += new EventHandler(lbDelete_Click); lbGoToEdit.Click += new EventHandler(lbGoToEdit_Click); lbEditSeries.Click += new EventHandler(lbEditSeries_Click); lbDeleteSeries.Click += new EventHandler(lbDeleteSeries_Click); }
/// <summary> /// Initialize result item. /// </summary> /// <param name="eventEntity">Event entity.</param> /// <returns>Result item.</returns> protected virtual CalendarEventSearchResultItem InitializeItem(CalendarEventEntity eventEntity) { CalendarEventSearchResultItem item = new CalendarEventSearchResultItem(this); string eventUrl = GetEventViewUrl(eventEntity); item.Title = String.Format("<a href='{0}' title='{1}'>{1}</a>", ClearSearchQueryParams(eventUrl), eventEntity.Title); item.Url = String.Empty; string description = GetFormattedEventDescription(eventEntity); if (ProviderAttributes[BoldSearchPhrasesParam] != null) { if (bool.Parse(ProviderAttributes[BoldSearchPhrasesParam])) { SearchEngineCore.BoldSearchPhrases(SearchPhrase, ref description); } } item.Description = description; item.Related = String.Empty; return(item); }
protected CalendarEventEntryEntity(SerializationInfo info, StreamingContext context) : base(info, context) { if(SerializationHelper.Optimization != SerializationOptimization.Fast) { _calendar = (CalendarEntity)info.GetValue("_calendar", typeof(CalendarEntity)); if(_calendar!=null) { _calendar.AfterSave+=new EventHandler(OnEntityAfterSave); } _calendarEvent = (CalendarEventEntity)info.GetValue("_calendarEvent", typeof(CalendarEventEntity)); if(_calendarEvent!=null) { _calendarEvent.AfterSave+=new EventHandler(OnEntityAfterSave); } this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance()); } // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor // __LLBLGENPRO_USER_CODE_REGION_END }
/// <summary> setups the sync logic for member _calendarEvent</summary> /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param> private void SetupSyncCalendarEvent(IEntityCore relatedEntity) { if(_calendarEvent!=relatedEntity) { DesetupSyncCalendarEvent(true, true); _calendarEvent = (CalendarEventEntity)relatedEntity; this.PerformSetupSyncRelatedEntity( _calendarEvent, new PropertyChangedEventHandler( OnCalendarEventPropertyChanged ), "CalendarEvent", MonoSoftware.MonoX.DAL.RelationClasses.StaticSnRelationshipRelations.CalendarEventEntityUsingCalendarEventIdStatic, true, new string[] { } ); } }
/// <summary> Removes the sync logic for member _calendarEvent</summary> /// <param name="signalRelatedEntity">If set to true, it will call the related entity's UnsetRelatedEntity method</param> /// <param name="resetFKFields">if set to true it will also reset the FK fields pointing to the related entity</param> private void DesetupSyncCalendarEvent(bool signalRelatedEntity, bool resetFKFields) { this.PerformDesetupSyncRelatedEntity( _calendarEvent, new PropertyChangedEventHandler( OnCalendarEventPropertyChanged ), "CalendarEvent", MonoSoftware.MonoX.DAL.RelationClasses.StaticSnRelationshipRelations.CalendarEventEntityUsingCalendarEventIdStatic, true, signalRelatedEntity, "SnRelationships", resetFKFields, new int[] { (int)SnRelationshipFieldIndex.CalendarEventId } ); _calendarEvent = null; }
protected SnRelationshipEntity(SerializationInfo info, StreamingContext context) : base(info, context) { if(SerializationHelper.Optimization != SerializationOptimization.Fast) { _snComments = (EntityCollection<SnCommentEntity>)info.GetValue("_snComments", typeof(EntityCollection<SnCommentEntity>)); _snFiles = (EntityCollection<SnFileEntity>)info.GetValue("_snFiles", typeof(EntityCollection<SnFileEntity>)); _snRatings = (EntityCollection<SnRatingEntity>)info.GetValue("_snRatings", typeof(EntityCollection<SnRatingEntity>)); _snSubscribers = (EntityCollection<SnSubscriberEntity>)info.GetValue("_snSubscribers", typeof(EntityCollection<SnSubscriberEntity>)); _snTags = (EntityCollection<SnTagEntity>)info.GetValue("_snTags", typeof(EntityCollection<SnTagEntity>)); _aspnetApplication = (AspnetApplicationsEntity)info.GetValue("_aspnetApplication", typeof(AspnetApplicationsEntity)); if(_aspnetApplication!=null) { _aspnetApplication.AfterSave+=new EventHandler(OnEntityAfterSave); } _aspnetUser = (AspnetUsersEntity)info.GetValue("_aspnetUser", typeof(AspnetUsersEntity)); if(_aspnetUser!=null) { _aspnetUser.AfterSave+=new EventHandler(OnEntityAfterSave); } _blog = (BlogEntity)info.GetValue("_blog", typeof(BlogEntity)); if(_blog!=null) { _blog.AfterSave+=new EventHandler(OnEntityAfterSave); } _blogPost = (BlogPostEntity)info.GetValue("_blogPost", typeof(BlogPostEntity)); if(_blogPost!=null) { _blogPost.AfterSave+=new EventHandler(OnEntityAfterSave); } _calendarEvent = (CalendarEventEntity)info.GetValue("_calendarEvent", typeof(CalendarEventEntity)); if(_calendarEvent!=null) { _calendarEvent.AfterSave+=new EventHandler(OnEntityAfterSave); } _campaign = (CampaignEntity)info.GetValue("_campaign", typeof(CampaignEntity)); if(_campaign!=null) { _campaign.AfterSave+=new EventHandler(OnEntityAfterSave); } _document = (DocumentEntity)info.GetValue("_document", typeof(DocumentEntity)); if(_document!=null) { _document.AfterSave+=new EventHandler(OnEntityAfterSave); } _listItem = (ListItemEntity)info.GetValue("_listItem", typeof(ListItemEntity)); if(_listItem!=null) { _listItem.AfterSave+=new EventHandler(OnEntityAfterSave); } _newsCategory = (NewsCategoryEntity)info.GetValue("_newsCategory", typeof(NewsCategoryEntity)); if(_newsCategory!=null) { _newsCategory.AfterSave+=new EventHandler(OnEntityAfterSave); } _newsItem = (NewsItemEntity)info.GetValue("_newsItem", typeof(NewsItemEntity)); if(_newsItem!=null) { _newsItem.AfterSave+=new EventHandler(OnEntityAfterSave); } _newsletter = (NewsletterEntity)info.GetValue("_newsletter", typeof(NewsletterEntity)); if(_newsletter!=null) { _newsletter.AfterSave+=new EventHandler(OnEntityAfterSave); } _page = (PageEntity)info.GetValue("_page", typeof(PageEntity)); if(_page!=null) { _page.AfterSave+=new EventHandler(OnEntityAfterSave); } _poll = (PollEntity)info.GetValue("_poll", typeof(PollEntity)); if(_poll!=null) { _poll.AfterSave+=new EventHandler(OnEntityAfterSave); } _snAlbum = (SnAlbumEntity)info.GetValue("_snAlbum", typeof(SnAlbumEntity)); if(_snAlbum!=null) { _snAlbum.AfterSave+=new EventHandler(OnEntityAfterSave); } _snDiscussionBoard = (SnDiscussionBoardEntity)info.GetValue("_snDiscussionBoard", typeof(SnDiscussionBoardEntity)); if(_snDiscussionBoard!=null) { _snDiscussionBoard.AfterSave+=new EventHandler(OnEntityAfterSave); } _snDiscussionMessage = (SnDiscussionMessageEntity)info.GetValue("_snDiscussionMessage", typeof(SnDiscussionMessageEntity)); if(_snDiscussionMessage!=null) { _snDiscussionMessage.AfterSave+=new EventHandler(OnEntityAfterSave); } _snDiscussionTopic = (SnDiscussionTopicEntity)info.GetValue("_snDiscussionTopic", typeof(SnDiscussionTopicEntity)); if(_snDiscussionTopic!=null) { _snDiscussionTopic.AfterSave+=new EventHandler(OnEntityAfterSave); } _snFile = (SnFileEntity)info.GetValue("_snFile", typeof(SnFileEntity)); if(_snFile!=null) { _snFile.AfterSave+=new EventHandler(OnEntityAfterSave); } _snGroup = (SnGroupEntity)info.GetValue("_snGroup", typeof(SnGroupEntity)); if(_snGroup!=null) { _snGroup.AfterSave+=new EventHandler(OnEntityAfterSave); } _snMessage = (SnMessageEntity)info.GetValue("_snMessage", typeof(SnMessageEntity)); if(_snMessage!=null) { _snMessage.AfterSave+=new EventHandler(OnEntityAfterSave); } _snNote = (SnNoteEntity)info.GetValue("_snNote", typeof(SnNoteEntity)); if(_snNote!=null) { _snNote.AfterSave+=new EventHandler(OnEntityAfterSave); } this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance()); } // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor // __LLBLGENPRO_USER_CODE_REGION_END }
/// <summary> /// Gets the event viewer URL. /// </summary> /// <param name="eventEntity">Calendar event entity.</param> /// <returns>Event viewer URL.</returns> protected virtual string GetEventViewUrl(CalendarEventEntity eventEntity) { string eventViewerURL = Paths.MonoX.Pages.SocialNetworking.EventCalendar_aspx; if (ProviderAttributes[CalendarEventPreviewPagePathParam] != null) eventViewerURL = ProviderAttributes[CalendarEventPreviewPagePathParam]; return UrlFormatter.ResolveServerUrl(eventViewerURL).Append(UrlParams.EntityId, eventEntity.Id); }
/// <summary> /// Gets the formatted event description. /// </summary> /// <param name="eventEntity">Event entity.</param> /// <returns>Formatted event description.</returns> protected virtual string GetFormattedEventDescription(CalendarEventEntity eventEntity) { string place = !String.IsNullOrWhiteSpace(eventEntity.Place) ? String.Format(EventModuleResources.Event_Description_Place, eventEntity.Place) : String.Empty; return String.Format(EventModuleResources.Event_Description, eventEntity.Title, place, eventEntity.StartTime.ToLongDateString(), eventEntity.EndTime.ToLongDateString(), String.Format("{0}<br/>", Environment.NewLine), eventEntity.Description); }
public CalendarEventUpdateResourcesRequest(CalendarEventEntity target) : base(CalendarResourcesUpdateMethod.METHOD_NAME, target) { }
private void BindValues() { CalendarEventEntity ceo = (CalendarEventEntity)DataItem; //BusinessManager.Load(CalendarEventEntity.ClassName, EventId) as CalendarEventEntity; if (ceo != null) { FilterElementCollection fec = new FilterElementCollection(); FilterElement fe = FilterElement.EqualElement("EventId", EventId); fec.Add(fe); EntityObject[] list = BusinessManager.List(CalendarEventRecurrenceEntity.ClassName, fec.ToArray()); if (list.Length > 0) { CalendarEventRecurrenceEntity cero = (CalendarEventRecurrenceEntity)list[0]; lblNoRecurrence.Visible = false; ShowRecurrence.Visible = true; txtStartTime.Text = ceo.Start.ToShortTimeString(); txtEndTime.Text = ceo.End.ToShortTimeString(); Pattern = (byte)cero.RecurrenceType; if (cero.RecurrenceType == (int)eRecurrenceType.RecursWeekly && cero.DayOfWeekMask.HasValue && cero.DayOfWeekMask.Value == (int)eBitDayOfWeek.Weekdays) { Pattern = (byte)eRecurrenceType.RecursDaily; } if (cero.Interval.HasValue) { Frequency = (byte)cero.Interval.Value; } if (cero.DayOfWeekMask.HasValue) { bWeekdays = (byte)cero.DayOfWeekMask; } if (cero.DayOfMonth.HasValue) { MonthDay = (byte)cero.DayOfMonth.Value; } if (cero.Instance.HasValue) { bWeekNumber = (byte)cero.Instance.Value; } if (cero.MonthOfYear.HasValue) { MonthNumber = (byte)cero.MonthOfYear.Value; } if (cero.Occurrences.HasValue) { EndAfter = cero.Occurrences.Value; } int pattern = Pattern; if (Pattern == 1) { pattern = (cero.DayOfWeekMask.HasValue && cero.DayOfWeekMask.Value == (int)eBitDayOfWeek.Weekdays) ? 12 : 11; } Label lblControl = (Label)this.FindControl("txtInfo" + pattern); if (lblControl != null) { lblControl.Visible = true; } if (EndAfter != 0) { lblEnd.Text = LocRM.GetString("Endafter") + ":"; txtEnd.Text = EndAfter.ToString() + " " + LocRM.GetString("occurrences"); } else if (cero.PatternEndDate.HasValue) { lblEnd.Text = LocRM.GetString("Endby") + ":"; txtEnd.Text = cero.PatternEndDate.Value.ToShortDateString(); } } else { lblNoRecurrence.Text = "<br> " + LocRM.GetString("NotSet") + "<br> "; lblNoRecurrence.Visible = true; ShowRecurrence.Visible = false; } } }
private void BindValues() { BindLists(); SetDefaulValues(); CalendarEventEntity ceo = BusinessManager.Load(CalendarEventEntity.ClassName, EventId) as CalendarEventEntity; if (ceo != null) { dtcDateStart.SelectedDate = ceo.Start; dtcDateEnd.SelectedDate = ceo.End; FilterElementCollection fec = new FilterElementCollection(); FilterElement fe = FilterElement.EqualElement("EventId", ((VirtualEventId)EventId).RealEventId); fec.Add(fe); EntityObject[] list = BusinessManager.List(CalendarEventRecurrenceEntity.ClassName, fec.ToArray()); if (list.Length > 0) { CalendarEventRecurrenceEntity cero = (CalendarEventRecurrenceEntity)list[0]; int pattern = cero.RecurrenceType; if (cero.RecurrenceType == (int)eRecurrenceType.RecursWeekly && cero.DayOfWeekMask.HasValue && cero.DayOfWeekMask.Value == (int)eBitDayOfWeek.Weekdays) { pattern = 1; } Pattern = (byte)pattern; if (cero.Interval.HasValue) { Frequency = (byte)cero.Interval.Value; } if (cero.DayOfWeekMask.HasValue) { Weekdays = (byte)cero.DayOfWeekMask; } if (cero.DayOfMonth.HasValue) { MonthDay = (byte)cero.DayOfMonth.Value; } if (cero.Instance.HasValue) { WeekNumber = (byte)cero.Instance.Value; } if (cero.MonthOfYear.HasValue) { MonthNumber = (byte)cero.MonthOfYear.Value; } if (cero.PatternEndDate.HasValue) { rbEndBy.Checked = true; rbEndAfter.Checked = false; dtcDateEnd.SelectedDate = cero.PatternEndDate.Value.Date; } else if (cero.Occurrences.HasValue && cero.Occurrences.Value > 0) { rbEndAfter.Checked = true; tbEndAfter.Text = cero.Occurrences.Value.ToString(); } } } }
/// <summary> /// Gets the formatted event description. /// </summary> /// <param name="eventEntity">Event entity.</param> /// <returns>Formatted event description.</returns> protected virtual string GetFormattedEventDescription(CalendarEventEntity eventEntity) { string place = !String.IsNullOrWhiteSpace(eventEntity.Place) ? String.Format(EventModuleResources.Event_Description_Place, eventEntity.Place) : String.Empty; return(String.Format(EventModuleResources.Event_Description, eventEntity.Title, place, eventEntity.StartTime.ToLongDateString(), eventEntity.EndTime.ToLongDateString(), String.Format("{0}<br/>", Environment.NewLine), eventEntity.Description)); }
protected void btnSave_ServerClick(object sender, System.EventArgs e) { CalendarEventEntity ceo = BusinessManager.Load(CalendarEventEntity.ClassName, EventId) as CalendarEventEntity; if (ceo != null) { CalendarEventRecurrenceEntity cero; bool create = false; FilterElementCollection fec = new FilterElementCollection(); FilterElement fe = FilterElement.EqualElement("EventId", ((VirtualEventId)EventId).RealEventId); fec.Add(fe); EntityObject[] list = BusinessManager.List(CalendarEventRecurrenceEntity.ClassName, fec.ToArray()); if (list.Length > 0) { cero = (CalendarEventRecurrenceEntity)list[0]; } else { cero = BusinessManager.InitializeEntity <CalendarEventRecurrenceEntity>(CalendarEventRecurrenceEntity.ClassName); create = true; } cero.EventId = ((VirtualEventId)EventId).RealEventId; cero.RecurrenceType = (int)Pattern; switch (Pattern) { case 1: //RecursDaily if (rbRecType11.Checked) { cero.Interval = (int)Frequency; } else { cero.RecurrenceType = (int)eRecurrenceType.RecursWeekly; cero.DayOfWeekMask = (int)eBitDayOfWeek.Weekdays; } break; case 2: //RecursWeekly cero.DayOfWeekMask = (int)Weekdays; cero.Interval = (int)Frequency; break; case 3: //RecursMonthly cero.DayOfMonth = (int)MonthDay; cero.Interval = (int)Frequency; break; case 4: //RecursMonthNth cero.Instance = (int)WeekNumber; cero.DayOfWeekMask = (int)Weekdays; cero.Interval = (int)Frequency; break; case 5: //RecursYearly cero.MonthOfYear = (int)MonthNumber; cero.DayOfMonth = (int)MonthDay; break; case 6: //RecursYearNth cero.Instance = (int)WeekNumber; cero.DayOfWeekMask = (int)Weekdays; cero.MonthOfYear = (int)MonthNumber; break; default: break; } cero.Title = ceo.Subject; if (rbEndBy.Checked) { cero.PatternEndDate = dtcDateEnd.SelectedDate.AddDays(1).AddSeconds(-1); cero.Occurrences = 0; } else { cero.Occurrences = int.Parse(tbEndAfter.Text); cero.PatternEndDate = null; } if (create) { BusinessManager.Create(cero); } else { BusinessManager.Update(cero); } CommandParameters cp = new CommandParameters("CEvent_ReccurenceAdded"); CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString(), true); } }
public CalendarEventUpdateResourcesRequest(CalendarEventEntity target, EntityObject[] entityObjects) : base(CalendarResourcesUpdateMethod.METHOD_NAME, target) { _entityObjects = entityObjects; }
/// <summary> Removes the sync logic for member _calendarEvent</summary> /// <param name="signalRelatedEntity">If set to true, it will call the related entity's UnsetRelatedEntity method</param> /// <param name="resetFKFields">if set to true it will also reset the FK fields pointing to the related entity</param> private void DesetupSyncCalendarEvent(bool signalRelatedEntity, bool resetFKFields) { this.PerformDesetupSyncRelatedEntity(_calendarEvent, new PropertyChangedEventHandler(OnCalendarEventPropertyChanged), "CalendarEvent", MonoSoftware.MonoX.DAL.RelationClasses.StaticCalendarEventEntryRelations.CalendarEventEntityUsingCalendarEventIdStatic, true, signalRelatedEntity, "CalendarEventEntries", resetFKFields, new int[] { (int)CalendarEventEntryFieldIndex.CalendarEventId }); _calendarEvent = null; }
/// <summary> /// Initialize result item. /// </summary> /// <param name="eventEntity">Event entity.</param> /// <returns>Result item.</returns> protected virtual CalendarEventSearchResultItem InitializeItem(CalendarEventEntity eventEntity) { CalendarEventSearchResultItem item = new CalendarEventSearchResultItem(this); string eventUrl = GetEventViewUrl(eventEntity); item.Title = String.Format("<a href='{0}' title='{1}'>{1}</a>", ClearSearchQueryParams(eventUrl), eventEntity.Title); item.Url = String.Empty; string description = GetFormattedEventDescription(eventEntity); if (ProviderAttributes[BoldSearchPhrasesParam] != null) if (bool.Parse(ProviderAttributes[BoldSearchPhrasesParam])) SearchEngineCore.BoldSearchPhrases(SearchPhrase, ref description); item.Description = description; item.Related = String.Empty; return item; }