public void SaveAlbumInfo(int parentAlbumId, string title, string description) { BXIBlockSection sec; if (AlbumId > 0 && this.Action=="edit") { sec = BXIBlockSection.GetById(AlbumId); sec.SectionId = parentAlbumId; sec.Name = title; sec.DescriptionType = BXTextType.Text; sec.Description = description; sec.Update(); } else if (this.Action=="add"){ sec = new BXIBlockSection(Parameters.Get("IBlockId", 0), parentAlbumId, title ); sec.Active = true; sec.Description = description; sec.DescriptionType = BXTextType.Text; sec.Sort=500; sec.Code=string.Empty; sec.XmlId = string.Empty; sec.Save(); } string url; if (!String.IsNullOrEmpty(BackUrl)) url = BackUrl; else if (EnableSef) { Results["AlbumId"] = (parentAlbumId > 0) ? parentAlbumId.ToString() : string.Empty; if (AlbumId > 0) { url = MakeLink(Parameters.Get<string>("SefFolder"), Parameters.Get<string>("Sef_Album"), ComponentCache); } else { url = MakeLink(Parameters.Get<string>("SefFolder"), string.Empty, ComponentCache); } } else { if (parentAlbumId > 0) { url = string.Format("{0}?{1}={2}", Request.Path, Parameters.Get<string>("ParamAlbum", "Album"), parentAlbumId); } else { url = Request.Path; } } if (Parameters.Get<bool>("EnableAjax", false) && !IsComponentDesignMode) { string script = string.Format("setTimeout(\"PageTransfer('{0}');\",0);", url); ScriptManager.RegisterStartupScript(Page, typeof(Page), "AJAX_BUTTON_CLICK", script, true); } else Response.Redirect(url); }
public override bool ProcessCommand(string commandName, BXParamsBag<object> commandParameters, System.Collections.Generic.List<string> commandErrors) { int albumId = (int)commandParameters["Id"]; int parentAlbumId = (int)commandParameters["ParentId"]; BXIBlockSection sec; if (albumId > 0) { sec = BXIBlockSection.GetById(albumId); sec.SectionId = parentAlbumId; sec.Name = commandParameters["Title"].ToString(); sec.Description = commandParameters["Description"].ToString(); sec.Update(); } else { sec = new BXIBlockSection(Parameters.Get("IBlockId", 0), parentAlbumId, commandParameters["Title"].ToString() ); sec.Active = true; sec.Description = commandParameters["Description"].ToString(); sec.DescriptionType = BXTextType.Text; sec.Sort = 500; sec.Code = string.Empty; sec.XmlId = string.Empty; sec.Save(); } string url; if (EnableSef) { Results["AlbumId"] = (albumId > 0) ? albumId.ToString() : string.Empty; if (albumId > 0) { url = MakeLink(Parameters.Get<string>("SefFolder"), Parameters.Get<string>("Sef_Album"), ComponentCache); } else { url = MakeLink(Parameters.Get<string>("SefFolder"), string.Empty, ComponentCache); } } else { if (albumId > 0) { url = string.Format("{0}?{1}={2}", Request.Path, Parameters.Get<string>("ParamAlbum", "Album"), albumId); } else { url = Request.Path; } } if (Parameters.Get<bool>("EnableAjax", false) && !IsComponentDesignMode) { string script = string.Format("setTimeout(\"PageTransfer('{0}');\",0);", url); ScriptManager.RegisterStartupScript(Page, typeof(Page), "AJAX_BUTTON_CLICK", script, true); } else Response.Redirect(url); return true; //return base.ProcessCommand(commandName, commandParameters, commandErrors); }