本文整理汇总了C#中Utilities.getID方法的典型用法代码示例。如果您正苦于以下问题:C# Utilities.getID方法的具体用法?C# Utilities.getID怎么用?C# Utilities.getID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utilities
的用法示例。
在下文中一共展示了Utilities.getID方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadData
void LoadData()
{
Utilities util = new Utilities();
string query;
db dbc = new db();
query = "SELECT * FROM pictures WHERE UserID = @id ORDER BY date DESC";
if (Request.QueryString["sort"] == "oldest")
query = "SELECT * FROM pictures WHERE UserID = @id ORDER BY date ASC";
else if (Request.QueryString["sort"] == "byalphaup")
query = query = "SELECT * FROM pictures WHERE UserID = @id pictures ORDER BY id DESC";
else if (Request.QueryString["sort"] == "byalphadown")
query = query = "SELECT * FROM pictures WHERE UserID = @id pictures ORDER BY id ASC";
else if (Request.QueryString["sort"] == "mostpop")
query = query = "SELECT * FROM pictures ORDER BY views DESC";
else if (Request.QueryString["sort"] == "mostrank")
query = query = "SELECT * FROM pictures ORDER BY rank DESC";
int id = util.getID(Convert.ToString(Session["eid"]));
dbc.cmd.Parameters.Add(new SqlParameter("id", id));
dbc.cmd.CommandText = query;
SqlDataAdapter da = new SqlDataAdapter(dbc.cmd);
DataTable dt = new DataTable();
da.Fill(dt);
PagedDataSource pgitems = new PagedDataSource();
System.Data.DataView dv = new System.Data.DataView(dt);
pgitems.DataSource = dv;
pgitems.AllowPaging = true;
pgitems.PageSize = 9;
pgitems.CurrentPageIndex = PageNumber;
if (pgitems.PageCount > 1)
{
rptPages.Visible = true;
System.Collections.ArrayList pages = new System.Collections.ArrayList();
for (int i = 0; i < pgitems.PageCount; i++)
pages.Add((i + 1).ToString());
rptPages.DataSource = pages;
rptPages.DataBind();
}
else
rptPages.Visible = false;
rptContent.DataSource = pgitems;
rptContent.DataBind();
}
示例2: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
Utilities util = new Utilities();
if (!String.IsNullOrEmpty(Request.QueryString["id"]))
{
if (Session["eid"] != null)
Session["usrID"] = util.getID(Session["eid"].ToString());
Session["picID"] = Request.QueryString["id"];
int id = Convert.ToInt32(Request.QueryString["id"]);
Session["PictureID"] = id;
dbc.cmd.Parameters.Add(new SqlParameter("id", id));
dbc.cmd.CommandText = query;
reader = dbc.cmd.ExecuteReader();
if (reader.Read())
{
picture.ImageUrl = reader["path"].ToString();
picture.AlternateText = reader["name"].ToString();
header.Text = reader["name"].ToString();
int userID = Convert.ToInt32(reader["userID"]);
author.Text = this.getAuthor(userID);
description.Text = reader["description"].ToString();
if (Session["eid"] != null && (bool)Session["lgin"] == true)
{
upView(id);
}
views.Text = this.getView(id).ToString();
rank.Text = Convert.ToString(Math.Round(totalRank(Convert.ToInt32(Request.QueryString["id"])),1));
}
reader.Close();
getComments(Convert.ToInt32(Request.QueryString["id"]));
dbc.dbCon.Close();
}
else
{
Response.Redirect("../default.aspx");
}
}
示例3: getID
protected internal int getID(string email)
{
Utilities util = new Utilities();
int id = util.getID(email);
return id;
}