///// <summary> ///// Annulla e va al tree ///// </summary> //public void ToTree() //{ // //?? //} ///// <summary> ///// Passa al secondo step ///// </summary> //public void Continue() //{ // View.ShowStep2(); //} ///// <summary> ///// Riassegne le categorie... (TO DO) ///// </summary> ///// <param name="Reassigment"></param> //public void Reassign(IList<Domain.DTO.DTO_CategoryReassign> Reassigment) //{ // View.Close(); //} public Boolean DeleteCategory(String ReassignMessage, long ReassignId, bool MoveUp) { Boolean Result = false; if (MoveUp) { Result = service.CategoryDeletePutUp(View.CategoryId); } else { Result = service.CategoryDeleteAll(View.CategoryId, ReassignId, ReassignMessage); } if (Result) { //Begin Action List <KeyValuePair <int, String> > Objects = new List <KeyValuePair <int, string> >(); Objects.Add(ModuleTicket.KVPgetPerson(this.UserContext.CurrentUserID)); Objects.Add(ModuleTicket.KVPgetCategory(View.CategoryId)); View.SendAction(ModuleTicket.ActionType.CategoryUndelete, View.CommunityId, ModuleTicket.InteractionType.UserWithLearningObject, Objects); //End Action } return(Result); }
//public void DeleteCategory(Int64 CategoryID) //{ // service.CategoryDelete(CategoryID); // View.BindList(service.CategoriesGetCommunity(true, true, CurrentCommunityId), Module.ManageCategory); //} public void RecoverCategory(Int64 CategoryID) { if (!CheckSessionAccess()) { return; } if (!(Module.EditCategory || Module.ManageCategory || Module.Administration)) { View.SendUserActions(service.ModuleID, ModuleTicket.ActionType.NoPermission, this.CurrentCommunityId, ModuleTicket.InteractionType.None); View.ShowNoPermission(); return; } service.CategoryRecover(CategoryID); //Begin Action List <KeyValuePair <int, String> > Objects = new List <KeyValuePair <int, string> >(); Objects.Add(ModuleTicket.KVPgetPerson(this.UserContext.CurrentUserID)); Objects.Add(ModuleTicket.KVPgetCategory(CategoryID)); View.SendUserActions(service.ModuleID, ModuleTicket.ActionType.CategoryUndelete, this.CurrentCommunityId, ModuleTicket.InteractionType.UserWithLearningObject, Objects); //End Action View.BindList(service.CategoriesGetCommunity(true, true, CurrentCommunityId), Module.ManageCategory, service.CategoryDefaultGetID()); }
public void Create() { if (!CheckSessionAccess()) { return; } if (!(Module.ManageCategory || Module.Administration)) { View.SendAction(ModuleTicket.ActionType.NoPermission, this.CurrentCommunityId, ModuleTicket.InteractionType.None); View.ShowNoPermission(); return; } Int64 newCatId = service.CategoryCreateSimple(View.Name, View.Description, View.Type); if (newCatId > 0) { IList <Domain.DTO.DTO_CategoryRole> Roles = new List <Domain.DTO.DTO_CategoryRole>(); Int32 USerId = View.SelectedManagerID; //View.Roles; //new List<Domain.DTO.DTO_CategoryRole>(); if (USerId <= 0) { Domain.DTO.DTO_CategoryRole ManRole = new Domain.DTO.DTO_CategoryRole(); ManRole.IsManager = true; ManRole.PersonId = UserContext.CurrentUserID; Roles.Add(ManRole); } else { Domain.DTO.DTO_CategoryRole ManRole = new Domain.DTO.DTO_CategoryRole(); ManRole.IsManager = true; ManRole.PersonId = USerId; Roles.Add(ManRole); } Domain.DTO.DTO_AddRolesResponse roleResponse = service.CategoryRolesAdd(newCatId, Roles); //Begin Action List <KeyValuePair <int, String> > Objects = new List <KeyValuePair <int, string> >(); Objects.Add(ModuleTicket.KVPgetPerson(this.UserContext.CurrentUserID)); Objects.Add(ModuleTicket.KVPgetCategory(newCatId)); View.SendAction(ModuleTicket.ActionType.CategoryCreate, this.CurrentCommunityId, ModuleTicket.InteractionType.UserWithLearningObject, Objects); //End Action //Gestire eventuali errori nell'aggiunta, tramite roleResponse... //View.CurrentCategoryId = newCatId; View.NavigateToEdit(newCatId); //InitView(); } else { //Manage Error } }
public void InitView() { if (!CheckSessionAccess()) { return; } if (!(Module.ManageCategory || Module.Administration)) { View.SendAction(ModuleTicket.ActionType.NoPermission, this.CurrentCommunityId, ModuleTicket.InteractionType.None); View.ShowNoPermission(); return; } //Begin Action List <KeyValuePair <int, String> > Objects = new List <KeyValuePair <int, string> >(); Objects.Add(ModuleTicket.KVPgetPerson(this.UserContext.CurrentUserID)); View.SendAction(ModuleTicket.ActionType.CategoryLoadManage, this.CurrentCommunityId, ModuleTicket.InteractionType.UserWithLearningObject, Objects); //End Action //int comTypeId = (from Community com in Man this.CurrentCommunityId this.View.Initialize(service.CategoryTypeGetPermission(this.CurrentCommunityId)); this.UpdateManager(); }
//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 Boolean DeleteCategory(String ReassignMessage, IDictionary <long, long> Reassignments) { Boolean Result = service.CategoryDeleteAll(View.CategoryId, Reassignments, ReassignMessage); //Begin Action if (Result) { List <KeyValuePair <int, String> > Objects = new List <KeyValuePair <int, string> >(); Objects.Add(ModuleTicket.KVPgetPerson(this.UserContext.CurrentUserID)); Objects.Add(ModuleTicket.KVPgetCategory(View.CategoryId)); View.SendAction(ModuleTicket.ActionType.CategoryUndelete, View.CommunityId, ModuleTicket.InteractionType.UserWithLearningObject, Objects); } //End Action return(Result); }
public void Save(IList <Domain.liteCategoryReorderItem> Items, Boolean Refresh) { if (!CheckSessionAccess()) { return; } if (!(Module.ManageCategory || Module.Administration)) { View.SendUserActions(service.ModuleID, ModuleTicket.ActionType.NoPermission, this.CurrentCommunityId, ModuleTicket.InteractionType.None); //View.ShowNoPermission(); View.ShowMessage(Domain.Enums.CategoryTreeMessageType.NoPermission); return; } Domain.Enums.CategoryReorderResponse Saved = service.CategoryReorder(Items); //Begin Action List <KeyValuePair <int, String> > Objects = new List <KeyValuePair <int, string> >(); Objects.Add(ModuleTicket.KVPgetPerson(this.UserContext.CurrentUserID)); View.SendUserActions(service.ModuleID, ModuleTicket.ActionType.CategoryReorder, this.CurrentCommunityId, ModuleTicket.InteractionType.UserWithLearningObject, Objects); //End Action if (Refresh) { this.InitView(); } switch (Saved) { case Domain.Enums.CategoryReorderResponse.Error: View.ShowMessage(Domain.Enums.CategoryTreeMessageType.UnSaved); break; case Domain.Enums.CategoryReorderResponse.NoDefaultReorder: View.ShowMessage(Domain.Enums.CategoryTreeMessageType.DefaultReorderWarning); break; case Domain.Enums.CategoryReorderResponse.Success: View.ShowMessage(Domain.Enums.CategoryTreeMessageType.Saved); break; } }
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 }
/// <summary> /// Al primo caricamento della pagina! /// </summary> public void InitView() { if (!CheckSessionAccess()) { return; } if (!(Module.ManageCategory || Module.Administration)) { View.SendUserActions(service.ModuleID, ModuleTicket.ActionType.NoPermission, this.CurrentCommunityId, ModuleTicket.InteractionType.None); View.ShowNoPermission(); return; } Domain.Category Category = new Domain.Category(); //View.CommunityCategories = service.CategoriesGetCommunity(true); if (View.CurrentCategoryId > 0) { //Categoria Domain.Category Cat = service.CategoryGetDetached(View.CurrentCategoryId, Domain.Enums.RolesLoad.all, false); if (Cat == null || Cat.Id <= 0 || Cat.IdCommunity != CurrentCommunityId) { View.ShowWrongCategory(); return; } Domain.DTO.DTO_CategoryTypeComPermission Permission = service.CategoryTypeGetPermission(this.CurrentCommunityId); View.InitCategories(Permission, Cat.Type, Cat.IsDefault); View.Category = Cat; //Traduzioni List <lm.Comol.Core.DomainModel.Languages.LanguageItem> langs = new List <lm.Comol.Core.DomainModel.Languages.LanguageItem>(); //List<Domain.DTO.DTO_CategoryTranslation> translations = new List<Domain.DTO.DTO_CategoryTranslation>(); langs = (from t in Cat.Translations where t.Deleted == BaseStatusDeleted.None select new lm.Comol.Core.DomainModel.Languages.LanguageItem { IsMultiLanguage = (t.LanguageId == TicketService.LangMultiID) ? true : false, Id = t.LanguageId, Code = (t.LanguageId == TicketService.LangMultiID) ? t.LanguageCode.ToUpper() : t.LanguageCode, Name = (t.LanguageId == TicketService.LangMultiID) ? t.LanguageName.ToUpper() : t.LanguageName, Status = DomainModel.Languages.ItemStatus.valid }).Distinct().ToList(); //.OrderBy(li => li.IsMultiLanguage).ThenBy(li => li.Code).ToList(); //.OrderBy(li => li.Code).ToList(); //langs = langs.OrderBy(li => li.IsMultiLanguage).ToList(); //.OrderBy(li => li.IsMultiLanguage).ThenBy(li => li.Code).Distinct().ToList(); ////TEST!!! //String TEST = ""; //foreach (lm.Comol.Core.DomainModel.Languages.LanguageItem _lng in langs) //{ // TEST += _lng.Code + " - " + _lng.Name + " - " + _lng.IsMultiLanguage + "/r/n"; //} //langs = langs.OrderBy(li => li.IsMultiLanguage).ThenBy(li => li.Code).ToList(); //TEST += "/r/n ------- /r/n"; //foreach(lm.Comol.Core.DomainModel.Languages.LanguageItem _lng in langs) //{ // TEST += _lng.Code + " - " + _lng.Name + " - " + _lng.IsMultiLanguage + "/r/n"; //} ////END TEST!!! lm.Comol.Core.DomainModel.Languages.LanguageItem current = (from lm.Comol.Core.DomainModel.Languages.LanguageItem lng in langs where lng.Id == TicketService.LangMultiID select lng).FirstOrDefault(); View.BindLanguages(service.LanguagesGetAvailableSys().Distinct().ToList(), langs, current); View.PreviousLanguage = current; //UTENTI IList <Domain.DTO.DTO_UserRole> roles = (from Domain.LK_UserCategory lkcat in Cat.UserRoles select new Domain.DTO.DTO_UserRole() { User = lkcat.User, IsManager = lkcat.IsManager }).ToList(); int Managercount = (from Domain.DTO.DTO_UserRole rl in roles where rl.IsManager == true select rl.IsManager).Count(); if (Managercount <= 1) { View.ShowDeleteManagers = false; } else { View.ShowDeleteManagers = true; } //Begin Action List <KeyValuePair <int, String> > Objects = new List <KeyValuePair <int, string> >(); Objects.Add(ModuleTicket.KVPgetPerson(this.UserContext.CurrentUserID)); Objects.Add(ModuleTicket.KVPgetCategory(Cat.Id)); View.SendUserActions(service.ModuleID, ModuleTicket.ActionType.CategoryLoadManage, this.CurrentCommunityId, ModuleTicket.InteractionType.UserWithLearningObject, Objects); //End Action View.AssociatedUsers = roles; View.ShowForcedReassigned(null); } else { View.RedirectToList(); //Vai alla creazione! //View.Category = new Domain.Category(); } //Category; }
public void Save(Boolean UpdateView, Boolean SaveUsers = true) { if (!CheckSessionAccess()) { return; } if (!(Module.ManageCategory || Module.Administration)) { View.SendUserActions(service.ModuleID, ModuleTicket.ActionType.NoPermission, this.CurrentCommunityId, ModuleTicket.InteractionType.None); View.ShowNoPermission(); return; } //Se la view non è valida, non faccio nulla (la view si arrangia a mostrare gli errori (Nome vuoto) if (!View.Validate()) { return; } lm.Comol.Core.DomainModel.Languages.LanguageItem Lang = View.PreviousLanguage; Domain.Category Cat = View.Category; Domain.Enums.CategoryAddModifyError Error = service.CategoryModify(Cat.Id, Cat.Name, Cat.Description, Cat.Type, Lang); Domain.Enums.CategoryAssignersError ResError = Domain.Enums.CategoryAssignersError.none; if (SaveUsers) { ResError = service.CategoryUserUpdate(Cat.Id, View.UsersSettings); } if (Error == Domain.Enums.CategoryAddModifyError.none) { //Begin Action List <KeyValuePair <int, String> > Objects = new List <KeyValuePair <int, string> >(); Objects.Add(ModuleTicket.KVPgetPerson(this.UserContext.CurrentUserID)); Objects.Add(ModuleTicket.KVPgetCategory(Cat.Id)); View.SendUserActions(service.ModuleID, ModuleTicket.ActionType.CategoryModify, this.CurrentCommunityId, ModuleTicket.InteractionType.UserWithLearningObject, Objects); //End Action } if (ResError != Domain.Enums.CategoryAssignersError.none) { Domain.DTO.DTO_CategoryCheckResponse resp = service.CategoryUsersCheck(Cat.Id); if (!resp.PreviousAssigned) { if (UpdateView) { this.InitView(); //this.UpdateView(null); } View.ShowForcedReassigned(resp); return; } } if (Error == Domain.Enums.CategoryAddModifyError.none) { if (UpdateView) { this.UpdateView(null); } View.ShowReassignError(ResError); return; } else { //Other error } }