public dtoDiaryItem(CoreItemPermission module, CommunityEventItem item, List <RepositoryAttachmentUploadActions> actions, RepositoryAttachmentUploadActions dAction) { Id = item.Id; EventItem = item; CommunityId = item.IdCommunityOwner; IdEvent = (item.EventOwner != null ? item.EventOwner.Id : 0); Permission = module; UploadActions = actions; DefaultUploadAction = dAction; Attachments = new List <dtoAttachmentItem>(); }
public dtoDiaryItem(int idCommunity, CoreItemPermission module, CommunityEventItem item, Int32 lessonNumber, String description, List <RepositoryAttachmentUploadActions> actions, RepositoryAttachmentUploadActions dAction) { Id = item.Id; CommunityId = idCommunity; IdEvent = (item.EventOwner != null ? item.EventOwner.Id : 0); EventItem = item; Permission = module; LessonNumber = lessonNumber; if (String.IsNullOrWhiteSpace(description)) { description = ""; } Description = description; UploadActions = actions; DefaultUploadAction = dAction; Attachments = new List <dtoAttachmentItem>(); }
public void InitView() { //Nascondo messaggi. Saranno eventualmente visualizzati in seguito all'InitView o internamente. View.ShowSendError(TicketMessageSendError.none); if (!CheckSessionAccess()) { return; } //int ComId = UserContext.CurrentCommunityID; int PersonId = UserContext.CurrentUserID; if (View.ViewCommunityId != CurrentCommunityId) { View.ViewCommunityId = CurrentCommunityId; } Domain.DTO.DTO_UserModify Data = service.TicketGetUser(View.TicketId); //Repository 4 upload lm.Comol.Core.FileRepository.Domain.ModuleRepository cRepository = service.GetRepositoryPermissions(CurrentCommunityId, PersonId); List <RepositoryAttachmentUploadActions> actions = service.UploadAvailableActionsGet( Data.CurrentUserType, CurrentCommunityId, PersonId, cRepository); //List<iCoreItemFileLink<long>> alreadyLinkedFiles = new List<iCoreItemFileLink<long>>(); //if (Data.DraftMessage != null && Data.DraftMessage.Attachments.Any()) //{ // alreadyLinkedFiles = (from Domain.TicketFile fl in Data.DraftMessage.Attachments // where fl.File != null && fl.Link != null // select new dtoCoreItemFileLink<long>() // { // CreatedBy = fl.CreatedBy, // CreatedOn = fl.CreatedOn, // Deleted = fl.Deleted, // ItemFileLinkId = fl.Id, // StatusId = 0, // Link = fl.Link, // ModifiedBy = fl.ModifiedBy, // ModifiedOn = fl.ModifiedOn, // Owner = fl.CreatedBy, // isVisible = (fl.Deleted == BaseStatusDeleted.None && !fl.File.isDeleted), // File = fl.File // }).ToList<iCoreItemFileLink<long>>(); // // && fl.Visibility == Domain.Enums.FileVisibility.visible // //NO: se non è visibile, non lo è per l'utente, manager e resolver lo possono vedere E comunque non posso linkarlo nuovamente. //} ////if (alreadyLinkedFiles == null) //// alreadyLinkedFiles = new List<iCoreItemFileLink<long>>(); RepositoryAttachmentUploadActions dAction = RepositoryAttachmentUploadActions.none; View.InitView(Data, actions, dAction, cRepository, CurrentCommunityId, (Data.DraftMessage == null ? 0 : Data.DraftMessage.Id)); if (Data.Errors == Domain.Enums.TicketEditUserErrors.none) { //Begin Action List <KeyValuePair <int, String> > Objects = new List <KeyValuePair <int, string> >(); Objects.Add(ModuleTicket.KVPgetUser(service.UserGetIdfromPerson(UserContext.CurrentUserID))); Objects.Add(ModuleTicket.KVPgetTicket(View.TicketId)); View.SendUserActions(service.ModuleID, ModuleTicket.ActionType.TicketLoadEditUser, CurrentCommunityId, ModuleTicket.InteractionType.UserWithLearningObject, Objects); //End Action View.TicketId = Data.TicketId; View.DraftMsgId = (Data.DraftMessage != null) ? Data.DraftMessage.Id : -1; if (Data.BehalfRevoked) { View.ShowBehalfError(BehalfError.permissionRevoked); } else { View.ShowBehalfError(BehalfError.none); } } else { if (Data.Errors == Domain.Enums.TicketEditUserErrors.NoPermission) { View.SendUserActions(service.ModuleID, ModuleTicket.ActionType.NoPermission, CurrentCommunityId, ModuleTicket.InteractionType.None); } View.ShowBehalfError(BehalfError.NoPermission); } //View.ShowInitError(Data.Errors); }
public dtoDiaryItem() { UploadActions = new List <RepositoryAttachmentUploadActions>(); DefaultUploadAction = RepositoryAttachmentUploadActions.none; Attachments = new List <dtoAttachmentItem>(); }
public void InitView() { if (!CheckSessionAccess()) { return; } //Boolean IsNewAndOtherTicket = false; Domain.DTO.DTO_AddInit values = new Domain.DTO.DTO_AddInit(); //Utente Domain.TicketUser Usr = service.UserGetfromPerson(UserContext.CurrentUserID); if (Usr == null) { View.DisplaySessionTimeout(View.ViewCommunityId); return; } Domain.Enums.TicketAddCondition Cond = service.PermissionTicketUsercanCreate(); if (Cond == Domain.Enums.TicketAddCondition.CheckCount && service.TicketGetNumOpen(Usr.Id) >= Access.MaxSended) { View.ShowCantCreate(Domain.Enums.CantCreate.MaxSend); } int DraftNum = service.TicketGetNumDraft(Usr.Id); //DDL Lingue values.availableLanguages = service.LanguagesGetAvailableSys(); int CommunityId = CurrentCommunityId; //Ticket (Se draft, altrimenti nuovo!) Domain.DTO.DTO_Ticket Tk = new Domain.DTO.DTO_Ticket(); if (View.CurrentTicketId <= 0) { //Controllo se può creare nuovi Ticket (Bozze) if (!(Cond == Domain.Enums.TicketAddCondition.CanCreate || (Cond == Domain.Enums.TicketAddCondition.CheckCount && (DraftNum < Access.MaxDraft)))) { if (View.CurrentTicketId <= 0) { View.ShowCantCreate(Domain.Enums.CantCreate.MaxDraftNoSend); View.SendUserActions(service.ModuleID, ModuleTicket.ActionType.NoPermission, CommunityId, ModuleTicket.InteractionType.None); return; } } //Creo un nuovo Ticket in BOZZA Tk = service.TicketCreateNewDraft(Usr.Id, CommunityId, View.GetDraftTitle(), View.GetDraftPreview()); values.IsNew = true; //Una volta creato, redirezione alla pagina con il ticket appena creato, per evitare problema F5. View.GotoNewTicketCreated(Tk.Code); return; } else { //Prendo il Ticket in Bozza Tk = service.TicketGetDraft(View.CurrentTicketId); } //SE Ticket == null o cercano di accedere ad un Ticket non valido //o non è possibile creare un nuovo Ticket. if (Tk == null || Tk.TicketId <= 0 || !Tk.IsDraft) { View.ShowCantCreate(Domain.Enums.CantCreate.permission); return; } //Carico Ticket (Nuovo, appena creato o precedente che sia) CommunityId = Tk.CommunityId; View.CurrentTicketId = Tk.TicketId; View.ViewCommunityId = CommunityId; View.DraftMsgId = Tk.DraftMsgId; values.TicketData = Tk; values.CurrentCommunityId = CommunityId; values.FileCommunityId = CurrentCommunityId; //Action List <KeyValuePair <int, String> > Objects = new List <KeyValuePair <int, string> >(); Objects.Add(ModuleTicket.KVPgetUser(service.UserGetIdfromPerson(UserContext.CurrentUserID))); View.SendUserActions(service.ModuleID, ModuleTicket.ActionType.ExternalCreate, -1, ModuleTicket.InteractionType.None, Objects); //End Action values.HasOtherDraft = (values.IsNew && DraftNum > 0); this.UpdateCommunity(CommunityId, Tk.CategoryId); //USER! values.CurrentUser.UserId = Usr.Id; if (Usr.Person != null) { values.CurrentUser.PersonId = Usr.Person.Id; values.CurrentUser.Name = Usr.Person.Name; values.CurrentUser.SName = Usr.Person.Surname; values.CurrentUser.LanguageCode = Usr.LanguageCode; values.CurrentUser.Mail = Usr.Person.Mail; } else { values.CurrentUser.PersonId = 0; values.CurrentUser.Name = Usr.Name; values.CurrentUser.SName = Usr.Sname; values.CurrentUser.LanguageCode = Usr.LanguageCode; // TicketService.LangMultiCODE; //OR SYS DEFAULT!? values.CurrentUser.Mail = Usr.mail; } //Behalf if (Usr.Person != null) { values.CanBehalf = service.SettingPermissionGet(Usr.Id, Usr.Person.TypeID, Domain.Enums.PermissionType.Behalf); } else { values.CanBehalf = false; } // Notification (sono state messe qui a differenza di "Edit" in cui sono messe nel service. // SPOSTARE IN SERVICE? if (Tk.IsBehalf) { if (Tk.HideToOwner) { bool isdefaultCreator = false; values.CreatorMailSettings = service.MailSettingsGet(Usr.Id, Tk.TicketId, false, ref isdefaultCreator); values.IsDefaultNotCreator = isdefaultCreator; values.OwnerMailSettings = MailSettings.none; values.IsDefaultNotOwner = true; } else { bool isdefaultOwner = false; bool isdefaultCreator = false; values.CreatorMailSettings = service.MailSettingsGet(Usr.Id, Tk.TicketId, false, ref isdefaultCreator); values.IsDefaultNotCreator = isdefaultCreator; values.OwnerMailSettings = service.MailSettingsGet(Tk.OwnerId, Tk.TicketId, false, ref isdefaultOwner); values.IsDefaultNotOwner = isdefaultOwner; } values.IsCreatorNotificationEnable = Usr.IsNotificationActiveUser; values.IsOwnerNotificationEnable = Tk.IsOwnerNotificationActive; } else { values.OwnerMailSettings = MailSettings.none; bool isdefaultCreator = false; values.CreatorMailSettings = service.MailSettingsGet(Usr.Id, Tk.TicketId, false, ref isdefaultCreator); values.IsDefaultNotCreator = isdefaultCreator; values.IsDefaultNotOwner = true; values.IsCreatorNotificationEnable = Usr.IsNotificationActiveUser; //values.IsOwnerNotificationEnable = Usr.IsNotificationActiveUser; } values.CanListUsers = CanListUsers(UserContext.CurrentCommunityID); //Upload File comunità //Repository 4 upload int CurPersId = (Usr.Person != null) ? Usr.Person.Id : 0; lm.Comol.Core.FileRepository.Domain.ModuleRepository cRepository = service.GetRepositoryPermissions(values.FileCommunityId, CurPersId); List <RepositoryAttachmentUploadActions> actions = service.UploadAvailableActionsGet(MessageUserType.Partecipant, values.FileCommunityId, Usr.Person.Id, cRepository); //if (values.TicketData.Attachments != null && values.TicketData.Attachments.Any()) //{ // alreadyLinkedFiles = (from Domain.DTO.DTO_AttachmentItem atc in values.TicketData.Attachments // where atc.File != null && atc.Link != null // select new dtoCoreItemFileLink<long>() // { // CreatedBy = atc.CreatedBy, // CreatedOn = atc.CreatedOn, // Deleted = atc.Deleted, // ItemFileLinkId = atc.IdAttachment,//fl.Id, // StatusId = 0, // Link = atc.Link, // Owner = atc.CreatedBy, // isVisible = (atc.Deleted == BaseStatusDeleted.None && !atc.File.isDeleted), // File = atc.File // }).ToList<iCoreItemFileLink<long>>(); // //ModifiedBy = atc.ModifiedBy, // //ModifiedOn = atc.ModifiedOn, // // && fl.Visibility == Domain.Enums.FileVisibility.visible // //NO: se non è visibile, non lo è per l'utente, manager e resolver lo possono vedere E comunque non posso linkarlo nuovamente. //} RepositoryAttachmentUploadActions dAction = RepositoryAttachmentUploadActions.none; View.InitView(values, actions, dAction, cRepository, Tk.DraftMsgId); initCommunitySelector(Tk.CommunityId); }