📄 books.ascx.cs
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Rainbow.UI;
using Rainbow.UI.WebControls;
using Rainbow.UI.DataTypes;
using Rainbow.Configuration;
using Esperantus;
namespace Rainbow.DesktopModules {
public class Books : PortalModuleControl {
protected System.Web.UI.WebControls.DataList myDataList;
public override bool Searchable
{
get
{
return true;
}
}
public Books() {
SettingItem Columns = new SettingItem(new IntegerDataType());
Columns.Required=true;
Columns.Value = "3";
Columns.MinValue=1;
Columns.MaxValue=10;
this._baseSettings.Add("Columns",Columns);
//Choose your editor here
SupportsWorkflow = false;
}
//*******************************************************
//
// The Page_Load event handler on this User Control is used to
// obtain a DataSet of announcement information from the Announcements
// table, and then databind the results to a templated DataList
// server control. It uses the ASPNetPortal.AnnouncementsDB()
// data component to encapsulate all data functionality.
//
//*******************************************************
private void Page_Load(object sender, System.EventArgs e) {
// Obtain book information and bind to datalist control
BooksDB books = new BooksDB();
// DataBind books to DataList Control
myDataList.DataSource = books.Getrb_Books(ModuleID);
myDataList.DataBind();
myDataList.RepeatColumns = Int32.Parse(Settings["Columns"].ToString());
}
public override Guid GuidID
{
get
{
return new Guid("{275C4B34-3315-4e0c-82E2-1836AB35069F}");
}
}
public override string SearchSqlSelect(int portalID, int userID, string searchString, string searchField){
Rainbow.Helpers.SearchDefinition s = new Rainbow.Helpers.SearchDefinition("rb_Books", "Title", "Authors", "CreatedByUser", "CreatedDate", searchField);
return s.SearchSqlSelect(portalID, userID, searchString);
}
public override void Install(System.Collections.IDictionary stateSaver){
string currentScriptName = Server.MapPath(TemplateSourceDirectory + "/Books_Install.sql");
ArrayList errors = Rainbow.Helpers.DBHelper.ExecuteScript(currentScriptName, true);
if (errors.Count > 0){
// Call rollback
throw new Exception("Error occurred:" + errors[0].ToString());
}
}
public override void Uninstall(System.Collections.IDictionary stateSaver){
string currentScriptName = Server.MapPath(TemplateSourceDirectory + "/Books_Uninstall.sql");
ArrayList errors = Rainbow.Helpers.DBHelper.ExecuteScript(currentScriptName, true);
if (errors.Count > 0){
// Call rollback
throw new Exception("Error occurred:" + errors[0].ToString());
}
}
#region Web Form Designer generated code
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
override protected void OnInit(EventArgs e)
{
InitializeComponent();
// Create a new Title the control
ModuleTitle = new DesktopModuleTitle();
// Set here title properties
// Add support for the edit page
ModuleTitle.AddUrl = "~/DesktopModules/Books/BooksEdit.aspx";
// Add title ad the very beginnig of
// the control's controls collection
Controls.AddAt(0, ModuleTitle);
base.OnInit(e);
}
private void InitializeComponent() {
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -