本文整理汇总了C#中UDS.Components.Database类的典型用法代码示例。如果您正苦于以下问题:C# Database类的具体用法?C# Database怎么用?C# Database使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Database类属于UDS.Components命名空间,在下文中一共展示了Database类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AdminBBS
/// <summary>
/// �ж��Ƿ��й���Ȩ��
/// </summary>
/// <param name="username">�û���</param>
/// <returns>bool</returns>
public bool AdminBBS(string username,int classid)
{
if(classid!=0)
{
int actid = 8;
Database db = new Database();
SqlParameter[] prams = {
db.MakeInParam("@Class_ID",SqlDbType.Int,4,classid),
db.MakeInParam("@Username",SqlDbType.VarChar,100,username),
db.MakeInParam("@Act_ID",SqlDbType.Int,4,actid),
db.MakeOutParam("@ReturnValue",SqlDbType.Int,4)
};
try
{
db.RunProc("sp_GetAccessPermission",prams);
// ����������
// return(true);
return((Int32.Parse(prams[3].Value.ToString())==1)?true:false);
}
catch(Exception ex)
{
Error.Log(ex.Message);
throw new Exception("BBSȨ���жϴ���!",ex);
}
}
else
return(false);
}
示例2: Delete
/// <summary>
/// ɾ��ijĿ¼
/// </summary>
/// <param name="ClassID">��ĿID</param>
public void Delete(int ClassID)
{
Database data = new Database();
SqlParameter[] prams = {
data.MakeInParam("@TeamID" , SqlDbType.Int, 20, ClassID),
};
try
{
data.RunProc("sp_DeleteTeam", prams);
}
catch (Exception ex)
{
Error.Log(ex.ToString());
}
finally
{
if (data != null)
{
data.Close();
data.Dispose();
}
}
}
示例3: GetMyDocument
/// <summary>
/// �õ��ҵ������ĵ�
/// </summary>
/// <param name="UserName">�û���</param>
/// <param name="RightCode">�鿴�ĵ���Ȩ����</param>
/// <returns>����dataReader</returns>
public SqlDataReader GetMyDocument(string UserName,int RightCode)
{
Database data = new Database();
SqlDataReader dataReader = null;
// ִ�д洢���̣�������SqlDataReader����
SqlParameter[] prams = {
data.MakeInParam("@UserName" , SqlDbType.VarChar , 300, UserName),
data.MakeInParam("@RightCode",SqlDbType.Int,4,RightCode)
};
try
{
data.RunProc("sp_GetMyNewDoc",prams,out dataReader);
return dataReader;
}
catch(Exception ex)
{
Error.Log(ex.ToString());
throw new Exception("��ȡ�ҵ��ĵ�����!",ex);
}
//finally
//{
// data = null;
// dataReader = null;
//}
}
示例4: BindGrid
private void BindGrid()
{
SqlDataReader dr=null; //������������
Database db = new Database();
try
{
SqlParameter[] prams = {
db.MakeInParam("@StaffType",SqlDbType.Bit,1,DisplayType)
};
db.RunProc("sp_GetStaffisneedkey", prams, out dr);
DataTable dt = Tools.ConvertDataReaderToDataTable(dr);
dbStaffList.DataSource = dt.DefaultView;
dbStaffList.DataBind();
}
finally
{
if (db != null)
{
db.Close();
}
if (dr != null)
{
dr.Close();
}
}
}
示例5: Add
/// <summary>
/// ��Ӳ���
/// </summary>
/// <param name="pid">�����ŵĸ�����id</param>
/// <param name="name">�����ŵ�����</param>
/// <param name="description">�����ŵ�����</param>
/// <returns>�����ŷ��䵽��id</returns>
public static long Add(long ParentDepartmentID,string name,string description)
{
Database db = new Database();
SqlParameter[] prams = new SqlParameter[3];
prams[0] = new SqlParameter();
prams[1] = new SqlParameter();
prams[2] = new SqlParameter();
prams[0].SqlDbType = SqlDbType.Int;
prams[0].ParameterName = "@Dept_ParentID";
prams[0].Value = ParentDepartmentID;
prams[1].SqlDbType = SqlDbType.VarChar;
prams[1].Size = 255;
prams[1].ParameterName = "@Dept_Name";
prams[1].Value = name;
prams[2].SqlDbType = SqlDbType.Text;
prams[2].ParameterName = "@Dept_Remark";
prams[2].Value = description;
//prams[3] = new SqlParameter();
//prams[3].SqlDbType = SqlDbType.Int;
//prams[3].ParameterName = "@ID";
//prams[3].Direction = ParameterDirection.ReturnValue;
return (db.RunProc("sp_AddDepartment",prams));
}
示例6: GetProjectName
/// <summary>
/// ��ȡij��Ŀ����
/// </summary>
/// <param name="ClassID">��ĿID</param>
public static string GetProjectName(int ClassID)
{
string ProjectName = "";
SqlDataReader dataReader = null;
Database data = new Database();
SqlParameter[] prams =
{
data.MakeInParam("@projectid", SqlDbType.Int, 20 ,ClassID)
};
try
{
data.RunProc("sp_GetProjectName", prams, out dataReader);
if (dataReader.Read())
ProjectName = dataReader[0].ToString();
return ProjectName;
}
catch (Exception ex)
{
Error.Log(ex.ToString());
return "";
}
finally
{
if (dataReader != null)
{
dataReader.Close();
}
}
}
示例7: BindGrid
private void BindGrid()
{
SqlDataReader dr; //������������
Database db = new Database();
SqlParameter[] prams = {
db.MakeInParam("@StaffType",SqlDbType.Bit,1,DisplayType)
};
db.RunProc("sp_GetAllStaff",prams,out dr);
DataTable dt =Tools.ConvertDataReaderToDataTable(dr);
dbStaffList.DataSource = dt.DefaultView;
dbStaffList.DataBind();
if(DisplayType==0)
{
// lbOnline.BackColor = Color.FromArgb(0xCCCCCC);
// lbOffLine.BackColor =Color.FromArgb(0xFFFFFF);
cmdRehab.Visible = false;
cmdDimission.Visible = true;
cmdChangePosition.Visible =true;
}
else
{
// lbOnline.BackColor =Color.FromArgb(0xFFFFFF);
// lbOffLine.BackColor =Color.FromArgb(0xCCCCCC);
cmdRehab.Visible = true;
cmdDimission.Visible = false;
cmdChangePosition.Visible =false;
}
}
示例8: Bangding
private void Bangding()
{
SqlDataReader dr;
Database db = new Database();
SqlParameter[] parms = {
db.MakeInParam("@DeptID",SqlDbType.Int ,4,DeptID),
};
db.RunProc("sp_Flow_GetDept", parms, out dr);
try
{
if (dr.Read())
{
txtDeptName.Text = dr["Dept_Name"].ToString();
txtRemark.Text = dr["Dept_Remark"].ToString();
}
if (db != null)
{
db.Close();
db = null;
}
}
finally
{
if (db != null)
{
db.Close();
}
if (dr != null)
{
dr.Close();
}
dr = null;
}
}
示例9: Bangding
private void Bangding()
{
SqlDataReader dr = null; //存放人物的数据
Database mySQL = new Database();
try
{
SqlParameter[] parameters = {
mySQL.MakeInParam("@NewsID",SqlDbType.Int ,4,0)
};
mySQL.RunProc("sp_Flow_GetNews", parameters, out dr);
DataTable dt = Tools.ConvertDataReaderToDataTable(dr);
dgStyleListAdmin.DataSource = dt.DefaultView;
dgStyleListAdmin.DataBind();
}
finally
{
if (mySQL != null)
{
mySQL.Close();
}
if (dr != null)
{
dr.Close();
}
}
}
示例10: Bangding
private void Bangding()
{
SqlDataReader dr; //������������
Database mySQL = new Database();
string UserName;
UserName = Server.UrlDecode(Request.Cookies["UserName"].Value);
SqlParameter[] parameters = {
mySQL.MakeInParam("@StaffName",SqlDbType.VarChar ,300,UserName)
};
mySQL.RunProc("sp_Flow_GetMyFlow",parameters,out dr);
try
{
DataTable dt = Tools.ConvertDataReaderToDataTable(dr);
dgFlowList.DataSource = dt.DefaultView;
dgFlowList.DataBind();
}
finally
{
if (mySQL != null)
{
mySQL.Close();
}
if (dr != null)
{
dr.Close();
}
}
}
示例11: BindGrid
/// <summary>
/// ���ݰ�
/// </summary>
private void BindGrid()
{
SqlDataReader dr; //������������
Database db = new Database();
SqlParameter[] prams = {
db.MakeInParam("@StaffType",SqlDbType.Bit,1,displaytype)
};
db.RunProc("sp_GetAllStaff",prams,out dr);
DataTable dt =Tools.ConvertDataReaderToDataTable(dr);
//��DataTable��ĩβ���Ͽ��У�ʹ��DataGrid�̶�����
int blankrows = StaffList.PageSize - (dt.Rows.Count % StaffList.PageSize);
for (int i = 0; i < blankrows; i++)
{
dt.Rows.Add(dt.NewRow());
}
StaffList.DataSource = dt.DefaultView;
StaffList.DataBind();
//���ڿռ�¼����ʾcheckbox
for(int i=0;i<StaffList.Items.Count;i++)
{
if(StaffList.Items[i].Cells[1].Text==" ")
{
StaffList.Items[i].FindControl("cb_StaffID").Visible = false;
}
}
lbl_totalrecord.Text =StaffList.PageCount.ToString();
lbl_curpage.Text = txb_PageNo.Text = (StaffList.CurrentPageIndex + 1).ToString();
txb_ItemPerPage.Text = StaffList.PageSize.ToString();
lbl_totalpage.Text = StaffList.PageCount.ToString();
}
示例12: Bangding
private void Bangding()
{
SqlDataReader dr;
Database db = new Database();
SqlParameter[] parms = {
db.MakeInParam("@StyleID",SqlDbType.Int ,4,StyleID),
};
db.RunProc("sp_Flow_GetStyle",parms,out dr);
if(dr.Read())
{
txtStyleName.Text = dr["Style_Name"].ToString();
txtStyleRemark.Text = dr["Style_Remark"].ToString();
lblTemplate.Text = "<a href='" + @"Template\" + dr["Template"].ToString() + "'>" + dr["Template"].ToString() + "</a>";
if(dr["Template"].ToString()=="")
Template.Visible = false;
else
Template.Visible = true;
}
else
{
Template.Visible = false;
}
if(db!=null)
{
db.Close();
db = null;
}
dr.Close();
dr = null;
}
示例13: BindGrid
public void BindGrid()
{
SqlDataReader dr; //���Ȩ������
string spName;//�洢������
spName = "";
Database db = new Database();
SqlParameter[] prams = new SqlParameter[1];
switch(DisplayType)
{
case "0":
prams[0] = db.MakeInParam("@PositionID",SqlDbType.Int,4,Int32.Parse(strObjID));
spName = "sp_GetPositionRightList";
break;
case "1":
prams[0] = db.MakeInParam("@Teamid",SqlDbType.Int,4,Int32.Parse(strObjID));
spName = "sp_GetTeamRightList";
break;
case "2":
prams[0] = db.MakeInParam("@RoleID",SqlDbType.Int,4,Int32.Parse(strObjID));
spName = "sp_GetRoleRightList";
break;
default:
break;
//������
}
db.RunProc(spName,prams,out dr);
DataTable dt =Tools.ConvertDataReaderToDataTable(dr);
RightsGrid.DataSource = dt.DefaultView;
RightsGrid.DataBind();
}
示例14: BindGrid
private void BindGrid()
{
SqlDataReader dr=null; //������������
Database db = new Database();
try
{
SqlParameter[] prams = {
db.MakeInParam("@RoleID",SqlDbType.Int,4,RoleID)
};
if (DisplayType == 0)
db.RunProc("sp_GetStaffInRole", prams, out dr);
else
db.RunProc("sp_GetStaffNotInRole", prams, out dr);
DataTable dt = Tools.ConvertDataReaderToDataTable(dr);
dbStaffList.DataSource = dt.DefaultView;
dbStaffList.DataBind();
}
finally
{
if (db != null)
{ db.Close(); }
if (dr != null)
{
dr.Close();
}
}
}
示例15: Add
/// <summary>
/// ��Ŀ���
/// </summary>
public void Add(int ParentID,string ProjectName,string ProjectRemark,string Wright,int Status,int Scale,DateTime StartDate,DateTime EndDate)
{
// �������ݿ�����༰DataReader
Database data = new Database();
// ִ�д洢���̣�������SqlDataReader����
SqlParameter[] prams = {
data.MakeInParam("@ParentID" , SqlDbType.Int, 20, ParentID),
data.MakeInParam("@ProjectName" , SqlDbType.NVarChar, 20, ProjectName.Trim()),
data.MakeInParam("@ProjectRemark" , SqlDbType.NVarChar, 400, ProjectRemark.Trim()),
data.MakeInParam("@Wright" , SqlDbType.NVarChar, 40, Wright),
data.MakeInParam("@Status" , SqlDbType.Int, 40, Status),
data.MakeInParam("@Scale" , SqlDbType.Int, 20, Scale),
data.MakeInParam("@StartDate" , SqlDbType.DateTime, 30, StartDate),
data.MakeInParam("@EndDate" , SqlDbType.DateTime, 30, EndDate)
};
try
{
data.RunProc("sp_AddProject",prams);
}
catch(Exception ex)
{
Error.Log(ex.ToString());
throw new Exception("��Ŀ��ӳ���",ex);
}
finally
{
data = null;
}
}