//TODO: notification - V - test public void ChangeStatus(Int64 TicketId, Domain.Enums.TicketStatus Status, Domain.Enums.MessageUserType UserType) { if (!CheckSessionAccess()) { return; } Int64 messageId = 0; Boolean Changed = service.TicketStatusModify(TicketId, Status, View.GetChangeStatusMessage(Status), true, UserType, ref messageId); //Begin Action if (Changed) { Int64 userId = service.UserGetIdfromPerson(UserContext.CurrentUserID); List <KeyValuePair <int, String> > Objects = new List <KeyValuePair <int, string> >(); Objects.Add(ModuleTicket.KVPgetUser(userId)); Objects.Add(ModuleTicket.KVPgetTicket(TicketId)); View.SendUserActions( service.ModuleID, ModuleTicket.ActionType.TicketStatusChanged, View.ViewCommunityId, ModuleTicket.InteractionType.UserWithLearningObject, Objects); //End Action //TODO: Notification - TEST if (messageId > 0) { SendNotification(messageId, userId, ModuleTicket.NotificationActionType.StatusChanged); } } }
//TODO: notification - V - TEST public void CategoryReassign(Int64 NewCategoryID) { if (NewCategoryID <= 0) { this.InitView(); this.View.ShowAssignError(CategoryReassignError.noChange); return; } if (!CheckSessionAccess()) { View.ShowNoPermission(); return; // Domain.Enums.CategoryReassignError.noPermission; } if (!service.UserHasManResTicketPermission(View.TicketId)) { View.SendUserActions(service.ModuleID, ModuleTicket.ActionType.NoPermission, this.CurrentCommunityId, ModuleTicket.InteractionType.None); View.ShowNoPermission(); return;// Domain.Enums.CategoryReassignError.noPermission; } Int64 messageId = 0; Domain.Enums.CategoryReassignError Response = service.TicketAssignToCategory(View.TicketId, NewCategoryID, View.GetChangeCategoryMessage(), View.UserType, true, ref messageId); if (Response == Domain.Enums.CategoryReassignError.none) { Int64 userId = this.service.UserGetIdfromPerson(UserContext.CurrentUserID); //Begin Action List <KeyValuePair <int, String> > Objects = new List <KeyValuePair <int, string> >(); Objects.Add(ModuleTicket.KVPgetPerson(UserContext.CurrentUserID)); Objects.Add(ModuleTicket.KVPgetTicket(View.TicketId)); Objects.Add(ModuleTicket.KVPgetCategory(NewCategoryID)); View.SendUserActions(service.ModuleID, ModuleTicket.ActionType.TicketAssignCategory, this.CurrentCommunityId, ModuleTicket.InteractionType.UserWithLearningObject, Objects); //End Action //TODO: Notification - test if (messageId > 0) { SendNotification(messageId, userId, ModuleTicket.NotificationActionType.AssignmentCategory); } this.InitView(); this.View.ShowCategoryChanged(); } else { this.InitView(); this.View.ShowAssignError(Response); } //return Response; }
//TODO: Notification - V - TEST public void SetBehalfPerson(Int32 PersonId, bool HideToOwner) { View.ShowBehalfError(Domain.Enums.BehalfError.none); if (!CheckSessionAccess()) { //Session error return; } Domain.TicketUser Usr = service.UserGetfromPerson(UserContext.CurrentUserID); if (Usr.Person == null) { View.ShowBehalfError(Domain.Enums.BehalfError.NoPermission); //Error: external? return; } if (!service.SettingPermissionGet(Usr.Id, Usr.Person.TypeID, Domain.Enums.PermissionType.Behalf)) { View.ShowBehalfError(Domain.Enums.BehalfError.NoPermission); //Error: no permission return; } Int64 messageId = 0; // -- SET BEHALF -- if (!service.TicketSetBehalfPerson(View.TicketId, PersonId, HideToOwner, ref messageId)) { View.ShowBehalfError(Domain.Enums.BehalfError.dBerror); return; //Error: dB } //TODO: Notification - TEST if (messageId > 0) //se MINORE <= 0 il Ticket è in DRAFT! { Int64 userId = service.UserGetIdfromPerson(UserContext.CurrentUserID); SendNotification(messageId, userId, ModuleTicket.NotificationActionType.OwnerChanged); } //Begin Action List <KeyValuePair <int, String> > Objects = new List <KeyValuePair <int, string> >(); Objects.Add(ModuleTicket.KVPgetPerson(PersonId)); Objects.Add(ModuleTicket.KVPgetTicket(View.TicketId)); View.SendUserActions(service.ModuleID, ModuleTicket.ActionType.BehalfTicketSet, CurrentCommunityId, ModuleTicket.InteractionType.UserWithLearningObject, Objects); //End Action this.InitView(); View.ShowBehalfError(Domain.Enums.BehalfError.success); //OK on page }
//TODO: Notification - V - test public void AssignMe() { if (!CheckSessionAccess()) { return; } if (!service.UserHasManResTicketPermission(View.TicketId)) { View.SendUserActions(service.ModuleID, ModuleTicket.ActionType.NoPermission, this.CurrentCommunityId, ModuleTicket.InteractionType.None); View.ShowNoPermission(); } Int64 messageId = 0; bool IsManager = false; if (View.UserType == Domain.Enums.MessageUserType.Manager || View.UserType == Domain.Enums.MessageUserType.CategoryManager) { IsManager = true; } Boolean Assigned = service.TicketAssignToCurrent( View.TicketId, View.UserType, View.GetChangeUserMessage(), false, IsManager, ref messageId); if (Assigned) { //Begin Action List <KeyValuePair <int, String> > Objects = new List <KeyValuePair <int, string> >(); Objects.Add(ModuleTicket.KVPgetPerson(UserContext.CurrentUserID)); Objects.Add(ModuleTicket.KVPgetTicket(View.TicketId)); View.SendUserActions(service.ModuleID, ModuleTicket.ActionType.TicketAssignPerson, this.CurrentCommunityId, ModuleTicket.InteractionType.UserWithLearningObject, Objects); //End Action //TODO: Notification - test if (messageId > 0) { Int64 userId = this.service.UserGetIdfromPerson(UserContext.CurrentUserID); SendNotification(messageId, userId, ModuleTicket.NotificationActionType.AssignmentUser); } } this.InitView(); if (!Assigned) { View.ShowAssignUsrError(UserReassignError.Current); } else { View.ShowAssignUsrError(UserReassignError.none); } }
public void SendTimerAction() { if (service.UserHasManResTicketPermission(View.TicketId)) { List <KeyValuePair <int, String> > Objects = new List <KeyValuePair <int, string> >(); Objects.Add(ModuleTicket.KVPgetPerson(UserContext.CurrentUserID)); Objects.Add(ModuleTicket.KVPgetTicket(View.TicketId)); View.SendUserActions(service.ModuleID, ModuleTicket.ActionType.TicketLoadEditManRes, this.CurrentCommunityId, ModuleTicket.InteractionType.UserWithLearningObject, Objects); } }
public void SendTimerAction() { if (CheckUser()) { 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, -1, ModuleTicket.InteractionType.UserWithLearningObject, Objects); } }
//TODO: Notification - V - TEST public void RemoveBehalf() { View.ShowBehalfError(BehalfError.none); if (!CheckSessionAccess()) { return; } Domain.TicketUser Usr = service.UserGetfromPerson(UserContext.CurrentUserID); if (Usr.Person == null) { View.ShowBehalfError(BehalfError.NoPermission); return; } //if (!service.SettingPermissionGet(Usr.Id, Usr.Person.TypeID, PermissionType.Behalf)) //{ // View.ShowBehalfError(BehalfError.NoPermission); // return; //} Int64 messageId = 0; if (!service.TicketSetBehalfCurrent(View.CurrentTicketId, ref messageId)) { View.ShowBehalfError(BehalfError.dBerror); } //TODO: Notification - TEST if (messageId > 0) //se MINORE <= 0 il Ticket è in DRAFT! { Int64 userId = service.UserGetIdfromPerson(UserContext.CurrentUserID); SendNotification(messageId, userId, ModuleTicket.NotificationActionType.OwnerChanged); } //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.CurrentTicketId)); View.SendUserActions(service.ModuleID, ModuleTicket.ActionType.BehalfTicketRemove, View.ViewCommunityId, ModuleTicket.InteractionType.UserWithLearningObject, Objects); //End Action this.InitView(); View.ShowBehalfError(BehalfError.deleteSuccess); //OK on page }
//TODO: Notification - V - TEST public void ReopenTicket() { if (!CheckSessionAccess()) { return; } //String ReopenText = "ToDo : Get reopen text from View!"; //ReopenText = ""; //View.ShowReopenError(); Domain.Enums.TicketMessageSendError SendError = Domain.Enums.TicketMessageSendError.none; //Boolean ChangeError = false; //if(String.IsNullOrEmpty(ReopenText)) // ChangeError = service.TicketChangeStatus(View.TicketId, Domain.Enums.TicketStatus.open); //else //SendError = service.MessageSendUser( // View.TicketId, // , // "", // true, // Domain.Enums.TicketStatus.open); Int64 NewMessageId = 0; Boolean Changed = service.TicketStatusModify(View.TicketId, Domain.Enums.TicketStatus.open, View.GetChangeStatusMessage(Domain.Enums.TicketStatus.open), true, Domain.Enums.MessageUserType.Partecipant, ref NewMessageId); //if (SendError != Domain.Enums.TicketMessageSendError.none) // View.ShowSendError(SendError); //else Int64 userId = service.UserGetIdfromPerson(UserContext.CurrentUserID); if (!Changed) { this.View.ShowChangeStatusError(true); //Begin Action List <KeyValuePair <int, String> > Objects = new List <KeyValuePair <int, string> >(); Objects.Add(ModuleTicket.KVPgetUser(userId)); Objects.Add(ModuleTicket.KVPgetTicket(View.TicketId)); View.SendUserActions(service.ModuleID, ModuleTicket.ActionType.TicketStatusChanged, CurrentCommunityId, ModuleTicket.InteractionType.UserWithLearningObject, Objects); //End Action SendNotification(NewMessageId, userId, ModuleTicket.NotificationActionType.StatusChanged); } else { this.InitView(); } //init view!!!!!! SE TUTTOP OK!!!! }
public void SendTimerAction() { if (CheckSessionAccess()) { List <KeyValuePair <int, String> > Objects = new List <KeyValuePair <int, string> >(); Objects.Add(ModuleTicket.KVPgetUser(service.UserGetIdfromPerson(UserContext.CurrentUserID))); if (View.CurrentTicketId > 0) { Objects.Add(ModuleTicket.KVPgetTicket(View.CurrentTicketId)); View.SendUserActions(service.ModuleID, ModuleTicket.ActionType.ExternalCreate, -1, ModuleTicket.InteractionType.None, Objects); } else { View.SendUserActions(service.ModuleID, ModuleTicket.ActionType.ExternalCreate, -1, ModuleTicket.InteractionType.None, Objects); } } }
//TODO: notification - V - TEST public void TicketChangeCondition(Domain.Enums.TicketCondition Condition, bool status) { if (!CheckSessionAccess()) { return; } if (!service.UserHasManResTicketPermission(View.TicketId)) { View.SendUserActions(service.ModuleID, ModuleTicket.ActionType.NoPermission, this.CurrentCommunityId, ModuleTicket.InteractionType.None); View.ShowNoPermission(); } Int64 messageId = 0; Boolean Changed = service.TicketConditionModify( View.TicketId, Condition, status, View.GetChangeConditionMessage(Condition), true, View.UserType, ref messageId); if (Changed) { //Begin Action List <KeyValuePair <int, String> > Objects = new List <KeyValuePair <int, string> >(); Objects.Add(ModuleTicket.KVPgetUser(this.service.UserGetIdfromPerson(UserContext.CurrentUserID))); Objects.Add(ModuleTicket.KVPgetTicket(View.TicketId)); View.SendUserActions(service.ModuleID, ModuleTicket.ActionType.TicketStatusChanged, this.CurrentCommunityId, ModuleTicket.InteractionType.UserWithLearningObject, Objects); //End Action //TODO: Notification - test if (messageId > 0) { Int64 userId = this.service.UserGetIdfromPerson(UserContext.CurrentUserID); SendNotification(messageId, userId, ModuleTicket.NotificationActionType.ModerationChanged); } this.InitView(); } else { //Mange Errors } }
public void InitView() { if (!CheckUser()) { return; } //if (View.ViewCommunityId != UserContext.CurrentCommunityID) View.ViewCommunityId = -1; Domain.DTO.DTO_UserModify Data = service.TicketGetUserExt(View.TicketId, View.CurrentUser); if (Data.Errors == Domain.Enums.TicketEditUserErrors.none) { View.InitView(Data); //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, -1, ModuleTicket.InteractionType.UserWithLearningObject, Objects); //End Action View.TicketId = Data.TicketId; View.DraftMsgId = (Data.DraftMessage != null) ? Data.DraftMessage.Id : -1; } else if (Data.Errors == Domain.Enums.TicketEditUserErrors.IsDraft) { View.ShowDraft(Data.TicketId); } else if (Data.Errors == Domain.Enums.TicketEditUserErrors.NoPermission) { View.SendUserActions(service.ModuleID, ModuleTicket.ActionType.NoPermission, this.AppContext.UserContext.CurrentCommunityID, ModuleTicket.InteractionType.None); } }
public bool SaveTicket(Domain.DTO.DTO_Ticket TkData, Boolean ForUpload = false) { if (!CheckUser()) { View.SendUserActions(service.ModuleID, ModuleTicket.ActionType.NoPermission, -1, ModuleTicket.InteractionType.None); View.ShowCantCreate(false, false); return(false); } Domain.Enums.TicketCreateError Error = Domain.Enums.TicketCreateError.none; Domain.Enums.TicketAddCondition Cond = service.PermissionTicketUsercanCreateExternal(); if (Cond == Domain.Enums.TicketAddCondition.CheckCount) { if (TkData.IsDraft) { if (!(service.TicketGetNumDraft(TkData.CreatorId) <= Access.MaxDraft)) { Error = Domain.Enums.TicketCreateError.ToMuchDraft; } } else { if (!(service.TicketGetNumOpen(TkData.CreatorId) <= Access.MaxSended)) { Error = Domain.Enums.TicketCreateError.ToMuchTicket; } } } else if (Cond != Domain.Enums.TicketAddCondition.CanCreate) { Error = Domain.Enums.TicketCreateError.NoPermission; } if (Error != Domain.Enums.TicketCreateError.none) { View.SendUserActions(service.ModuleID, ModuleTicket.ActionType.NoPermission, this.CurrentCommunityId, ModuleTicket.InteractionType.None); View.ShowError(Error); return(false); } //Boolean CanCreate = false; //if (Cond == Domain.Enums.TicketAddCondition.CanCreate) // CanCreate = true; //else if (Cond == Domain.Enums.TicketAddCondition.CheckCount) //{ // if (TkData.IsDraft) // { // if (service.TicketGetNumDraft(TkData.UserId) <= Access.MaxDraft) // CanCreate = true; // } // else // { // if (service.TicketGetNumOpen(TkData.UserId) <= Access.MaxSended) // CanCreate = true; // } //} //if (!CanCreate) //{ // View.SendUserActions(service.ModuleID, ModuleTicket.ActionType.NoPermission, -1, ModuleTicket.InteractionType.None); // //View.SendAction(ModuleTicket.ActionType.NoPermission, this.CurrentCommunityId); // //View.SendAction(ModuleTicket.ActionType.NoPermission); // View.ShowCantCreate(false); // return; //} Error = service.TicketCreateExternal(View.CurrentUser, ref TkData); if (Error == Domain.Enums.TicketCreateError.none || TkData.IsDraft && Error != Domain.Enums.TicketCreateError.NoCategory) { //Begin Action List <KeyValuePair <int, String> > Objects = new List <KeyValuePair <int, string> >(); Objects.Add(ModuleTicket.KVPgetUser(TkData.CreatorId)); Objects.Add(ModuleTicket.KVPgetTicket(TkData.TicketId)); if (TkData.IsDraft) { View.SendUserActions(service.ModuleID, ModuleTicket.ActionType.TicketCreateDraft, -1, ModuleTicket.InteractionType.UserWithLearningObject, Objects); } else { View.SendUserActions(service.ModuleID, ModuleTicket.ActionType.TicketCreate, -1, ModuleTicket.InteractionType.UserWithLearningObject, Objects); } //End Action service.NotificationSetTicketCreatorExternal(TkData.TicketId, TkData.MailSettings, View.CurrentUser.UserId); if (!TkData.IsDraft) { SendNotification(TkData.DraftMsgId, TkData.CreatorId, ModuleTicket.NotificationActionType.TicketSend); } View.TicketCreated(TkData.TicketId, TkData.IsDraft); } else { View.ShowError(Error); return(false); } return(true); }
//TODO: notification - V - test public Boolean SaveTicket(Domain.DTO.DTO_Ticket TkData, Domain.Enums.MailSettings ownerSettings, Domain.Enums.MailSettings creatorSettings, Boolean ForUpload = false) { if (!CheckSessionAccess()) { View.SendUserActions(service.ModuleID, ModuleTicket.ActionType.NoPermission, -1, ModuleTicket.InteractionType.None); View.ShowError(Domain.Enums.TicketCreateError.NoPermission); return(false); } Domain.Enums.TicketCreateError Error = Domain.Enums.TicketCreateError.none; Domain.Enums.TicketAddCondition Cond = service.PermissionTicketUsercanCreate(); if (Cond == Domain.Enums.TicketAddCondition.CheckCount) { if (TkData.IsDraft) { if (!(service.TicketGetNumDraft(TkData.CreatorId) <= Access.MaxDraft)) { Error = Domain.Enums.TicketCreateError.ToMuchDraft; } } else { if (!(service.TicketGetNumOpen(TkData.CreatorId) <= Access.MaxSended)) { Error = Domain.Enums.TicketCreateError.ToMuchTicket; } } } else if (Cond != Domain.Enums.TicketAddCondition.CanCreate) { Error = Domain.Enums.TicketCreateError.NoPermission; } if (Error != Domain.Enums.TicketCreateError.none) { View.SendUserActions(service.ModuleID, ModuleTicket.ActionType.NoPermission, this.CurrentCommunityId, ModuleTicket.InteractionType.None); View.ShowError(Error); return(false); } Error = service.TicketCreate(ref TkData); Boolean CanSave = false; if (Error == Domain.Enums.TicketCreateError.none) { CanSave = true; } else if (Error == Domain.Enums.TicketCreateError.NoCategory || Error == Domain.Enums.TicketCreateError.NoText || Error == Domain.Enums.TicketCreateError.NoTitle) { CanSave = ForUpload || TkData.IsDraft; } if (CanSave) { //Begin Action List <KeyValuePair <int, String> > Objects = new List <KeyValuePair <int, string> >(); Objects.Add(ModuleTicket.KVPgetUser(TkData.CreatorId)); Objects.Add(ModuleTicket.KVPgetTicket(TkData.TicketId)); if (TkData.IsDraft) { View.SendUserActions(service.ModuleID, ModuleTicket.ActionType.TicketCreateDraft, this.CurrentCommunityId, ModuleTicket.InteractionType.UserWithLearningObject, Objects); } else { View.SendUserActions(service.ModuleID, ModuleTicket.ActionType.TicketCreate, this.CurrentCommunityId, ModuleTicket.InteractionType.UserWithLearningObject, Objects); } //End Action //NOTIFICATION //Se DISABLED, SOLO per il creator corrente (no behalf) if (ownerSettings != MailSettings.DISABLED) { bool IsOwner = creatorSettings == MailSettings.DISABLED; service.NotificationSetTicketOwner(TkData.TicketId, ownerSettings, IsOwner); } if (creatorSettings != MailSettings.DISABLED) { service.NotificationSetTicketCreatorCurrent(TkData.TicketId, creatorSettings); } //TODO: notification - test if (!TkData.IsDraft) { SendNotification(TkData.DraftMsgId, TkData.CreatorId, ModuleTicket.NotificationActionType.TicketSend); //SE inviato il DraftMsgdiventa il Primo messaggio. //Il Creator è sempre quello che "fa fede" sulle logiche di invio. } View.TicketCreated(TkData.TicketId, TkData.IsDraft); if (!ForUpload) { this.InitView(); } } else { View.ShowError(Error); return(false); } return(true); }
public void InitView() { if (!CheckSessionAccess()) { return; } int ColUserId = this.UserContext.CurrentUserID; Domain.DTO.DTO_ManagerModify Data = service.TicketGetManager(View.TicketId, View.MassageFilter, View.MessagesOrder); if (Data.Errors == TicketEditManErrors.NoPermission)// (!service.UserHasManResTicketPermission(View.TicketId)) { View.SendUserActions(service.ModuleID, ModuleTicket.ActionType.NoPermission, this.CurrentCommunityId, ModuleTicket.InteractionType.None); View.ShowNoPermission(); } //Int32 CommunityId = UserContext.CurrentCommunityID; IList <Domain.DTO.DTO_CategoryTree> Categories = service.CategoriesGetTreeDLL(CurrentCommunityId, CategoryTREEgetType.FilterManager); //service.CategoryGetDDLManRes_ComCurrent(); View.UserType = Data.CurrentUserType; //this.CurrentCommunityId // lm.Comol.Core.FileRepository.Domain.ModuleRepository cRepository = service.GetRepositoryPermissions(CurrentCommunityId, ColUserId); //List<iCoreItemFileLink<long>> alreadyLinkedFiles = new List<iCoreItemFileLink<long>>(); ////= new List<iCoreItemFileLink<long>>(); ////Link di comunità già usati //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.Link.DestinationItem.ObjectLongID // // && 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>>(); bool hasComManager = service.UsersCommunityHasManRes(CurrentCommunityId, Data.UserAssignedId); bool hasCommunity = (CurrentCommunityId > 0); View.InitView( Data, Categories, service.CategoryGetDTOCatTree(Data.CategoryCurrentId), service.UploadAvailableActionsGet( Data.CurrentUserType, CurrentCommunityId, ColUserId, cRepository), cRepository, CurrentCommunityId, (Data.DraftMessage == null ? 0 : Data.DraftMessage.Id), hasComManager, hasCommunity); if (Data.Errors == Domain.Enums.TicketEditManErrors.none) { View.DraftMsgId = Data.DraftMessage.Id; View.TicketId = Data.TicketId; } //Begin Action List <KeyValuePair <int, String> > Objects = new List <KeyValuePair <int, string> >(); Objects.Add(ModuleTicket.KVPgetPerson(UserContext.CurrentUserID)); Objects.Add(ModuleTicket.KVPgetTicket(View.TicketId)); View.SendUserActions(service.ModuleID, ModuleTicket.ActionType.TicketLoadEditManRes, this.CurrentCommunityId, ModuleTicket.InteractionType.UserWithLearningObject, Objects); //End Action }
//TODO: notification - V - test public void SendMessage( String Text, String Preview, Boolean HideToUser, Domain.Enums.TicketStatus NewStatus, Domain.Enums.MessageType MsgType, Int64 DraftId) { if (!CheckSessionAccess()) { return; } if (!service.UserHasManResTicketPermission(View.TicketId)) { View.SendUserActions(service.ModuleID, ModuleTicket.ActionType.NoPermission, this.CurrentCommunityId, ModuleTicket.InteractionType.None); View.ShowNoPermission(); } if (DraftId <= 0) { this.InitView(); return; } if (this.service.MessageCheckDraft(DraftId)) { this.InitView(); return; } Domain.Enums.TicketMessageSendError error = Domain.Enums.TicketMessageSendError.none; Int64 messageId = 0; Int64 userId = this.service.UserGetIdfromPerson(UserContext.CurrentUserID); if (NewStatus == Domain.Enums.TicketStatus.closeSolved || NewStatus == Domain.Enums.TicketStatus.closeUnsolved) { error = service.MessageSendMan(View.TicketId, Text, Preview, HideToUser, MsgType, View.UserType, false, ref messageId); service.TicketStatusModify(View.TicketId, NewStatus, View.GetChangeStatusMessage(NewStatus), true, View.UserType, ref messageId); //Begin Action List <KeyValuePair <int, String> > Objects = new List <KeyValuePair <int, string> >(); Objects.Add(ModuleTicket.KVPgetUser(userId)); Objects.Add(ModuleTicket.KVPgetTicket(View.TicketId)); View.SendUserActions(service.ModuleID, ModuleTicket.ActionType.TicketStatusChanged, this.CurrentCommunityId, ModuleTicket.InteractionType.UserWithLearningObject, Objects); //End Action } else { service.TicketStatusModify(View.TicketId, NewStatus, View.GetChangeStatusMessage(NewStatus), false, View.UserType, ref messageId); error = service.MessageSendMan(View.TicketId, Text, Preview, HideToUser, MsgType, View.UserType, true, ref messageId); } if (error == Domain.Enums.TicketMessageSendError.none) { //Int64 userId = this.service.UserGetIdfromPerson(UserContext.CurrentUserID); //Begin Action List <KeyValuePair <int, String> > Objects = new List <KeyValuePair <int, string> >(); Objects.Add(ModuleTicket.KVPgetUser(userId)); Objects.Add(ModuleTicket.KVPgetMessage(messageId)); View.SendUserActions(service.ModuleID, ModuleTicket.ActionType.MessageSend, this.CurrentCommunityId, ModuleTicket.InteractionType.UserWithLearningObject, Objects); //End Action //ToDo: Send Notification if (messageId > 0) { SendNotification(messageId, userId, ModuleTicket.NotificationActionType.MassageSend); } this.InitView(); } //else View.ShowSendError(error); }
//TODO: Notification - V - TEST public void SendMessage( string Text, string Preview, Boolean CloseMessage, Boolean IsSolved) { if (!CheckSessionAccess()) { return; } Domain.Enums.TicketStatus status = (IsSolved)? Domain.Enums.TicketStatus.closeSolved : Domain.Enums.TicketStatus.closeUnsolved; if (service.MessageCheckDraft(View.DraftMsgId)) { this.InitView(); return; } Int64 NewMessageId = View.DraftMsgId; Domain.Enums.TicketMessageSendError Errors = service.MessageSendUser(View.TicketId, Text, Preview, ref NewMessageId); //, CloseMessage, status); Boolean Changed = true; if (CloseMessage) { if (IsSolved) { Changed = service.TicketStatusModify(View.TicketId, Domain.Enums.TicketStatus.closeSolved, View.GetChangeStatusMessage(Domain.Enums.TicketStatus.closeSolved), false, Domain.Enums.MessageUserType.Partecipant, ref NewMessageId); } else { Changed = service.TicketStatusModify(View.TicketId, Domain.Enums.TicketStatus.closeUnsolved, View.GetChangeStatusMessage(Domain.Enums.TicketStatus.closeUnsolved), false, Domain.Enums.MessageUserType.Partecipant, ref NewMessageId); } } Int64 userId = service.UserGetIdfromPerson(UserContext.CurrentUserID); if (Errors != Domain.Enums.TicketMessageSendError.none && Errors != TicketMessageSendError.TicketClosed) { //Begin Action if (Changed) { List <KeyValuePair <int, String> > Objects = new List <KeyValuePair <int, string> >(); Objects.Add(ModuleTicket.KVPgetUser(userId)); Objects.Add(ModuleTicket.KVPgetTicket(View.TicketId)); View.SendUserActions(service.ModuleID, ModuleTicket.ActionType.TicketStatusChanged, CurrentCommunityId, ModuleTicket.InteractionType.UserWithLearningObject, Objects); } List <KeyValuePair <int, String> > ObjectsMsg = new List <KeyValuePair <int, string> >(); ObjectsMsg.Add(ModuleTicket.KVPgetUser(userId)); ObjectsMsg.Add(ModuleTicket.KVPgetMessage(NewMessageId)); View.SendUserActions(service.ModuleID, ModuleTicket.ActionType.MessageSend, CurrentCommunityId, ModuleTicket.InteractionType.UserWithLearningObject, ObjectsMsg); //End Action View.ShowSendError(Errors); } else if (!Changed) { View.ShowChangeStatusError(false); } else { if (Errors == TicketMessageSendError.none) { SendNotification(NewMessageId, userId, ModuleTicket.NotificationActionType.MassageSend); } this.InitView(); View.ShowSendError(Errors); } }
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); }