public XTemplate(TemplateLevel level) : this() { if (!IsLevelSupported(level)) { throw new NotSupportedException(); } Name = ""; Description = ""; CreateDate = DateTime.Now; Level = level; }
public static bool IsLevelSupported(TemplateLevel level) { switch (level) { case TemplateLevel.Project: case TemplateLevel.View: case TemplateLevel.Page: return(true); default: return(false); } }
public dtoVersionItem(TemplateLevel l) { Level = l; }
public dtoVersionItem() { Level = TemplateLevel.Removed; }
public List <lm.Comol.Core.TemplateMessages.Domain.CommonNotificationSettings> SaveNotificationSettings(TemplateLevel level, List <lm.Comol.Core.BaseModules.TemplateMessages.Domain.dtoModuleEvent> settings, Boolean forPortal, Int32 idCommunity, Int32 idOrganization, ModuleObject obj = null, lm.Comol.Core.Notification.Domain.NotificationChannel channel = lm.Comol.Core.Notification.Domain.NotificationChannel.Mail, lm.Comol.Core.Notification.Domain.NotificationMode mode = lm.Comol.Core.Notification.Domain.NotificationMode.Automatic) { List <lm.Comol.Core.TemplateMessages.Domain.CommonNotificationSettings> items = new List <lm.Comol.Core.TemplateMessages.Domain.CommonNotificationSettings>(); try { Manager.BeginTransaction(); litePerson p = Manager.GetLitePerson(UC.CurrentUserID); if (p != null && p.TypeID != (int)UserTypeStandard.Guest) { List <lm.Comol.Core.TemplateMessages.Domain.CommonNotificationSettings> inUse = null; if (obj == null) { inUse = (from n in Manager.GetIQ <lm.Comol.Core.TemplateMessages.Domain.CommonNotificationSettings>() where n.Settings.Channel == channel && n.Settings.Mode == mode && n.Settings.ActionType != lm.Comol.Core.Notification.Domain.NotificationActionType.Ignore && n.Settings.ActionType != lm.Comol.Core.Notification.Domain.NotificationActionType.None && (n.ObjectOwner == null || (idCommunity != -1 && (idCommunity == n.IdCommunity)) || (idOrganization != -1 && idOrganization == n.IdOrganization) || n.IsForPortal) select n).ToList(); } else { inUse = (from n in Manager.GetIQ <lm.Comol.Core.TemplateMessages.Domain.CommonNotificationSettings>() where n.Settings.Channel == channel && n.Settings.Mode == mode && n.Settings.ActionType != lm.Comol.Core.Notification.Domain.NotificationActionType.Ignore && n.Settings.ActionType != lm.Comol.Core.Notification.Domain.NotificationActionType.None && ( (n.ObjectOwner != null && n.ObjectOwner.ObjectLongID == obj.ObjectLongID && n.ObjectOwner.ObjectTypeID == obj.ObjectTypeID && n.ObjectOwner.ServiceCode == obj.ServiceCode) || (idCommunity != -1 && (idCommunity == n.IdCommunity)) || (idOrganization != -1 && idOrganization == n.IdOrganization) || n.IsForPortal ) select n).ToList(); } Dictionary <String, Int32> mInfo = Manager.GetIdModules(settings.Select(s => s.ModuleCode).Distinct().ToList()); foreach (lm.Comol.Core.BaseModules.TemplateMessages.Domain.dtoModuleEvent setting in settings) { CommonNotificationSettings current = null; var query = inUse.Where(n => n.Settings.IdModuleAction == setting.IdEvent && n.Settings.ModuleCode == setting.ModuleCode); if (obj == null) { query = query.Where(n => n.ObjectOwner == null); } else { query = query.Where(n => (n.ObjectOwner != null && n.ObjectOwner.ObjectLongID == obj.ObjectLongID && n.ObjectOwner.ObjectTypeID == obj.ObjectTypeID && n.ObjectOwner.ServiceCode == obj.ServiceCode)); } switch (level) { case TemplateLevel.Portal: #region "Portal Saving Settings" current = query.Where(n => n.IsForPortal && n.ObjectOwner == null).FirstOrDefault(); if (current == null && setting.IdTemplate > 0) { current = new CommonNotificationSettings(); current.CreateMetaInfo(p, UC.IpAddress, UC.ProxyIpAddress); current.IsEnabled = true; current.IsForPortal = true; current.Settings.ActionType = lm.Comol.Core.Notification.Domain.NotificationActionType.BySystem; current.Settings.Channel = channel; current.Settings.IdModule = (mInfo.ContainsKey(setting.ModuleCode) ? mInfo[setting.ModuleCode]: 0); current.Settings.IdModuleAction = setting.IdEvent; current.Settings.Mode = mode; current.Settings.ModuleCode = setting.ModuleCode; } else if (current != null && (current.Deleted == BaseStatusDeleted.None || (setting.IdTemplate > 0 && current.Deleted != BaseStatusDeleted.None))) { current.UpdateMetaInfo(p, UC.IpAddress, UC.ProxyIpAddress); } if (current != null) { current.Deleted = (setting.IdTemplate > 0) ? BaseStatusDeleted.None: BaseStatusDeleted.Manual; if (setting.IdTemplate > 0) { current.AlwaysLastVersion = (setting.IdVersion == 0); current.Template = Manager.Get <TemplateDefinition>(setting.IdTemplate); current.Version = (setting.IdVersion == 0) ? null : Manager.Get <TemplateDefinitionVersion>(setting.IdVersion); } Manager.SaveOrUpdate(current); items.Add(current); } #endregion break; case TemplateLevel.Organization: //#region "Organization Saving Settings" //if (setting.IdTemplate > 0) { // if (setting.ItemLevel== TemplateLevel.Organization) //} //if (setting.IdTemplate<=0){ // // rimuovo //} //current = query.Where(n=>!n.IsForPortal && && n.ObjectOwner==null).FirstOrDefault(); //if (current == null && setting.IdTemplate>0) //{ // current = new CommonNotificationSettings(); // current.CreateMetaInfo(p, UC.IpAddress, UC.ProxyIpAddress); // current.IsEnabled = true; // current.IsForPortal = true; // current.Settings.ActionType = NotificationActionType.BySystem; // current.Settings.Channel = channel; // current.Settings.IdModule= (mInfo.ContainsKey(setting.ModuleCode) ? mInfo[setting.ModuleCode]: 0); // current.Settings.IdModuleAction= setting.IdEvent; // current.Settings.Mode= mode; // current.Settings.ModuleCode= setting.ModuleCode; //} //else if (current != null && (current.Deleted== BaseStatusDeleted.None || (setting.IdTemplate>0 && current.Deleted!= BaseStatusDeleted.None))) // current.UpdateMetaInfo(p, UC.IpAddress, UC.ProxyIpAddress); //if (current != null) { // current.Deleted =(setting.IdTemplate>0) ? BaseStatusDeleted.None: BaseStatusDeleted.Manual; // if (setting.IdTemplate>0){ // current.AlwaysLastVersion = (setting.IdVersion == 0); // current.Template = Manager.Get<TemplateDefinition>(setting.IdTemplate); // current.Version = (setting.IdVersion == 0) ? null : Manager.Get<TemplateDefinitionVersion>(setting.IdVersion); // } // Manager.SaveOrUpdate(current); // items.Add(current); //} //#endregion break; } } } else { items = null; } Manager.Commit(); } catch (Exception ex) { Manager.RollBack(); items = null; } return(items); }
/// <summary>Initializes a new instance of the <see cref="TemplateCommand"/> class. public TemplateCommand(TemplateLevel level, string templateName, string folder, string filePattern) { this.Level = level; this.TemplateName = templateName; this.RelativeFolder = folder; this.FilePattern = filePattern; }