📄 listinfo.cs
字号:
string sql = "Select CSDM,CSMC From XTCS Where CSDM Like '16%'";
cmd.CommandText = sql;
Connection.Open();
try
{
//声明并使用SqlCommand的ExecuteReader方法创建一个SqlDataReader对象的实例
System.Data.SqlClient.SqlDataReader SqlDR = cmd.ExecuteReader();
//将查询结果集与下拉列表框控件进行绑定
theDDL.DataSource = SqlDR;
theDDL.DataValueField = "CSDM";
theDDL.DataTextField = "CSMC";
theDDL.DataBind();
//关闭数据库连接对象
Connection.Close();
return true;
}
catch(Exception e)
{
Connection.Close();
LogService.Write ("ListWxxmlx(System.Web.UI.WebControls.DropDownList theDDL)");
LogService.Write ("在绑定维修细目类型时发生错误。");
LogService.Write (e.Message);
return false;
}
}
/// **************************************************************************
/// END
/// **************************************************************************
/// **************************************************************************
/// BEIGIN
/// <summary>
/// 绑定运输类别
/// </summary>
/// <param name="theDDL">被绑定的下拉列表框控件对象</param>
/// <returns>布尔型返回值,成功执行时返回true,产生错误时返回false</returns>
/// **************************************************************************
public static bool ListYslb(System.Web.UI.WebControls.DropDownList theDDL)
{
System.Data.SqlClient.SqlConnection Connection = new SqlConnection (com.unicafe.common.Configuration.GetDBConnectionString());
System.Data.SqlClient.SqlCommand cmd = Connection.CreateCommand();
string sql = "Select CSDM,CSMC From XTCS Where CSDM Like '12%'";
cmd.CommandText = sql;
Connection.Open();
try
{
//声明并使用SqlCommand的ExecuteReader方法创建一个SqlDataReader对象的实例
System.Data.SqlClient.SqlDataReader SqlDR = cmd.ExecuteReader();
//将查询结果集与下拉列表框控件进行绑定
theDDL.DataSource = SqlDR;
theDDL.DataValueField = "CSDM";
theDDL.DataTextField = "CSMC";
theDDL.DataBind();
//关闭数据库连接对象
Connection.Close();
return true;
}
catch(Exception e)
{
Connection.Close();
LogService.Write ("ListYslb(System.Web.UI.WebControls.DropDownList theDDL)");
LogService.Write ("在绑定运输类别时发生错误。");
LogService.Write (e.Message);
return false;
}
}
/// **************************************************************************
/// END
/// **************************************************************************
/// **************************************************************************
/// BEIGIN
/// <summary>
/// 绑定统计查询类型
/// </summary>
/// <param name="theDDL">被绑定的下拉列表框控件对象</param>
/// <returns>布尔型返回值,成功执行时返回true,产生错误时返回false</returns>
/// **************************************************************************
public static bool ListTjcxlb(System.Web.UI.WebControls.DropDownList theDDL)
{
System.Data.SqlClient.SqlConnection Connection = new SqlConnection (com.unicafe.common.Configuration.GetDBConnectionString());
System.Data.SqlClient.SqlCommand cmd = Connection.CreateCommand();
string sql = "Select LBDM,LBMC From ZDYCXLB ";
cmd.CommandText = sql;
Connection.Open();
try
{
//声明并使用SqlCommand的ExecuteReader方法创建一个SqlDataReader对象的实例
System.Data.SqlClient.SqlDataReader SqlDR = cmd.ExecuteReader();
//将查询结果集与下拉列表框控件进行绑定
theDDL.DataSource = SqlDR;
theDDL.DataValueField = "LBDM";
theDDL.DataTextField = "LBMC";
theDDL.DataBind();
//关闭数据库连接对象
Connection.Close();
return true;
}
catch(Exception e)
{
Connection.Close();
LogService.Write ("ListTjcxlb(System.Web.UI.WebControls.DropDownList theDDL)");
LogService.Write ("在绑定统计查询类型时发生错误。");
LogService.Write (e.Message);
return false;
}
}
/// **************************************************************************
/// END
/// **************************************************************************
/// **************************************************************************
/// BEIGIN
/// <summary>
/// 绑定角色
/// </summary>
/// <param name="theDDL">被绑定的下拉列表框控件对象</param>
/// <returns>布尔型返回值,成功执行时返回true,产生错误时返回false</returns>
/// **************************************************************************
public static bool ListJs(System.Web.UI.WebControls.DropDownList theDDL)
{
System.Data.SqlClient.SqlConnection Connection = new SqlConnection (com.unicafe.common.Configuration.GetDBConnectionString());
System.Data.SqlClient.SqlCommand cmd = Connection.CreateCommand();
string sql = "Select RoleID,RoleName From Roles ";
cmd.CommandText = sql;
Connection.Open();
try
{
//声明并使用SqlCommand的ExecuteReader方法创建一个SqlDataReader对象的实例
System.Data.SqlClient.SqlDataReader SqlDR = cmd.ExecuteReader();
//将查询结果集与下拉列表框控件进行绑定
theDDL.DataSource = SqlDR;
theDDL.DataValueField = "RoleID";
theDDL.DataTextField = "RoleName";
theDDL.DataBind();
//关闭数据库连接对象
Connection.Close();
return true;
}
catch(Exception e)
{
Connection.Close();
LogService.Write ("ListJs(System.Web.UI.WebControls.DropDownList theDDL)");
LogService.Write ("在绑定角色时发生错误。");
LogService.Write (e.Message);
return false;
}
}
/// **************************************************************************
/// END
/// **************************************************************************
/// **************************************************************************
/// BEIGIN
/// <summary>
/// 绑定仓库和机构
/// </summary>
/// <param name="theDDL">被绑定的下拉列表框控件对象</param>
/// <param name="JGDM">被绑定的机构代码,如果为"%"则选择所有机构的仓库</param>
/// <returns>布尔型返回值,成功执行时返回true,产生错误时返回false</returns>
/// **************************************************************************
public static bool ListCK(System.Web.UI.WebControls.DropDownList theDDL,string JGDM)
{
System.Data.SqlClient.SqlConnection Connection = new SqlConnection (com.unicafe.common.Configuration.GetDBConnectionString());
System.Data.SqlClient.SqlCommand cmd = Connection.CreateCommand();
string sql = "select distinct ckdm,ckmc from cKB where ckzt='1' and ckb.jgdm like '"+ JGDM+"'";
cmd.CommandText = sql;
Connection.Open();
try
{
//声明并使用SqlCommand的ExecuteReader方法创建一个SqlDataReader对象的实例
System.Data.SqlClient.SqlDataReader SqlDR = cmd.ExecuteReader();
//将查询结果集与下拉列表框控件进行绑定
theDDL.DataSource = SqlDR;
theDDL.DataValueField = "ckdm";
theDDL.DataTextField = "ckmc";
theDDL.DataBind();
//关闭数据库连接对象
Connection.Close();
return true;
}
catch(Exception e)
{
Connection.Close();
LogService.Write ("ListCK(System.Web.UI.WebControls.DropDownList theDDL,string JGDM)");
LogService.Write ("在根据机构绑定仓库时发生错误。");
LogService.Write (e.Message);
return false;
}
}
/// **************************************************************************
/// END
/// **************************************************************************
/// **************************************************************************
/// BEIGIN
/// <summary>
/// 绑定仓库和仓库保管员
/// </summary>
/// <param name="theDDL">被绑定的下拉列表框控件对象</param>
/// <param name="EmplId">被绑定的仓库保管员的EmplId</param>
/// <returns>布尔型返回值,成功执行时返回true,产生错误时返回false</returns>
/// **************************************************************************
public static bool ListCkByEmpl(System.Web.UI.WebControls.DropDownList theDDL,string EmplId)
{
System.Data.SqlClient.SqlConnection Connection = new SqlConnection (com.unicafe.common.Configuration.GetDBConnectionString());
System.Data.SqlClient.SqlCommand cmd = Connection.CreateCommand();
string sql = "Select Distinct CKDM,CKMC From CKB Where CKZT='1' And CKB.FZR= '"+ EmplId+"'";
cmd.CommandText = sql;
Connection.Open();
try
{
//声明并使用SqlCommand的ExecuteReader方法创建一个SqlDataReader对象的实例
System.Data.SqlClient.SqlDataReader SqlDR = cmd.ExecuteReader();
//将查询结果集与下拉列表框控件进行绑定
theDDL.DataSource = SqlDR;
theDDL.DataValueField = "ckdm";
theDDL.DataTextField = "ckmc";
theDDL.DataBind();
//关闭数据库连接对象
Connection.Close();
return true;
}
catch(Exception e)
{
Connection.Close();
LogService.Write ("ListCkByEmpl(System.Web.UI.WebControls.DropDownList theDDL,string EmplId)");
LogService.Write ("在根据仓库保管员绑定仓库时发生错误。");
LogService.Write (e.Message);
return false;
}
}
/// **************************************************************************
/// END
/// **************************************************************************
/// **************************************************************************
/// BEIGIN
/// <summary>
/// 绑定维修站和机构
/// </summary>
/// <param name="theDDL">被绑定的下拉列表框控件对象</param>
/// <param name="JGDM">被绑定的机构代码,如果为"%"则选择所有机构的维修站</param>
/// <returns>布尔型返回值,成功执行时返回true,产生错误时返回false</returns>
/// **************************************************************************
public static bool ListWXZ(System.Web.UI.WebControls.DropDownList theDDL,string JGDM)
{
System.Data.SqlClient.SqlConnection Connection = new SqlConnection (com.unicafe.common.Configuration.GetDBConnectionString());
System.Data.SqlClient.SqlCommand cmd = Connection.CreateCommand();
string sql = "select distinct wxzdm,wxzmc,* from wxzxx where sfsy='0' and jgdm like '"+ JGDM+"'";
cmd.CommandText = sql;
Connection.Open();
try
{
//声明并使用SqlCommand的ExecuteReader方法创建一个SqlDataReader对象的实例
System.Data.SqlClient.SqlDataReader SqlDR = cmd.ExecuteReader();
//将查询结果集与下拉列表框控件进行绑定
theDDL.DataSource = SqlDR;
theDDL.DataValueField = "wxzdm";
theDDL.DataTextField = "wxzmc";
theDDL.DataBind();
//关闭数据库连接对象
Connection.Close();
return true;
}
catch(Exception e)
{
Connection.Close();
LogService.Write ("ListWXZ(System.Web.UI.WebControls.DropDownList theDDL)");
LogService.Write ("在绑定维修站时发生错误。");
LogService.Write (e.Message);
return false;
}
}
/// **************************************************************************
/// END
/// **************************************************************************
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -