public JsonResult GetAllStudents() { List <Student> students = _studentService.GetStudents(); List <StudentDTO> dtos = BaseDomainObject.CopyList <StudentDTO, Student>(students); return(Json(new { result = dtos, count = dtos.Count }, JsonRequestBehavior.AllowGet)); }
internal static void LogSaveEvent(BaseDomainObject baseDomainObject) { if (//baseDomainObject.GetType() == typeof(SearchResultItem) || baseDomainObject.GetType() == typeof(BaseModule)) { return; } EventLog log = new EventLog(); log.Description = "Bewaar: " + GetObjectNameNL(baseDomainObject) + " (" + baseDomainObject.Name + ", ID=" + baseDomainObject.ID.ToString() + ")"; if (baseDomainObject.IsNew) { log.Description += " (Nieuw)"; } log.Type = "Save action"; if (baseDomainObject.GetType() == typeof(CmsSite) && baseDomainObject.IsNew) { log.Site = null; } else { log.Site = GetSite(); } log.UserName = GetUserName(); log.Failure = false; log.Save(); }
public static string MoveModule(string moduleid, string pageid, string containername, int sortorder) { BaseService.CheckLoginAndLicense(); string where = String.Format("FK_PAGE = '{0}' And ContainerName='{1}' AND OrderingNumber >= {2}", pageid, containername, sortorder); //where = String.Format("FK_PAGE = '{0}' And Container='{1}'", pageid, containername); BaseCollection <BaseModule> modules = BaseCollection <BaseModule> .Get(where, "OrderingNumber"); foreach (BaseModule mod in modules) { mod.OrderingNumber++; mod.Save(); } string returnValue = ""; //moduleid = moduleid.Replace("bitModule", ""); moduleid = moduleid.Replace("bitModule", "").Replace("_", "-"); containername = containername.Replace("bitContainer", ""); BaseModule module = (BaseModule)BaseDomainObject.GetById <BaseModule>(new Guid(moduleid)); module.ContainerName = containername; module.OrderingNumber = sortorder; module.Save(); returnValue = new ModuleService().GetUserControlContent(module); //moet naar container //updateOrderingNumber //alleen degene ophalen met een groter nummer dan sortorder PublishDependentPages(module); return(returnValue); }
internal static void LogDeleteEvent(BaseDomainObject baseDomainObject) { EventLog log = new EventLog(); log.Description = "Delete " + GetObjectNameNL(baseDomainObject) + " (" + baseDomainObject.Name + ")"; log.Site = GetSite(); log.UserName = GetUserName(); log.Type = "Delete action"; log.Failure = false; log.Save(); }
public JsonResult PagingGetStudents() { int skip = int.Parse(Request.QueryString["$skip"]); int top = int.Parse(Request.QueryString["$top"]); string orderby = Request.QueryString["$orderby"]; int count = 0; List <Student> students = _studentService.GetStudents(skip, top, orderby, out count); List <StudentDTO> dtos = BaseDomainObject.CopyList <StudentDTO, Student>(students); return(Json(new { result = dtos, count = count }, JsonRequestBehavior.AllowGet)); }
public string MoveModule(string moduleid, string pageid, string containername, int sortorder, string newsletterid) { BaseService.CheckLoginAndLicense(); string returnValue = ""; //moduleid = moduleid.Replace("bitModule", ""); moduleid = moduleid.Replace("bitModule", "").Replace("_", "-"); containername = containername.Replace("bitContainer", ""); BaseModule module = (BaseModule)BaseDomainObject.GetById <BaseModule>(new Guid(moduleid)); module.ContainerName = containername; module.OrderingNumber = sortorder; module.Save(); CmsPage page = (pageid != null && pageid != "") ? BaseObject.GetById <CmsPage>(Guid.Parse(pageid)) : null; Newsletter newsletter = (newsletterid != null && newsletterid != "") ? BaseObject.GetById <Newsletter>(Guid.Parse(newsletterid)) : null; if (page != null) { returnValue = module.Publish2(page); } else { returnValue = module.Publish2(newsletter); } //moet naar container //updateOrderingNumber //alleen degene ophalen met een groter nummer dan sortorder string where = String.Format("FK_Page = '{0}' And ContainerName='{1}' AND OrderingNumber > {2}", pageid, containername, sortorder); if (newsletterid != null && newsletterid != "") { where = String.Format("FK_Newsletter = '{0}' And ContainerName='{1}' AND OrderingNumber > {2}", newsletterid, containername, sortorder); } //where = String.Format("FK_PAGE = '{0}' And Container='{1}'", pageid, containername); BaseCollection <BaseModule> modules = BaseCollection <BaseModule> .Get(where, "OrderingNumber"); foreach (BaseModule mod in modules) { mod.OrderingNumber++; mod.Save(); } return(returnValue); }
public string GetModuleContent(string id, string mode) { BaseService.CheckLoginAndLicense(); string returnValue = ""; //id = id.Replace("bitModule", ""); id = id.Replace("bitModule", "").Replace("_", "-"); BaseModule module = (BaseModule)BaseDomainObject.GetById <BaseModule>(new Guid(id)); module = module.ConvertToType(); if (mode == "edit") { returnValue = module.Content; Uri uri = System.Web.HttpContext.Current.Request.UrlReferrer; string currentDomain = uri.GetLeftPart(UriPartial.Authority); if (SessionObject.CurrentSite.DomainName != currentDomain) { returnValue = HtmlHelper.ReplaceImageSources(returnValue, ModeEnum.Edit, SessionObject.CurrentSite); } if (module.HasBitplateAutorisation()) { //BitAutorisationService.AutorisationClient client = BitAutorisationServiceHelper.GetClient(); //BitplateUserGroup[] usergroups = client.GetUserGroupsByObjectPermission(module.ID); //module.AutorizedBitplateUserGroups = usergroups; //BitplateUser[] users = client.GetUsersByObjectPermission(module.ID); //module.AutorizedBitplateUsers = users; if (!module.IsAutorized(SessionObject.CurrentBitplateUser)) { throw new Exception("U heeft geen rechten voor deze module"); } } } else { //module.LoadPropsFromXmlFile(); //returnValue = new ModuleService().GetUserControlContent(module); } return(returnValue); }
private static string GetObjectNameNL(BaseDomainObject baseDomainObject) { string typeName = baseDomainObject.GetType().Name; string returnValue = typeName; if (typeName == "CmsSite") { returnValue = "Site"; } else if (typeName == "CmsPage") { returnValue = "Pagina"; } else if (typeName == "CmsTemplate") { returnValue = "Template"; } return(returnValue); }
protected void Page_Load(object sender, EventArgs e) { if (HttpContext.Current.Session["CurrentSite"] == null) { string siteID = ConfigurationManager.AppSettings["SiteID"]; if (siteID != null && siteID != "") { CmsSite site = BaseDomainObject.GetById <CmsSite>(new Guid(siteID)); HttpContext.Current.Session["CurrentSite"] = site; } } string id = Request.QueryString["id"]; //CmsPage page = BaseDomainObject.GetById<CmsPage>(new Guid(id)); CmsPage page = PageService.GetPreviewPage(id, ""); //Response.ClearContent(); //Response.Write(page.GetPublishHtml()); //Response.Flush(); //LiteralTitle.Text = "Preview: " + page.Title; LiteralHead.Text = page.Head; LiteralBody.Text = page.Body; }
public Dictionary <string, object> GetTags(string id) { BaseService.CheckLoginAndLicense(); List <string> tagArray = new List <string>(); string tagString = "Dubbelklik op een tag om het op de plaats van de cursor te zetten<br/>"; id = id.Replace("bitModule", ""); id = id.Replace("bitEditor", ""); //id = id.Replace("Template", ""); if (id.Contains("Template")) { tagString += "<br/>"; tagString += "<strong>Body-tags:</strong> (Deze tags kunnen genummerd worden.<br />Bijvoorbeeld: [CONTENT1], [CONTENT2], [CONTENT...)<br/>"; tagString += "<div class='tagToInsert'>[CONTENT]</div>"; tagArray.Add("[CONTENT]"); tagString += "<div class='tagToInsert'>[TOP]</div>"; tagArray.Add("[TOP]"); tagString += "<div class='tagToInsert'>[LEFT]</div>"; tagArray.Add("[LEFT]"); tagString += "<div class='tagToInsert'>[CENTER]</div>"; tagArray.Add("[CENTER]"); tagString += "<div class='tagToInsert'>[RIGHT]</div>"; tagArray.Add("[RIGHT]"); tagString += "<div class='tagToInsert'>[BOTTOM]</div>"; tagArray.Add("[BOTTOM]"); tagString += "<br/>"; tagString += "<strong>Head-tags:</strong><br/>"; tagString += "<div class='tagToInsert'>[PAGETITLE]</div>"; tagArray.Add("[PAGETITLE]"); tagString += "<div class='tagToInsert'>[SCRIPTS]</div>"; tagArray.Add("[SCRIPTS]"); tagString += "<div class='tagToInsert'>[HEAD]</div>"; tagArray.Add("[HEAD]"); //returnValue += "<div class='tagToInsert'>[METADESCRIPTION]</div>"; //returnValue += "<div class='tagToInsert'>[METAKEYWORDS]</div>"; } else if (id != "") { //TemplateModule module = (TemplateModule)BaseDomainObject.GetById<TemplateModule>(new Guid(id)); BaseModule module = (BaseModule)BaseDomainObject.GetById <BaseModule>(new Guid(id)); module = module.ConvertToType(); List <Tag> tags = module.GetAllTags(); tags = tags.OrderBy(c => c.Name).ToList(); foreach (Tag tag in tags) //ModeEnum.EditPageMode)) { if (tag.HasCloseTag) { tagString += String.Format("<div class='tagToInsert'>{0}</div>", tag.Name + tag.CloseTag); tagArray.Add(tag.Name + tag.CloseTag); } else { tagString += String.Format("<div class='tagToInsert'>{0}</div>", tag.Name); tagArray.Add(tag.Name); if (tag.AllowFormats && tag.SampleFormats != null) { foreach (string sampleFormat in tag.SampleFormats) { string tagWithFormat = tag.Name.Replace("}", ":" + sampleFormat + "}"); tagString += String.Format("<div class='tagToInsert'>{0}</div>", tagWithFormat); tagArray.Add(tagWithFormat); } } //if (tag.AllowFormats && tag.AvailableArguments != null) //{ // foreach (string argument in tag.AvailableArguments) // { // string tagWithFormat = tag.Name.Replace("}", ":" + argument + "}"); // tagString += String.Format("<div class='tagToInsert'>{0}</div>", tagWithFormat); // tagArray.Add(tagWithFormat); // } //} } } if (tags.Count == 0) { tagString = "Deze module kent geen tags"; } } Dictionary <string, object> returnvalue = new Dictionary <string, object>(); returnvalue.Add("CKTags", tagString); returnvalue.Add("CMTags", tagArray.ToArray()); return(returnvalue); }
public static bool IsNotNull(BaseDomainObject entity) { return(entity != null && entity.Id != null); }
public static bool IsNull(BaseDomainObject entity) { return(entity == null || entity.Id == null); }