📄 getuserid.cs
字号:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlClient;
/// <summary>
/// Summary description for GetUserId
/// </summary>
public class GetUserId:DataAccess
{
public Int32 userid;
public GetUserId()
{
}
public int GetUserId_register()
{
SqlCommand comm = new SqlCommand();
conn.Open();
comm.CommandType = CommandType.StoredProcedure;
comm.CommandText = "User_SelectUserId_register";
comm.Connection = conn;
SqlDataAdapter sda = new SqlDataAdapter(comm);
DataSet ds = new DataSet();
DataTable dt = new DataTable();
try
{
sda.Fill(ds, "UserId_Register");
dt = ds.Tables["UserId_Register"];
foreach (DataRow dr in dt.Rows)
{
TableRow tr = new TableRow();
for (int j = 0; j <=dt.Columns.Count - 1; j++)
userid=Convert.ToInt32(dr[0].ToString());
}
}
catch (SqlException e)
{
String error_string = e.ToString();
conn.Close();
return 0;
}
conn.Close();
return userid;
}
public int GetUserId_basicinformation(string Email)
{
SqlCommand comm = new SqlCommand();
conn.Open();
comm.CommandType = CommandType.StoredProcedure;
comm.CommandText = "User_SelectUserId_basicinformation";
comm.Connection = conn;
comm.Parameters.Add("@Email", SqlDbType.NVarChar).Value =Email;
SqlDataAdapter sda = new SqlDataAdapter(comm);
DataSet ds = new DataSet();
DataTable dt = new DataTable();
try
{
sda.Fill(ds, "UserId_Organisation");
dt = ds.Tables["UserId_Organisation"];
foreach (DataRow dr in dt.Rows)
{
TableRow tr = new TableRow();
for (int j = 0; j <=dt.Columns.Count - 1; j++)
userid=Convert.ToInt32(dr[0].ToString());
}
}
catch (SqlException e)
{
String error_string = e.ToString();
conn.Close();
return 0;
}
conn.Close();
return userid;
}
public int GetUserId_organization(string Email)
{
SqlCommand comm = new SqlCommand();
conn.Open();
comm.CommandType = CommandType.StoredProcedure;
comm.CommandText = "User_SelectUserId_organisationByEmail";
comm.Connection = conn;
comm.Parameters.Add("@Email", SqlDbType.NVarChar).Value = Email;
SqlDataAdapter sda = new SqlDataAdapter(comm);
DataSet ds = new DataSet();
DataTable dt = new DataTable();
try
{
sda.Fill(ds, "UserId_Organisation");
dt = ds.Tables["UserId_Organisation"];
foreach (DataRow dr in dt.Rows)
{
TableRow tr = new TableRow();
for (int j = 0; j <=dt.Columns.Count - 1; j++)
userid=Convert.ToInt32(dr[0].ToString());
}
}
catch (SqlException e)
{
String error_string = e.ToString();
conn.Close();
return 0;
}
conn.Close();
return userid;
}
public int GetUserId_envoyers(int ArticleId)
{
SqlCommand comm = new SqlCommand();
conn.Open();
comm.CommandType = CommandType.StoredProcedure;
comm.CommandText = "User_SelectUserIdbyArticleId";
comm.Connection = conn;
comm.Parameters.Add("@ArticleId", SqlDbType.Int).Value = ArticleId;
SqlDataAdapter sda = new SqlDataAdapter(comm);
DataSet ds = new DataSet();
DataTable dt = new DataTable();
try
{
sda.Fill(ds, "UserId_fromenvoyers");
dt = ds.Tables["UserId_fromenvoyrs"];
foreach (DataRow dr in dt.Rows)
{
TableRow tr = new TableRow();
for (int j = 0; j <= dt.Columns.Count - 1; j++)
userid = Convert.ToInt32(dr[0].ToString());
}
}
catch (SqlException e)
{
String error_string = e.ToString();
conn.Close();
return 0;
}
conn.Close();
return userid;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -